diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 360f35a9a5..f6c78e0d62 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,45 +1,64 @@ -name: build-nightly -run-name: Automatically building nightly-version... +name: build-neoforge-backport +run-name: Build the NeoForge 1.21.1 Jar-in-Jar on: push: - branches: [ dev ] + branches: + - dev + - 1.0.1-1.21.1-neoforge-backport + - 1.0.2-1.21.1-neoforge-backport + pull_request: + workflow_dispatch: jobs: build: - strategy: - matrix: - # need to be changed as minecraft version changed - # java 17 for minecraft 1.20.x - # java 21 for minecraft 1.21.x - java: [ - 21, - ] runs-on: ubuntu-latest steps: - name: checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: validate gradle wrapper - uses: gradle/wrapper-validation-action@v2 + uses: gradle/actions/wrapper-validation@v6 - - name: setup jdk ${{ matrix.java }} - uses: actions/setup-java@v4 + - name: setup jdk 21 + uses: actions/setup-java@v5 with: - java-version: ${{ matrix.java }} + java-version: 21 distribution: 'microsoft' - - name: make gradle wrapper excutable - run: chmod +x ./gradlew + - name: setup gradle + uses: gradle/actions/setup-gradle@v6 - - name: data generation - run: ./gradlew middle-earth:runDatagenClient + - name: make gradle wrapper executable + run: chmod +x ./gradlew - - name: build - run: ./gradlew build + - name: generate data and build + run: ./gradlew clean build --console=plain - - name: capture build mod jar - uses: actions/upload-artifact@v4 - with: - name: SevenStars Project Nightly - path: build/libs/ + - name: verify bundled modules + shell: bash + run: | + set -euo pipefail + mapfile -t player_jars < <(find middle-earth/build/libs -maxdepth 1 -type f -name 'Middle-earth-*.jar' ! -name '*-sources.jar') + test "${#player_jars[@]}" -eq 1 + jar tf "${player_jars[0]}" > "$RUNNER_TEMP/middle-earth-player-jar-entries.txt" + grep -Eq '^META-INF/jarjar/.+SevenStarsAPI.+\.jar$' "$RUNNER_TEMP/middle-earth-player-jar-entries.txt" + grep -Eq '^META-INF/jarjar/.+Of-Beasts-and-Wild-Things.+\.jar$' "$RUNNER_TEMP/middle-earth-player-jar-entries.txt" + grep -Fxq 'META-INF/neoforge.mods.toml' "$RUNNER_TEMP/middle-earth-player-jar-entries.txt" + ! grep -Fxq 'fabric.mod.json' "$RUNNER_TEMP/middle-earth-player-jar-entries.txt" + grep -Fxq 'data/middle-earth/recipe/corrupted_moss_carpet.json' "$RUNNER_TEMP/middle-earth-player-jar-entries.txt" + grep -Fxq 'data/middle-earth/recipe/forest_moss_carpet.json' "$RUNNER_TEMP/middle-earth-player-jar-entries.txt" + grep -Fxq 'data/middle-earth/recipe/saddle.json' "$RUNNER_TEMP/middle-earth-player-jar-entries.txt" + grep -Fxq 'data/middle-earth/advancement/recipes/misc/saddle.json' "$RUNNER_TEMP/middle-earth-player-jar-entries.txt" + grep -Fxq 'data/middle-earth/loot_table/blocks/forge.json' "$RUNNER_TEMP/middle-earth-player-jar-entries.txt" + grep -Fxq 'data/middle-earth/loot_table/blocks/skeletal_pile_layer.json' "$RUNNER_TEMP/middle-earth-player-jar-entries.txt" + grep -Fxq 'data/middle-earth/loot_table/blocks/waste_pile_layer.json' "$RUNNER_TEMP/middle-earth-player-jar-entries.txt" + grep -Fxq 'assets/middle-earth/models/item/gondorian_sword.json' "$RUNNER_TEMP/middle-earth-player-jar-entries.txt" + wild_things_entry=$(grep -E '^META-INF/jarjar/.+Of-Beasts-and-Wild-Things.+\.jar$' "$RUNNER_TEMP/middle-earth-player-jar-entries.txt") + unzip -p "${player_jars[0]}" "$wild_things_entry" > "$RUNNER_TEMP/wild-things.jar" + jar tf "$RUNNER_TEMP/wild-things.jar" > "$RUNNER_TEMP/wild-things-entries.txt" + for item in bird_nest raw_venison cooked_venison raw_poultry cooked_poultry raw_swan cooked_swan swan_feather swan_egg deer_spawn_egg swan_spawn_egg pheasant_spawn_egg snail_spawn_egg; do + grep -Fxq "assets/wild-things/models/item/${item}.json" "$RUNNER_TEMP/wild-things-entries.txt" + grep -Fxq "assets/wild-things/textures/item/${item}.png" "$RUNNER_TEMP/wild-things-entries.txt" + done + sha256sum "${player_jars[0]}" diff --git a/.gitignore b/.gitignore index d86ffb31a2..e7dbbabb40 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .gradle +.gradle-local-maven/ **/build/ !src/**/build/ @@ -27,3 +28,12 @@ bin/main/* middle-earth/src/main/java/net/sevenstars/middleearth/block/ModBlocks.java /.idea /.run2 + +# Local crash/test artifacts +__pycache__/ +*.py[cod] +.pytest_cache/ +hs_err_pid*.log +replay_pid*.log +*.hprof +.codex-*.init.gradle diff --git a/README.md b/README.md index ae78898cb0..e215844686 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,33 @@ ----- +## Unofficial NeoForge 1.21.1 backport + +The `1.0.2-1.21.1-neoforge-backport` branch is an unofficial semantic +backport of the official upstream +[`1.0.2-1.21.8-beta`](https://github.com/Jukoz/middle-earth/releases/tag/1.0.2-1.21.8-beta) +tag at +[`fe655f713`](https://github.com/Jukoz/middle-earth/commit/fe655f71374db31629c228e1435e64636698b56c). +That tagged tree is identical to the fully merged upstream `dev` tree at +[`b92dbab45`](https://github.com/Jukoz/middle-earth/commit/b92dbab458da78a36378e18b7afa216288631f14). +All compatible source, resource, data, recipe, loot, translation, model, +balance, and gameplay changes in that release are represented either directly +or by a 1.21.1/NeoForge semantic adaptation. Known upstream defects are +corrected while translating them to the older APIs. The upstream wild-spawn +chunk cache and global mob-cap implementations are not copied because their +global state and coarse rejection semantics are incompatible with this port; +the existing bounded, dimension-aware spawning implementation is retained. +It is not an official release from the original Middle-earth mod team. + +All original copyright notices, credits, trademarks and the ARR license remain +unchanged. This fork grants no additional rights; see [LICENSE](./LICENSE) and +the [upstream repository](https://github.com/Jukoz/middle-earth). + +Target runtime: Minecraft 1.21.1, Java 21 and NeoForge 21.1.233 or newer within +the 21.1 line. The build currently validates against NeoForge 21.1.244. + +----- + ## Current state of the mod As of now, the mod is in the Alpha development stage, meaning this project is still a prototype, and missing many core features we are planning on adding. @@ -85,6 +112,18 @@ dylanhugh and Angmarzku for their ideas & arts for Gundabad and more. ----- +## Building the NeoForge 1.21.1 backport + +Build all three source modules with Java 21: + +```shell +./gradlew build +``` + +The player artifact is `middle-earth/build/libs/Middle-earth-.jar`. It embeds Seven Stars API and Of Beasts and Wild Things through NeoForge Jar-in-Jar, so players should install only this outer Middle-earth jar. The standalone jars under the two subproject build directories are intermediate development artifacts and are not part of the player release. + +----- + ## License All of our content is under the **ARR** license (**All Right Reserved**), meaning you cannot use our code without our written consent. If you want to use our code in any way, please write an issue using the [request template in our Github](https://github.com/Jukoz/middle-earth/issues/new?assignees=&labels=request&projects=&template=code_use_permission_request.yml). > **Please be aware that this project is a Minecraft Parody set in the Middle-earth universe and all rights are reserved under Tolkien domain.** @@ -109,4 +148,4 @@ if you want to participate in the localization, please join our [Discord server] [github]: https://github.com/Jukoz/middle-earth [discord]: https://discord.gg/9yQ7UWkVUz -[crowdin]: https://crowdin.com/project/middle-earth-mod \ No newline at end of file +[crowdin]: https://crowdin.com/project/middle-earth-mod diff --git a/build.gradle b/build.gradle index 05b62235d4..ade3535431 100644 --- a/build.gradle +++ b/build.gradle @@ -1,106 +1,181 @@ plugins { - id 'fabric-loom' version "${loom_version}" apply false - id 'maven-publish' - id 'java' - id 'base' + id 'base' + id 'net.neoforged.moddev' apply false } -version = project.mod_version -group = project.maven_group - -java { - sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21 - tasks.withType(JavaCompile).configureEach { - it.options.release = 21 - } -} - -/* configurations for each projects */ -project(":sevenstars-api") { - java { - sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21 - } - tasks.withType(JavaCompile).configureEach { - it.options.release = 21 - } -} - -project(":middle-earth") { - java { - sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21 - } - tasks.withType(JavaCompile).configureEach { - it.options.release = 21 - } -} - -project(":of-beasts-and-wild-things") { - java { - sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21 - } - tasks.withType(JavaCompile).configureEach { - it.options.release = 21 - } -} - -subprojects() { - apply plugin: 'fabric-loom' - - version = project.mod_version - group = project.maven_group - - base { - archivesName = project.archives_base_name - } - - dependencies { - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - } - - processResources { - inputs.property "version", project.version - - filesMatching("fabric.mod.json") { - expand "version": project.version - } - } - - sourceSets.main.resources.srcDirs += 'src/main/generated' - - jar { - from("LICENSE") { - rename { "${it}_${project.archives_base_name}"} - } - } -} - -// root project will not build anything -jar.enabled = false - -jar { - zip64 = true -} -tasks.withType(Jar).configureEach { - zip64 = true -} - -tasks.register("copyFiles", Copy) { - rootProject.subprojects.each {project -> - from project.name + '/build/libs/' + project.archives_base_name + '-' + project.version + '.jar' - } - into "build/libs" -} - -// make sure the copy task runs after each subproject is built -copyFiles.dependsOn { - subprojects.collect { - it.tasks.named("build") - } +subprojects { + apply plugin: 'java-library' + apply plugin: 'maven-publish' + apply plugin: 'net.neoforged.moddev' + + version = project.mod_version + group = project.maven_group + + base { + archivesName = project.archives_base_name + } + + java { + toolchain.languageVersion = JavaLanguageVersion.of(21) + withSourcesJar() + } + + neoForge { + version = rootProject.neo_version + + def accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + if (accessTransformer.exists()) { + accessTransformers = files(accessTransformer) + } + + runs { + client { + client() + systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id + def quickPlayWorld = providers.gradleProperty('quickPlayWorld') + if (quickPlayWorld.isPresent()) { + programArguments.addAll '--quickPlaySingleplayer', quickPlayWorld.get() + } + } + + server { + server() + systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id + programArgument '--nogui' + } + + data { + data() + systemProperty 'middleearth.datagen.existing', file('src/main/resources').absolutePath + programArguments.addAll '--mod', project.mod_id, '--all', + '--output', file('src/main/generated').absolutePath, + '--existing', file('src/main/resources').absolutePath + } + } + + mods { + "${project.mod_id}" { + sourceSet(sourceSets.main) + } + } + } + + sourceSets.main.resources.srcDir 'src/main/generated' + + dependencies { + implementation 'com.mojang:brigadier:1.3.10' + implementation 'com.mojang:authlib:6.0.54' + implementation 'com.mojang:datafixerupper:8.0.16' + implementation 'com.google.code.gson:gson:2.10.1' + implementation 'com.google.guava:guava:32.1.2-jre' + implementation 'com.google.guava:failureaccess:1.0.1' + implementation 'com.ibm.icu:icu4j:73.2' + implementation 'com.mojang:blocklist:1.0.10' + implementation 'com.mojang:logging:1.2.7' + implementation 'com.mojang:text2speech:1.17.9' + implementation 'commons-codec:commons-codec:1.16.0' + implementation 'com.github.oshi:oshi-core:6.4.10' + implementation 'commons-io:commons-io:2.15.1' + implementation 'commons-logging:commons-logging:1.2' + implementation 'it.unimi.dsi:fastutil:8.5.12' + implementation 'net.java.dev.jna:jna:5.14.0' + implementation 'net.java.dev.jna:jna-platform:5.14.0' + implementation 'org.joml:joml:1.10.5' + implementation 'io.netty:netty-buffer:4.1.97.Final' + implementation 'io.netty:netty-common:4.1.97.Final' + implementation 'io.netty:netty-transport:4.1.97.Final' + implementation 'io.netty:netty-transport-classes-epoll:4.1.97.Final' + implementation 'io.netty:netty-codec:4.1.97.Final' + implementation 'io.netty:netty-handler:4.1.97.Final' + implementation 'io.netty:netty-resolver:4.1.97.Final' + implementation 'org.apache.commons:commons-lang3:3.14.0' + implementation 'org.apache.httpcomponents:httpclient:4.5.13' + implementation 'org.apache.httpcomponents:httpcore:4.4.16' + implementation 'org.apache.logging.log4j:log4j-api:2.22.1' + implementation 'org.apache.logging.log4j:log4j-core:2.22.1' + implementation 'org.apache.logging.log4j:log4j-slf4j2-impl:2.22.1' + implementation 'org.lwjgl:lwjgl:3.3.3' + implementation 'org.lwjgl:lwjgl-freetype:3.3.3' + implementation 'org.lwjgl:lwjgl-glfw:3.3.3' + implementation 'org.lwjgl:lwjgl-jemalloc:3.3.3' + implementation 'org.lwjgl:lwjgl-openal:3.3.3' + implementation 'org.lwjgl:lwjgl-opengl:3.3.3' + implementation 'org.lwjgl:lwjgl-stb:3.3.3' + implementation 'org.lwjgl:lwjgl-tinyfd:3.3.3' + implementation 'org.lz4:lz4-java:1.8.0' + implementation 'org.slf4j:slf4j-api:2.0.9' + + runtimeOnly 'org.lwjgl:lwjgl:3.3.3:natives-windows' + runtimeOnly 'org.lwjgl:lwjgl-freetype:3.3.3:natives-windows' + runtimeOnly 'org.lwjgl:lwjgl-glfw:3.3.3:natives-windows' + runtimeOnly 'org.lwjgl:lwjgl-jemalloc:3.3.3:natives-windows' + runtimeOnly 'org.lwjgl:lwjgl-openal:3.3.3:natives-windows' + runtimeOnly 'org.lwjgl:lwjgl-opengl:3.3.3:natives-windows' + runtimeOnly 'org.lwjgl:lwjgl-stb:3.3.3:natives-windows' + runtimeOnly 'org.lwjgl:lwjgl-tinyfd:3.3.3:natives-windows' + } + + def replaceProperties = [ + minecraft_version : rootProject.minecraft_version, + minecraft_version_range: rootProject.minecraft_version_range, + neo_version : rootProject.neo_version, + neo_version_range : rootProject.neo_version_range, + loader_version_range : rootProject.loader_version_range, + mod_id : project.mod_id, + mod_name : project.mod_name, + mod_license : project.mod_license, + mod_version : project.mod_version, + mod_authors : project.mod_authors, + mod_description : project.mod_description + ] + + tasks.named('processResources', ProcessResources).configure { + inputs.properties replaceProperties + + filesMatching('META-INF/neoforge.mods.toml') { + expand replaceProperties + } + } + + tasks.register('refreshProcessedResources', Sync) { + dependsOn tasks.named('runData') + inputs.properties replaceProperties + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + exclude '.cache/**' + from('src/main/generated') + from('src/main/resources') + into(layout.buildDirectory.dir('resources/main')) + + filesMatching('META-INF/neoforge.mods.toml') { + expand replaceProperties + } + } + + tasks.withType(Jar).configureEach { + zip64 = true + exclude '.cache/**' + } + + tasks.named('jar', Jar).configure { + from(rootProject.file('LICENSE')) { + rename { "${it}_${project.base.archivesName.get()}" } + } + } + + tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' + options.release = 21 + } + + publishing { + publications { + register('mavenJava', MavenPublication) { + from components.java + } + } + } } -build { - finalizedBy copyFiles +tasks.named('build').configure { + dependsOn subprojects.collect { it.tasks.named('build') } } diff --git a/docs/neo-1.21.1-backport-acceptance.md b/docs/neo-1.21.1-backport-acceptance.md new file mode 100644 index 0000000000..bb074a5b63 --- /dev/null +++ b/docs/neo-1.21.1-backport-acceptance.md @@ -0,0 +1,99 @@ +# NeoForge 1.21.1 backport acceptance + +This document records the upstream modules represented by the player Jar-in-Jar artifact and the behavioral checks required before publishing or deploying a backport build. + +## Adopted upstream baseline + +- Released ancestor: `origin/main` at `1f047d55dd1509c001596876617b4ae660eb006e`. +- Official release baseline: tag `1.0.2-1.21.8-beta` at `fe655f71374db31629c228e1435e64636698b56c`. +- The fully merged upstream `dev` commit `b92dbab458da78a36378e18b7afa216288631f14` and the official tag share tree `531effb8d0d4e2b63b7fb0e7b2631c13b0028a0b`; there is no main/dev content split in this baseline. +- Every compatible change from the released ancestor through that tag is represented directly or by an explicit Minecraft 1.21.1/NeoForge adaptation. This includes the complete `d576f1817b563996339d40b0170b636b4646451c` content merge, fixes through `52519872d3ba10a0391b129ea74898cc6396249e`, and inscription/localization changes through `ee79dc1977da654ca0276a91d93901f1b8521552`. +- Fabric metadata is replaced by NeoForge metadata, and 1.21.8 item-definition resources are expressed through the 1.21.1 `models/item` contract. +- Upstream static forge and layered-pile loot JSONs are emitted by the NeoForge data provider and verified at the generated-resource boundary. The Fabric `ServerWorldMixin` sleep hook maps to NeoForge's native sleeping-level advance plus a guarded Overworld advance; its entity UUID tracker is deliberately absent with the global mob-cap implementation it served. +- Upstream removes its saddle recipe after Minecraft 1.21.8 adds an equivalent vanilla recipe. Minecraft 1.21.1 has no vanilla replacement, so this backport deliberately continues to generate `middle-earth:saddle` with the original leather-and-iron pattern. +- Wild-spawn chunk caching and the global mob-cap lineage are documented incompatibilities rather than silent omissions. Their process-global mutable state and coarse rejection semantics are replaced by the existing bounded, dimension-aware NeoForge spawn implementation. + +## Source modules + +### Middle-earth + +The main mod owns world generation, structures, NPCs, gameplay screens, recipes, items, blocks, entities, models, textures, sounds, data generation, and the outer player jar. + +Required rendering checks: + +- Inscription-table catalyst and chisel placeholders resolve from the 1.21.1 atlas contract. +- All 18 forged-component base models retain 22 material permutations plus the hot-state override; authored models must not shadow the generated override sets. +- Big weapons, longswords, longbows, spears, artefacts, pipes, the troll mace, the candle holder, and the watering can select the same inventory, hand, using, broken, and glowing model states as the upstream item definitions. +- Grass-tinted items, dyeable equipment, beech leaves, and colored bundles retain their upstream item colors. +- Shields and held banners continue to use their special item renderers. + +Required functional checks: + +- Inscription word selection stays synchronized with the server when a full three-word selection is replaced. +- Catalyst and chisel durability ends on the configured final use; the mithril chisel remains infinite. +- Longbow pulling, longsword blocking, artefact broken state, pipe smoking, and watering-can sprinkling switch only under their intended use conditions. +- Structure generation, structure NPC placement, natural spawning, dimension travel, respawn persistence, plate interaction, and the previously repaired animal/NPC render paths remain regression-free. +- Old skull rendering and persistence, all nine skeleton poses, and all four chandelier variants survive place/use/save/reload cycles. +- New wearable models and dye layers render on players and NPCs; the beekeeper mask preserves the upstream hive-protection behavior. +- Existing and new Dol Guldur shields retain the corrected medium/heavy types and blocking models. +- Hewing and Tree Feller secondary drops honor the real tool, Silk Touch, Fortune, break-event cancellation, and block-entity loot. +- Holly and Mallorn leaf bone-meal interactions preserve required block-state properties. +- Sleeping in the Middle-earth dimension advances both that level and the Overworld without double-advancing an Overworld sleep. +- The forge drops only from its top part, while skeletal-pile and waste-pile drops preserve their placed layer counts from one through eight. +- Saddle craftability remains available on Minecraft 1.21.1 with the upstream pre-1.21.8 recipe semantics. + +### Seven Stars API + +This embedded dependency owns shared registration, networking, AI, animation, and utility infrastructure. Its common upstream image resources are byte-identical in the backport. + +Required checks: + +- Its logical mod is discovered from the nested jar and reaches common/client initialization once. +- Shared registry and networking helpers resolve without Fabric runtime classes. +- No API resource or mixin load failure appears in a fresh client log. + +### Of Beasts and Wild Things + +This embedded dependency owns farm-animal variants and its own entities, models, textures, and sounds. Common PNG and OGG resources are byte-identical to upstream; the backport additionally carries the required 1.21.1 vanilla animal fallback textures. + +Required checks: + +- Pig, cow, and chicken base and variant textures render correctly. +- Chicken and cow rendering does not recurse when another mod injects renderer bridge methods. +- Entity attributes, AI, spawning, sounds, persistence, and client render-layer registration remain functional. + +## Automated gates + +1. `:middle-earth:test` and all module compilation tasks pass. +2. `:middle-earth:runData` completes and the model/resource audit reports zero missing references. +3. A clean player jar contains all three logical mods, generated resources, NeoForge metadata, and no Fabric runtime classes or `fabric.mod.json`. +4. A muted client runs on an isolated Win32 desktop without switching the user's input desktop. +5. Fresh screenshots and logs demonstrate the target GUI and representative item, block, entity, NPC, and submodule renders with no Middle-earth missing-texture/model/atlas error. +6. Publishing and live-jar replacement happen only from the exact source and artifact that passed these gates. + +## Accepted 1.21.1 build + +- Player jar: `Middle-earth-1.0.2-1.21.1-beta-backport.1.jar`. +- SHA-256: `0B4EB219764F315CACF3FBDB5C82639C17B58A73C770FE308C3DF0EEE8EDA70D`. +- Packaging: 68,126 entries, 356 Middle-earth structure NBT files, and exactly two nested logical-mod jars. +- Loader audit: NeoForge metadata and both Middle-earth mixin configs are present; `fabric.mod.json`, `net/fabricmc/**`, and bundled JEI/EMI API classes are absent. +- Generated forged-component audit: 18/18 base models contain exactly 23 overrides each (22 material variants plus hot state). +- Independent item-state audit: 615 effective custom state models, including 260 inventory models. The descriptor contract still registers 176 descriptors and 418 additional baked models; every referenced parent, texture, and override target resolves. +- Data recipes in the player jar include 63 forge, 11 shaping-anvil, and 102 inscription definitions. Runtime viewer registration resolves 863 artisan, 63 forge, 11 shaping-anvil, 102 inscription, and 8 dynamic crafting displays. +- The player jar also contains the version-specific `middle-earth:saddle` crafting recipe and its unlock advancement; the generated recipe uses the 1.21.1 ingredient-object schema. +- Every inscription recipe has a unique matching recipe-book advancement; the former five shared advancement paths can no longer overwrite each other during data generation. +- All 71 pale-oak block models use explicit Minecraft 1.21.1 birch or dark-oak texture fallbacks, and faction NPC ranks serialize in deterministic enum order. +- JEI and EMI are optional compile-time integrations and are not embedded. With EMI alone, the 8 dynamic displays are registered natively; with JEI and EMI together, JEMI imports the JEI extensions and native EMI registration is suppressed to avoid duplicate recipe IDs. + +## Acceptance evidence + +- Final `clean build` completed 37 actionable tasks. Across the three modules, 116 tests in 26 suites passed with no failure, error, or skip. +- The final Jar-in-Jar audit found 68,126 entries, exactly two nested logical mods, zero duplicate ZIP paths, 10,304 recipe JSON files, 8,092 item-model JSON files, and 270 biome-event definitions. +- A second consecutive `:middle-earth:runData` wrote zero files, confirming deterministic generated resources after canonical faction-rank ordering. +- Current 1.0.2 JEI+EMI client check: `client-20260815-151821`; 135/135 actions and 17/17 nonblank captures passed. It covered the six new decorative blocks, all nine skeleton poses, six wearables, five new shields, representative blocking models, both leaf bone-meal transformations, and the starlight-phial return flow. +- The starlight-phial check opened the return screen while the integrated server was paused, observed the 3-second countdown and enabled button, returned from `middle-earth:middle_earth` to the configured Overworld point, and consumed the survival-mode phial. All positive markers were present and no failure marker appeared. +- In the JEI+EMI run, both integrations reported `863/102/11/63/8`; JEMI skipped the four categories already owned by native EMI. The generic JEMI tag-ingredient duplicate notices did not involve Middle-earth recipe IDs. +- Current 1.0.2 EMI-only client check: `client-20260815-152552`; 59/59 actions and 6/6 nonblank captures passed. Artisan (863 pages), forge (63), shaping anvil (11), and inscription (102) categories opened and rendered correctly, and the `@middle-earth` item search populated. +- Both current runs used isolated Win32 desktops, preserved the `Default` input desktop for all 230 samples, restored options byte-for-byte, set master volume to zero, and confirmed OpenAL's null backend with no output device. +- Fresh logs contain no fatal, Mixin-apply failure, Middle-earth missing texture/model, invalid resource path, uncaught exception, or crash report. +- The 2026-08-03 evidence remains the exhaustive 1.0.1 renderer baseline; the two 2026-08-15 runs above are the publication gates for this 1.0.2 artifact. diff --git a/gradle.properties b/gradle.properties index 7fef8fb0c0..3efe6b386b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,20 +1,14 @@ -# Done to increase the memory available to gradle. -org.gradle.jvmargs=-Xmx2G +org.gradle.jvmargs=-Xmx3G org.gradle.parallel=true - - -minecraft_version=1.21.8 -yarn_mappings=1.21.8+build.1 -loader_version=0.16.14 -loom_version=1.11-SNAPSHOT - -# Fabric API -fabric_version=0.129.0+1.21.8 - -# Mod Properties -mod_version = 1.5.3-1.21.5-alpha -maven_group = net.sevenstars -archives_base_name = SevenStarsProjects - -api_version=1.5.3-1.21.2-alpha -modid=sevenstars \ No newline at end of file +org.gradle.daemon=false +systemProp.org.gradle.internal.http.socketTimeout=120000 +systemProp.org.gradle.internal.http.connectionTimeout=120000 +systemProp.java.net.preferIPv4Stack=true + +minecraft_version=1.21.1 +minecraft_version_range=[1.21.1,1.21.2) +neo_version=21.1.244 +neo_version_range=[21.1.233,21.2) +loader_version_range=[4,) +emi_version=1.1.24+1.21.1 +jei_version=19.43.0.390 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 429c116965..348aa04959 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Wed Apr 10 22:54:46 CEST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/middle-earth/build.gradle b/middle-earth/build.gradle index e3e680dc42..da2fa12e02 100644 --- a/middle-earth/build.gradle +++ b/middle-earth/build.gradle @@ -1,47 +1,43 @@ -repositories { - maven { url "https://maven.shedaniel.me" } - mavenCentral() +def viewerRuntime = providers.gradleProperty('viewer').orElse('both').get() +def supportedViewerRuntimes = ['none', 'jei', 'emi', 'both'] +if (!supportedViewerRuntimes.any { it.equalsIgnoreCase(viewerRuntime) }) { + throw new GradleException("Unsupported recipe viewer runtime '${viewerRuntime}'. Use none, jei, emi, or both.") } dependencies { - implementation project(path: ':sevenstars-api', configuration: 'dev') - implementation project(path: ':of-beasts-and-wild-things', configuration: 'dev') - modCompileOnly "me.shedaniel:RoughlyEnoughItems-api-fabric:20.0.811" - modRuntimeOnly "me.shedaniel:RoughlyEnoughItems-fabric:20.0.811" - modImplementation(include("me.lucko:fabric-permissions-api:0.4.0")) + implementation project(':sevenstars-api') + implementation project(':of-beasts-and-wild-things') + jarJar project(':sevenstars-api') + jarJar project(':of-beasts-and-wild-things') + compileOnly 'me.shedaniel:RoughlyEnoughItems-api-neoforge:16.0.799' + compileOnly "dev.emi:emi-neoforge:${emi_version}:api" + compileOnly "mezz.jei:jei-${minecraft_version}-common-api:${jei_version}" + compileOnly "mezz.jei:jei-${minecraft_version}-neoforge-api:${jei_version}" + if (viewerRuntime.equalsIgnoreCase('emi') || viewerRuntime.equalsIgnoreCase('both')) { + runtimeOnly "dev.emi:emi-neoforge:${emi_version}" + } + if (viewerRuntime.equalsIgnoreCase('jei') || viewerRuntime.equalsIgnoreCase('both')) { + runtimeOnly "mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}" + } + testImplementation 'org.junit.jupiter:junit-jupiter:5.11.4' + testImplementation 'org.ow2.asm:asm:9.7.1' } -loom { - runs { - datagenClient { - inherit client - name "Data Generation" - vmArg "-Dfabric-api.datagen" - vmArg "-Dfabric-api.datagen.output-dir=${file("src/main/generated")}" - vmArg "-Dfabric-api.datagen.modid=${modid}" +sourceSets.main.resources.setSrcDirs(['src/main/generated', 'src/main/resources']) - runDir "build/datagen" - } - } - accessWidenerPath = file("src/main/resources/middle-earth.accesswidener") +tasks.named('test') { + dependsOn tasks.named('runData') + dependsOn tasks.named('jar') + useJUnitPlatform() } -// FIXME: -// do not know how to make this work correctly -// - use `runDatagenClient` - not working, at all -// - use `mustRunAfter` - not working, at all -// - use `dependsOn` - not working, but generated data at lease -// still need to manually `runDatagenClient` then `build` now -// otherwise the jar file will not have the generated data -build { -// runDatagenClient -// dependsOn "runDatagenClient" -// mustRunAfter "runDatagenClient" +tasks.named('compileTestJava') { + dependsOn tasks.named('refreshProcessedResources') } -jar { - zip64 = true +tasks.named('jar') { + dependsOn tasks.named('runData') + dependsOn tasks.named('refreshProcessedResources') + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + from('src/main/generated') } -tasks.withType(Jar).configureEach { - zip64 = true -} \ No newline at end of file diff --git a/middle-earth/gradle.properties b/middle-earth/gradle.properties index 8b085ded55..ff39decf01 100644 --- a/middle-earth/gradle.properties +++ b/middle-earth/gradle.properties @@ -1,21 +1,8 @@ -# Done to increase the memory available to gradle. -org.gradle.jvmargs=-Xmx8192m -XX:+HeapDumpOnOutOfMemoryError -org.gradle.parallel=true -org.gradle.daemon=true -org.gradle.caching=true -org.gradle.configuration-cache=true - -minecraft_version=1.21.8 -yarn_mappings=1.21.8+build.1 -loader_version=0.16.14 -loom_version=1.11-SNAPSHOT - -# Fabric API -fabric_version=0.129.0+1.21.8 - -# Mod Properties -mod_version = 1.0.2-1.21.8-beta -maven_group = net.sevenstars.middleearth -archives_base_name = Middle-earth - -modid=middle-earth \ No newline at end of file +mod_id=middle_earth +mod_name=Middle-earth +mod_license=ARR +mod_version=1.0.2-1.21.1-beta-backport.1 +maven_group=net.sevenstars.middleearth +archives_base_name=Middle-earth +mod_authors=Jukoz, ObliviousCrab, TomSchlom, Boenndal, Jooble, Sindavar, Angmarzku, Scosher, Osserc, Kolhosp, CoffeeViking, Nautilus, Arwaeneth, Thud, Akkon, Louise +mod_description=Join the legendary world of Tolkien's universe from The Lord of The Rings to the Hobbit and more! diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/MiddleEarth.java b/middle-earth/src/main/java/net/sevenstars/middleearth/MiddleEarth.java index c2592ec627..d07d69d19c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/MiddleEarth.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/MiddleEarth.java @@ -1,8 +1,12 @@ package net.sevenstars.middleearth; -import net.fabricmc.api.ModInitializer; -import net.minecraft.util.Identifier; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.common.Mod; +import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; +import net.neoforged.neoforge.registries.DataPackRegistryEvent; import net.sevenstars.api.utils.ModLogger; +import net.sevenstars.middleearth.block.ModBlockEntityCompatibility; import net.sevenstars.middleearth.block.registration.*; import net.sevenstars.middleearth.commands.ModCommands; import net.sevenstars.middleearth.config.ModClientConfigs; @@ -20,8 +24,8 @@ import net.sevenstars.middleearth.item.utils.ItemGroupsME; import net.sevenstars.middleearth.item.utils.armor.DyeablePiecesME; import net.sevenstars.middleearth.network.ModServerNetworkHandler; -import net.sevenstars.middleearth.network.connections.ConnectionToClient; import net.sevenstars.middleearth.particles.ModParticleTypes; +import net.sevenstars.middleearth.permissions.PermissionsME; import net.sevenstars.middleearth.recipe.ModRecipeSerializer; import net.sevenstars.middleearth.recipe.RecipesME; import net.sevenstars.middleearth.recipe.inscription.InscriptionWordBank; @@ -31,7 +35,6 @@ import net.sevenstars.middleearth.statusEffects.ModStatusEffects; import net.sevenstars.api.utils.IdentifierUtil; import net.sevenstars.middleearth.utils.LootModifiers; -import net.sevenstars.middleearth.utils.resources.FileUtils; import net.sevenstars.middleearth.world.biomes.MEBiomeKeys; import net.sevenstars.middleearth.world.biomes.surface.MapBasedBiomePool; import net.sevenstars.middleearth.world.biomes.surface.MapBiomeData; @@ -40,23 +43,33 @@ import net.sevenstars.middleearth.world.map.MiddleEarthMapGeneration; import net.sevenstars.middleearth.world.spawners.ModEntitySpawning; -public class MiddleEarth implements ModInitializer { +@Mod(MiddleEarth.NEOFORGE_MOD_ID) +public class MiddleEarth { + public static final String NEOFORGE_MOD_ID = "middle_earth"; public static final String MOD_ID = "middle-earth"; public static final String OLD_MOD_ID = "me"; - public static final String MOD_VERSION = "1.0.0-1.21.8-beta"; - public static final boolean IS_DEBUG = true; + public static final String MOD_VERSION = "1.0.2-1.21.1-beta-backport.1"; + public static final boolean IS_DEBUG = false; public static final boolean ENABLE_INSTANT_BOOTING = true; public static final ModLogger LOGGER = new ModLogger(MOD_ID, IS_DEBUG); - @Override - public void onInitialize() { - new FileUtils(getClass().getClassLoader()); + public MiddleEarth(IEventBus modEventBus) { + modEventBus.addListener(ModServerNetworkHandler::register); + modEventBus.addListener((DataPackRegistryEvent.NewRegistry event) -> DynamicRegistriesME.register(event)); + modEventBus.addListener(this::commonSetup); + modEventBus.addListener(EntitiesME::registerAttributes); + modEventBus.addListener(EntitiesME::registerSpawnPlacements); + ModBlockEntityCompatibility.register(modEventBus); + initialize(); + } + private void initialize() { LOGGER.logInfoMsg(""); LOGGER.logInfoMsg("================ MiddleEarth ================"); - ModServerNetworkHandler.register(new ConnectionToClient()); ModEvents.register(); + PermissionsME.register(); + RegistriesME.registerPlatformHooks(); ModServerConfigs.registerConfigs(); ModClientConfigs.registerConfigs(); @@ -88,15 +101,6 @@ public void onInitialize() { EnchantmentsME.registerModEnchantmentEffects(); - RegistriesME.registerFuels(); - RegistriesME.registerToolTipAppenders(); - RegistriesME.registerFlammableBlocks(); - RegistriesME.registerTillableBlocks(); - RegistriesME.registerAgingCopperBlocks(); - RegistriesME.registerComposterBlocks(); - RegistriesME.registerCauldronBehaviour(); - RegistriesME.registerLandPathNodeTypesBlocks(); - ModBlockEntities.registerBlockEntities(); ModScreenHandlers.registerAllScreenHandlers(); @@ -116,7 +120,6 @@ public void onInitialize() { SoundsME.registerModSounds(); ModParticleTypes.registerParticleTypes(); - ModStatusEffects.registerStatusEffects(); ModDimensions.register(); MapBiomeData.loadBiomes(); @@ -127,10 +130,6 @@ public void onInitialize() { LootModifiers.modifyLootTables(); InscriptionWordBank.addWordsToBank(); - // Dynamic Data - DynamicRegistriesME.register(); - RegistriesME.registerRegistryAliases(); - try { new MiddleEarthMapGeneration(); } catch (Exception e) { @@ -138,45 +137,60 @@ public void onInitialize() { } } - public static Identifier fetchId(String stringId){ + private void commonSetup(FMLCommonSetupEvent event) { + event.enqueueWork(() -> { + RegistriesME.registerFuels(); + RegistriesME.registerToolTipAppenders(); + RegistriesME.registerFlammableBlocks(); + RegistriesME.registerTillableBlocks(); + RegistriesME.registerAgingCopperBlocks(); + RegistriesME.registerComposterBlocks(); + RegistriesME.registerCauldronBehaviour(); + RegistriesME.registerLandPathNodeTypesBlocks(); + RegistriesME.registerRegistryAliases(); + ModDecorativeBlocks.registerFlowerPots(); + }); + } + + public static ResourceLocation fetchId(String stringId){ return IdentifierUtil.getIdentifierFromString(stringId); } - public static Identifier ofPrefix(Identifier base, Identifier prefixId) { + public static ResourceLocation ofPrefix(ResourceLocation base, ResourceLocation prefixId) { if(base == null) return null; - return base.withPrefixedPath(String.format("%s/", prefixId.getPath())); + return base.withPrefix(String.format("%s/", prefixId.getPath())); } - public static Identifier of(String path){ + public static ResourceLocation of(String path){ return IdentifierUtil.build(MOD_ID, path); } - public static Identifier of(String... names){ + public static ResourceLocation of(String... names){ return IdentifierUtil.buildAggregate(MOD_ID, names); } - public static Identifier of(char splitter, String... names){ + public static ResourceLocation of(char splitter, String... names){ return IdentifierUtil.build(MOD_ID, createAggregate(splitter, names)); } - public static Identifier ofPath(String... names){ + public static ResourceLocation ofPath(String... names){ return IdentifierUtil.build(MOD_ID, createAggregate('/', names)); } - public static Identifier ofVanillaPath(String... names){ + public static ResourceLocation ofVanillaPath(String... names){ return IdentifierUtil.ofVanilla(createAggregate('/', names)); } - public static Identifier append(Identifier base, String suffix) { + public static ResourceLocation append(ResourceLocation base, String suffix) { String id = base.toString(); - return Identifier.of(id + suffix); + return ResourceLocation.parse(id + suffix); } public static String createAggregate(char splitter, String... names){ return IdentifierUtil.createAggregateValue(splitter, names); } - public static boolean compareId(Identifier id1, Identifier id2) { + public static boolean compareId(ResourceLocation id1, ResourceLocation id2) { return id1.compareTo(id2) == 0; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/MiddleEarthClient.java b/middle-earth/src/main/java/net/sevenstars/middleearth/MiddleEarthClient.java index 81c689ab4e..e447f47f76 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/MiddleEarthClient.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/MiddleEarthClient.java @@ -1,26 +1,35 @@ package net.sevenstars.middleearth; -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.fabric.api.client.model.loading.v1.ExtraModelKey; -import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin; -import net.fabricmc.fabric.api.client.model.loading.v1.SimpleUnbakedExtraModel; -import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; -import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderer; -import net.fabricmc.fabric.api.client.rendering.v1.BlockRenderLayerMap; -import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry; -import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; -import net.minecraft.block.Block; -import net.minecraft.client.gui.screen.ingame.HandledScreens; -import net.minecraft.client.render.BlockRenderLayer; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactories; -import net.minecraft.client.render.entity.FlyingItemEntityRenderer; -import net.minecraft.client.render.entity.model.EntityModelLayer; -import net.minecraft.client.render.item.model.special.SpecialModelTypes; -import net.minecraft.client.render.item.property.bool.BooleanProperties; -import net.minecraft.util.Identifier; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.renderer.ItemBlockRenderTypes; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.ThrownItemRenderer; +import net.minecraft.client.renderer.entity.player.PlayerRenderer; +import net.minecraft.client.renderer.item.ItemProperties; +import net.minecraft.client.renderer.item.ItemPropertyFunction; +import net.minecraft.core.component.DataComponents; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.CrossbowItem; +import net.minecraft.world.item.BundleItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.component.ChargedProjectiles; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.Block; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; +import net.neoforged.neoforge.client.event.EntityRenderersEvent; +import net.neoforged.neoforge.client.event.ModelEvent; +import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; +import net.neoforged.neoforge.client.event.RegisterDimensionSpecialEffectsEvent; +import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent; +import net.neoforged.neoforge.client.extensions.common.RegisterClientExtensionsEvent; import net.sevenstars.middleearth.block.registration.*; import net.sevenstars.middleearth.block.special.bellows.BellowsBlockEntityRenderer; import net.sevenstars.middleearth.block.special.coffers.*; +import net.sevenstars.middleearth.block.special.crockpot.CrockpotScreen; import net.sevenstars.middleearth.block.special.fire_of_orthanc.FireOfOrthancEntityRenderer; import net.sevenstars.middleearth.block.special.forge.ForgeEntityRenderer; import net.sevenstars.middleearth.block.special.plate.PlateEntityRenderer; @@ -29,6 +38,9 @@ import net.sevenstars.middleearth.block.special.shapingAnvil.ShapingAnvilEntityRenderer; import net.sevenstars.middleearth.block.special.skull.OldSkullBlockEntityRenderer; import net.sevenstars.middleearth.client.BlockColorsME; +import net.sevenstars.middleearth.client.ItemColorsME; +import net.sevenstars.middleearth.client.ItemModelRenderStateClient; +import net.sevenstars.middleearth.client.MiddleEarthDimensionEffects; import net.sevenstars.middleearth.client.model.equipment.CustomBootsModel; import net.sevenstars.middleearth.client.model.equipment.CustomChestplateModel; import net.sevenstars.middleearth.client.model.equipment.CustomHelmetModel; @@ -43,15 +55,12 @@ import net.sevenstars.middleearth.client.model.hand.shields.HeaterShieldEntityModel; import net.sevenstars.middleearth.client.model.hand.shields.KiteShieldEntityModel; import net.sevenstars.middleearth.client.model.hand.shields.RoundShieldEntityModel; +import net.sevenstars.middleearth.client.renderer.ModBuiltInModelItemRenderer; import net.sevenstars.middleearth.client.renderer.armor.*; -import net.sevenstars.middleearth.client.renderer.handheld.HeaterShieldModelRenderer; -import net.sevenstars.middleearth.client.renderer.handheld.HeldBannerModelRenderer; -import net.sevenstars.middleearth.client.renderer.handheld.KiteShieldModelRenderer; -import net.sevenstars.middleearth.client.renderer.handheld.RoundShieldModelRenderer; import net.sevenstars.middleearth.datageneration.content.models.*; import net.sevenstars.middleearth.datageneration.content.tags.Crops; import net.sevenstars.middleearth.entity.EntitiesME; -import net.sevenstars.middleearth.entity.EntityModelsME; +import net.sevenstars.middleearth.entity.EntityModelLayersME; import net.sevenstars.middleearth.entity.barrel.BarrelEntityRenderer; import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatRenderer; import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollRenderer; @@ -65,10 +74,10 @@ import net.sevenstars.middleearth.entity.projectile.smoke.SmokeRingProjectileRenderer; import net.sevenstars.middleearth.entity.projectile.spear.SpearEntityRenderer; import net.sevenstars.middleearth.entity.seat.SeatRenderer; +import net.sevenstars.middleearth.entity.spider.EnwebbedFeatureRenderer; import net.sevenstars.middleearth.entity.spider.larva.ShelobiteLarvaRenderer; import net.sevenstars.middleearth.entity.spider.scuttler.ShelobiteScuttlerRenderer; import net.sevenstars.middleearth.entity.spider.spawn.SpawnOfShelobRenderer; -import net.sevenstars.middleearth.event.KeyInputHandler; import net.sevenstars.middleearth.gui.ModScreenHandlers; import net.sevenstars.middleearth.gui.artisantable.ArtisanTableScreen; import net.sevenstars.middleearth.gui.forge.ForgeAlloyingScreen; @@ -79,128 +88,259 @@ import net.sevenstars.middleearth.gui.wood_pile.WoodPileScreen; import net.sevenstars.middleearth.item.EquipmentItemsME; import net.sevenstars.middleearth.item.ResourceItemsME; +import net.sevenstars.middleearth.item.WeaponItemsME; import net.sevenstars.middleearth.item.items.weapons.HotComponentProperty; import net.sevenstars.middleearth.item.items.weapons.SneakAttackProperty; +import net.sevenstars.middleearth.item.items.weapons.CustomLongswordWeaponItem; +import net.sevenstars.middleearth.item.items.weapons.artefacts.ArtefactCustomGlowingDaggerWeaponItem; +import net.sevenstars.middleearth.item.items.weapons.artefacts.ArtefactCustomGlowingLongswordWeaponItem; import net.sevenstars.middleearth.item.utils.armor.ArmorModelsME; import net.sevenstars.middleearth.network.ModClientNetworkHandler; import net.sevenstars.middleearth.network.connections.ConnectionToServer; -import net.sevenstars.middleearth.particles.ModParticleTypes; -import net.sevenstars.middleearth.particles.custom.AnvilBonkParticle; -import net.sevenstars.middleearth.particles.custom.BiomeFogParticle; -public class MiddleEarthClient implements ClientModInitializer { +@EventBusSubscriber(modid = MiddleEarth.NEOFORGE_MOD_ID, value = Dist.CLIENT) +public final class MiddleEarthClient { + private static final ResourceLocation PULL = ResourceLocation.withDefaultNamespace("pull"); + private static final ResourceLocation PULLING = ResourceLocation.withDefaultNamespace("pulling"); + private static final ResourceLocation CHARGED = ResourceLocation.withDefaultNamespace("charged"); + private static final ResourceLocation FIREWORK = ResourceLocation.withDefaultNamespace("firework"); + private static final ResourceLocation BLOCKING = ResourceLocation.withDefaultNamespace("blocking"); + private static final ResourceLocation HOLDING = ResourceLocation.withDefaultNamespace("holding"); + private static final ResourceLocation BROKEN = ResourceLocation.withDefaultNamespace("broken"); + private static final ResourceLocation GLOWING = ResourceLocation.withDefaultNamespace("glowing"); + private static final ResourceLocation FILLED = ResourceLocation.withDefaultNamespace("filled"); + + private static final ItemPropertyFunction USING_ITEM = (stack, level, entity, seed) -> + entity != null && entity.isUsingItem() && entity.getUseItem() == stack ? 1.0F : 0.0F; + private static final ItemPropertyFunction BOW_PULL = (stack, level, entity, seed) -> + entity == null || entity.getUseItem() != stack + ? 0.0F + : (float) (stack.getUseDuration(entity) - entity.getUseItemRemainingTicks()) / 20.0F; + private static final ItemPropertyFunction LONGBOW_PULL = (stack, level, entity, seed) -> + entity == null || entity.getUseItem() != stack + ? 0.0F + : (float) (stack.getUseDuration(entity) - entity.getUseItemRemainingTicks()) / 20.0F; + private static final ItemPropertyFunction CROSSBOW_PULL = (stack, level, entity, seed) -> + entity == null || CrossbowItem.isCharged(stack) + ? 0.0F + : (float) (stack.getUseDuration(entity) - entity.getUseItemRemainingTicks()) + / (float) CrossbowItem.getChargeDuration(stack, entity); + private static final ItemPropertyFunction CROSSBOW_PULLING = (stack, level, entity, seed) -> + entity != null && entity.isUsingItem() && entity.getUseItem() == stack && !CrossbowItem.isCharged(stack) + ? 1.0F : 0.0F; + private static final ItemPropertyFunction CROSSBOW_CHARGED = (stack, level, entity, seed) -> + CrossbowItem.isCharged(stack) ? 1.0F : 0.0F; + private static final ItemPropertyFunction CROSSBOW_FIREWORK = (stack, level, entity, seed) -> { + ChargedProjectiles projectiles = stack.get(DataComponents.CHARGED_PROJECTILES); + return projectiles != null && projectiles.contains(Items.FIREWORK_ROCKET) ? 1.0F : 0.0F; + }; + private static final ItemPropertyFunction ARTEFACT_BROKEN = (stack, level, entity, seed) -> + stack.isDamageableItem() && stack.getDamageValue() >= stack.getMaxDamage() - 1 ? 1.0F : 0.0F; + private static final ItemPropertyFunction ARTEFACT_GLOWING = (stack, level, entity, seed) -> { + if (stack.getItem() instanceof ArtefactCustomGlowingLongswordWeaponItem) { + return ArtefactCustomGlowingLongswordWeaponItem.shouldBeGlowing(level, entity) ? 1.0F : 0.0F; + } + if (stack.getItem() instanceof ArtefactCustomGlowingDaggerWeaponItem) { + return ArtefactCustomGlowingDaggerWeaponItem.shouldBeGlowing(level, entity) ? 1.0F : 0.0F; + } + return 0.0F; + }; - public static final EntityModelLayer CUSTOM_ARMOR_HELMET = new EntityModelLayer(Identifier.of(MiddleEarth.MOD_ID, "armor"), "_1"); - public static final EntityModelLayer CUSTOM_ARMOR_CHESTPLATE = new EntityModelLayer(Identifier.of(MiddleEarth.MOD_ID, "armor"), "_2"); - public static final EntityModelLayer CUSTOM_ARMOR_LEGGINGS = new EntityModelLayer(Identifier.of(MiddleEarth.MOD_ID, "armor"), "_3"); - public static final EntityModelLayer CUSTOM_ARMOR_BOOTS = new EntityModelLayer(Identifier.of(MiddleEarth.MOD_ID, "armor"), "_4"); - public static final EntityModelLayer HELMET_ADDON_MODEL_LAYER = new EntityModelLayer(Identifier.of(MiddleEarth.MOD_ID, "armor"), "helmet_addon"); - public static final EntityModelLayer BACK_ATTACHMENT_MODEL_LAYER = new EntityModelLayer(Identifier.of(MiddleEarth.MOD_ID, "armor"), "back_attachment"); - public static final EntityModelLayer HELMET_ATTACHMENT_MODEL_LAYER = new EntityModelLayer(Identifier.of(MiddleEarth.MOD_ID, "armor"), "helmet_attachment"); - - public static final EntityModelLayer HEATER_SHIELD_LAYER = new EntityModelLayer(Identifier.of(MiddleEarth.MOD_ID, "heater_shield"), "main"); - public static final EntityModelLayer KITE_SHIELD_LAYER = new EntityModelLayer(Identifier.of(MiddleEarth.MOD_ID, "kite_shield"), "main"); - public static final EntityModelLayer ROUND_SHIELD_LAYER = new EntityModelLayer(Identifier.of(MiddleEarth.MOD_ID, "round_shield"), "main"); - - public static final EntityModelLayer HELD_BANNER_LAYER = new EntityModelLayer(Identifier.of(MiddleEarth.MOD_ID, "held_banner"), "main"); - - @Override - public void onInitializeClient() { - ModClientNetworkHandler.register(new ConnectionToServer()); - - KeyInputHandler.register(); - - EntityModelsME.getModels(); - BooleanProperties.ID_MAPPER.put(MiddleEarth.of("sneak_attack"), SneakAttackProperty.CODEC); - BooleanProperties.ID_MAPPER.put(MiddleEarth.of("hot_component"), HotComponentProperty.CODEC); - - // Entities - - EntityRendererRegistry.register(EntitiesME.SNOW_TROLL, SnowTrollRenderer::new); - EntityRendererRegistry.register(EntitiesME.CAVE_TROLL, CaveTrollRenderer::new); - EntityRendererRegistry.register(EntitiesME.STONE_TROLL, StoneTrollRenderer::new); - EntityRendererRegistry.register(EntitiesME.PETRIFIED_TROLL, PetrifiedTrollRenderer::new); - - EntityRendererRegistry.register(EntitiesME.BROADHOOF_GOAT, BroadhoofGoatRenderer::new); - EntityRendererRegistry.register(EntitiesME.GREAT_HORN, GreatHornRenderer::new); - EntityRendererRegistry.register(EntitiesME.WARG, WargRenderer::new); - - EntityRendererRegistry.register(EntitiesME.REINFORCED_BARREL, BarrelEntityRenderer::new); - - EntityRendererRegistry.register(EntitiesME.SHELOBITE_LARVA, ShelobiteLarvaRenderer::new); - EntityRendererRegistry.register(EntitiesME.SHELOBITE_SCUTTLER, ShelobiteScuttlerRenderer::new); - EntityRendererRegistry.register(EntitiesME.SPAWN_OF_SHELOB, SpawnOfShelobRenderer::new); - //EntityRendererRegistry.register(EntitiesME.BALROG, BalrogRenderer::new); - - - EntityRendererRegistry.register(EntitiesME.FIRE_OF_ORTHANC, FireOfOrthancEntityRenderer::new); - EntityRendererRegistry.register(EntitiesME.PEBBLE, FlyingItemEntityRenderer::new); - EntityRendererRegistry.register(EntitiesME.PINECONE, FlyingItemEntityRenderer::new); - EntityRendererRegistry.register(EntitiesME.LIT_PINECONE, FlyingItemEntityRenderer::new); - EntityRendererRegistry.register(EntitiesME.SPEAR, SpearEntityRenderer::new); - EntityRendererRegistry.register(EntitiesME.BOULDER, BoulderEntityRenderer::new); - EntityRendererRegistry.register(EntitiesME.SMOKE_RING_PROJECTILE, SmokeRingProjectileRenderer::new); - EntityRendererRegistry.register(EntitiesME.WEB, FlyingItemEntityRenderer::new); - - EntityRendererRegistry.register(EntitiesME.NPC, NpcEntityRenderer::new); - - - EntityRendererRegistry.register(EntitiesME.SEAT_ENTITY, SeatRenderer::new); - //HandledScreens.register(ModScreenHandlers.CROCKPOT_SCREEN_HANDLER, CrockpotScreen::new); - HandledScreens.register(ModScreenHandlers.FORGE_ALLOYING_SCREEN_HANDLER, ForgeAlloyingScreen::new); - HandledScreens.register(ModScreenHandlers.ARTISAN_SCREEN_HANDLER, ArtisanTableScreen::new); - HandledScreens.register(ModScreenHandlers.INSCRIPTION_SCREEN_HANDLER, InscriptionTableScreen::new); - HandledScreens.register(ModScreenHandlers.TREATED_ANVIL_SCREEN_HANDLER, ShapingAnvilScreen::new); - HandledScreens.register(ModScreenHandlers.WOOD_PILE_SCREEN_HANDLER, WoodPileScreen::new); - HandledScreens.register(ModScreenHandlers.STRUCTURE_MANAGER_SCREEN_HANDLER, StructureManagerScreen::new); - HandledScreens.register(ModScreenHandlers.STRUCTURE_NEST_SCREEN_HANDLER, StructureNestScreen::new); - - BlockEntityRendererFactories.register(ModBlockEntities.STONE_ANVIL, ShapingAnvilEntityRenderer::new); - BlockEntityRendererFactories.register(ModBlockEntities.TREATED_ANVIL, ShapingAnvilEntityRenderer::new); - BlockEntityRendererFactories.register(ModBlockEntities.FORGE, ForgeEntityRenderer::new); - BlockEntityRendererFactories.register(ModBlockEntities.LARCH_COFFER, LarchCofferEntityRenderer::new); - BlockEntityRendererFactories.register(ModBlockEntities.PINE_COFFER, PineCofferEntityRenderer::new); - BlockEntityRendererFactories.register(ModBlockEntities.SPRUCE_COFFER, SpruceCofferEntityRenderer::new); - BlockEntityRendererFactories.register(ModBlockEntities.FIR_COFFER, FirCofferEntityRenderer::new); - BlockEntityRendererFactories.register(ModBlockEntities.BEECH_COFFER, BeechCofferEntityRenderer::new); - BlockEntityRendererFactories.register(ModBlockEntities.CHESTNUT_COFFER, ChestnutCofferEntityRenderer::new); - BlockEntityRendererFactories.register(ModBlockEntities.OAK_COFFER, OakCofferEntityRenderer::new); - BlockEntityRendererFactories.register(ModBlockEntities.WILLOW_COFFER, WillowCofferEntityRenderer::new); - BlockEntityRendererFactories.register(ModBlockEntities.REINFORCED_CHEST, ReinforcedChestEntityRenderer::new); - BlockEntityRendererFactories.register(ModBlockEntities.OLD_SKULL, OldSkullBlockEntityRenderer::new); - BlockEntityRendererFactories.register(ModBlockEntities.BELLOWS, BellowsBlockEntityRenderer::new); - //BlockEntityRendererFactories.register(ModBlockEntities.CROCKPOT, CrockpotEntityRenderer::new); - BlockEntityRendererFactories.register(ModBlockEntities.PLATE, PlateEntityRenderer::new); - BlockEntityRendererFactories.register(net.minecraft.block.entity.BlockEntityType.DECORATED_POT, LootablePotBlockEntityRenderer::new); - - EntityModelLayerRegistry.registerModelLayer(CUSTOM_ARMOR_HELMET, CustomHelmetModel::getTexturedModelData); - EntityModelLayerRegistry.registerModelLayer(CUSTOM_ARMOR_CHESTPLATE, CustomChestplateModel::getTexturedModelData); - EntityModelLayerRegistry.registerModelLayer(CUSTOM_ARMOR_LEGGINGS, CustomLeggingsModel::getTexturedModelData); - EntityModelLayerRegistry.registerModelLayer(CUSTOM_ARMOR_BOOTS, CustomBootsModel::getTexturedModelData); - EntityModelLayerRegistry.registerModelLayer(HELMET_ADDON_MODEL_LAYER, RohanHelmetModel::getTexturedModelData); - EntityModelLayerRegistry.registerModelLayer(BACK_ATTACHMENT_MODEL_LAYER, CapeMediumModel::getTexturedModelData); - EntityModelLayerRegistry.registerModelLayer(HELMET_ATTACHMENT_MODEL_LAYER, HoodModel::getTexturedModelData); - - EntityModelLayerRegistry.registerModelLayer(HEATER_SHIELD_LAYER, HeaterShieldEntityModel::getTexturedModelData); - EntityModelLayerRegistry.registerModelLayer(KITE_SHIELD_LAYER, KiteShieldEntityModel::getTexturedModelData); - EntityModelLayerRegistry.registerModelLayer(ROUND_SHIELD_LAYER, RoundShieldEntityModel::getTexturedModelData); - - EntityModelLayerRegistry.registerModelLayer(HELD_BANNER_LAYER, HeldBannerEntityModel::getTexturedModelData); - - - SpecialModelTypes.ID_MAPPER.put(Identifier.of(MiddleEarth.MOD_ID, "held_banner"), HeldBannerModelRenderer.Unbaked.CODEC); - - SpecialModelTypes.ID_MAPPER.put(Identifier.of(MiddleEarth.MOD_ID, "heater_shield"), HeaterShieldModelRenderer.Unbaked.CODEC); - SpecialModelTypes.ID_MAPPER.put(Identifier.of(MiddleEarth.MOD_ID, "kite_shield"), KiteShieldModelRenderer.Unbaked.CODEC); - SpecialModelTypes.ID_MAPPER.put(Identifier.of(MiddleEarth.MOD_ID, "round_shield"), RoundShieldModelRenderer.Unbaked.CODEC); + public static final ModelLayerLocation CUSTOM_ARMOR_HELMET = new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "armor"), "_1"); + public static final ModelLayerLocation CUSTOM_ARMOR_CHESTPLATE = new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "armor"), "_2"); + public static final ModelLayerLocation CUSTOM_ARMOR_LEGGINGS = new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "armor"), "_3"); + public static final ModelLayerLocation CUSTOM_ARMOR_BOOTS = new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "armor"), "_4"); + public static final ModelLayerLocation HELMET_ADDON_MODEL_LAYER = new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "armor"), "helmet_addon"); + public static final ModelLayerLocation BACK_ATTACHMENT_MODEL_LAYER = new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "armor"), "back_attachment"); + public static final ModelLayerLocation HELMET_ATTACHMENT_MODEL_LAYER = new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "armor"), "helmet_attachment"); + + public static final ModelLayerLocation HEATER_SHIELD_LAYER = new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "heater_shield"), "main"); + public static final ModelLayerLocation KITE_SHIELD_LAYER = new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "kite_shield"), "main"); + public static final ModelLayerLocation ROUND_SHIELD_LAYER = new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "round_shield"), "main"); + + public static final ModelLayerLocation HELD_BANNER_LAYER = new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "held_banner"), "main"); + + private MiddleEarthClient() { + } + + @SubscribeEvent + public static void clientSetup(FMLClientSetupEvent event) { + event.enqueueWork(() -> { + ModClientNetworkHandler.register(new ConnectionToServer()); + registerItemProperties(); + registerArmorRenderers(); + initializeRenderLayerMap(); + }); + } + + private static void registerItemProperties() { + ItemProperties.registerGeneric(MiddleEarth.of("sneak_attack"), new SneakAttackProperty()); + ItemProperties.registerGeneric(MiddleEarth.of("hot_component"), new HotComponentProperty()); + + SimpleBowItemModel.items.forEach(item -> { + ItemProperties.register(item, PULL, BOW_PULL); + ItemProperties.register(item, PULLING, USING_ITEM); + }); + SimpleBigItemModel.bigBows.forEach(item -> { + ItemProperties.register(item, PULL, LONGBOW_PULL); + ItemProperties.register(item, PULLING, USING_ITEM); + }); + SimpleBigItemModel.items.forEach(item -> { + if (item instanceof CustomLongswordWeaponItem) { + ItemProperties.register(item, BLOCKING, USING_ITEM); + } + }); + SimpleCrossbowItemModel.items.forEach(item -> { + ItemProperties.register(item, PULL, CROSSBOW_PULL); + ItemProperties.register(item, PULLING, CROSSBOW_PULLING); + ItemProperties.register(item, CHARGED, CROSSBOW_CHARGED); + ItemProperties.register(item, FIREWORK, CROSSBOW_FIREWORK); + }); + WeaponItemsME.shields.forEach(item -> ItemProperties.register(item, BLOCKING, USING_ITEM)); + SimpleSpearModel.items.forEach(item -> ItemProperties.register(item, HOLDING, USING_ITEM)); + SimpleArtefactModels.artefacts.forEach(artefact -> { + ItemProperties.register(artefact.artefact(), BROKEN, ARTEFACT_BROKEN); + if (artefact.dualModel()) { + ItemProperties.register(artefact.artefact(), BLOCKING, USING_ITEM); + } + if (artefact.artefact() instanceof ArtefactCustomGlowingLongswordWeaponItem + || artefact.artefact() instanceof ArtefactCustomGlowingDaggerWeaponItem) { + ItemProperties.register(artefact.artefact(), GLOWING, ARTEFACT_GLOWING); + } + }); + ResourceItemsME.COLORED_BUNDLES.forEach(item -> + ItemProperties.register(item, FILLED, (stack, level, entity, seed) -> + BundleItem.getFullnessDisplay(stack)) + ); + } + + @SubscribeEvent + public static void registerMenuScreens(RegisterMenuScreensEvent event) { + event.register(ModScreenHandlers.CROCKPOT_SCREEN_HANDLER, CrockpotScreen::new); + event.register(ModScreenHandlers.FORGE_ALLOYING_SCREEN_HANDLER, ForgeAlloyingScreen::new); + event.register(ModScreenHandlers.ARTISAN_SCREEN_HANDLER, ArtisanTableScreen::new); + event.register(ModScreenHandlers.INSCRIPTION_SCREEN_HANDLER, InscriptionTableScreen::new); + event.register(ModScreenHandlers.TREATED_ANVIL_SCREEN_HANDLER, ShapingAnvilScreen::new); + event.register(ModScreenHandlers.WOOD_PILE_SCREEN_HANDLER, WoodPileScreen::new); + event.register(ModScreenHandlers.STRUCTURE_MANAGER_SCREEN_HANDLER, StructureManagerScreen::new); + event.register(ModScreenHandlers.STRUCTURE_NEST_SCREEN_HANDLER, StructureNestScreen::new); + } + + @SubscribeEvent + public static void registerRenderers(EntityRenderersEvent.RegisterRenderers event) { + event.registerEntityRenderer(EntitiesME.SNOW_TROLL, SnowTrollRenderer::new); + event.registerEntityRenderer(EntitiesME.CAVE_TROLL, CaveTrollRenderer::new); + event.registerEntityRenderer(EntitiesME.STONE_TROLL, StoneTrollRenderer::new); + event.registerEntityRenderer(EntitiesME.PETRIFIED_TROLL, PetrifiedTrollRenderer::new); + event.registerEntityRenderer(EntitiesME.BROADHOOF_GOAT, BroadhoofGoatRenderer::new); + event.registerEntityRenderer(EntitiesME.GREAT_HORN, GreatHornRenderer::new); + event.registerEntityRenderer(EntitiesME.WARG, WargRenderer::new); + event.registerEntityRenderer(EntitiesME.REINFORCED_BARREL, BarrelEntityRenderer::new); + event.registerEntityRenderer(EntitiesME.SHELOBITE_LARVA, ShelobiteLarvaRenderer::new); + event.registerEntityRenderer(EntitiesME.SHELOBITE_SCUTTLER, ShelobiteScuttlerRenderer::new); + event.registerEntityRenderer(EntitiesME.SPAWN_OF_SHELOB, SpawnOfShelobRenderer::new); + event.registerEntityRenderer(EntitiesME.FIRE_OF_ORTHANC, FireOfOrthancEntityRenderer::new); + event.registerEntityRenderer(EntitiesME.PEBBLE, ThrownItemRenderer::new); + event.registerEntityRenderer(EntitiesME.PINECONE, ThrownItemRenderer::new); + event.registerEntityRenderer(EntitiesME.LIT_PINECONE, ThrownItemRenderer::new); + event.registerEntityRenderer(EntitiesME.SPEAR, SpearEntityRenderer::new); + event.registerEntityRenderer(EntitiesME.BOULDER, BoulderEntityRenderer::new); + event.registerEntityRenderer(EntitiesME.SMOKE_RING_PROJECTILE, SmokeRingProjectileRenderer::new); + event.registerEntityRenderer(EntitiesME.WEB, ThrownItemRenderer::new); + event.registerEntityRenderer(EntitiesME.NPC, NpcEntityRenderer::new); + event.registerEntityRenderer(EntitiesME.SEAT_ENTITY, SeatRenderer::new); + + event.registerBlockEntityRenderer(ModBlockEntities.STONE_ANVIL, ShapingAnvilEntityRenderer::new); + event.registerBlockEntityRenderer(ModBlockEntities.TREATED_ANVIL, ShapingAnvilEntityRenderer::new); + event.registerBlockEntityRenderer(ModBlockEntities.FORGE, ForgeEntityRenderer::new); + event.registerBlockEntityRenderer(ModBlockEntities.LARCH_COFFER, LarchCofferEntityRenderer::new); + event.registerBlockEntityRenderer(ModBlockEntities.PINE_COFFER, PineCofferEntityRenderer::new); + event.registerBlockEntityRenderer(ModBlockEntities.SPRUCE_COFFER, SpruceCofferEntityRenderer::new); + event.registerBlockEntityRenderer(ModBlockEntities.FIR_COFFER, FirCofferEntityRenderer::new); + event.registerBlockEntityRenderer(ModBlockEntities.BEECH_COFFER, BeechCofferEntityRenderer::new); + event.registerBlockEntityRenderer(ModBlockEntities.CHESTNUT_COFFER, ChestnutCofferEntityRenderer::new); + event.registerBlockEntityRenderer(ModBlockEntities.OAK_COFFER, OakCofferEntityRenderer::new); + event.registerBlockEntityRenderer(ModBlockEntities.WILLOW_COFFER, WillowCofferEntityRenderer::new); + event.registerBlockEntityRenderer(ModBlockEntities.REINFORCED_CHEST, ReinforcedChestEntityRenderer::new); + event.registerBlockEntityRenderer(ModBlockEntities.OLD_SKULL, OldSkullBlockEntityRenderer::new); + event.registerBlockEntityRenderer(ModBlockEntities.BELLOWS, BellowsBlockEntityRenderer::new); + event.registerBlockEntityRenderer(ModBlockEntities.PLATE, PlateEntityRenderer::new); + event.registerBlockEntityRenderer(BlockEntityType.DECORATED_POT, LootablePotBlockEntityRenderer::new); + } + + @SubscribeEvent + public static void registerLayerDefinitions(EntityRenderersEvent.RegisterLayerDefinitions event) { + EntityModelLayersME.registerLayerDefinitions(event); + event.registerLayerDefinition(CUSTOM_ARMOR_HELMET, CustomHelmetModel::getTexturedModelData); + event.registerLayerDefinition(CUSTOM_ARMOR_CHESTPLATE, CustomChestplateModel::getTexturedModelData); + event.registerLayerDefinition(CUSTOM_ARMOR_LEGGINGS, CustomLeggingsModel::getTexturedModelData); + event.registerLayerDefinition(CUSTOM_ARMOR_BOOTS, CustomBootsModel::getTexturedModelData); + event.registerLayerDefinition(HELMET_ADDON_MODEL_LAYER, RohanHelmetModel::getTexturedModelData); + event.registerLayerDefinition(BACK_ATTACHMENT_MODEL_LAYER, CapeMediumModel::getTexturedModelData); + event.registerLayerDefinition(HELMET_ATTACHMENT_MODEL_LAYER, HoodModel::getTexturedModelData); + event.registerLayerDefinition(HEATER_SHIELD_LAYER, HeaterShieldEntityModel::getTexturedModelData); + event.registerLayerDefinition(KITE_SHIELD_LAYER, KiteShieldEntityModel::getTexturedModelData); + event.registerLayerDefinition(ROUND_SHIELD_LAYER, RoundShieldEntityModel::getTexturedModelData); + event.registerLayerDefinition(HELD_BANNER_LAYER, HeldBannerEntityModel::getTexturedModelData); + } + + @SubscribeEvent + public static void registerBlockColors(RegisterColorHandlersEvent.Block event) { + BlockColorsME.registerBlockColors(event); + } + + @SubscribeEvent + public static void registerItemColors(RegisterColorHandlersEvent.Item event) { + ItemColorsME.register(event); + } + + @SubscribeEvent + public static void registerAdditionalItemModels(ModelEvent.RegisterAdditional event) { + ItemModelRenderStateClient.registerAdditionalModels(event); + } + @SubscribeEvent + public static void cacheBakedItemModels(ModelEvent.BakingCompleted event) { + ItemModelRenderStateClient.cacheBakedModels(event); + } + + @SubscribeEvent + public static void registerDimensionEffects(RegisterDimensionSpecialEffectsEvent event) { + event.register( + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "middle_earth"), + new MiddleEarthDimensionEffects() + ); + } + + @SubscribeEvent + public static void registerClientExtensions(RegisterClientExtensionsEvent event) { + ModBuiltInModelItemRenderer.register( + event, + WeaponItemsME.HEATER_SHIELD, + WeaponItemsME.KITE_SHIELD, + WeaponItemsME.ROUND_SHIELD, + WeaponItemsME.HELD_BANNER + ); + } + + @SubscribeEvent + public static void addPlayerLayers(EntityRenderersEvent.AddLayers event) { + for (var skin : event.getSkins()) { + PlayerRenderer renderer = event.getSkin(skin); + if (renderer != null) { + renderer.addLayer(new EnwebbedFeatureRenderer<>(renderer, event.getEntityModels())); + } + } + } + + private static void registerArmorRenderers() { for(ArmorModelsME.ModHelmetModels model : ArmorModelsME.ModHelmetModels.values()){ ArmorRenderer.register(new HelmetArmorRenderer(model.getModel()), model.getItem()); } - ArmorRenderer.register(new HelmetVariantsRenderer(new SilvanLordHelmetModel(SilvanLordHelmetModel.getTexturedModelData().createModel())), EquipmentItemsME.SILVAN_LORD_HELMET); - ArmorRenderer.register(new HelmetVariantsRenderer(new ErynGalenWatchwardenHelmetModel(ErynGalenWatchwardenHelmetModel.getTexturedModelData().createModel())), EquipmentItemsME.ERYN_GALEN_WATCHWARDEN_HELMET); - ArmorRenderer.register(new HelmetVariantsRenderer(new ErynGalenWatchwardenHelmetModel(ErynGalenWatchwardenHelmetModel.getTexturedModelData().createModel())), EquipmentItemsME.OXIDISED_ERYN_GALEN_WATCHWARDEN_HELMET); - ArmorRenderer.register(new WoodlandCrownRenderer(new WoodlandRealmCrownModel(WoodlandRealmCrownModel.getTexturedModelData().createModel())), EquipmentItemsME.WOODLAND_REALM_CROWN); + ArmorRenderer.register(new HelmetVariantsRenderer(new SilvanLordHelmetModel(SilvanLordHelmetModel.getTexturedModelData().bakeRoot())), EquipmentItemsME.SILVAN_LORD_HELMET); + ArmorRenderer.register(new HelmetVariantsRenderer(new ErynGalenWatchwardenHelmetModel(ErynGalenWatchwardenHelmetModel.getTexturedModelData().bakeRoot())), EquipmentItemsME.ERYN_GALEN_WATCHWARDEN_HELMET); + ArmorRenderer.register(new HelmetVariantsRenderer(new ErynGalenWatchwardenHelmetModel(ErynGalenWatchwardenHelmetModel.getTexturedModelData().bakeRoot())), EquipmentItemsME.OXIDISED_ERYN_GALEN_WATCHWARDEN_HELMET); + ArmorRenderer.register(new WoodlandCrownRenderer(new WoodlandRealmCrownModel(WoodlandRealmCrownModel.getTexturedModelData().bakeRoot())), EquipmentItemsME.WOODLAND_REALM_CROWN); for(ArmorModelsME.ModChestplateModels model : ArmorModelsME.ModChestplateModels.values()){ ArmorRenderer.register(new ChestplateArmorRenderer(model.getModel()), model.getItem()); @@ -225,465 +365,462 @@ public void onInitializeClient() { EquipmentItemsME.backAttachments.forEach(cape -> { ArmorRenderer.register(new BackAttachmentRenderer(), cape); }); - - ModelLoadingPlugin.register(pluginContext -> { - pluginContext.addModel(ExtraModelKey.create(() -> "plate_apple"), SimpleUnbakedExtraModel.blockStateModel(MiddleEarth.ofPath("item", "plate_apple"))); - }); - - ParticleFactoryRegistry.getInstance().register(ModParticleTypes.ANVIL_SPARK_PARTICLE, AnvilBonkParticle.Factory::new); - ParticleFactoryRegistry.getInstance().register(ModParticleTypes.BIOME_FOG_PARTICLE, BiomeFogParticle.Factory::new); - - initializeRenderLayerMap(); - BlockColorsME.initializeBlockColors(); } - private void initializeRenderLayerMap() { - BlockRenderLayerMap.putBlock(ModNatureBlocks.MORGUL_IVY, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.HANGING_WEBS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.CORNER_COBWEB, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.SHELOBITE_LARVA_EGG, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.HANGING_SHELOBITE_LARVA_EGG, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModNatureBlocks.ATHELAS, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModNatureBlocks.BROWN_GRASS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.GREEN_SHRUB, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.SMALL_DRY_SHRUB, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.FROZEN_SHRUB, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.ELANOR, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.MALLOS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.NIPHREDIL, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.SIMBELMYNE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.TAN_SHRUB, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.STRAWBERRY_BUSH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.TOUGH_BERRY_BUSH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.YELLOW_FLOWER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.BLUE_GENTIAN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.GREEN_JEWEL_CORNFLOWER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.NOBLEWHITE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.MIRKWOOD_ROOTS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.MIRKWOOD_HANGING_ROOTS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.PINE_BRANCHES, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModNatureBlocks.LIGHT_BLUE_FLOWERS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.MAGENTA_FLOWERS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.ORANGE_FLOWERS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.PINK_FLOWERS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.PURPLE_FLOWERS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.RED_FLOWERS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.WHITE_FLOWERS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.YELLOW_FLOWERS, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModNatureBlocks.BLUE_LAVENDER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.LAVENDER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.WHITE_LAVENDER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.YELLOW_TROLLIUS, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModNatureBlocks.HOBBIT_SUNFLOWERS, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModNatureBlocks.BLUE_FESCUE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.DYING_GRASS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.FROZEN_GRASS, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModNatureBlocks.GRIM_GRASS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.MEADOWGRASS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.SPARSE_GRASS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.NETTLES, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.THISTLE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.TEMPERATE_GRASS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.GRASS_TUFT, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.FROZEN_TUFT, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.HEATHER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.RED_HEATHER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.DEAD_HEATHER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.DRY_HEATHER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.HEATH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.WHEATGRASS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.WILD_GRASS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.WILDERGRASS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.BEACH_GRASS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.COASTAL_PANIC_GRASS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.MISTWEED, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.SEDUM, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.ORANGE_SEDUM, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.RED_SEDUM, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.YELLOW_SEDUM, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.GIANT_BUTTERBUR, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.BRACKEN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.CAMPION, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.BLUE_BIGLEAF_HYDRANGEA, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.PINK_BIGLEAF_HYDRANGEA, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.WHITE_BIGLEAF_HYDRANGEA, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.DEAD_HEATHER_BUSH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.DRY_HEATHER_BUSH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.DEAD_RUSHES, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.FALSE_OATGRASS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.HEATHER_BUSH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.LARGE_BLUE_FESCUE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.LARGE_BUSH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.LARGE_SHRIVELED_SHRUB, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.RED_HEATHER_BUSH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.RUSHES, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.BRAMBLES_OF_MORDOR, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.SHORT_DEAD_RUSHES, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.CLOVERS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.SHORT_RUSHES, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.SHORT_REEDS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.SHORT_CATTAILS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.SHORT_BULRUSH, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModNatureBlocks.SHRIVELED_SHRUB, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModNatureBlocks.SCORCHED_GRASS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.SCORCHED_TUFT, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.SCORCHED_SHRUB, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModNatureBlocks.SMALL_LILY_PADS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.SMALL_FLOWERING_LILY_PADS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.LILY_PADS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.FLOWERING_LILY_PADS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.LARGE_LILY_PAD, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.LARGE_FLOWERING_LILY_PAD, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModNatureBlocks.DUCKWEED, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModNatureBlocks.FLOATING_ICE, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModBlocks.GRASSY_DIRT, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.GRASSY_DIRT_SLAB, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.GRASSY_DIRT_STAIRS, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModBlocks.CHALKSOIL_GRASS_BLOCK, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.LOAM_GRASS_BLOCK, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.PEAT_GRASS_BLOCK, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.SILT_GRASS_BLOCK, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModBlocks.GRASSY_CHALKSOIL, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.GRASSY_CHALKSOIL_SLAB, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.GRASSY_CHALKSOIL_STAIRS, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModBlocks.GRASSY_LOAM, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.GRASSY_LOAM_SLAB, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.GRASSY_LOAM_STAIRS, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModBlocks.GRASSY_PEAT, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.GRASSY_PEAT_SLAB, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.GRASSY_PEAT_STAIRS, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModBlocks.GRASSY_SILT, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.GRASSY_SILT_SLAB, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.GRASSY_SILT_STAIRS, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModBlocks.PEBBLED_GRASS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.PEBBLED_GRASS_SLAB, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.PEBBLED_GRASS_STAIRS, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.FIRE_OF_ORTHANC, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.INSCRIPTION_TABLE, BlockRenderLayer.CUTOUT); - - /*BlockRenderLayerMap.putBlock(ModDecorativeBlocks.CERAMIC_CROCKPOT, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.CROCKPOT, BlockRenderLayer.CUTOUT);*/ - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.CERAMIC_PLATE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.ROTTEN_PLATE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SILVER_PLATE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.TAPPER, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModBlocks.POINTED_LIMESTONE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.POINTED_GALONN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.POINTED_IZHERABAN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.POINTED_DOLOMITE, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModBlocks.EMBERS, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.REINFORCED_SCAFFOLDING, BlockRenderLayer.CUTOUT); + private static void initializeRenderLayerMap() { + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.MORGUL_IVY, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.HANGING_WEBS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.CORNER_COBWEB, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SHELOBITE_LARVA_EGG, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.HANGING_SHELOBITE_LARVA_EGG, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.ATHELAS, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.BROWN_GRASS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.GREEN_SHRUB, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SMALL_DRY_SHRUB, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.BUSH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SHORT_DRY_GRASS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.TALL_DRY_GRASS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.WILDFLOWERS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.LEAF_LITTER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.FIREFLY_BUSH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.RESIN_CLUMP, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.FROZEN_SHRUB, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.ELANOR, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.MALLOS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.NIPHREDIL, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SIMBELMYNE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.TAN_SHRUB, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.STRAWBERRY_BUSH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.TOUGH_BERRY_BUSH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.YELLOW_FLOWER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.BLUE_GENTIAN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.GREEN_JEWEL_CORNFLOWER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.NOBLEWHITE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.MIRKWOOD_ROOTS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.MIRKWOOD_HANGING_ROOTS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.PINE_BRANCHES, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.LIGHT_BLUE_FLOWERS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.MAGENTA_FLOWERS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.ORANGE_FLOWERS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.PINK_FLOWERS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.PURPLE_FLOWERS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.RED_FLOWERS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.WHITE_FLOWERS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.YELLOW_FLOWERS, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.BLUE_LAVENDER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.LAVENDER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.WHITE_LAVENDER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.YELLOW_TROLLIUS, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.HOBBIT_SUNFLOWERS, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.BLUE_FESCUE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.DYING_GRASS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.FROZEN_GRASS, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.GRIM_GRASS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.MEADOWGRASS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SPARSE_GRASS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.NETTLES, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.THISTLE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.TEMPERATE_GRASS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.GRASS_TUFT, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.FROZEN_TUFT, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.HEATHER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.RED_HEATHER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.DEAD_HEATHER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.DRY_HEATHER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.HEATH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.WHEATGRASS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.WILD_GRASS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.WILDERGRASS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.BEACH_GRASS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.COASTAL_PANIC_GRASS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.MISTWEED, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SEDUM, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.ORANGE_SEDUM, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.RED_SEDUM, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.YELLOW_SEDUM, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.GIANT_BUTTERBUR, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.BRACKEN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.CAMPION, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.BLUE_BIGLEAF_HYDRANGEA, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.PINK_BIGLEAF_HYDRANGEA, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.WHITE_BIGLEAF_HYDRANGEA, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.DEAD_HEATHER_BUSH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.DRY_HEATHER_BUSH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.DEAD_RUSHES, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.FALSE_OATGRASS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.HEATHER_BUSH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.LARGE_BLUE_FESCUE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.LARGE_BUSH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.LARGE_SHRIVELED_SHRUB, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.RED_HEATHER_BUSH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.RUSHES, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.BRAMBLES_OF_MORDOR, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SHORT_DEAD_RUSHES, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.CLOVERS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SHORT_RUSHES, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SHORT_REEDS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SHORT_CATTAILS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SHORT_BULRUSH, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SHRIVELED_SHRUB, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SCORCHED_GRASS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SCORCHED_TUFT, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SCORCHED_SHRUB, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SMALL_LILY_PADS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SMALL_FLOWERING_LILY_PADS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.LILY_PADS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.FLOWERING_LILY_PADS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.LARGE_LILY_PAD, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.LARGE_FLOWERING_LILY_PAD, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.DUCKWEED, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.FLOATING_ICE, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModBlocks.GRASSY_DIRT, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.GRASSY_DIRT_SLAB, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.GRASSY_DIRT_STAIRS, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModBlocks.CHALKSOIL_GRASS_BLOCK, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.LOAM_GRASS_BLOCK, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.PEAT_GRASS_BLOCK, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.SILT_GRASS_BLOCK, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModBlocks.GRASSY_CHALKSOIL, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.GRASSY_CHALKSOIL_SLAB, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.GRASSY_CHALKSOIL_STAIRS, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModBlocks.GRASSY_LOAM, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.GRASSY_LOAM_SLAB, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.GRASSY_LOAM_STAIRS, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModBlocks.GRASSY_PEAT, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.GRASSY_PEAT_SLAB, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.GRASSY_PEAT_STAIRS, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModBlocks.GRASSY_SILT, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.GRASSY_SILT_SLAB, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.GRASSY_SILT_STAIRS, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModBlocks.PEBBLED_GRASS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.PEBBLED_GRASS_SLAB, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.PEBBLED_GRASS_STAIRS, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.FIRE_OF_ORTHANC, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.INSCRIPTION_TABLE, RenderType.cutout()); + + /*ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.CERAMIC_CROCKPOT, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.CROCKPOT, BlockRenderLayer.CUTOUT);*/ + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.CERAMIC_PLATE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.ROTTEN_PLATE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SILVER_PLATE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.TAPPER, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModBlocks.POINTED_LIMESTONE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.POINTED_GALONN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.POINTED_IZHERABAN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.POINTED_DOLOMITE, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModBlocks.EMBERS, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.REINFORCED_SCAFFOLDING, RenderType.cutout()); for(Block block : SimpleDoubleBlockModel.doubleBlocks){ - BlockRenderLayerMap.putBlock(block, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(block, RenderType.cutout()); } for(Block block : SimpleFlowerBedModel.flowerBeds){ - BlockRenderLayerMap.putBlock(block, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(block, RenderType.cutout()); } for(SimpleFlowerPotModel.FlowerPot flowerPot : SimpleFlowerPotModel.pots){ - BlockRenderLayerMap.putBlock(flowerPot.pottedPlant(), BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(flowerPot.pottedPlant(), RenderType.cutout()); } - BlockRenderLayerMap.putBlock(ModNatureBlocks.MIRKWOOD_SAPLING, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.WHITE_MUSHROOM, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.WHITE_MUSHROOM_TILLER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.MOSS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.STICKY_SNOW, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.STICKY_ICE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.FOREST_MOSS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.CORRUPTED_MOSS, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.MIRKWOOD_SAPLING, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.WHITE_MUSHROOM, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.WHITE_MUSHROOM_TILLER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.MOSS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.STICKY_SNOW, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.STICKY_ICE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.FOREST_MOSS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.CORRUPTED_MOSS, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModNatureBlocks.SHORT_ICICLES, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.DROOPING_ICICLES, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SHORT_ICICLES, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.DROOPING_ICICLES, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModBlocks.BURZUM_SPIKES, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.BURZUM_SPIKES, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.TALL_BLACK_PINE_DOOR, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.REINFORCED_BLACK_PINE_DOOR, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.RICKETY_SIMPLE_LARCH_DOOR, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SPRUCE_STABLE_DOOR, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.LARGE_BEECH_FENCE_GATE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.RUINED_DWARVEN_DOOR, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.LIGHT_BLUE_HOBBIT_DOOR, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.TALL_BLACK_PINE_DOOR, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.REINFORCED_BLACK_PINE_DOOR, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.RICKETY_SIMPLE_LARCH_DOOR, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SPRUCE_STABLE_DOOR, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.LARGE_BEECH_FENCE_GATE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.RUINED_DWARVEN_DOOR, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.LIGHT_BLUE_HOBBIT_DOOR, RenderType.cutout()); for (Block block : Crops.crops){ - BlockRenderLayerMap.putBlock(block, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(block, RenderType.cutout()); } - for(Block block : TintableCrossModel.notTintedBlocks) { - if(block != null) BlockRenderLayerMap.putBlock(block, BlockRenderLayer.CUTOUT); + for(Block block : TintableCrossModel.notTintedBlocks()) { + if(block != null) ItemBlockRenderTypes.setRenderLayer(block, RenderType.cutout()); } - for(Block block : TintableCrossModel.tintedBlocks) { - BlockRenderLayerMap.putBlock(block, BlockRenderLayer.CUTOUT); + for(Block block : TintableCrossModel.tintedBlocks()) { + ItemBlockRenderTypes.setRenderLayer(block, RenderType.cutout()); } - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.TREATED_WOOD_LADDER, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.TREATED_WOOD_LADDER, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.ROPE_LADDER, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.ROPE_LADDER, RenderType.cutout()); for(SimpleLadderModel.Ladder block : SimpleLadderModel.vanillaLadders) { - BlockRenderLayerMap.putBlock(block.ladder(), BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(block.ladder(), RenderType.cutout()); } - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.TREATED_WOOD_CHAIR, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModNatureBlocks.FALLEN_LEAVES, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.FALLEN_MALLORN_LEAVES, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.FALLEN_MIRKWOOD_LEAVES, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModBlocks.QUARTZ_CLUSTER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.SMALL_QUARTZ_BUD, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.MEDIUM_QUARTZ_BUD, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.LARGE_QUARTZ_BUD, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.RED_AGATE_CLUSTER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.SMALL_RED_AGATE_BUD, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.MEDIUM_RED_AGATE_BUD, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.LARGE_RED_AGATE_BUD, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.CITRINE_CLUSTER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.SMALL_CITRINE_BUD, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.MEDIUM_CITRINE_BUD, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.LARGE_CITRINE_BUD, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.GLOWSTONE_CLUSTER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.SMALL_GLOWSTONE_BUD, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.MEDIUM_GLOWSTONE_BUD, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.LARGE_GLOWSTONE_BUD, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_BLACK_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_BLUE_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_BROWN_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_BURNT_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_DARK_BLUE_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_DARK_BROWN_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_DARK_GREEN_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_DARK_RED_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_FANCY_BLUE_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_FANCY_GREEN_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_FANCY_RED_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_GRAY_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_GREEN_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_PURPLE_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_RED_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_ROTTEN_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_WHITE_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_YELLOW_CURTAIN, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.BLACK_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.BLUE_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.BROWN_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.BURNT_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.DARK_BLUE_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.DARK_BROWN_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.DARK_GREEN_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.DARK_RED_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.FANCY_BLUE_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.FANCY_GREEN_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.FANCY_RED_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.GRAY_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.GREEN_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.PURPLE_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.RED_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.ROTTEN_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.WHITE_CURTAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.YELLOW_CURTAIN, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.DWARVEN_LANTERN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.WALL_DWARVEN_LANTERN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.TREATED_STEEL_LANTERN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.WALL_TREATED_STEEL_LANTERN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.CRYSTAL_LAMP, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.WALL_CRYSTAL_LAMP, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SILVER_LANTERN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.WALL_SILVER_LANTERN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.ELVEN_LANTERN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.WALL_ELVEN_LANTERN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.CRUDE_LANTERN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.WALL_CRUDE_LANTERN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.LEAD_LANTERN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.WALL_LEAD_LANTERN, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.BRONZE_CHAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.BRONZE_BROAD_CHAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.CRUDE_CHAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.CRUDE_BROAD_CHAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SPIKY_CHAIN, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModBlocks.NET, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModBlocks.COPPER_BARS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.EXPOSED_COPPER_BARS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.WEATHERED_COPPER_BARS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.OXIDIZED_COPPER_BARS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.WAXED_COPPER_BARS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.WAXED_EXPOSED_COPPER_BARS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.WAXED_WEATHERED_COPPER_BARS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.WAXED_OXIDIZED_COPPER_BARS, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.TREATED_WOOD_CHAIR, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.FALLEN_LEAVES, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.FALLEN_MALLORN_LEAVES, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.FALLEN_MIRKWOOD_LEAVES, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModBlocks.QUARTZ_CLUSTER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.SMALL_QUARTZ_BUD, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.MEDIUM_QUARTZ_BUD, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.LARGE_QUARTZ_BUD, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.RED_AGATE_CLUSTER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.SMALL_RED_AGATE_BUD, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.MEDIUM_RED_AGATE_BUD, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.LARGE_RED_AGATE_BUD, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.CITRINE_CLUSTER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.SMALL_CITRINE_BUD, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.MEDIUM_CITRINE_BUD, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.LARGE_CITRINE_BUD, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.GLOWSTONE_CLUSTER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.SMALL_GLOWSTONE_BUD, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.MEDIUM_GLOWSTONE_BUD, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.LARGE_GLOWSTONE_BUD, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_BLACK_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_BLUE_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_BROWN_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_BURNT_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_DARK_BLUE_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_DARK_BROWN_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_DARK_GREEN_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_DARK_RED_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_FANCY_BLUE_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_FANCY_GREEN_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_FANCY_RED_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_GRAY_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_GREEN_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_PURPLE_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_RED_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_ROTTEN_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_WHITE_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_YELLOW_CURTAIN, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.BLACK_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.BLUE_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.BROWN_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.BURNT_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.DARK_BLUE_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.DARK_BROWN_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.DARK_GREEN_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.DARK_RED_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.FANCY_BLUE_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.FANCY_GREEN_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.FANCY_RED_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.GRAY_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.GREEN_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.PURPLE_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.RED_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.ROTTEN_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.WHITE_CURTAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.YELLOW_CURTAIN, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.DWARVEN_LANTERN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.WALL_DWARVEN_LANTERN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.TREATED_STEEL_LANTERN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.WALL_TREATED_STEEL_LANTERN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.CRYSTAL_LAMP, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.WALL_CRYSTAL_LAMP, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SILVER_LANTERN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.WALL_SILVER_LANTERN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.ELVEN_LANTERN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.WALL_ELVEN_LANTERN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.CRUDE_LANTERN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.WALL_CRUDE_LANTERN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.LEAD_LANTERN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.WALL_LEAD_LANTERN, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.BRONZE_CHAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.BRONZE_BROAD_CHAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.CRUDE_CHAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.CRUDE_BROAD_CHAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SPIKY_CHAIN, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModBlocks.NET, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModBlocks.COPPER_BARS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.EXPOSED_COPPER_BARS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.WEATHERED_COPPER_BARS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.OXIDIZED_COPPER_BARS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.WAXED_COPPER_BARS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.WAXED_EXPOSED_COPPER_BARS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.WAXED_WEATHERED_COPPER_BARS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.WAXED_OXIDIZED_COPPER_BARS, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModBlocks.BRONZE_BARS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.CRUDE_BARS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.TREATED_STEEL_BARS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.TREATED_STEEL_DOOR, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.BURZUM_BARS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.AGED_WOOD_DOOR, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.BRONZE_DOOR, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.CRUDE_DOOR, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.AGED_WOOD_TRAPDOOR, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.BRONZE_TRAPDOOR, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.CRUDE_TRAPDOOR, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.TREATED_STEEL_TRAPDOOR, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModBlocks.SILVER_BARS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModBlocks.GILDED_BARS, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModNatureBlocks.WILD_CARROT, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.WILD_POTATO, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.WILD_BEETROOT, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModNatureBlocks.AZALEA_FLOWER_GROWTH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.DRY_GROWTH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.FROZEN_GROWTH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.GREEN_GROWTH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.IVY_GROWTH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.LILAC_FLOWER_GROWTH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.PINK_FLOWER_GROWTH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.RED_FLOWER_GROWTH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.THORNY_GROWTH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.WHITE_FLOWER_GROWTH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.YELLOW_FLOWER_GROWTH, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModNatureBlocks.WEBBING, BlockRenderLayer.CUTOUT); - - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.MEDGON_SPIKE, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.BRONZE_BARS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.CRUDE_BARS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.TREATED_STEEL_BARS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.TREATED_STEEL_DOOR, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.BURZUM_BARS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.AGED_WOOD_DOOR, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.BRONZE_DOOR, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.CRUDE_DOOR, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.AGED_WOOD_TRAPDOOR, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.BRONZE_TRAPDOOR, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.CRUDE_TRAPDOOR, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.TREATED_STEEL_TRAPDOOR, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModBlocks.SILVER_BARS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.GILDED_BARS, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.WILD_CARROT, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.WILD_POTATO, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.WILD_BEETROOT, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.AZALEA_FLOWER_GROWTH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.DRY_GROWTH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.FROZEN_GROWTH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.GREEN_GROWTH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.IVY_GROWTH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.LILAC_FLOWER_GROWTH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.PINK_FLOWER_GROWTH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.RED_FLOWER_GROWTH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.THORNY_GROWTH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.WHITE_FLOWER_GROWTH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.YELLOW_FLOWER_GROWTH, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.WEBBING, RenderType.cutout()); + + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.MEDGON_SPIKE, RenderType.cutout()); for (SimplePaneModel.Pane pane : SimplePaneModel.panes){ - BlockRenderLayerMap.putBlock(pane.glass(), BlockRenderLayer.TRANSLUCENT); - BlockRenderLayerMap.putBlock(pane.pane(), BlockRenderLayer.TRANSLUCENT); + ItemBlockRenderTypes.setRenderLayer(pane.glass(), RenderType.translucent()); + ItemBlockRenderTypes.setRenderLayer(pane.pane(), RenderType.translucent()); } StoneBlockSets.stoneSetsList.forEach(setBuilder -> { if (setBuilder.carvedWindows != null){ - BlockRenderLayerMap.putBlock(setBuilder.carvedWindows.block(), BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(setBuilder.carvedWindows.verticalSlab(), BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(setBuilder.carvedWindows.block(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(setBuilder.carvedWindows.verticalSlab(), RenderType.cutout()); } }); WoodBlockSets.woodSetsList.forEach(setBuilder -> { if (setBuilder.redstoneBlocks != null){ - BlockRenderLayerMap.putBlock(setBuilder.redstoneBlocks.trapdoor(), BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(setBuilder.redstoneBlocks.door(), BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(setBuilder.redstoneBlocks.trapdoor(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(setBuilder.redstoneBlocks.door(), RenderType.cutout()); } if (setBuilder.furnitureBlocks != null){ - BlockRenderLayerMap.putBlock(setBuilder.furnitureBlocks.chair(), BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(setBuilder.furnitureBlocks.ladder(), BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(setBuilder.furnitureBlocks.chair(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(setBuilder.furnitureBlocks.ladder(), RenderType.cutout()); } }); - BlockRenderLayerMap.putBlock(ResourceItemsME.REEDS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.TALL_CATTAILS, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.TALL_BULRUSH, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.HOGWEED, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.SHORT_HOGWEED, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ResourceItemsME.REEDS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.TALL_CATTAILS, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.TALL_BULRUSH, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.HOGWEED, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.SHORT_HOGWEED, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.WATERING_CAN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.WOODEN_BUCKET, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.WATERING_CAN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.WOODEN_BUCKET, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.BROWN_JUG, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.LARGE_JUG, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.BROWN_JUG, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.LARGE_JUG, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.AMPHORA, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.BROWN_AMPHORA, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.AMPHORA, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.BROWN_AMPHORA, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.BROWN_JAR, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.BROWN_JAR, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.BROWN_FAT_POT, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.FAT_POT, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.BROWN_FAT_POT, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.FAT_POT, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SKELETON, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SKELETON, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.CANDLESTICK, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.CERAMIC_LAMP, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.CANDLE_HOLDER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SKULL_CANDLE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.CANDLE_HEAP, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_BRONZE_CHANDELIER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.BRONZE_CHANDELIER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_CHANDELIER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.CHANDELIER, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.CANDLESTICK, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.CERAMIC_LAMP, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.CANDLE_HOLDER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SKULL_CANDLE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.CANDLE_HEAP, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_BRONZE_CHANDELIER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.BRONZE_CHANDELIER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_CHANDELIER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.CHANDELIER, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.BIG_BRAZIER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SMALL_BRAZIER, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.BIG_BRAZIER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SMALL_BRAZIER, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.GILDED_BIG_BRAZIER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.GILDED_SMALL_BRAZIER, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.GILDED_BIG_BRAZIER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.GILDED_SMALL_BRAZIER, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.FIRE_BOWL, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.TORCH_OF_ORTHANC, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.BONFIRE, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.FIRE_BOWL, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.TORCH_OF_ORTHANC, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.BONFIRE, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.SCONCE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.GILDED_SCONCE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.ORCISH_SCONCE, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.SCONCE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.GILDED_SCONCE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.ORCISH_SCONCE, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.WALL_SCONCE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.GILDED_WALL_SCONCE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.ORCISH_WALL_SCONCE, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.WALL_SCONCE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.GILDED_WALL_SCONCE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.ORCISH_WALL_SCONCE, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.ORCISH_ARTISAN_TABLE, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.ORCISH_ARTISAN_TABLE, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.STONE_LECTERN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.CHISELED_DOLOMITE_BOOKSHELF, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.STONE_LECTERN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.CHISELED_DOLOMITE_BOOKSHELF, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.BASALT_STATUE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.DEEPSLATE_STATUE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.PUMICE_STATUE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.GABBRO_STATUE, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.GALONN_STATUE, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.BASALT_STATUE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.DEEPSLATE_STATUE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.PUMICE_STATUE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.GABBRO_STATUE, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.GALONN_STATUE, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.ARKENSTONE, BlockRenderLayer.TRANSLUCENT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.WALL_ARKENSTONE, BlockRenderLayer.TRANSLUCENT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.ARKENSTONE, RenderType.translucent()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.WALL_ARKENSTONE, RenderType.translucent()); SimpleWoodChairModel.vanillaChairs.forEach(block -> { - BlockRenderLayerMap.putBlock(block.base(), BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(block.base(), RenderType.cutout()); }); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.BELLOWS, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.BELLOWS, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModBlocks.TREATED_WOOD_ROPE_FENCE, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.TREATED_WOOD_ROPE_FENCE, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.STRUCTURE_MANAGER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.ORC_STRUCTURE_MANAGER, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModDecorativeBlocks.STRUCTURE_NEST, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.STRUCTURE_MANAGER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.ORC_STRUCTURE_MANAGER, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModDecorativeBlocks.STRUCTURE_NEST, RenderType.cutout()); - BlockRenderLayerMap.putBlock(ModNatureBlocks.MIRKWOOD_VINES, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.WILLOW_VINES, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.GLOWWORM_MAIN, BlockRenderLayer.CUTOUT); - BlockRenderLayerMap.putBlock(ModNatureBlocks.GLOWWORM_WEBBING, BlockRenderLayer.CUTOUT); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.MIRKWOOD_VINES, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.WILLOW_VINES, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.GLOWWORM_MAIN, RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModNatureBlocks.GLOWWORM_WEBBING, RenderType.cutout()); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/ModBlockEntityCompatibility.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/ModBlockEntityCompatibility.java new file mode 100644 index 0000000000..b129d4d517 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/ModBlockEntityCompatibility.java @@ -0,0 +1,47 @@ +package net.sevenstars.middleearth.block; + +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.neoforge.event.BlockEntityTypeAddBlocksEvent; +import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; + +public final class ModBlockEntityCompatibility { + private ModBlockEntityCompatibility() { + } + + public static void register(IEventBus modEventBus) { + modEventBus.addListener(ModBlockEntityCompatibility::addValidBlocks); + } + + private static void addValidBlocks(BlockEntityTypeAddBlocksEvent event) { + event.modify(BlockEntityType.BARREL, ModDecorativeBlocks.THIN_BARREL, ModDecorativeBlocks.SMALL_CRATE); + event.modify(BlockEntityType.LECTERN, ModDecorativeBlocks.STONE_LECTERN); + event.modify(BlockEntityType.CHISELED_BOOKSHELF, ModDecorativeBlocks.CHISELED_DOLOMITE_BOOKSHELF); + event.modify( + BlockEntityType.DECORATED_POT, + ModDecorativeBlocks.AMPHORA, + ModDecorativeBlocks.BROWN_AMPHORA, + ModDecorativeBlocks.BROWN_JUG, + ModDecorativeBlocks.GRAY_POT, + ModDecorativeBlocks.LARGE_JUG, + ModDecorativeBlocks.GRAY_VASE, + ModDecorativeBlocks.BROWN_JAR, + ModDecorativeBlocks.CLAY_JAR, + ModDecorativeBlocks.GRAY_JAR, + ModDecorativeBlocks.BROWN_FAT_POT, + ModDecorativeBlocks.FAT_POT, + ModDecorativeBlocks.GRAY_FAT_POT, + ModDecorativeBlocks.POT_OF_GOLD + ); + event.modify( + BlockEntityType.TRIAL_SPAWNER, + ModDecorativeBlocks.BRIGAND_TRIAL_SPAWNER, + ModDecorativeBlocks.SPIDER_TRIAL_SPAWNER + ); + event.modify( + BlockEntityType.VAULT, + ModDecorativeBlocks.BRIGAND_VAULT, + ModDecorativeBlocks.SPIDER_VAULT + ); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/GenericBlockSets.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/GenericBlockSets.java index d919b0e43f..7371e1292d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/GenericBlockSets.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/GenericBlockSets.java @@ -1,11 +1,14 @@ + package net.sevenstars.middleearth.block.registration; -import net.fabricmc.fabric.api.registry.FlammableBlockRegistry; -import net.fabricmc.fabric.api.registry.FuelRegistryEvents; -import net.minecraft.block.enums.NoteBlockInstrument; -import net.minecraft.sound.BlockSoundGroup; +import net.sevenstars.middleearth.block.utils.BlockDataMapCollector; + import net.sevenstars.middleearth.MiddleEarth; -import net.minecraft.block.*; +import net.minecraft.world.level.block.*; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.WeatheringCopper; +import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; +import net.minecraft.world.level.material.MapColor; import net.sevenstars.middleearth.block.utils.BlockSetRegistration; import net.sevenstars.middleearth.block.utils.setBuilders.GenericBlockSetBuilder; import net.sevenstars.middleearth.block.utils.setBuilders.OxidizableBlockSetBuilder; @@ -22,452 +25,447 @@ public class GenericBlockSets { public static List simpleSetsList = new ArrayList<>(); public static GenericBlockSetBuilder WHITE_DAUB = registerBlockSet(new GenericBlockSetBuilder( - "white_daub", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.TERRACOTTA_WHITE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, + "white_daub", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.TERRACOTTA_WHITE, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder DARK_DAUB = registerBlockSet(new GenericBlockSetBuilder( - "dark_daub", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.TERRACOTTA_BLACK, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, + "dark_daub", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.TERRACOTTA_BLACK, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder YELLOW_DAUB = registerBlockSet(new GenericBlockSetBuilder( - "yellow_daub", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.TERRACOTTA_YELLOW, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, + "yellow_daub", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.TERRACOTTA_YELLOW, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder PLASTER = registerBlockSet(new GenericBlockSetBuilder( - "plaster", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.OFF_WHITE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, + "plaster", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.QUARTZ, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder STUCCO = registerBlockSet(new GenericBlockSetBuilder( - "stucco", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.OFF_WHITE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, + "stucco", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.QUARTZ, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder PACKED_MIRE = registerBlockSet(new GenericBlockSetBuilder( - "packed_mire", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.TERRACOTTA_BLACK, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.PACKED_MUD, true, + "packed_mire", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.TERRACOTTA_BLACK, NoteBlockInstrument.BASEDRUM, SoundType.PACKED_MUD, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder MIRE_BRICKS = registerBlockSet(new GenericBlockSetBuilder( - "mire_bricks", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.TERRACOTTA_BLACK, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.PACKED_MUD, true, + "mire_bricks", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.TERRACOTTA_BLACK, NoteBlockInstrument.BASEDRUM, SoundType.PACKED_MUD, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder FRAMED_DRYSTONE = registerPillarBlockSet(new GenericBlockSetBuilder( - "framed_drystone", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.DEEPSLATE_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, + "framed_drystone", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.DEEPSLATE, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder OLD_BRICKS = registerBlockSet(new GenericBlockSetBuilder( - "old_bricks", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.DULL_RED, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, + "old_bricks", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.CRIMSON_NYLIUM, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder MIXED_STONES = registerBlockSet(new GenericBlockSetBuilder( - "mixed_stones", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.STONE_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, + "mixed_stones", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.STONE, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder MOSSY_MIXED_STONES = registerBlockSet(new GenericBlockSetBuilder( - "mossy_mixed_stones", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.STONE_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, + "mossy_mixed_stones", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.STONE, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder CRACKED_MIXED_STONES = registerBlockSet(new GenericBlockSetBuilder( - "cracked_mixed_stones", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.STONE_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, + "cracked_mixed_stones", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.STONE, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder MIXED_STONES_BRICKWORK = registerBlockSet(new GenericBlockSetBuilder( - "mixed_stones_brickwork", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.STONE_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, + "mixed_stones_brickwork", StoneBlockSets.STONE_HARDNESS + 0.5f, StoneBlockSets.STONE_BLAST_RESISTANCE, MapColor.STONE, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder CLAY_TILING = registerBlockSet(new GenericBlockSetBuilder( - "clay_tiling", 1.25F, 4.2F, MapColor.ORANGE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "clay_tiling", 1.25F, 4.2F, MapColor.COLOR_ORANGE, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder BLACK_CLAY_TILING = registerBlockSet(new GenericBlockSetBuilder( - "black_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_BLACK, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "black_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_BLACK, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder BLUE_CLAY_TILING = registerBlockSet(new GenericBlockSetBuilder( - "blue_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_BLUE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "blue_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_BLUE, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder BROWN_CLAY_TILING = registerBlockSet(new GenericBlockSetBuilder( - "brown_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "brown_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder CYAN_CLAY_TILING = registerBlockSet(new GenericBlockSetBuilder( - "cyan_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_CYAN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "cyan_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_CYAN, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder GRAY_CLAY_TILING = registerBlockSet(new GenericBlockSetBuilder( - "gray_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "gray_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_GRAY, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder GREEN_CLAY_TILING = registerBlockSet(new GenericBlockSetBuilder( - "green_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_GREEN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "green_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_GREEN, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder LIGHT_BLUE_CLAY_TILING = registerBlockSet(new GenericBlockSetBuilder( - "light_blue_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_LIGHT_BLUE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "light_blue_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_LIGHT_BLUE, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder LIGHT_GRAY_CLAY_TILING = registerBlockSet(new GenericBlockSetBuilder( - "light_gray_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_LIGHT_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "light_gray_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_LIGHT_GRAY, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder LIME_CLAY_TILING = registerBlockSet(new GenericBlockSetBuilder( - "lime_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_LIME, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "lime_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_LIGHT_GREEN, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder MAGENTA_CLAY_TILING = registerBlockSet(new GenericBlockSetBuilder( - "magenta_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_MAGENTA, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "magenta_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_MAGENTA, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder ORANGE_CLAY_TILING = registerBlockSet(new GenericBlockSetBuilder( - "orange_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_ORANGE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "orange_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_ORANGE, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder PINK_CLAY_TILING = registerBlockSet(new GenericBlockSetBuilder( - "pink_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_PINK, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "pink_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_PINK, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder PURPLE_CLAY_TILING = registerBlockSet(new GenericBlockSetBuilder( - "purple_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_PURPLE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "purple_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_PURPLE, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder RED_CLAY_TILING = registerBlockSet(new GenericBlockSetBuilder( - "red_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_RED, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "red_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_RED, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder WHITE_CLAY_TILING = registerBlockSet(new GenericBlockSetBuilder( - "white_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_WHITE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "white_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_WHITE, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder YELLOW_CLAY_TILING = registerBlockSet(new GenericBlockSetBuilder( - "yellow_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_YELLOW, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "yellow_clay_tiling", 1.25F, 4.2F, MapColor.TERRACOTTA_YELLOW, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder BLUE_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "blue_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_BLUE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "blue_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_BLUE, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder BRIGHT_BLUE_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "bright_blue_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_BLUE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "bright_blue_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_BLUE, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder DARK_BLUE_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "dark_blue_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_BLUE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "dark_blue_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_BLUE, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder LIGHT_BLUE_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "light_blue_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_BLUE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "light_blue_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_BLUE, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder OFF_BLUE_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "off_blue_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_BLUE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "off_blue_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_BLUE, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder BROWN_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "brown_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "brown_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder DARK_BROWN_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "dark_brown_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "dark_brown_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder OFF_BROWN_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "off_brown_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "off_brown_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder CYAN_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "cyan_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_CYAN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "cyan_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_CYAN, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder BRIGHT_CYAN_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "bright_cyan_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_CYAN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "bright_cyan_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_CYAN, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder DARK_CYAN_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "dark_cyan_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_CYAN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "dark_cyan_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_CYAN, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder LIGHT_CYAN_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "light_cyan_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_CYAN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "light_cyan_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_CYAN, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder OFF_CYAN_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "off_cyan_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_CYAN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "off_cyan_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_CYAN, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder GRAY_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "gray_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "gray_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GRAY, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder DARK_GRAY_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "dark_gray_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "dark_gray_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GRAY, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder LIGHT_GRAY_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "light_gray_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "light_gray_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GRAY, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder OFF_GRAY_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "off_gray_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "off_gray_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GRAY, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder GREEN_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "green_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GREEN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "green_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GREEN, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder BRIGHT_GREEN_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "bright_green_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GREEN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "bright_green_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GREEN, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder DARK_GREEN_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "dark_green_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GREEN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "dark_green_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GREEN, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder LIGHT_GREEN_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "light_green_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GREEN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "light_green_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GREEN, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder OFF_GREEN_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "off_green_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GREEN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "off_green_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_GREEN, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder RED_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "red_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_RED, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "red_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_RED, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder BRIGHT_RED_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "bright_red_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_RED, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "bright_red_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_RED, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder DARK_RED_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "dark_red_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_RED, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "dark_red_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_RED, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder LIGHT_RED_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "light_red_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_RED, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "light_red_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_RED, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder OFF_RED_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "off_red_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_RED, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "off_red_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_RED, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder YELLOW_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "yellow_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_YELLOW, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "yellow_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_YELLOW, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder BRIGHT_YELLOW_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "bright_yellow_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_YELLOW, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "bright_yellow_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_YELLOW, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder DARK_YELLOW_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "dark_yellow_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_YELLOW, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "dark_yellow_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_YELLOW, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder LIGHT_YELLOW_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "light_yellow_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_YELLOW, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "light_yellow_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_YELLOW, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder OFF_YELLOW_ROOF_TILES = registerBlockSet(new GenericBlockSetBuilder( - "off_yellow_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_YELLOW, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, + "off_yellow_roof_tiles", 1.25F, 4.2F, MapColor.TERRACOTTA_YELLOW, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, ItemGroupsME.STONE_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder WEATHERED_SHINGLES = registerBlockSet(new GenericBlockSetBuilder( - "weathered_shingles", 2.0f, 3.0f, MapColor.WHITE_GRAY, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "weathered_shingles", 2.0f, 3.0f, MapColor.WOOL, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder TREATED_WOOD = registerPillarBlockSet(new GenericBlockSetBuilder( - "treated_wood", 2.0f, 3.0f, MapColor.SPRUCE_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "treated_wood", 2.0f, 3.0f, MapColor.PODZOL, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder TREATED_WOOD_PLANKS = registerBlockSet(new GenericBlockSetBuilder( - "treated_wood_planks", 2.0f, 3.0f, MapColor.SPRUCE_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "treated_wood_planks", 2.0f, 3.0f, MapColor.PODZOL, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder TREATED_WOOD_BEAM = registerPillarBlockSet(new GenericBlockSetBuilder( - "treated_wood_beam", 2.0f, 3.0f, MapColor.SPRUCE_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "treated_wood_beam", 2.0f, 3.0f, MapColor.PODZOL, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder TREATED_WOOD_CARVED_BEAM = registerPillarBlockSet(new GenericBlockSetBuilder( - "treated_wood_carved_beam", 2.0f, 3.0f, MapColor.SPRUCE_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "treated_wood_carved_beam", 2.0f, 3.0f, MapColor.PODZOL, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder TREATED_WOOD_PANELS = registerBlockSet(new GenericBlockSetBuilder( - "treated_wood_panels", 2.0f, 3.0f, MapColor.SPRUCE_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "treated_wood_panels", 2.0f, 3.0f, MapColor.PODZOL, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder TREATED_WOOD_TILING = registerBlockSet(new GenericBlockSetBuilder( - "treated_wood_tiling", 2.0f, 3.0f, MapColor.SPRUCE_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "treated_wood_tiling", 2.0f, 3.0f, MapColor.PODZOL, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder AGED_WOOD = registerPillarBlockSet(new GenericBlockSetBuilder( - "aged_wood", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "aged_wood", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder AGED_WOOD_BOARDS = registerPillarBlockSet(new GenericBlockSetBuilder( - "aged_wood_boards", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "aged_wood_boards", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder AGED_WOOD_CARVING = registerPillarBlockSet(new GenericBlockSetBuilder( - "aged_wood_carving", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "aged_wood_carving", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder AGED_WOOD_PLANKS = registerBlockSet(new GenericBlockSetBuilder( - "aged_wood_planks", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "aged_wood_planks", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder AGED_WOOD_BEAM = registerPillarBlockSet(new GenericBlockSetBuilder( - "aged_wood_beam", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "aged_wood_beam", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder AGED_WOOD_FISH_CARVING = registerPillarBlockSet(new GenericBlockSetBuilder( - "aged_wood_fish_carving", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "aged_wood_fish_carving", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder AGED_WOOD_PANELS = registerBlockSet(new GenericBlockSetBuilder( - "aged_wood_panels", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "aged_wood_panels", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder AGED_WOOD_SHINGLES = registerBlockSet(new GenericBlockSetBuilder( - "aged_wood_shingles", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "aged_wood_shingles", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder AGED_WOOD_CARVED_BEAM = registerPillarBlockSet(new GenericBlockSetBuilder( - "aged_wood_carved_beam", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "aged_wood_carved_beam", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder AGED_WOOD_KNOTTED_BEAM = registerPillarBlockSet(new GenericBlockSetBuilder( - "aged_wood_knotted_beam", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "aged_wood_knotted_beam", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder AGED_WOOD_REDDISH_BEAM = registerPillarBlockSet(new GenericBlockSetBuilder( - "aged_wood_reddish_beam", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "aged_wood_reddish_beam", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder AGED_WOOD_GILDED_CARVED_PILLAR = registerPillarBlockSet(new GenericBlockSetBuilder( - "aged_wood_gilded_carved_pillar", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "aged_wood_gilded_carved_pillar", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder AGED_WOOD_GILDED_CARVING = registerPillarBlockSet(new GenericBlockSetBuilder( - "aged_wood_gilded_carving", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "aged_wood_gilded_carving", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder AGED_WOOD_GILDED_HORSES = registerPillarBlockSet(new GenericBlockSetBuilder( - "aged_wood_gilded_horses", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "aged_wood_gilded_horses", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder AGED_WOOD_GILDED_TRIM = registerPillarBlockSet(new GenericBlockSetBuilder( - "aged_wood_gilded_trim", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, true, + "aged_wood_gilded_trim", 2.0f, 3.0f, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, true, ItemGroupsME.WOOD_BLOCKS_CONTENTS)); public static OxidizableBlockSetBuilder THATCH = registerOxidizableBlockSet(new OxidizableBlockSetBuilder( - "thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, - ItemGroupsME.MISC_BLOCKS_CONTENTS, Oxidizable.OxidationLevel.UNAFFECTED)); + "thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, + ItemGroupsME.MISC_BLOCKS_CONTENTS, WeatheringCopper.WeatherState.UNAFFECTED)); public static OxidizableBlockSetBuilder WEATHERED_THATCH = registerOxidizableBlockSet(new OxidizableBlockSetBuilder( - "weathered_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, - ItemGroupsME.MISC_BLOCKS_CONTENTS, Oxidizable.OxidationLevel.EXPOSED)); + "weathered_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, + ItemGroupsME.MISC_BLOCKS_CONTENTS, WeatheringCopper.WeatherState.EXPOSED)); public static OxidizableBlockSetBuilder AGED_THATCH = registerOxidizableBlockSet(new OxidizableBlockSetBuilder( - "aged_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, - ItemGroupsME.MISC_BLOCKS_CONTENTS, Oxidizable.OxidationLevel.WEATHERED)); + "aged_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, + ItemGroupsME.MISC_BLOCKS_CONTENTS, WeatheringCopper.WeatherState.WEATHERED)); public static OxidizableBlockSetBuilder OLD_THATCH = registerOxidizableBlockSet(new OxidizableBlockSetBuilder( - "old_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, - ItemGroupsME.MISC_BLOCKS_CONTENTS, Oxidizable.OxidationLevel.OXIDIZED)); + "old_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, + ItemGroupsME.MISC_BLOCKS_CONTENTS, WeatheringCopper.WeatherState.OXIDIZED)); public static OxidizableBlockSetBuilder ROTTEN_THATCH = registerOxidizableBlockSet(new OxidizableBlockSetBuilder( - "rotten_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, - ItemGroupsME.MISC_BLOCKS_CONTENTS, Oxidizable.OxidationLevel.OXIDIZED)); + "rotten_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, + ItemGroupsME.MISC_BLOCKS_CONTENTS, WeatheringCopper.WeatherState.OXIDIZED)); public static GenericBlockSetBuilder WAXED_THATCH = registerBlockSet(new GenericBlockSetBuilder( - "waxed_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, + "waxed_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder WAXED_WEATHERED_THATCH = registerBlockSet(new GenericBlockSetBuilder( - "waxed_weathered_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, + "waxed_weathered_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder WAXED_AGED_THATCH = registerBlockSet(new GenericBlockSetBuilder( - "waxed_aged_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, + "waxed_aged_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder WAXED_OLD_THATCH = registerBlockSet(new GenericBlockSetBuilder( - "waxed_old_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, + "waxed_old_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder WAXED_ROTTEN_THATCH = registerBlockSet(new GenericBlockSetBuilder( - "waxed_rotten_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, + "waxed_rotten_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static OxidizableBlockSetBuilder REED_THATCH = registerOxidizableBlockSet(new OxidizableBlockSetBuilder( - "reed_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, - ItemGroupsME.MISC_BLOCKS_CONTENTS, Oxidizable.OxidationLevel.UNAFFECTED)); + "reed_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, + ItemGroupsME.MISC_BLOCKS_CONTENTS, WeatheringCopper.WeatherState.UNAFFECTED)); public static OxidizableBlockSetBuilder WEATHERED_REED_THATCH = registerOxidizableBlockSet(new OxidizableBlockSetBuilder( - "weathered_reed_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, - ItemGroupsME.MISC_BLOCKS_CONTENTS, Oxidizable.OxidationLevel.EXPOSED)); + "weathered_reed_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, + ItemGroupsME.MISC_BLOCKS_CONTENTS, WeatheringCopper.WeatherState.EXPOSED)); public static OxidizableBlockSetBuilder AGED_REED_THATCH = registerOxidizableBlockSet(new OxidizableBlockSetBuilder( - "aged_reed_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, - ItemGroupsME.MISC_BLOCKS_CONTENTS, Oxidizable.OxidationLevel.WEATHERED)); + "aged_reed_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, + ItemGroupsME.MISC_BLOCKS_CONTENTS, WeatheringCopper.WeatherState.WEATHERED)); public static OxidizableBlockSetBuilder OLD_REED_THATCH = registerOxidizableBlockSet(new OxidizableBlockSetBuilder( - "old_reed_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, - ItemGroupsME.MISC_BLOCKS_CONTENTS, Oxidizable.OxidationLevel.OXIDIZED)); + "old_reed_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, + ItemGroupsME.MISC_BLOCKS_CONTENTS, WeatheringCopper.WeatherState.OXIDIZED)); public static OxidizableBlockSetBuilder ROTTEN_REED_THATCH = registerOxidizableBlockSet(new OxidizableBlockSetBuilder( - "rotten_reed_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, - ItemGroupsME.MISC_BLOCKS_CONTENTS, Oxidizable.OxidationLevel.OXIDIZED)); + "rotten_reed_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, + ItemGroupsME.MISC_BLOCKS_CONTENTS, WeatheringCopper.WeatherState.OXIDIZED)); public static GenericBlockSetBuilder WAXED_REED_THATCH = registerBlockSet(new GenericBlockSetBuilder( - "waxed_reed_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, + "waxed_reed_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder WAXED_WEATHERED_REED_THATCH = registerBlockSet(new GenericBlockSetBuilder( - "waxed_weathered_reed_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, + "waxed_weathered_reed_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder WAXED_AGED_REED_THATCH = registerBlockSet(new GenericBlockSetBuilder( - "waxed_aged_reed_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, + "waxed_aged_reed_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder WAXED_OLD_REED_THATCH = registerBlockSet(new GenericBlockSetBuilder( - "waxed_old_reed_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, + "waxed_old_reed_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder WAXED_ROTTEN_REED_THATCH = registerBlockSet(new GenericBlockSetBuilder( - "waxed_rotten_reed_thatch", 0.5f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, + "waxed_rotten_reed_thatch", 0.5f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder REED = registerPillarBlockSet(new GenericBlockSetBuilder( - "reed_block", 0.6f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, + "reed_block", 0.6f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder STRAW = registerPillarBlockSet(new GenericBlockSetBuilder( - "straw_block", 0.6f, 0.0f, MapColor.PALE_YELLOW, NoteBlockInstrument.BANJO, BlockSoundGroup.GRASS, false, + "straw_block", 0.6f, 0.0f, MapColor.SAND, NoteBlockInstrument.BANJO, SoundType.GRASS, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder CANVAS = registerSimpleBlockSet( new SimpleBlockSetBuilder("canvas", - 0.8f, 0.8f, MapColor.DULL_PINK, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.CRIMSON_STEM, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder BLACK_CANVAS = registerSimpleBlockSet( new SimpleBlockSetBuilder("black_canvas", - 0.8f, 0.8f, MapColor.BLACK, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.COLOR_BLACK, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder BLUE_CANVAS = registerSimpleBlockSet( new SimpleBlockSetBuilder("blue_canvas", - 0.8f, 0.8f, MapColor.BLUE, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.COLOR_BLUE, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder BROWN_CANVAS = registerSimpleBlockSet( new SimpleBlockSetBuilder("brown_canvas", - 0.8f, 0.8f, MapColor.BROWN, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.COLOR_BROWN, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder CYAN_CANVAS = registerSimpleBlockSet( new SimpleBlockSetBuilder("cyan_canvas", - 0.8f, 0.8f, MapColor.CYAN, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.COLOR_CYAN, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder GRAY_CANVAS = registerSimpleBlockSet( new SimpleBlockSetBuilder("gray_canvas", - 0.8f, 0.8f, MapColor.GRAY, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.COLOR_GRAY, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder GREEN_CANVAS = registerSimpleBlockSet( new SimpleBlockSetBuilder("green_canvas", - 0.8f, 0.8f, MapColor.GREEN, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.COLOR_GREEN, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder LIGHT_BLUE_CANVAS = registerSimpleBlockSet( new SimpleBlockSetBuilder("light_blue_canvas", - 0.8f, 0.8f, MapColor.LIGHT_BLUE, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.COLOR_LIGHT_BLUE, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder LIGHT_GRAY_CANVAS = registerSimpleBlockSet( new SimpleBlockSetBuilder("light_gray_canvas", - 0.8f, 0.8f, MapColor.LIGHT_GRAY, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.COLOR_LIGHT_GRAY, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder MAGENTA_CANVAS = registerSimpleBlockSet( new SimpleBlockSetBuilder("magenta_canvas", - 0.8f, 0.8f, MapColor.MAGENTA, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.COLOR_MAGENTA, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder ORANGE_CANVAS = registerSimpleBlockSet( new SimpleBlockSetBuilder("orange_canvas", - 0.8f, 0.8f, MapColor.ORANGE, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.COLOR_ORANGE, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder PINK_CANVAS = registerSimpleBlockSet( new SimpleBlockSetBuilder("pink_canvas", - 0.8f, 0.8f, MapColor.PINK, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.COLOR_PINK, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder PURPLE_CANVAS = registerSimpleBlockSet( new SimpleBlockSetBuilder("purple_canvas", - 0.8f, 0.8f, MapColor.PURPLE, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.COLOR_PURPLE, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder RED_CANVAS = registerSimpleBlockSet( new SimpleBlockSetBuilder("red_canvas", - 0.8f, 0.8f, MapColor.RED, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.COLOR_RED, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder WHITE_CANVAS = registerSimpleBlockSet( new SimpleBlockSetBuilder("white_canvas", - 0.8f, 0.8f, MapColor.WHITE, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.SNOW, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder YELLOW_CANVAS = registerSimpleBlockSet(new SimpleBlockSetBuilder("yellow_canvas", - 0.8f, 0.8f, MapColor.YELLOW, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.COLOR_YELLOW, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder DARK_BLUE_CANVAS = registerSimpleBlockSet(new SimpleBlockSetBuilder("dark_blue_canvas", - 0.8f, 0.8f, MapColor.LAPIS_BLUE, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.LAPIS, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder DARK_BROWN_CANVAS = registerSimpleBlockSet(new SimpleBlockSetBuilder("dark_brown_canvas", - 0.8f, 0.8f, MapColor.SPRUCE_BROWN, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.PODZOL, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder DARK_GRAY_CANVAS = registerSimpleBlockSet(new SimpleBlockSetBuilder("dark_gray_canvas", - 0.8f, 0.8f, MapColor.DEEPSLATE_GRAY, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.DEEPSLATE, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder DARK_GREEN_CANVAS = registerSimpleBlockSet(new SimpleBlockSetBuilder("dark_green_canvas", - 0.8f, 0.8f, MapColor.DARK_GREEN, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.PLANT, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder DARK_RED_CANVAS = registerSimpleBlockSet(new SimpleBlockSetBuilder("dark_red_canvas", - 0.8f, 0.8f, MapColor.DARK_RED, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.NETHER, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static SimpleBlockSetBuilder DARK_YELLOW_CANVAS = registerSimpleBlockSet(new SimpleBlockSetBuilder("dark_yellow_canvas", - 0.8f, 0.8f, MapColor.BROWN, NoteBlockInstrument.GUITAR, BlockSoundGroup.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); + 0.8f, 0.8f, MapColor.COLOR_BROWN, NoteBlockInstrument.GUITAR, SoundType.WOOL, false, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder CUT_BRONZE = registerBlockSet(new GenericBlockSetBuilder( - "cut_bronze", 3.0F, 6.0F, MapColor.ORANGE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.COPPER, true, + "cut_bronze", 3.0F, 6.0F, MapColor.COLOR_ORANGE, NoteBlockInstrument.BASEDRUM, SoundType.COPPER, true, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder CUT_CRUDE_PLATES = registerBlockSet(new GenericBlockSetBuilder( - "cut_crude_plates", 3.0F, 6.0F, MapColor.DIRT_BROWN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.COPPER, true, + "cut_crude_plates", 3.0F, 6.0F, MapColor.DIRT, NoteBlockInstrument.BASEDRUM, SoundType.COPPER, true, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder CUT_LEAD = registerBlockSet(new GenericBlockSetBuilder( - "cut_lead", 3.0F, 6.0F, MapColor.GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.COPPER, true, + "cut_lead", 3.0F, 6.0F, MapColor.COLOR_GRAY, NoteBlockInstrument.BASEDRUM, SoundType.COPPER, true, ItemGroupsME.MISC_BLOCKS_CONTENTS)); public static GenericBlockSetBuilder CUT_SILVER = registerBlockSet(new GenericBlockSetBuilder( - "cut_silver", 3.0F, 6.0F, MapColor.WHITE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.COPPER, true, + "cut_silver", 3.0F, 6.0F, MapColor.SNOW, NoteBlockInstrument.BASEDRUM, SoundType.COPPER, true, ItemGroupsME.MISC_BLOCKS_CONTENTS)); private static GenericBlockSetBuilder registerBlockSet(GenericBlockSetBuilder set){ - set.blockSet = BlockSetRegistration.createRegularSet(set.setName , set.hardness, set.blastResistance, set.mapColor, - set.instrument, set.soundGroup, false, set.group, set.requiresTool); + set.blockSet = BlockSetRegistration.createRegularSet(set.setName , set.hardness, set.blastResistance, set.mapColor, set.instrument, set.soundGroup, false, set.group, set.requiresTool); genericSetsList.add(set); if(set.setName.contains("thatch")) { - FlammableBlockRegistry.getDefaultInstance().add(set.blockSet.base(), 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(set.blockSet.slab(), 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(set.blockSet.verticalSlab(), 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(set.blockSet.stairs(), 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(set.blockSet.wall(), 5, 20); + BlockDataMapCollector.registerFlammable(set.blockSet.base(), 5, 20); + BlockDataMapCollector.registerFlammable(set.blockSet.slab(), 5, 20); + BlockDataMapCollector.registerFlammable(set.blockSet.verticalSlab(), 5, 20); + BlockDataMapCollector.registerFlammable(set.blockSet.stairs(), 5, 20); + BlockDataMapCollector.registerFlammable(set.blockSet.wall(), 5, 20); } return set; } private static SimpleBlockSetBuilder registerSimpleBlockSet(SimpleBlockSetBuilder set){ - set.blockSet = BlockSetRegistration.createSimpleSet(set.setName , set.hardness, set.blastResistance, set.mapColor, - set.instrument, set.soundGroup, false, set.group, set.requiresTool); + set.blockSet = BlockSetRegistration.createSimpleSet(set.setName , set.hardness, set.blastResistance, set.mapColor, set.instrument, set.soundGroup, false, set.group, set.requiresTool); simpleSetsList.add(set); return set; } private static GenericBlockSetBuilder registerPillarBlockSet(GenericBlockSetBuilder set){ - set.blockSet = BlockSetRegistration.createRegularSet(set.setName , set.hardness, set.blastResistance, set.mapColor, - set.instrument, set.soundGroup, true, set.group, set.requiresTool); + set.blockSet = BlockSetRegistration.createRegularSet(set.setName , set.hardness, set.blastResistance, set.mapColor, set.instrument, set.soundGroup, true, set.group, set.requiresTool); genericSetsList.add(set); if(set.setName.contains("wood")){ - FlammableBlockRegistry.getDefaultInstance().add(set.blockSet.base(), 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(set.blockSet.slab(), 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(set.blockSet.verticalSlab(), 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(set.blockSet.stairs(), 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(set.blockSet.wall(), 5, 20); - - FuelRegistryEvents.BUILD.register(((builder, context) -> { - builder.add(set.blockSet.base(), 300); - builder.add(set.blockSet.slab(), 150); - builder.add(set.blockSet.verticalSlab(), 150); - builder.add(set.blockSet.stairs(), 300); - builder.add(set.blockSet.wall(), 300); - })); + BlockDataMapCollector.registerFlammable(set.blockSet.base(), 5, 20); + BlockDataMapCollector.registerFlammable(set.blockSet.slab(), 5, 20); + BlockDataMapCollector.registerFlammable(set.blockSet.verticalSlab(), 5, 20); + BlockDataMapCollector.registerFlammable(set.blockSet.stairs(), 5, 20); + BlockDataMapCollector.registerFlammable(set.blockSet.wall(), 5, 20); + + BlockDataMapCollector.registerFuel(set.blockSet.base(), 300); + BlockDataMapCollector.registerFuel(set.blockSet.slab(), 150); + BlockDataMapCollector.registerFuel(set.blockSet.verticalSlab(), 150); + BlockDataMapCollector.registerFuel(set.blockSet.stairs(), 300); + BlockDataMapCollector.registerFuel(set.blockSet.wall(), 300); } return set; @@ -478,11 +476,11 @@ private static OxidizableBlockSetBuilder registerOxidizableBlockSet(OxidizableBl genericSetsList.add(set); - FlammableBlockRegistry.getDefaultInstance().add(set.blockSet.base(), 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(set.blockSet.slab(), 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(set.blockSet.verticalSlab(), 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(set.blockSet.stairs(), 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(set.blockSet.wall(), 5, 20); + BlockDataMapCollector.registerFlammable(set.blockSet.base(), 5, 20); + BlockDataMapCollector.registerFlammable(set.blockSet.slab(), 5, 20); + BlockDataMapCollector.registerFlammable(set.blockSet.verticalSlab(), 5, 20); + BlockDataMapCollector.registerFlammable(set.blockSet.stairs(), 5, 20); + BlockDataMapCollector.registerFlammable(set.blockSet.wall(), 5, 20); return set; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/ModBlockEntities.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/ModBlockEntities.java index 1efcf5ad14..59e860d998 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/ModBlockEntities.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/ModBlockEntities.java @@ -1,9 +1,12 @@ package net.sevenstars.middleearth.block.registration; -import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; -import net.minecraft.block.Block; -import net.minecraft.block.entity.BlockEntity; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.api.registries.RegistrationBridge; import net.sevenstars.middleearth.block.special.beds.CustomBedBlockEntity; import net.sevenstars.middleearth.block.special.bellows.BellowsBlockEntity; import net.sevenstars.middleearth.block.special.coffers.*; @@ -18,10 +21,6 @@ import net.sevenstars.middleearth.block.special.structureManager.StructureManagerBlockEntity; import net.sevenstars.middleearth.block.special.structureManager.nest.StructureNestBlockEntity; import net.sevenstars.middleearth.block.special.wood_pile.WoodPileBlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.util.Identifier; import net.sevenstars.middleearth.registries.RegistryAliasesME; public class ModBlockEntities { @@ -51,7 +50,8 @@ public class ModBlockEntities { public static BlockEntityType OAK_COFFER = register("oak_coffer", OakCofferBlockEntity::new, ModDecorativeBlocks.OAK_COFFER); public static BlockEntityType WILLOW_COFFER = register("willow_coffer", WillowCofferBlockEntity::new, ModDecorativeBlocks.WILLOW_COFFER); - public static BlockEntityType OLD_SKULL = register("old_skull", OldSkullBlockEntity::new, ModDecorativeBlocks.OLD_SKULL); + public static BlockEntityType OLD_SKULL = register("old_skull", OldSkullBlockEntity::new, + ModDecorativeBlocks.OLD_SKULL); public static BlockEntityType SACK = register("sack", SackBlockEntity::new, ModDecorativeBlocks.SACK); @@ -86,34 +86,19 @@ public class ModBlockEntities { ModDecorativeBlocks.STRAW_BED); public static void registerBlockEntities() { - BlockEntityType.BARREL.addSupportedBlock(ModDecorativeBlocks.SMALL_CRATE); - BlockEntityType.BARREL.addSupportedBlock(ModDecorativeBlocks.THIN_BARREL); - BlockEntityType.DECORATED_POT.addSupportedBlock(ModDecorativeBlocks.AMPHORA); - BlockEntityType.DECORATED_POT.addSupportedBlock(ModDecorativeBlocks.BROWN_AMPHORA); - BlockEntityType.DECORATED_POT.addSupportedBlock(ModDecorativeBlocks.BROWN_JUG); - BlockEntityType.DECORATED_POT.addSupportedBlock(ModDecorativeBlocks.GRAY_POT); - BlockEntityType.DECORATED_POT.addSupportedBlock(ModDecorativeBlocks.LARGE_JUG); - BlockEntityType.DECORATED_POT.addSupportedBlock(ModDecorativeBlocks.GRAY_VASE); - BlockEntityType.DECORATED_POT.addSupportedBlock(ModDecorativeBlocks.BROWN_JAR); - BlockEntityType.DECORATED_POT.addSupportedBlock(ModDecorativeBlocks.CLAY_JAR); - BlockEntityType.DECORATED_POT.addSupportedBlock(ModDecorativeBlocks.GRAY_JAR); - BlockEntityType.DECORATED_POT.addSupportedBlock(ModDecorativeBlocks.BROWN_FAT_POT); - BlockEntityType.DECORATED_POT.addSupportedBlock(ModDecorativeBlocks.FAT_POT); - BlockEntityType.DECORATED_POT.addSupportedBlock(ModDecorativeBlocks.GRAY_FAT_POT); - BlockEntityType.DECORATED_POT.addSupportedBlock(ModDecorativeBlocks.POT_OF_GOLD); - - BlockEntityType.TRIAL_SPAWNER.addSupportedBlock(ModDecorativeBlocks.BRIGAND_TRIAL_SPAWNER); - BlockEntityType.TRIAL_SPAWNER.addSupportedBlock(ModDecorativeBlocks.SPIDER_TRIAL_SPAWNER); - BlockEntityType.VAULT.addSupportedBlock(ModDecorativeBlocks.BRIGAND_VAULT); - BlockEntityType.VAULT.addSupportedBlock(ModDecorativeBlocks.SPIDER_VAULT); + // Class initialization queues the static block entity types through the registration bridge. } private static BlockEntityType register(String name, - FabricBlockEntityTypeBuilder.Factory entityFactory, + BlockEntityType.BlockEntitySupplier entityFactory, Block... blocks) { - Identifier id = Identifier.of(MiddleEarth.MOD_ID, name); - RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(Registries.BLOCK_ENTITY_TYPE, name)); + ResourceLocation id = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, name); + RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(BuiltInRegistries.BLOCK_ENTITY_TYPE, name)); - return Registry.register(Registries.BLOCK_ENTITY_TYPE, id, FabricBlockEntityTypeBuilder.create(entityFactory, blocks).build()); + return RegistrationBridge.register( + BuiltInRegistries.BLOCK_ENTITY_TYPE, + id, + BlockEntityType.Builder.of(entityFactory, blocks).build(null) + ); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/ModBlocks.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/ModBlocks.java index 34c091dae9..bcdd1aafac 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/ModBlocks.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/ModBlocks.java @@ -1,8 +1,8 @@ + package net.sevenstars.middleearth.block.registration; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; +import net.sevenstars.api.registries.RegistrationBridge; + import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.*; import net.sevenstars.middleearth.block.special.dirts.CustomFarmlandBlock; @@ -15,17 +15,40 @@ import net.sevenstars.middleearth.block.special.pointedBlocks.PointedLimestoneBlock; import net.sevenstars.middleearth.block.special.verticalSlabs.VerticalSlabBlock; import net.sevenstars.middleearth.datageneration.content.TranslationEntries; -import net.sevenstars.middleearth.datageneration.content.loot_tables.BlockDrops; +import net.sevenstars.middleearth.datageneration.content.loot_tables.DynamicBlockDrops; import net.sevenstars.middleearth.item.utils.ItemGroupsME; -import net.minecraft.block.*; -import net.minecraft.block.piston.PistonBehavior; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.sound.BlockSoundGroup; -import net.minecraft.util.ColorCode; -import net.minecraft.util.Identifier; +import net.minecraft.world.level.block.*; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ColorRGBA; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.AmethystBlock; +import net.minecraft.world.level.block.AmethystClusterBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ColoredFallingBlock; +import net.minecraft.world.level.block.DoorBlock; +import net.minecraft.world.level.block.FenceBlock; +import net.minecraft.world.level.block.IronBarsBlock; +import net.minecraft.world.level.block.MudBlock; +import net.minecraft.world.level.block.SlabBlock; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.StairBlock; +import net.minecraft.world.level.block.TrapDoorBlock; +import net.minecraft.world.level.block.WallBlock; +import net.minecraft.world.level.block.WeatheringCopper; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.state.properties.BlockSetType; +import net.minecraft.world.level.material.PushReaction; import net.sevenstars.middleearth.registries.RegistryAliasesME; import java.util.List; @@ -36,799 +59,807 @@ public class ModBlocks { public static final float SLAB_RESISTANCE = 6.0f; // From explosions public static final Block POINTED_DOLOMITE = registerStoneBlock("pointed_dolomite", - PointedDolomiteBlock::new,AbstractBlock.Settings.copy(Blocks.POINTED_DRIPSTONE).ticksRandomly().strength(1.5F, 3.0F).dynamicBounds().offset(AbstractBlock.OffsetType.XZ).pistonBehavior(PistonBehavior.DESTROY).solidBlock(Blocks::never), false); + PointedDolomiteBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.POINTED_DRIPSTONE).randomTicks().strength(1.5F, 3.0F).dynamicShape().offsetType(BlockBehaviour.OffsetType.XZ).pushReaction(PushReaction.DESTROY).isRedstoneConductor(ModBlocks::never), false); public static final Block POINTED_LIMESTONE = registerStoneBlock("pointed_limestone", - PointedLimestoneBlock::new,AbstractBlock.Settings.copy(Blocks.POINTED_DRIPSTONE).ticksRandomly().strength(1.5F, 3.0F).dynamicBounds().offset(AbstractBlock.OffsetType.XZ).pistonBehavior(PistonBehavior.DESTROY).solidBlock(Blocks::never), false); + PointedLimestoneBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.POINTED_DRIPSTONE).randomTicks().strength(1.5F, 3.0F).dynamicShape().offsetType(BlockBehaviour.OffsetType.XZ).pushReaction(PushReaction.DESTROY).isRedstoneConductor(ModBlocks::never), false); public static final Block POINTED_IZHERABAN = registerStoneBlock("pointed_izheraban", - PointedIzherabanBlock::new,AbstractBlock.Settings.copy(Blocks.POINTED_DRIPSTONE).ticksRandomly().strength(1.5F, 3.0F).dynamicBounds().offset(AbstractBlock.OffsetType.XZ).pistonBehavior(PistonBehavior.DESTROY).solidBlock(Blocks::never), false); + PointedIzherabanBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.POINTED_DRIPSTONE).randomTicks().strength(1.5F, 3.0F).dynamicShape().offsetType(BlockBehaviour.OffsetType.XZ).pushReaction(PushReaction.DESTROY).isRedstoneConductor(ModBlocks::never), false); public static final Block POINTED_GALONN = registerStoneBlock("pointed_galonn", - PointedGalonnBlock::new,AbstractBlock.Settings.copy(Blocks.POINTED_DRIPSTONE).ticksRandomly().strength(1.5F, 3.0F).dynamicBounds().offset(AbstractBlock.OffsetType.XZ).pistonBehavior(PistonBehavior.DESTROY).solidBlock(Blocks::never), false); + PointedGalonnBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.POINTED_DRIPSTONE).randomTicks().strength(1.5F, 3.0F).dynamicShape().offsetType(BlockBehaviour.OffsetType.XZ).pushReaction(PushReaction.DESTROY).isRedstoneConductor(ModBlocks::never), false); public static final Block BLACK_WATTLE_TRAPDOOR = registerWoodBlock("black_wattle_trapdoor", - (settings) -> new TrapdoorBlock(BlockSetType.OAK, settings), AbstractBlock.Settings.copy(Blocks.OAK_TRAPDOOR), true); + (settings) -> new TrapDoorBlock(BlockSetType.OAK, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_TRAPDOOR), true); public static final Block DARK_WATTLE_TRAPDOOR = registerWoodBlock("dark_wattle_trapdoor", - (settings) -> new TrapdoorBlock(BlockSetType.OAK, settings), AbstractBlock.Settings.copy(Blocks.OAK_TRAPDOOR), true); + (settings) -> new TrapDoorBlock(BlockSetType.OAK, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_TRAPDOOR), true); public static final Block GREEN_WATTLE_TRAPDOOR = registerWoodBlock("green_wattle_trapdoor", - (settings) -> new TrapdoorBlock(BlockSetType.OAK, settings), AbstractBlock.Settings.copy(Blocks.OAK_TRAPDOOR), true); + (settings) -> new TrapDoorBlock(BlockSetType.OAK, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_TRAPDOOR), true); public static final Block RED_WATTLE_TRAPDOOR = registerWoodBlock("red_wattle_trapdoor", - (settings) -> new TrapdoorBlock(BlockSetType.OAK, settings), AbstractBlock.Settings.copy(Blocks.OAK_TRAPDOOR), true); + (settings) -> new TrapDoorBlock(BlockSetType.OAK, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_TRAPDOOR), true); public static final Block WATTLE_TRAPDOOR = registerWoodBlock("wattle_trapdoor", - (settings) -> new TrapdoorBlock(BlockSetType.OAK, settings), AbstractBlock.Settings.copy(Blocks.OAK_TRAPDOOR), true); + (settings) -> new TrapDoorBlock(BlockSetType.OAK, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_TRAPDOOR), true); public static final Block TREATED_WOOD_ROPE_FENCE = registerWoodBlock("treated_wood_rope_fence", - FenceBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_FENCE), true); + FenceBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_FENCE), true); public static final Block SNOWY_GRASS_BLOCK = registerMiscBlock("snowy_grass_block", - Block::new,AbstractBlock.Settings.copy(Blocks.GRASS_BLOCK),false); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.GRASS_BLOCK),false); public static final Block SNOWY_DIRT = registerMiscBlock("snowy_dirt", - Block::new,AbstractBlock.Settings.copy(Blocks.COARSE_DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.COARSE_DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block SNOWY_DIRT_SLAB = registerMiscBlock("snowy_dirt_slab", - SlabBlock::new,AbstractBlock.Settings.copy(SNOWY_DIRT),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(SNOWY_DIRT),true); public static final Block SNOWY_DIRT_STAIRS = registerMiscBlock("snowy_dirt_stairs", - (settings) -> new StairsBlock(SNOWY_DIRT.getDefaultState(), settings), AbstractBlock.Settings.copy(SNOWY_DIRT),true); + (settings) -> new StairBlock(SNOWY_DIRT.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(SNOWY_DIRT),true); public static final Block DRY_DIRT = registerMiscBlock("dry_dirt", - Block::new,AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block DRY_DIRT_SLAB = registerMiscBlock("dry_dirt_slab", - SlabBlock::new,AbstractBlock.Settings.copy(DRY_DIRT),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(DRY_DIRT),true); public static final Block DRY_DIRT_STAIRS = registerMiscBlock("dry_dirt_stairs", - (settings) -> new StairsBlock(DRY_DIRT.getDefaultState(), settings), AbstractBlock.Settings.copy(DRY_DIRT),true); + (settings) -> new StairBlock(DRY_DIRT.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(DRY_DIRT),true); public static final Block GRASSY_DIRT = registerMiscBlock("grassy_dirt", - Block::new,AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block GRASSY_DIRT_SLAB = registerMiscBlock("grassy_dirt_slab", - SlabBlock::new,AbstractBlock.Settings.copy(GRASSY_DIRT),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(GRASSY_DIRT),true); public static final Block GRASSY_DIRT_STAIRS = registerMiscBlock("grassy_dirt_stairs", - (settings) -> new StairsBlock(GRASSY_DIRT.getDefaultState(), settings), AbstractBlock.Settings.copy(GRASSY_DIRT),true); + (settings) -> new StairBlock(GRASSY_DIRT.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(GRASSY_DIRT),true); public static final Block PEBBLED_GRASS = registerMiscBlock("pebbled_grass", - Block::new,AbstractBlock.Settings.copy(Blocks.COBBLESTONE).sounds(BlockSoundGroup.STONE),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.COBBLESTONE).sound(SoundType.STONE),true); public static final Block PEBBLED_GRASS_SLAB = registerMiscBlock("pebbled_grass_slab", - SlabBlock::new,AbstractBlock.Settings.copy(PEBBLED_GRASS),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(PEBBLED_GRASS),true); public static final Block PEBBLED_GRASS_STAIRS = registerMiscBlock("pebbled_grass_stairs", - (settings) -> new StairsBlock(PEBBLED_GRASS.getDefaultState(), settings), AbstractBlock.Settings.copy(PEBBLED_GRASS),true); + (settings) -> new StairBlock(PEBBLED_GRASS.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(PEBBLED_GRASS),true); public static final Block COBBLY_DIRT = registerMiscBlock("cobbly_dirt", - Block::new,AbstractBlock.Settings.copy(Blocks.COARSE_DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.COARSE_DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block COBBLY_DIRT_SLAB = registerMiscBlock("cobbly_dirt_slab", - SlabBlock::new,AbstractBlock.Settings.copy(COBBLY_DIRT),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(COBBLY_DIRT),true); public static final Block COBBLY_DIRT_STAIRS = registerMiscBlock("cobbly_dirt_stairs", - (settings) -> new StairsBlock(COBBLY_DIRT.getDefaultState(), settings), AbstractBlock.Settings.copy(COBBLY_DIRT),true); + (settings) -> new StairBlock(COBBLY_DIRT.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(COBBLY_DIRT),true); public static final Block CHALKSOIL = registerMiscBlock("chalksoil", - Block::new,AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block CHALKSOIL_SLAB = registerMiscBlock("chalksoil_slab", - SlabBlock::new,AbstractBlock.Settings.copy(CHALKSOIL),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(CHALKSOIL),true); public static final Block CHALKSOIL_STAIRS = registerMiscBlock("chalksoil_stairs", - (settings) -> new StairsBlock(CHALKSOIL.getDefaultState(), settings), AbstractBlock.Settings.copy(CHALKSOIL),true); + (settings) -> new StairBlock(CHALKSOIL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(CHALKSOIL),true); public static final Block CHALKSOIL_GRASS_BLOCK = registerMiscBlock("chalksoil_grass_block", - (settings) -> new CustomGrassBlock(settings, CHALKSOIL), AbstractBlock.Settings.copy(Blocks.GRASS_BLOCK),false); + (settings) -> new CustomGrassBlock(settings, CHALKSOIL), BlockBehaviour.Properties.ofFullCopy(Blocks.GRASS_BLOCK),false); public static final Block GRASSY_CHALKSOIL = registerMiscBlock("grassy_chalksoil", - Block::new,AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block GRASSY_CHALKSOIL_SLAB = registerMiscBlock("grassy_chalksoil_slab", - SlabBlock::new,AbstractBlock.Settings.copy(GRASSY_CHALKSOIL),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(GRASSY_CHALKSOIL),true); public static final Block GRASSY_CHALKSOIL_STAIRS = registerMiscBlock("grassy_chalksoil_stairs", - (settings) -> new StairsBlock(GRASSY_CHALKSOIL.getDefaultState(), settings), AbstractBlock.Settings.copy(GRASSY_CHALKSOIL),true); + (settings) -> new StairBlock(GRASSY_CHALKSOIL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(GRASSY_CHALKSOIL),true); public static final Block COARSE_CHALKSOIL = registerMiscBlock("coarse_chalksoil", - Block::new,AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block COARSE_CHALKSOIL_SLAB = registerMiscBlock("coarse_chalksoil_slab", - SlabBlock::new,AbstractBlock.Settings.copy(DRY_DIRT),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(DRY_DIRT),true); public static final Block COARSE_CHALKSOIL_STAIRS = registerMiscBlock("coarse_chalksoil_stairs", - (settings) -> new StairsBlock(COARSE_CHALKSOIL.getDefaultState(), settings), AbstractBlock.Settings.copy(DRY_DIRT),true); + (settings) -> new StairBlock(COARSE_CHALKSOIL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(DRY_DIRT),true); public static final Block CHALKSOIL_PATH = registerMiscBlock("chalksoil_path", - (settings) -> new CustomPathBlock(settings, CHALKSOIL), AbstractBlock.Settings.copy(Blocks.DIRT_PATH),false); + (settings) -> new CustomPathBlock(settings, CHALKSOIL), BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT_PATH),false); public static final Block CHALKSOIL_FARMLAND = registerMiscBlock("chalksoil_farmland", - (settings) -> new CustomFarmlandBlock(settings, CHALKSOIL), AbstractBlock.Settings.copy(Blocks.FARMLAND),false); + (settings) -> new CustomFarmlandBlock(settings, CHALKSOIL), BlockBehaviour.Properties.ofFullCopy(Blocks.FARMLAND),false); public static final Block LOAM = registerMiscBlock("loam", - Block::new,AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block LOAM_SLAB = registerMiscBlock("loam_slab", - SlabBlock::new,AbstractBlock.Settings.copy(LOAM),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(LOAM),true); public static final Block LOAM_STAIRS = registerMiscBlock("loam_stairs", - (settings) -> new StairsBlock(LOAM.getDefaultState(), settings), AbstractBlock.Settings.copy(LOAM),true); + (settings) -> new StairBlock(LOAM.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(LOAM),true); public static final Block LOAM_GRASS_BLOCK = registerMiscBlock("loam_grass_block", - (settings) -> new CustomGrassBlock(settings, LOAM), AbstractBlock.Settings.copy(Blocks.GRASS_BLOCK),false); + (settings) -> new CustomGrassBlock(settings, LOAM), BlockBehaviour.Properties.ofFullCopy(Blocks.GRASS_BLOCK),false); public static final Block GRASSY_LOAM = registerMiscBlock("grassy_loam", - Block::new,AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block GRASSY_LOAM_SLAB = registerMiscBlock("grassy_loam_slab", - SlabBlock::new,AbstractBlock.Settings.copy(GRASSY_LOAM),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(GRASSY_LOAM),true); public static final Block GRASSY_LOAM_STAIRS = registerMiscBlock("grassy_loam_stairs", - (settings) -> new StairsBlock(GRASSY_LOAM.getDefaultState(), settings), AbstractBlock.Settings.copy(GRASSY_LOAM),true); + (settings) -> new StairBlock(GRASSY_LOAM.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(GRASSY_LOAM),true); public static final Block COARSE_LOAM = registerMiscBlock("coarse_loam", - Block::new,AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block COARSE_LOAM_SLAB = registerMiscBlock("coarse_loam_slab", - SlabBlock::new,AbstractBlock.Settings.copy(DRY_DIRT),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(DRY_DIRT),true); public static final Block COARSE_LOAM_STAIRS = registerMiscBlock("coarse_loam_stairs", - (settings) -> new StairsBlock(COARSE_LOAM.getDefaultState(), settings), AbstractBlock.Settings.copy(DRY_DIRT),true); + (settings) -> new StairBlock(COARSE_LOAM.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(DRY_DIRT),true); public static final Block LOAM_PATH = registerMiscBlock("loam_path", - (settings) -> new CustomPathBlock(settings, LOAM), AbstractBlock.Settings.copy(Blocks.DIRT_PATH),false); + (settings) -> new CustomPathBlock(settings, LOAM), BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT_PATH),false); public static final Block LOAM_FARMLAND = registerMiscBlock("loam_farmland", - (settings) -> new CustomFarmlandBlock(settings, LOAM), AbstractBlock.Settings.copy(Blocks.FARMLAND),false); + (settings) -> new CustomFarmlandBlock(settings, LOAM), BlockBehaviour.Properties.ofFullCopy(Blocks.FARMLAND),false); public static final Block PEAT = registerMiscBlock("peat", - Block::new,AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block PEAT_SLAB = registerMiscBlock("peat_slab", - SlabBlock::new,AbstractBlock.Settings.copy(PEAT),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(PEAT),true); public static final Block PEAT_STAIRS = registerMiscBlock("peat_stairs", - (settings) -> new StairsBlock(PEAT.getDefaultState(), settings), AbstractBlock.Settings.copy(PEAT),true); + (settings) -> new StairBlock(PEAT.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(PEAT),true); public static final Block PEAT_GRASS_BLOCK = registerMiscBlock("peat_grass_block", - (settings) -> new CustomGrassBlock(settings, PEAT), AbstractBlock.Settings.copy(Blocks.GRASS_BLOCK),false); + (settings) -> new CustomGrassBlock(settings, PEAT), BlockBehaviour.Properties.ofFullCopy(Blocks.GRASS_BLOCK),false); public static final Block GRASSY_PEAT = registerMiscBlock("grassy_peat", - Block::new,AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block GRASSY_PEAT_SLAB = registerMiscBlock("grassy_peat_slab", - SlabBlock::new,AbstractBlock.Settings.copy(GRASSY_PEAT),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(GRASSY_PEAT),true); public static final Block GRASSY_PEAT_STAIRS = registerMiscBlock("grassy_peat_stairs", - (settings) -> new StairsBlock(GRASSY_PEAT.getDefaultState(), settings), AbstractBlock.Settings.copy(GRASSY_PEAT),true); + (settings) -> new StairBlock(GRASSY_PEAT.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(GRASSY_PEAT),true); public static final Block COARSE_PEAT = registerMiscBlock("coarse_peat", - Block::new,AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block COARSE_PEAT_SLAB = registerMiscBlock("coarse_peat_slab", - SlabBlock::new,AbstractBlock.Settings.copy(DRY_DIRT),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(DRY_DIRT),true); public static final Block COARSE_PEAT_STAIRS = registerMiscBlock("coarse_peat_stairs", - (settings) -> new StairsBlock(COARSE_PEAT.getDefaultState(), settings), AbstractBlock.Settings.copy(DRY_DIRT),true); + (settings) -> new StairBlock(COARSE_PEAT.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(DRY_DIRT),true); public static final Block PEAT_PATH = registerMiscBlock("peat_path", - (settings) -> new CustomPathBlock(settings, PEAT), AbstractBlock.Settings.copy(Blocks.DIRT_PATH),false); + (settings) -> new CustomPathBlock(settings, PEAT), BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT_PATH),false); public static final Block PEAT_FARMLAND = registerMiscBlock("peat_farmland", - (settings) -> new CustomFarmlandBlock(settings, PEAT), AbstractBlock.Settings.copy(Blocks.FARMLAND),false); + (settings) -> new CustomFarmlandBlock(settings, PEAT), BlockBehaviour.Properties.ofFullCopy(Blocks.FARMLAND),false); public static final Block SILT = registerMiscBlock("silt", - Block::new,AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block SILT_SLAB = registerMiscBlock("silt_slab", - SlabBlock::new,AbstractBlock.Settings.copy(SILT),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(SILT),true); public static final Block SILT_STAIRS = registerMiscBlock("silt_stairs", - (settings) -> new StairsBlock(SILT.getDefaultState(), settings), AbstractBlock.Settings.copy(SILT),true); + (settings) -> new StairBlock(SILT.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(SILT),true); public static final Block SILT_GRASS_BLOCK = registerMiscBlock("silt_grass_block", - (settings) -> new CustomGrassBlock(settings, SILT), AbstractBlock.Settings.copy(Blocks.GRASS_BLOCK),false); + (settings) -> new CustomGrassBlock(settings, SILT), BlockBehaviour.Properties.ofFullCopy(Blocks.GRASS_BLOCK),false); public static final Block GRASSY_SILT = registerMiscBlock("grassy_silt", - Block::new,AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block GRASSY_SILT_SLAB = registerMiscBlock("grassy_silt_slab", - SlabBlock::new,AbstractBlock.Settings.copy(GRASSY_SILT),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(GRASSY_SILT),true); public static final Block GRASSY_SILT_STAIRS = registerMiscBlock("grassy_silt_stairs", - (settings) -> new StairsBlock(GRASSY_SILT.getDefaultState(), settings), AbstractBlock.Settings.copy(GRASSY_SILT),true); + (settings) -> new StairBlock(GRASSY_SILT.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(GRASSY_SILT),true); public static final Block COARSE_SILT = registerMiscBlock("coarse_silt", - Block::new,AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block COARSE_SILT_SLAB = registerMiscBlock("coarse_silt_slab", - SlabBlock::new,AbstractBlock.Settings.copy(DRY_DIRT),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(DRY_DIRT),true); public static final Block COARSE_SILT_STAIRS = registerMiscBlock("coarse_silt_stairs", - (settings) -> new StairsBlock(COARSE_SILT.getDefaultState(), settings), AbstractBlock.Settings.copy(DRY_DIRT),true); + (settings) -> new StairBlock(COARSE_SILT.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(DRY_DIRT),true); public static final Block SILT_PATH = registerMiscBlock("silt_path", - (settings) -> new CustomPathBlock(settings, SILT), AbstractBlock.Settings.copy(Blocks.DIRT_PATH),false); + (settings) -> new CustomPathBlock(settings, SILT), BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT_PATH),false); public static final Block SILT_FARMLAND = registerMiscBlock("silt_farmland", - (settings) -> new CustomFarmlandBlock(settings, SILT), AbstractBlock.Settings.copy(Blocks.FARMLAND),false); + (settings) -> new CustomFarmlandBlock(settings, SILT), BlockBehaviour.Properties.ofFullCopy(Blocks.FARMLAND),false); public static final Block MIRE = registerMiscBlock("mire", - MudBlock::new, AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.MUD),true); + MudBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.MUD),true); public static final Block MIRE_SLAB = registerMiscBlock("mire_slab", - SlabBlock::new,AbstractBlock.Settings.copy(MIRE),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(MIRE),true); public static final Block MIRE_STAIRS = registerMiscBlock("mire_stairs", - (settings) -> new StairsBlock(MIRE.getDefaultState(), settings), AbstractBlock.Settings.copy(MIRE),true); + (settings) -> new StairBlock(MIRE.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(MIRE),true); public static final Block TURF = registerMiscBlock("turf", - Block::new,AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRASS),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRASS),true); public static final Block TURF_SLAB = registerMiscBlock("turf_slab", - SlabBlock::new,AbstractBlock.Settings.copy(TURF),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(TURF),true); public static final Block TURF_STAIRS = registerMiscBlock("turf_stairs", - (settings) -> new StairsBlock(TURF.getDefaultState(), settings), AbstractBlock.Settings.copy(TURF),true); + (settings) -> new StairBlock(TURF.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(TURF),true); public static final Block TURF_VERTICAL_SLAB = registerMiscBlock("turf_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(TURF),true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(TURF),true); public static final Block DIRTY_ROOTS = registerMiscBlock("dirty_roots", - Block::new,AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block DIRTY_ROOTS_SLAB = registerMiscBlock("dirty_roots_slab", - SlabBlock::new,AbstractBlock.Settings.copy(DIRTY_ROOTS),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(DIRTY_ROOTS),true); public static final Block DIRTY_ROOTS_STAIRS = registerMiscBlock("dirty_roots_stairs", - (settings) -> new StairsBlock(DIRTY_ROOTS.getDefaultState(), settings), AbstractBlock.Settings.copy(DIRTY_ROOTS),true); + (settings) -> new StairBlock(DIRTY_ROOTS.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(DIRTY_ROOTS),true); public static final Block FOUL_DIRT = registerMiscBlock("foul_dirt", - Block::new,AbstractBlock.Settings.copy(Blocks.COARSE_DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.COARSE_DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block FOUL_DIRT_SLAB = registerMiscBlock("foul_dirt_slab", - SlabBlock::new,AbstractBlock.Settings.copy(FOUL_DIRT),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(FOUL_DIRT),true); public static final Block FOUL_DIRT_STAIRS = registerMiscBlock("foul_dirt_stairs", - (settings) -> new StairsBlock(FOUL_DIRT.getDefaultState(), settings), AbstractBlock.Settings.copy(FOUL_DIRT),true); + (settings) -> new StairBlock(FOUL_DIRT.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(FOUL_DIRT),true); public static final Block ASHEN_DIRT = registerMiscBlock("ashen_dirt", - Block::new,AbstractBlock.Settings.copy(Blocks.DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block ASHEN_DIRT_SLAB = registerMiscBlock("ashen_dirt_slab", - SlabBlock::new,AbstractBlock.Settings.copy(ASHEN_DIRT),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(ASHEN_DIRT),true); public static final Block ASHEN_DIRT_STAIRS = registerMiscBlock("ashen_dirt_stairs", - (settings) -> new StairsBlock(ASHEN_DIRT.getDefaultState(), settings), AbstractBlock.Settings.copy(ASHEN_DIRT),true); + (settings) -> new StairBlock(ASHEN_DIRT.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(ASHEN_DIRT),true); public static final Block COBBLY_ASHEN_DIRT = registerMiscBlock("cobbly_ashen_dirt", - Block::new,AbstractBlock.Settings.copy(Blocks.COARSE_DIRT).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.COARSE_DIRT).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block COBBLY_ASHEN_DIRT_SLAB = registerMiscBlock("cobbly_ashen_dirt_slab", - SlabBlock::new,AbstractBlock.Settings.copy(COBBLY_ASHEN_DIRT),true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(COBBLY_ASHEN_DIRT),true); public static final Block COBBLY_ASHEN_DIRT_STAIRS = registerMiscBlock("cobbly_ashen_dirt_stairs", - (settings) -> new StairsBlock(COBBLY_ASHEN_DIRT.getDefaultState(), settings), AbstractBlock.Settings.copy(ASHEN_DIRT),true); + (settings) -> new StairBlock(COBBLY_ASHEN_DIRT.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(ASHEN_DIRT),true); public static final Block ASHEN_SAND = registerMiscBlock("ashen_sand", - (settings) -> new ColoredFallingBlock(new ColorCode(14406560), settings), AbstractBlock.Settings.copy(Blocks.SAND).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + (settings) -> new ColoredFallingBlock(new ColorRGBA(14406560), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.SAND).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block ASHEN_SAND_LAYER = registerMiscBlock("ashen_sand_layer", - (settings) -> new LayersBlock(settings, ASHEN_SAND),AbstractBlock.Settings.copy(ASHEN_SAND), false); + (settings) -> new LayersBlock(settings, ASHEN_SAND),BlockBehaviour.Properties.ofFullCopy(ASHEN_SAND), false); public static final Block ASHEN_GRAVEL = registerMiscBlock("ashen_gravel", - (settings) -> new ColoredFallingBlock(new ColorCode(14406560), settings), AbstractBlock.Settings.copy(Blocks.GRAVEL).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.GRAVEL),true); + (settings) -> new ColoredFallingBlock(new ColorRGBA(14406560), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.GRAVEL).strength(DIRT_STRENGTH).sound(SoundType.GRAVEL),true); public static final Block ASHEN_GRAVEL_LAYER = registerMiscBlock("ashen_gravel_layer", - (settings) -> new LayersBlock(settings, ASHEN_GRAVEL), AbstractBlock.Settings.copy(ASHEN_GRAVEL), false); + (settings) -> new LayersBlock(settings, ASHEN_GRAVEL), BlockBehaviour.Properties.ofFullCopy(ASHEN_GRAVEL), false); public static final Block EMBERS = registerMiscBlock("embers", - Block::new, AbstractBlock.Settings.copy(Blocks.NETHERRACK),true); + Block::new, BlockBehaviour.Properties.ofFullCopy(Blocks.NETHERRACK),true); public static final Block SKELETAL_PILE = registerMiscBlock("skeletal_pile", - Block::new, AbstractBlock.Settings.copy(Blocks.BONE_BLOCK).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.BONE),true); + Block::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BONE_BLOCK).strength(DIRT_STRENGTH).sound(SoundType.BONE_BLOCK),true); public static final Block SKELETAL_PILE_LAYER = registerMiscBlock("skeletal_pile_layer", - (settings) -> new LayersBlock(settings, SKELETAL_PILE),AbstractBlock.Settings.copy(SKELETAL_PILE), false); + (settings) -> new LayersBlock(settings, SKELETAL_PILE),BlockBehaviour.Properties.ofFullCopy(SKELETAL_PILE), false); public static final Block WASTE_PILE = registerMiscBlock("waste_pile", - Block::new, AbstractBlock.Settings.copy(Blocks.MUD).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.MUD),true); + Block::new, BlockBehaviour.Properties.ofFullCopy(Blocks.MUD).strength(DIRT_STRENGTH).sound(SoundType.MUD),true); public static final Block WASTE_PILE_LAYER = registerMiscBlock("waste_pile_layer", - (settings) -> new LayersBlock(settings, WASTE_PILE),AbstractBlock.Settings.copy(WASTE_PILE), false); + (settings) -> new LayersBlock(settings, WASTE_PILE),BlockBehaviour.Properties.ofFullCopy(WASTE_PILE), false); public static final Block WATTLE_AND_BRICK = registerMiscBlock("wattle_and_brick", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block WATTLE_AND_BRICK_CROSS = registerMiscBlock("wattle_and_brick_cross", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block WATTLE_AND_BRICK_RIGHT = registerMiscBlock("wattle_and_brick_right", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block WATTLE_AND_BRICK_LEFT = registerMiscBlock("wattle_and_brick_left", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block WATTLE_AND_BRICK_PILLAR = registerMiscBlock("wattle_and_brick_pillar", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block WATTLE_AND_BRICK_DIAMOND = registerMiscBlock("wattle_and_brick_diamond", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block WATTLE_AND_WHITE_DAUB = registerMiscBlock("wattle_and_white_daub", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block WATTLE_AND_WHITE_DAUB_CROSS = registerMiscBlock("wattle_and_white_daub_cross", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block WATTLE_AND_WHITE_DAUB_RIGHT = registerMiscBlock("wattle_and_white_daub_right", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block WATTLE_AND_WHITE_DAUB_LEFT = registerMiscBlock("wattle_and_white_daub_left", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block WATTLE_AND_WHITE_DAUB_PILLAR = registerMiscBlock("wattle_and_white_daub_pillar", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block WATTLE_AND_WHITE_DAUB_DIAMOND = registerMiscBlock("wattle_and_white_daub_diamond", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block BLACK_WATTLE_AND_WHITE_DAUB = registerMiscBlock("black_wattle_and_white_daub", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block BLACK_WATTLE_AND_WHITE_DAUB_CROSS = registerMiscBlock("black_wattle_and_white_daub_cross", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block BLACK_WATTLE_AND_WHITE_DAUB_RIGHT = registerMiscBlock("black_wattle_and_white_daub_right", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block BLACK_WATTLE_AND_WHITE_DAUB_LEFT = registerMiscBlock("black_wattle_and_white_daub_left", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block BLACK_WATTLE_AND_WHITE_DAUB_PILLAR = registerMiscBlock("black_wattle_and_white_daub_pillar", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block BLACK_WATTLE_AND_WHITE_DAUB_DIAMOND = registerMiscBlock("black_wattle_and_white_daub_diamond", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block GREEN_WATTLE_AND_WHITE_DAUB = registerMiscBlock("green_wattle_and_white_daub", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block GREEN_WATTLE_AND_WHITE_DAUB_CROSS = registerMiscBlock("green_wattle_and_white_daub_cross", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block GREEN_WATTLE_AND_WHITE_DAUB_RIGHT = registerMiscBlock("green_wattle_and_white_daub_right", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block GREEN_WATTLE_AND_WHITE_DAUB_LEFT = registerMiscBlock("green_wattle_and_white_daub_left", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block GREEN_WATTLE_AND_WHITE_DAUB_PILLAR = registerMiscBlock("green_wattle_and_white_daub_pillar", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block GREEN_WATTLE_AND_WHITE_DAUB_DIAMOND = registerMiscBlock("green_wattle_and_white_daub_diamond", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block RED_WATTLE_AND_WHITE_DAUB = registerMiscBlock("red_wattle_and_white_daub", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block RED_WATTLE_AND_WHITE_DAUB_CROSS = registerMiscBlock("red_wattle_and_white_daub_cross", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block RED_WATTLE_AND_WHITE_DAUB_RIGHT = registerMiscBlock("red_wattle_and_white_daub_right", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block RED_WATTLE_AND_WHITE_DAUB_LEFT = registerMiscBlock("red_wattle_and_white_daub_left", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block RED_WATTLE_AND_WHITE_DAUB_PILLAR = registerMiscBlock("red_wattle_and_white_daub_pillar", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block RED_WATTLE_AND_WHITE_DAUB_DIAMOND = registerMiscBlock("red_wattle_and_white_daub_diamond", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block DARK_WATTLE_AND_DARK_DAUB = registerMiscBlock("dark_wattle_and_dark_daub", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block DARK_WATTLE_AND_DARK_DAUB_CROSS = registerMiscBlock("dark_wattle_and_dark_daub_cross", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block DARK_WATTLE_AND_DARK_DAUB_RIGHT = registerMiscBlock("dark_wattle_and_dark_daub_right", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block DARK_WATTLE_AND_DARK_DAUB_LEFT = registerMiscBlock("dark_wattle_and_dark_daub_left", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block DARK_WATTLE_AND_DARK_DAUB_PILLAR = registerMiscBlock("dark_wattle_and_dark_daub_pillar", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block DARK_WATTLE_AND_DARK_DAUB_DIAMOND = registerMiscBlock("dark_wattle_and_dark_daub_diamond", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block WATTLE_AND_YELLOW_DAUB = registerMiscBlock("wattle_and_yellow_daub", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block WATTLE_AND_YELLOW_DAUB_CROSS = registerMiscBlock("wattle_and_yellow_daub_cross", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block WATTLE_AND_YELLOW_DAUB_RIGHT = registerMiscBlock("wattle_and_yellow_daub_right", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block WATTLE_AND_YELLOW_DAUB_LEFT = registerMiscBlock("wattle_and_yellow_daub_left", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block WATTLE_AND_YELLOW_DAUB_PILLAR = registerMiscBlock("wattle_and_yellow_daub_pillar", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); public static final Block WATTLE_AND_YELLOW_DAUB_DIAMOND = registerMiscBlock("wattle_and_yellow_daub_diamond", - Block::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD),true); //region METAL AND GEMS public static final Block RAW_MITHRIL_BLOCK = registerMiscBlock("raw_mithril_block", - Block::new,AbstractBlock.Settings.copy(Blocks.RAW_IRON_BLOCK).strength(4f).requiresTool(),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.RAW_IRON_BLOCK).strength(4f).requiresCorrectToolForDrops(),true); public static final Block MITHRIL_BLOCK = registerMiscBlock("mithril_block", - Block::new,AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).strength(6f).requiresTool(),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).strength(6f).requiresCorrectToolForDrops(),true); public static final Block RAW_TIN_BLOCK = registerMiscBlock("raw_tin_block", - Block::new,AbstractBlock.Settings.copy(Blocks.STONE).strength(2f).requiresTool(),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).strength(2f).requiresCorrectToolForDrops(),true); public static final Block TIN_BLOCK = registerMiscBlock("tin_block", - Block::new,AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).strength(3f).requiresTool(),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).strength(3f).requiresCorrectToolForDrops(),true); public static final Block RAW_LEAD_BLOCK = registerMiscBlock("raw_lead_block", - Block::new,AbstractBlock.Settings.copy(Blocks.RAW_IRON_BLOCK).strength(3f).requiresTool(),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.RAW_IRON_BLOCK).strength(3f).requiresCorrectToolForDrops(),true); public static final Block LEAD_BLOCK = registerMiscBlock("lead_block", - Block::new,AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).strength(2f).requiresTool(),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).strength(2f).requiresCorrectToolForDrops(),true); public static final Block RAW_SILVER_BLOCK = registerMiscBlock("raw_silver_block", - Block::new,AbstractBlock.Settings.copy(Blocks.RAW_IRON_BLOCK).strength(3f).requiresTool(),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.RAW_IRON_BLOCK).strength(3f).requiresCorrectToolForDrops(),true); public static final Block SILVER_BLOCK = registerMiscBlock("silver_block", - Block::new,AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).strength(4f).requiresTool(),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).strength(4f).requiresCorrectToolForDrops(),true); public static final Block BRONZE_BLOCK = registerMiscBlock("bronze_block", - Block::new,AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).strength(5f).requiresTool(),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).strength(5f).requiresCorrectToolForDrops(),true); public static final Block CRUDE_BLOCK = registerMiscBlock("crude_block", - Block::new,AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).strength(5.5f).requiresTool(),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).strength(5.5f).requiresCorrectToolForDrops(),true); public static final Block STEEL_BLOCK = registerMiscBlock("steel_block", - Block::new,AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).strength(6f).requiresTool(),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).strength(6f).requiresCorrectToolForDrops(),true); public static final Block KHAZAD_STEEL_BLOCK = registerMiscBlock("khazad_steel_block", - Block::new,AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).strength(7f).requiresTool(),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).strength(7f).requiresCorrectToolForDrops(),true); public static final Block EDHEL_STEEL_BLOCK = registerMiscBlock("edhel_steel_block", - Block::new,AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).strength(6f).requiresTool(),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).strength(6f).requiresCorrectToolForDrops(),true); public static final Block BURZUM_STEEL_BLOCK = registerMiscBlock("burzum_steel_block", - Block::new,AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).strength(6f).requiresTool(),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).strength(6f).requiresCorrectToolForDrops(),true); public static final Block ADAMANT_BLOCK = registerMiscBlock("adamant_block", - Block::new,AbstractBlock.Settings.copy(Blocks.DIAMOND_BLOCK).requiresTool(),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIAMOND_BLOCK).requiresCorrectToolForDrops(),true); public static final Block RUBY_BLOCK = registerMiscBlock("ruby_block", - Block::new,AbstractBlock.Settings.copy(Blocks.DIAMOND_BLOCK).requiresTool(),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIAMOND_BLOCK).requiresCorrectToolForDrops(),true); public static final Block SAPPHIRE_BLOCK = registerMiscBlock("sapphire_block", - Block::new,AbstractBlock.Settings.copy(Blocks.DIAMOND_BLOCK).requiresTool(),true); + Block::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIAMOND_BLOCK).requiresCorrectToolForDrops(),true); public static final Block QUARTZ_BLOCK = registerMiscBlock("quartz_block", - AmethystBlock::new,AbstractBlock.Settings.copy(Blocks.AMETHYST_BLOCK), true); + AmethystBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.AMETHYST_BLOCK), true); public static final Block QUARTZ_CLUSTER = registerMiscBlock("quartz_cluster", - (settings) -> new AmethystClusterBlock(7,3, settings), AbstractBlock.Settings.copy(Blocks.AMETHYST_CLUSTER), false); + (settings) -> new AmethystClusterBlock(7,3, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.AMETHYST_CLUSTER), false); public static final Block LARGE_QUARTZ_BUD = registerMiscBlock("large_quartz_bud", - (settings) -> new AmethystClusterBlock(5,3, settings), AbstractBlock.Settings.copy(ModBlocks.QUARTZ_CLUSTER).sounds(BlockSoundGroup.LARGE_AMETHYST_BUD), false); + (settings) -> new AmethystClusterBlock(5,3, settings), BlockBehaviour.Properties.ofFullCopy(ModBlocks.QUARTZ_CLUSTER).sound(SoundType.LARGE_AMETHYST_BUD), false); public static final Block MEDIUM_QUARTZ_BUD = registerMiscBlock("medium_quartz_bud", - (settings) -> new AmethystClusterBlock(4,3, settings), AbstractBlock.Settings.copy(ModBlocks.QUARTZ_CLUSTER).sounds(BlockSoundGroup.MEDIUM_AMETHYST_BUD), false); + (settings) -> new AmethystClusterBlock(4,3, settings), BlockBehaviour.Properties.ofFullCopy(ModBlocks.QUARTZ_CLUSTER).sound(SoundType.MEDIUM_AMETHYST_BUD), false); public static final Block SMALL_QUARTZ_BUD = registerMiscBlock("small_quartz_bud", - (settings) -> new AmethystClusterBlock(3,4, settings), AbstractBlock.Settings.copy(ModBlocks.QUARTZ_CLUSTER).sounds(BlockSoundGroup.SMALL_AMETHYST_BUD), false); + (settings) -> new AmethystClusterBlock(3,4, settings), BlockBehaviour.Properties.ofFullCopy(ModBlocks.QUARTZ_CLUSTER).sound(SoundType.SMALL_AMETHYST_BUD), false); public static final Block BUDDING_QUARTZ = registerMiscBlock("budding_quartz", - (settings) -> new CustomBuddingGemBlock(settings, List.of(SMALL_QUARTZ_BUD,MEDIUM_QUARTZ_BUD,LARGE_QUARTZ_BUD, QUARTZ_CLUSTER)), AbstractBlock.Settings.copy(Blocks.BUDDING_AMETHYST), false); + (settings) -> new CustomBuddingGemBlock(settings, List.of(SMALL_QUARTZ_BUD,MEDIUM_QUARTZ_BUD,LARGE_QUARTZ_BUD, QUARTZ_CLUSTER)), BlockBehaviour.Properties.ofFullCopy(Blocks.BUDDING_AMETHYST), false); public static final Block RED_AGATE_BLOCK = registerMiscBlock("red_agate_block", - AmethystBlock::new,AbstractBlock.Settings.copy(Blocks.AMETHYST_BLOCK), true); + AmethystBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.AMETHYST_BLOCK), true); public static final Block RED_AGATE_CLUSTER = registerMiscBlock("red_agate_cluster", - (settings) -> new AmethystClusterBlock(7,3, settings), AbstractBlock.Settings.copy(Blocks.AMETHYST_CLUSTER), false); + (settings) -> new AmethystClusterBlock(7,3, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.AMETHYST_CLUSTER), false); public static final Block LARGE_RED_AGATE_BUD = registerMiscBlock("large_red_agate_bud", - (settings) -> new AmethystClusterBlock(5,3, settings), AbstractBlock.Settings.copy(ModBlocks.RED_AGATE_CLUSTER).sounds(BlockSoundGroup.LARGE_AMETHYST_BUD), false); + (settings) -> new AmethystClusterBlock(5,3, settings), BlockBehaviour.Properties.ofFullCopy(ModBlocks.RED_AGATE_CLUSTER).sound(SoundType.LARGE_AMETHYST_BUD), false); public static final Block MEDIUM_RED_AGATE_BUD = registerMiscBlock("medium_red_agate_bud", - (settings) -> new AmethystClusterBlock(4,3, settings), AbstractBlock.Settings.copy(ModBlocks.RED_AGATE_CLUSTER).sounds(BlockSoundGroup.MEDIUM_AMETHYST_BUD), false); + (settings) -> new AmethystClusterBlock(4,3, settings), BlockBehaviour.Properties.ofFullCopy(ModBlocks.RED_AGATE_CLUSTER).sound(SoundType.MEDIUM_AMETHYST_BUD), false); public static final Block SMALL_RED_AGATE_BUD = registerMiscBlock("small_red_agate_bud", - (settings) -> new AmethystClusterBlock(3,4, settings), AbstractBlock.Settings.copy(ModBlocks.RED_AGATE_CLUSTER).sounds(BlockSoundGroup.SMALL_AMETHYST_BUD), false); + (settings) -> new AmethystClusterBlock(3,4, settings), BlockBehaviour.Properties.ofFullCopy(ModBlocks.RED_AGATE_CLUSTER).sound(SoundType.SMALL_AMETHYST_BUD), false); public static final Block BUDDING_RED_AGATE = registerMiscBlock("budding_red_agate", - (settings) -> new CustomBuddingGemBlock(settings, List.of(SMALL_RED_AGATE_BUD,MEDIUM_RED_AGATE_BUD,LARGE_RED_AGATE_BUD, RED_AGATE_CLUSTER)),AbstractBlock.Settings.copy(Blocks.BUDDING_AMETHYST), false); + (settings) -> new CustomBuddingGemBlock(settings, List.of(SMALL_RED_AGATE_BUD,MEDIUM_RED_AGATE_BUD,LARGE_RED_AGATE_BUD, RED_AGATE_CLUSTER)),BlockBehaviour.Properties.ofFullCopy(Blocks.BUDDING_AMETHYST), false); public static final Block CITRINE_BLOCK = registerMiscBlock("citrine_block", - AmethystBlock::new,AbstractBlock.Settings.copy(Blocks.AMETHYST_BLOCK), true); + AmethystBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.AMETHYST_BLOCK), true); public static final Block CITRINE_CLUSTER = registerMiscBlock("citrine_cluster", - (settings) -> new AmethystClusterBlock(7,3, settings), AbstractBlock.Settings.copy(Blocks.AMETHYST_CLUSTER), false); + (settings) -> new AmethystClusterBlock(7,3, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.AMETHYST_CLUSTER), false); public static final Block LARGE_CITRINE_BUD = registerMiscBlock("large_citrine_bud", - (settings) -> new AmethystClusterBlock(5,3, settings), AbstractBlock.Settings.copy(ModBlocks.CITRINE_CLUSTER).sounds(BlockSoundGroup.LARGE_AMETHYST_BUD), false); + (settings) -> new AmethystClusterBlock(5,3, settings), BlockBehaviour.Properties.ofFullCopy(ModBlocks.CITRINE_CLUSTER).sound(SoundType.LARGE_AMETHYST_BUD), false); public static final Block MEDIUM_CITRINE_BUD = registerMiscBlock("medium_citrine_bud", - (settings) -> new AmethystClusterBlock(4,3, settings), AbstractBlock.Settings.copy(ModBlocks.CITRINE_CLUSTER).sounds(BlockSoundGroup.MEDIUM_AMETHYST_BUD), false); + (settings) -> new AmethystClusterBlock(4,3, settings), BlockBehaviour.Properties.ofFullCopy(ModBlocks.CITRINE_CLUSTER).sound(SoundType.MEDIUM_AMETHYST_BUD), false); public static final Block SMALL_CITRINE_BUD = registerMiscBlock("small_citrine_bud", - (settings) -> new AmethystClusterBlock(3,4, settings), AbstractBlock.Settings.copy(ModBlocks.CITRINE_CLUSTER).sounds(BlockSoundGroup.SMALL_AMETHYST_BUD), false); + (settings) -> new AmethystClusterBlock(3,4, settings), BlockBehaviour.Properties.ofFullCopy(ModBlocks.CITRINE_CLUSTER).sound(SoundType.SMALL_AMETHYST_BUD), false); public static final Block BUDDING_CITRINE = registerMiscBlock("budding_citrine", - (settings) -> new CustomBuddingGemBlock(settings, List.of(SMALL_CITRINE_BUD,MEDIUM_CITRINE_BUD,LARGE_CITRINE_BUD, CITRINE_CLUSTER)), AbstractBlock.Settings.copy(Blocks.BUDDING_AMETHYST),false); + (settings) -> new CustomBuddingGemBlock(settings, List.of(SMALL_CITRINE_BUD,MEDIUM_CITRINE_BUD,LARGE_CITRINE_BUD, CITRINE_CLUSTER)), BlockBehaviour.Properties.ofFullCopy(Blocks.BUDDING_AMETHYST),false); public static final Block GLOWSTONE_BLOCK = registerMiscBlock("glowstone_block", - AmethystBlock::new,AbstractBlock.Settings.copy(Blocks.AMETHYST_BLOCK).luminance(state -> 12), true); + AmethystBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.AMETHYST_BLOCK).lightLevel(state -> 12), true); public static final Block GLOWSTONE_CLUSTER = registerMiscBlock("glowstone_cluster", - (settings) -> new AmethystClusterBlock(7,3, settings), AbstractBlock.Settings.copy(Blocks.AMETHYST_CLUSTER).luminance(state -> 10), false); + (settings) -> new AmethystClusterBlock(7,3, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.AMETHYST_CLUSTER).lightLevel(state -> 10), false); public static final Block LARGE_GLOWSTONE_BUD = registerMiscBlock("large_glowstone_bud", - (settings) -> new AmethystClusterBlock(5,3, settings), AbstractBlock.Settings.copy(ModBlocks.GLOWSTONE_CLUSTER).sounds(BlockSoundGroup.LARGE_AMETHYST_BUD).luminance(state -> 9), false); + (settings) -> new AmethystClusterBlock(5,3, settings), BlockBehaviour.Properties.ofFullCopy(ModBlocks.GLOWSTONE_CLUSTER).sound(SoundType.LARGE_AMETHYST_BUD).lightLevel(state -> 9), false); public static final Block MEDIUM_GLOWSTONE_BUD = registerMiscBlock("medium_glowstone_bud", - (settings) -> new AmethystClusterBlock(4,3, settings), AbstractBlock.Settings.copy(ModBlocks.GLOWSTONE_CLUSTER).sounds(BlockSoundGroup.MEDIUM_AMETHYST_BUD).luminance(state -> 7), false); + (settings) -> new AmethystClusterBlock(4,3, settings), BlockBehaviour.Properties.ofFullCopy(ModBlocks.GLOWSTONE_CLUSTER).sound(SoundType.MEDIUM_AMETHYST_BUD).lightLevel(state -> 7), false); public static final Block SMALL_GLOWSTONE_BUD = registerMiscBlock("small_glowstone_bud", - (settings) -> new AmethystClusterBlock(3,4, settings), AbstractBlock.Settings.copy(ModBlocks.GLOWSTONE_CLUSTER).sounds(BlockSoundGroup.SMALL_AMETHYST_BUD).luminance(state -> 5), false); + (settings) -> new AmethystClusterBlock(3,4, settings), BlockBehaviour.Properties.ofFullCopy(ModBlocks.GLOWSTONE_CLUSTER).sound(SoundType.SMALL_AMETHYST_BUD).lightLevel(state -> 5), false); public static final Block BUDDING_GLOWSTONE = registerMiscBlock("budding_glowstone", - (settings) -> new CustomBuddingGemBlock(settings, List.of(SMALL_GLOWSTONE_BUD,MEDIUM_GLOWSTONE_BUD,LARGE_GLOWSTONE_BUD, GLOWSTONE_CLUSTER)), AbstractBlock.Settings.copy(Blocks.BUDDING_AMETHYST),false); + (settings) -> new CustomBuddingGemBlock(settings, List.of(SMALL_GLOWSTONE_BUD,MEDIUM_GLOWSTONE_BUD,LARGE_GLOWSTONE_BUD, GLOWSTONE_CLUSTER)), BlockBehaviour.Properties.ofFullCopy(Blocks.BUDDING_AMETHYST),false); public static final Block NET = registerMiscBlock("net", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).sounds(BlockSoundGroup.WOOL), true); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).sound(SoundType.WOOL), true); public static final Block COPPER_BARS = registerMiscBlock("copper_bars", - (settings) -> new OxidizablePaneBlock(Oxidizable.OxidationLevel.UNAFFECTED, settings), AbstractBlock.Settings.copy(Blocks.CUT_COPPER_SLAB), true); + (settings) -> new OxidizablePaneBlock(WeatheringCopper.WeatherState.UNAFFECTED, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.CUT_COPPER_SLAB), true); public static final Block EXPOSED_COPPER_BARS = registerMiscBlock("exposed_copper_bars", - (settings) -> new OxidizablePaneBlock(Oxidizable.OxidationLevel.EXPOSED, settings), AbstractBlock.Settings.copy(Blocks.EXPOSED_CUT_COPPER_SLAB), true); + (settings) -> new OxidizablePaneBlock(WeatheringCopper.WeatherState.EXPOSED, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.EXPOSED_CUT_COPPER_SLAB), true); public static final Block WEATHERED_COPPER_BARS = registerMiscBlock("weathered_copper_bars", - (settings) -> new OxidizablePaneBlock(Oxidizable.OxidationLevel.WEATHERED, settings), AbstractBlock.Settings.copy(Blocks.WEATHERED_CUT_COPPER_SLAB), true); + (settings) -> new OxidizablePaneBlock(WeatheringCopper.WeatherState.WEATHERED, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WEATHERED_CUT_COPPER_SLAB), true); public static final Block OXIDIZED_COPPER_BARS = registerMiscBlock("oxidized_copper_bars", - (settings) -> new OxidizablePaneBlock(Oxidizable.OxidationLevel.OXIDIZED, settings), AbstractBlock.Settings.copy(Blocks.OXIDIZED_CUT_COPPER_SLAB), true); + (settings) -> new OxidizablePaneBlock(WeatheringCopper.WeatherState.OXIDIZED, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.OXIDIZED_CUT_COPPER_SLAB), true); public static final Block WAXED_COPPER_BARS = registerMiscBlock("waxed_copper_bars", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.WAXED_CUT_COPPER_SLAB), true); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WAXED_CUT_COPPER_SLAB), true); public static final Block WAXED_EXPOSED_COPPER_BARS = registerMiscBlock("waxed_exposed_copper_bars", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.WAXED_EXPOSED_CUT_COPPER_SLAB), true); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WAXED_EXPOSED_CUT_COPPER_SLAB), true); public static final Block WAXED_WEATHERED_COPPER_BARS = registerMiscBlock("waxed_weathered_copper_bars", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.WAXED_WEATHERED_CUT_COPPER_SLAB), true); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WAXED_WEATHERED_CUT_COPPER_SLAB), true); public static final Block WAXED_OXIDIZED_COPPER_BARS = registerMiscBlock("waxed_oxidized_copper_bars", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.WAXED_OXIDIZED_CUT_COPPER_SLAB), true); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WAXED_OXIDIZED_CUT_COPPER_SLAB), true); public static final Block BRONZE_BARS = registerMiscBlock("bronze_bars", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.IRON_BARS), true); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BARS), true); public static final Block CRUDE_BARS = registerMiscBlock("crude_bars", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.IRON_BARS), true); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BARS), true); public static final Block TREATED_STEEL_BARS = registerMiscBlock("treated_steel_bars", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.IRON_BARS), true); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BARS), true); public static final Block BURZUM_BARS = registerMiscBlock("burzum_bars", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.IRON_BARS), true); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BARS), true); public static final Block SILVER_BARS = registerMiscBlock("silver_bars", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.IRON_BARS).sounds(BlockSoundGroup.METAL), true); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BARS).sound(SoundType.METAL), true); public static final Block GILDED_BARS = registerMiscBlock("gilded_bars", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.IRON_BARS).sounds(BlockSoundGroup.COPPER), true); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BARS).sound(SoundType.COPPER), true); public static final Block AGED_WOOD_DOOR = registerMiscBlock("aged_wood_door", - (settings) -> new DoorBlock(BlockSetType.DARK_OAK, settings), AbstractBlock.Settings.copy(Blocks.DARK_OAK_DOOR), true); + (settings) -> new DoorBlock(BlockSetType.DARK_OAK, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DARK_OAK_DOOR), true); public static final Block BRONZE_DOOR = registerMiscBlock("bronze_door", - (settings) -> new DoorBlock(BlockSetType.COPPER, settings), AbstractBlock.Settings.copy(Blocks.IRON_DOOR), true); + (settings) -> new DoorBlock(BlockSetType.COPPER, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_DOOR), true); public static final Block CRUDE_DOOR = registerMiscBlock("crude_door", - (settings) -> new DoorBlock(BlockSetType.COPPER, settings), AbstractBlock.Settings.copy(Blocks.IRON_DOOR), true); + (settings) -> new DoorBlock(BlockSetType.COPPER, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_DOOR), true); public static final Block TREATED_STEEL_DOOR = registerMiscBlock("treated_steel_door", - (settings) -> new DoorBlock(BlockSetType.COPPER, settings), AbstractBlock.Settings.copy(Blocks.IRON_DOOR), true); + (settings) -> new DoorBlock(BlockSetType.COPPER, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_DOOR), true); public static final Block AGED_WOOD_TRAPDOOR = registerMiscBlock("aged_wood_trapdoor", - (settings) -> new TrapdoorBlock(BlockSetType.DARK_OAK, settings), AbstractBlock.Settings.copy(Blocks.DARK_OAK_TRAPDOOR), true); + (settings) -> new TrapDoorBlock(BlockSetType.DARK_OAK, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DARK_OAK_TRAPDOOR), true); public static final Block BRONZE_TRAPDOOR = registerMiscBlock("bronze_trapdoor", - (settings) -> new TrapdoorBlock(BlockSetType.COPPER, settings), AbstractBlock.Settings.copy(Blocks.IRON_TRAPDOOR), true); + (settings) -> new TrapDoorBlock(BlockSetType.COPPER, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_TRAPDOOR), true); public static final Block CRUDE_TRAPDOOR = registerMiscBlock("crude_trapdoor", - (settings) -> new TrapdoorBlock(BlockSetType.COPPER, settings), AbstractBlock.Settings.copy(Blocks.IRON_TRAPDOOR), true); + (settings) -> new TrapDoorBlock(BlockSetType.COPPER, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_TRAPDOOR), true); public static final Block TREATED_STEEL_TRAPDOOR = registerMiscBlock("treated_steel_trapdoor", - (settings) -> new TrapdoorBlock(BlockSetType.COPPER, settings), AbstractBlock.Settings.copy(Blocks.IRON_TRAPDOOR), true); + (settings) -> new TrapDoorBlock(BlockSetType.COPPER, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_TRAPDOOR), true); public static final Block BURZUM_SPIKES = registerMiscBlock("burzum_spikes", - SpikesBlock::new, AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).nonOpaque(), true); + SpikesBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).noOcclusion(), true); //endregion public static final Block RIVER_SAND = registerMiscBlock("river_sand", - (settings) -> new ColoredFallingBlock(new ColorCode(-8356741), settings), AbstractBlock.Settings.copy(Blocks.SAND).sounds(BlockSoundGroup.SAND), true); + (settings) -> new ColoredFallingBlock(new ColorRGBA(-8356741), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.SAND).sound(SoundType.SAND), true); public static final Block BLACK_SAND = registerMiscBlock("black_sand", - (settings) -> new ColoredFallingBlock(new ColorCode(-8356741), settings), AbstractBlock.Settings.copy(Blocks.SAND).sounds(BlockSoundGroup.SAND), true); + (settings) -> new ColoredFallingBlock(new ColorRGBA(-8356741), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.SAND).sound(SoundType.SAND), true); public static final Block WHITE_SAND = registerMiscBlock("white_sand", - (settings) -> new ColoredFallingBlock(new ColorCode(14406560), settings), AbstractBlock.Settings.copy(Blocks.SAND).sounds(BlockSoundGroup.SAND), true); + (settings) -> new ColoredFallingBlock(new ColorRGBA(14406560), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.SAND).sound(SoundType.SAND), true); public static final Block STONE_MYCELIUM = registerMiscBlock("stone_mycelium", - StoneMyceliumBlock::new, AbstractBlock.Settings.copy(Blocks.STONE).ticksRandomly(), false); + StoneMyceliumBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).randomTicks(), false); public static final Block ASH_BLOCK = registerMiscBlock("ash_block", - (settings) -> new ColoredFallingBlock(new ColorCode(-8356741), settings), AbstractBlock.Settings.copy(Blocks.SAND).strength(DIRT_STRENGTH).sounds(BlockSoundGroup.SAND), true); + (settings) -> new ColoredFallingBlock(new ColorRGBA(-8356741), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.SAND).strength(DIRT_STRENGTH).sound(SoundType.SAND), true); //region VANILLA SLABS public static final Block DIRT_SLAB = registerMiscBlock("dirt_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.DIRT), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT), true); public static final Block COARSE_DIRT_SLAB = registerMiscBlock("coarse_dirt_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.COARSE_DIRT), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.COARSE_DIRT), true); public static final Block ROOTED_DIRT_SLAB = registerMiscBlock("rooted_dirt_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.ROOTED_DIRT), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.ROOTED_DIRT), true); public static final Block MUD_SLAB = registerMiscBlock("mud_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.MUD), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.MUD), true); public static final Block MOSS_SLAB = registerMiscBlock("moss_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.MOSS_BLOCK), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.MOSS_BLOCK), true); public static final Block PACKED_MUD_SLAB = registerStoneBlock("packed_mud_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD), true); public static final Block PACKED_MUD_VERTICAL_SLAB = registerStoneBlock("packed_mud_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.PACKED_MUD), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD), true); public static final Block PACKED_MUD_STAIRS = registerStoneBlock("packed_mud_stairs", - (settings) -> new StairsBlock(Blocks.PACKED_MUD.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.PACKED_MUD), true); + (settings) -> new StairBlock(Blocks.PACKED_MUD.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD), true); public static final Block PACKED_MUD_WALL = registerStoneBlock("packed_mud_wall", - WallBlock::new,AbstractBlock.Settings.copy(Blocks.PACKED_MUD), true); + WallBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.PACKED_MUD), true); public static final Block CUT_COPPER_WALL = registerMiscBlock("cut_copper_wall", - (settings) -> new OxidizableWallBlock(Oxidizable.OxidationLevel.UNAFFECTED, settings), AbstractBlock.Settings.copy(Blocks.CUT_COPPER_SLAB), true); + (settings) -> new OxidizableWallBlock(WeatheringCopper.WeatherState.UNAFFECTED, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.CUT_COPPER_SLAB), true); public static final Block EXPOSED_CUT_COPPER_WALL = registerMiscBlock("exposed_cut_copper_wall", - (settings) -> new OxidizableWallBlock(Oxidizable.OxidationLevel.EXPOSED, settings), AbstractBlock.Settings.copy(Blocks.EXPOSED_CUT_COPPER_SLAB), true); + (settings) -> new OxidizableWallBlock(WeatheringCopper.WeatherState.EXPOSED, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.EXPOSED_CUT_COPPER_SLAB), true); public static final Block WEATHERED_CUT_COPPER_WALL = registerMiscBlock("weathered_cut_copper_wall", - (settings) -> new OxidizableWallBlock(Oxidizable.OxidationLevel.WEATHERED, settings), AbstractBlock.Settings.copy(Blocks.WEATHERED_CUT_COPPER_SLAB), true); + (settings) -> new OxidizableWallBlock(WeatheringCopper.WeatherState.WEATHERED, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WEATHERED_CUT_COPPER_SLAB), true); public static final Block OXIDIZED_CUT_COPPER_WALL = registerMiscBlock("oxidized_cut_copper_wall", - (settings) -> new OxidizableWallBlock(Oxidizable.OxidationLevel.OXIDIZED, settings), AbstractBlock.Settings.copy(Blocks.OXIDIZED_CUT_COPPER_SLAB), true); + (settings) -> new OxidizableWallBlock(WeatheringCopper.WeatherState.OXIDIZED, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.OXIDIZED_CUT_COPPER_SLAB), true); public static final Block WAXED_CUT_COPPER_WALL = registerMiscBlock("waxed_cut_copper_wall", - WallBlock::new,AbstractBlock.Settings.copy(Blocks.WAXED_CUT_COPPER_SLAB), true); + WallBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WAXED_CUT_COPPER_SLAB), true); public static final Block WAXED_EXPOSED_CUT_COPPER_WALL = registerMiscBlock("waxed_exposed_cut_copper_wall", - WallBlock::new,AbstractBlock.Settings.copy(Blocks.WAXED_EXPOSED_CUT_COPPER_SLAB), true); + WallBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WAXED_EXPOSED_CUT_COPPER_SLAB), true); public static final Block WAXED_WEATHERED_CUT_COPPER_WALL = registerMiscBlock("waxed_weathered_cut_copper_wall", - WallBlock::new,AbstractBlock.Settings.copy(Blocks.WAXED_WEATHERED_CUT_COPPER_SLAB), true); + WallBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WAXED_WEATHERED_CUT_COPPER_SLAB), true); public static final Block WAXED_OXIDIZED_CUT_COPPER_WALL = registerMiscBlock("waxed_oxidized_cut_copper_wall", - WallBlock::new,AbstractBlock.Settings.copy(Blocks.WAXED_OXIDIZED_CUT_COPPER_SLAB), true); + WallBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WAXED_OXIDIZED_CUT_COPPER_SLAB), true); public static final Block BLACK_WOOL_SLAB = registerMiscBlock("black_wool_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block BLUE_WOOL_SLAB = registerMiscBlock("blue_wool_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block BROWN_WOOL_SLAB = registerMiscBlock("brown_wool_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block CYAN_WOOL_SLAB = registerMiscBlock("cyan_wool_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block GRAY_WOOL_SLAB = registerMiscBlock("gray_wool_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block GREEN_WOOL_SLAB = registerMiscBlock("green_wool_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block LIGHT_BLUE_WOOL_SLAB = registerMiscBlock("light_blue_wool_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block LIGHT_GRAY_WOOL_SLAB = registerMiscBlock("light_gray_wool_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block LIME_WOOL_SLAB = registerMiscBlock("lime_wool_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block MAGENTA_WOOL_SLAB = registerMiscBlock("magenta_wool_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block ORANGE_WOOL_SLAB = registerMiscBlock("orange_wool_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block PINK_WOOL_SLAB = registerMiscBlock("pink_wool_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block PURPLE_WOOL_SLAB = registerMiscBlock("purple_wool_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block RED_WOOL_SLAB = registerMiscBlock("red_wool_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block WHITE_WOOL_SLAB = registerMiscBlock("white_wool_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block YELLOW_WOOL_SLAB = registerMiscBlock("yellow_wool_slab", - SlabBlock::new,AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + SlabBlock::new,BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); //endregion //region VANILLA VERTICAL SLABS public static final Block BRICK_VERTICAL_SLAB = registerStoneBlock("brick_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.BRICK_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BRICK_SLAB), true); public static final Block MUD_BRICK_VERTICAL_SLAB = registerStoneBlock("mud_brick_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.MUD_BRICK_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.MUD_BRICK_SLAB), true); public static final Block SANDSTONE_VERTICAL_SLAB = registerStoneBlock("sandstone_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.SANDSTONE_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SANDSTONE_SLAB), true); public static final Block SMOOTH_SANDSTONE_VERTICAL_SLAB = registerStoneBlock("smooth_sandstone_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.SMOOTH_SANDSTONE_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SMOOTH_SANDSTONE_SLAB), true); public static final Block CUT_SANDSTONE_VERTICAL_SLAB = registerStoneBlock("cut_sandstone_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.CUT_SANDSTONE_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CUT_SANDSTONE_SLAB), true); public static final Block RED_SANDSTONE_VERTICAL_SLAB = registerStoneBlock("red_sandstone_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.RED_SANDSTONE_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_SANDSTONE_SLAB), true); public static final Block SMOOTH_RED_SANDSTONE_VERTICAL_SLAB = registerStoneBlock("smooth_red_sandstone_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.SMOOTH_RED_SANDSTONE_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SMOOTH_RED_SANDSTONE_SLAB), true); public static final Block CUT_RED_SANDSTONE_VERTICAL_SLAB = registerStoneBlock("cut_red_sandstone_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.CUT_RED_SANDSTONE_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CUT_RED_SANDSTONE_SLAB), true); public static final Block PRISMARINE_VERTICAL_SLAB = registerStoneBlock("prismarine_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.PRISMARINE_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.PRISMARINE_SLAB), true); public static final Block PRISMARINE_BRICK_VERTICAL_SLAB = registerStoneBlock("prismarine_brick_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.PRISMARINE_BRICK_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.PRISMARINE_BRICK_SLAB), true); public static final Block DARK_PRISMARINE_VERTICAL_SLAB = registerStoneBlock("dark_prismarine_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.DARK_PRISMARINE_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DARK_PRISMARINE_SLAB), true); public static final Block NETHER_BRICK_VERTICAL_SLAB = registerStoneBlock("nether_brick_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.NETHER_BRICK_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.NETHER_BRICK_SLAB), true); public static final Block RED_NETHER_BRICK_VERTICAL_SLAB = registerStoneBlock("red_nether_brick_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.RED_NETHER_BRICK_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_NETHER_BRICK_SLAB), true); public static final Block END_STONE_BRICK_VERTICAL_SLAB = registerStoneBlock("end_stone_brick_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.END_STONE_BRICK_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.END_STONE_BRICK_SLAB), true); public static final Block PURPUR_VERTICAL_SLAB = registerStoneBlock("purpur_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.PURPUR_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.PURPUR_SLAB), true); public static final Block QUARTZ_VERTICAL_SLAB = registerStoneBlock("quartz_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.QUARTZ_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.QUARTZ_SLAB), true); public static final Block SMOOTH_QUARTZ_VERTICAL_SLAB = registerStoneBlock("smooth_quartz_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.SMOOTH_QUARTZ_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SMOOTH_QUARTZ_SLAB), true); public static final Block CUT_COPPER_VERTICAL_SLAB = registerMiscBlock("cut_copper_vertical_slab", - (settings) -> new OxidizableVerticalSlabBlock(Oxidizable.OxidationLevel.UNAFFECTED, settings), AbstractBlock.Settings.copy(Blocks.CUT_COPPER_SLAB), true); + (settings) -> new OxidizableVerticalSlabBlock(WeatheringCopper.WeatherState.UNAFFECTED, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.CUT_COPPER_SLAB), true); public static final Block EXPOSED_CUT_COPPER_VERTICAL_SLAB = registerMiscBlock("exposed_cut_copper_vertical_slab", - (settings) -> new OxidizableVerticalSlabBlock(Oxidizable.OxidationLevel.EXPOSED, settings), AbstractBlock.Settings.copy(Blocks.EXPOSED_CUT_COPPER_SLAB), true); + (settings) -> new OxidizableVerticalSlabBlock(WeatheringCopper.WeatherState.EXPOSED, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.EXPOSED_CUT_COPPER_SLAB), true); public static final Block WEATHERED_CUT_COPPER_VERTICAL_SLAB = registerMiscBlock("weathered_cut_copper_vertical_slab", - (settings) -> new OxidizableVerticalSlabBlock(Oxidizable.OxidationLevel.WEATHERED, settings), AbstractBlock.Settings.copy(Blocks.WEATHERED_CUT_COPPER_SLAB), true); + (settings) -> new OxidizableVerticalSlabBlock(WeatheringCopper.WeatherState.WEATHERED, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WEATHERED_CUT_COPPER_SLAB), true); public static final Block OXIDIZED_CUT_COPPER_VERTICAL_SLAB = registerMiscBlock("oxidized_cut_copper_vertical_slab", - (settings) -> new OxidizableVerticalSlabBlock(Oxidizable.OxidationLevel.OXIDIZED, settings), AbstractBlock.Settings.copy(Blocks.OXIDIZED_CUT_COPPER_SLAB), true); + (settings) -> new OxidizableVerticalSlabBlock(WeatheringCopper.WeatherState.OXIDIZED, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.OXIDIZED_CUT_COPPER_SLAB), true); public static final Block WAXED_CUT_COPPER_VERTICAL_SLAB = registerMiscBlock("waxed_cut_copper_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WAXED_CUT_COPPER_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WAXED_CUT_COPPER_SLAB), true); public static final Block WAXED_EXPOSED_CUT_COPPER_VERTICAL_SLAB = registerMiscBlock("waxed_exposed_cut_copper_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WAXED_EXPOSED_CUT_COPPER_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WAXED_EXPOSED_CUT_COPPER_SLAB), true); public static final Block WAXED_WEATHERED_CUT_COPPER_VERTICAL_SLAB = registerMiscBlock("waxed_weathered_cut_copper_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WAXED_WEATHERED_CUT_COPPER_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WAXED_WEATHERED_CUT_COPPER_SLAB), true); public static final Block WAXED_OXIDIZED_CUT_COPPER_VERTICAL_SLAB = registerMiscBlock("waxed_oxidized_cut_copper_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WAXED_OXIDIZED_CUT_COPPER_SLAB), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WAXED_OXIDIZED_CUT_COPPER_SLAB), true); public static final Block BLACK_WOOL_VERTICAL_SLAB = registerMiscBlock("black_wool_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block BLUE_WOOL_VERTICAL_SLAB = registerMiscBlock("blue_wool_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block BROWN_WOOL_VERTICAL_SLAB = registerMiscBlock("brown_wool_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block CYAN_WOOL_VERTICAL_SLAB = registerMiscBlock("cyan_wool_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block GRAY_WOOL_VERTICAL_SLAB = registerMiscBlock("gray_wool_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block GREEN_WOOL_VERTICAL_SLAB = registerMiscBlock("green_wool_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block LIGHT_BLUE_WOOL_VERTICAL_SLAB = registerMiscBlock("light_blue_wool_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block LIGHT_GRAY_WOOL_VERTICAL_SLAB = registerMiscBlock("light_gray_wool_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block LIME_WOOL_VERTICAL_SLAB = registerMiscBlock("lime_wool_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block MAGENTA_WOOL_VERTICAL_SLAB = registerMiscBlock("magenta_wool_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block ORANGE_WOOL_VERTICAL_SLAB = registerMiscBlock("orange_wool_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block PINK_WOOL_VERTICAL_SLAB = registerMiscBlock("pink_wool_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block PURPLE_WOOL_VERTICAL_SLAB = registerMiscBlock("purple_wool_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block RED_WOOL_VERTICAL_SLAB = registerMiscBlock("red_wool_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block WHITE_WOOL_VERTICAL_SLAB = registerMiscBlock("white_wool_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block YELLOW_WOOL_VERTICAL_SLAB = registerMiscBlock("yellow_wool_vertical_slab", - VerticalSlabBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + VerticalSlabBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); //endregion //region VANILLA STAIRS public static final Block DIRT_STAIRS = registerMiscBlock("dirt_stairs", - (settings) -> new StairsBlock(Blocks.DIRT.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.DIRT), true); + (settings) -> new StairBlock(Blocks.DIRT.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT), true); public static final Block COARSE_DIRT_STAIRS = registerMiscBlock("coarse_dirt_stairs", - (settings) -> new StairsBlock(Blocks.COARSE_DIRT.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.COARSE_DIRT), true); + (settings) -> new StairBlock(Blocks.COARSE_DIRT.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.COARSE_DIRT), true); public static final Block ROOTED_DIRT_STAIRS = registerMiscBlock("rooted_dirt_stairs", - (settings) -> new StairsBlock(Blocks.ROOTED_DIRT.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.ROOTED_DIRT), true); + (settings) -> new StairBlock(Blocks.ROOTED_DIRT.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.ROOTED_DIRT), true); public static final Block MUD_STAIRS = registerMiscBlock("mud_stairs", - (settings) -> new StairsBlock(Blocks.MUD.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.DIRT).sounds(BlockSoundGroup.MUD), true); + (settings) -> new StairBlock(Blocks.MUD.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DIRT).sound(SoundType.MUD), true); public static final Block MOSS_STAIRS = registerMiscBlock("moss_stairs", - (settings) -> new StairsBlock(Blocks.MOSS_BLOCK.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.MOSS_BLOCK), true); + (settings) -> new StairBlock(Blocks.MOSS_BLOCK.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.MOSS_BLOCK), true); public static final Block BLACK_WOOL_STAIRS = registerMiscBlock("black_wool_stairs", - (settings) -> new StairsBlock(Blocks.BLACK_WOOL.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + (settings) -> new StairBlock(Blocks.BLACK_WOOL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block BLUE_WOOL_STAIRS = registerMiscBlock("blue_wool_stairs", - (settings) -> new StairsBlock(Blocks.BLACK_WOOL.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + (settings) -> new StairBlock(Blocks.BLACK_WOOL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block BROWN_WOOL_STAIRS = registerMiscBlock("brown_wool_stairs", - (settings) -> new StairsBlock(Blocks.BLACK_WOOL.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + (settings) -> new StairBlock(Blocks.BLACK_WOOL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block CYAN_WOOL_STAIRS = registerMiscBlock("cyan_wool_stairs", - (settings) -> new StairsBlock(Blocks.BLACK_WOOL.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + (settings) -> new StairBlock(Blocks.BLACK_WOOL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block GRAY_WOOL_STAIRS = registerMiscBlock("gray_wool_stairs", - (settings) -> new StairsBlock(Blocks.BLACK_WOOL.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + (settings) -> new StairBlock(Blocks.BLACK_WOOL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block GREEN_WOOL_STAIRS = registerMiscBlock("green_wool_stairs", - (settings) -> new StairsBlock(Blocks.BLACK_WOOL.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + (settings) -> new StairBlock(Blocks.BLACK_WOOL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block LIGHT_BLUE_WOOL_STAIRS = registerMiscBlock("light_blue_wool_stairs", - (settings) -> new StairsBlock(Blocks.BLACK_WOOL.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + (settings) -> new StairBlock(Blocks.BLACK_WOOL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block LIGHT_GRAY_WOOL_STAIRS = registerMiscBlock("light_gray_wool_stairs", - (settings) -> new StairsBlock(Blocks.BLACK_WOOL.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + (settings) -> new StairBlock(Blocks.BLACK_WOOL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block LIME_WOOL_STAIRS = registerMiscBlock("lime_wool_stairs", - (settings) -> new StairsBlock(Blocks.BLACK_WOOL.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + (settings) -> new StairBlock(Blocks.BLACK_WOOL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block MAGENTA_WOOL_STAIRS = registerMiscBlock("magenta_wool_stairs", - (settings) -> new StairsBlock(Blocks.BLACK_WOOL.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + (settings) -> new StairBlock(Blocks.BLACK_WOOL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block ORANGE_WOOL_STAIRS = registerMiscBlock("orange_wool_stairs", - (settings) -> new StairsBlock(Blocks.BLACK_WOOL.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + (settings) -> new StairBlock(Blocks.BLACK_WOOL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block PINK_WOOL_STAIRS = registerMiscBlock("pink_wool_stairs", - (settings) -> new StairsBlock(Blocks.BLACK_WOOL.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + (settings) -> new StairBlock(Blocks.BLACK_WOOL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block PURPLE_WOOL_STAIRS = registerMiscBlock("purple_wool_stairs", - (settings) -> new StairsBlock(Blocks.BLACK_WOOL.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + (settings) -> new StairBlock(Blocks.BLACK_WOOL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block RED_WOOL_STAIRS = registerMiscBlock("red_wool_stairs", - (settings) -> new StairsBlock(Blocks.BLACK_WOOL.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + (settings) -> new StairBlock(Blocks.BLACK_WOOL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block WHITE_WOOL_STAIRS = registerMiscBlock("white_wool_stairs", - (settings) -> new StairsBlock(Blocks.BLACK_WOOL.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + (settings) -> new StairBlock(Blocks.BLACK_WOOL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); public static final Block YELLOW_WOOL_STAIRS = registerMiscBlock("yellow_wool_stairs", - (settings) -> new StairsBlock(Blocks.BLACK_WOOL.getDefaultState(), settings), AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).burnable(), true); + (settings) -> new StairBlock(Blocks.BLACK_WOOL.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).ignitedByLava(), true); //endregion //region VANILLA LAYERS public static final Block GRAVEL_LAYER = registerMiscBlock("gravel_layer", - (settings) -> new LayersBlock(settings, Blocks.GRAVEL), AbstractBlock.Settings.copy(Blocks.GRAVEL), false); + (settings) -> new LayersBlock(settings, Blocks.GRAVEL), BlockBehaviour.Properties.ofFullCopy(Blocks.GRAVEL), false); public static final Block SAND_LAYER = registerMiscBlock("sand_layer", - (settings) -> new LayersBlock(settings, Blocks.SAND), AbstractBlock.Settings.copy(Blocks.SAND), false); + (settings) -> new LayersBlock(settings, Blocks.SAND), BlockBehaviour.Properties.ofFullCopy(Blocks.SAND), false); public static final Block BLACK_SAND_LAYER = registerMiscBlock("black_sand_layer", - (settings) -> new LayersBlock(settings, BLACK_SAND), AbstractBlock.Settings.copy(Blocks.SAND), false); + (settings) -> new LayersBlock(settings, BLACK_SAND), BlockBehaviour.Properties.ofFullCopy(Blocks.SAND), false); public static final Block WHITE_SAND_LAYER = registerMiscBlock("white_sand_layer", - (settings) -> new LayersBlock(settings, WHITE_SAND), AbstractBlock.Settings.copy(Blocks.SAND), false); + (settings) -> new LayersBlock(settings, WHITE_SAND), BlockBehaviour.Properties.ofFullCopy(Blocks.SAND), false); //endregion //region FOOD public static final Block LAYERED_CAKE = registerTablessBlock("layered_cake", - LayeredCakeBlock::new, AbstractBlock.Settings.copy(Blocks.CAKE), false); + LayeredCakeBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CAKE), false); public static final Block CANDLES_LAYERED_CAKE = registerTablessBlock("candles_layered_cake", - (settings) -> new CandleLayeredCakeBlock(Blocks.CANDLE, settings), AbstractBlock.Settings.copy(Blocks.BLACK_CANDLE_CAKE), false); + (settings) -> new CandleLayeredCakeBlock(Blocks.CANDLE, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_CANDLE_CAKE), false); public static final Block WHITE_CANDLES_LAYERED_CAKE = registerTablessBlock("white_candles_layered_cake", - (settings) -> new CandleLayeredCakeBlock(Blocks.WHITE_CANDLE, settings), AbstractBlock.Settings.copy(Blocks.BLACK_CANDLE_CAKE), false); + (settings) -> new CandleLayeredCakeBlock(Blocks.WHITE_CANDLE, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_CANDLE_CAKE), false); public static final Block ORANGE_CANDLES_LAYERED_CAKE = registerTablessBlock("orange_candles_layered_cake", - (settings) -> new CandleLayeredCakeBlock(Blocks.ORANGE_CANDLE, settings), AbstractBlock.Settings.copy(Blocks.BLACK_CANDLE_CAKE), false); + (settings) -> new CandleLayeredCakeBlock(Blocks.ORANGE_CANDLE, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_CANDLE_CAKE), false); public static final Block MAGENTA_CANDLES_LAYERED_CAKE = registerTablessBlock("magenta_candles_layered_cake", - (settings) -> new CandleLayeredCakeBlock(Blocks.MAGENTA_CANDLE, settings), AbstractBlock.Settings.copy(Blocks.BLACK_CANDLE_CAKE), false); + (settings) -> new CandleLayeredCakeBlock(Blocks.MAGENTA_CANDLE, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_CANDLE_CAKE), false); public static final Block LIGHT_BLUE_CANDLES_LAYERED_CAKE = registerTablessBlock("light_blue_candles_layered_cake", - (settings) -> new CandleLayeredCakeBlock(Blocks.LIGHT_BLUE_CANDLE, settings), AbstractBlock.Settings.copy(Blocks.BLACK_CANDLE_CAKE), false); + (settings) -> new CandleLayeredCakeBlock(Blocks.LIGHT_BLUE_CANDLE, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_CANDLE_CAKE), false); public static final Block YELLOW_CANDLES_LAYERED_CAKE = registerTablessBlock("yellow_candles_layered_cake", - (settings) -> new CandleLayeredCakeBlock(Blocks.YELLOW_CANDLE, settings), AbstractBlock.Settings.copy(Blocks.BLACK_CANDLE_CAKE), false); + (settings) -> new CandleLayeredCakeBlock(Blocks.YELLOW_CANDLE, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_CANDLE_CAKE), false); public static final Block LIME_CANDLES_LAYERED_CAKE = registerTablessBlock("lime_candles_layered_cake", - (settings) -> new CandleLayeredCakeBlock(Blocks.LIME_CANDLE, settings), AbstractBlock.Settings.copy(Blocks.BLACK_CANDLE_CAKE), false); + (settings) -> new CandleLayeredCakeBlock(Blocks.LIME_CANDLE, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_CANDLE_CAKE), false); public static final Block PINK_CANDLES_LAYERED_CAKE = registerTablessBlock("pink_candles_layered_cake", - (settings) -> new CandleLayeredCakeBlock(Blocks.PINK_CANDLE, settings), AbstractBlock.Settings.copy(Blocks.BLACK_CANDLE_CAKE), false); + (settings) -> new CandleLayeredCakeBlock(Blocks.PINK_CANDLE, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_CANDLE_CAKE), false); public static final Block GRAY_CANDLES_LAYERED_CAKE = registerTablessBlock("gray_candles_layered_cake", - (settings) -> new CandleLayeredCakeBlock(Blocks.GRAY_CANDLE, settings), AbstractBlock.Settings.copy(Blocks.BLACK_CANDLE_CAKE), false); + (settings) -> new CandleLayeredCakeBlock(Blocks.GRAY_CANDLE, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_CANDLE_CAKE), false); public static final Block LIGHT_GRAY_CANDLES_LAYERED_CAKE = registerTablessBlock("light_gray_candles_layered_cake", - (settings) -> new CandleLayeredCakeBlock(Blocks.LIGHT_GRAY_CANDLE, settings), AbstractBlock.Settings.copy(Blocks.BLACK_CANDLE_CAKE), false); + (settings) -> new CandleLayeredCakeBlock(Blocks.LIGHT_GRAY_CANDLE, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_CANDLE_CAKE), false); public static final Block CYAN_CANDLES_LAYERED_CAKE = registerTablessBlock("cyan_candles_layered_cake", - (settings) -> new CandleLayeredCakeBlock(Blocks.CYAN_CANDLE, settings), AbstractBlock.Settings.copy(Blocks.BLACK_CANDLE_CAKE), false); + (settings) -> new CandleLayeredCakeBlock(Blocks.CYAN_CANDLE, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_CANDLE_CAKE), false); public static final Block PURPLE_CANDLES_LAYERED_CAKE = registerTablessBlock("purple_candles_layered_cake", - (settings) -> new CandleLayeredCakeBlock(Blocks.PURPLE_CANDLE, settings), AbstractBlock.Settings.copy(Blocks.BLACK_CANDLE_CAKE), false); + (settings) -> new CandleLayeredCakeBlock(Blocks.PURPLE_CANDLE, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_CANDLE_CAKE), false); public static final Block BLUE_CANDLES_LAYERED_CAKE = registerTablessBlock("blue_candles_layered_cake", - (settings) -> new CandleLayeredCakeBlock(Blocks.BLUE_CANDLE, settings), AbstractBlock.Settings.copy(Blocks.BLACK_CANDLE_CAKE), false); + (settings) -> new CandleLayeredCakeBlock(Blocks.BLUE_CANDLE, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_CANDLE_CAKE), false); public static final Block BROWN_CANDLES_LAYERED_CAKE = registerTablessBlock("brown_candles_layered_cake", - (settings) -> new CandleLayeredCakeBlock(Blocks.BROWN_CANDLE, settings), AbstractBlock.Settings.copy(Blocks.BLACK_CANDLE_CAKE), false); + (settings) -> new CandleLayeredCakeBlock(Blocks.BROWN_CANDLE, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_CANDLE_CAKE), false); public static final Block GREEN_CANDLES_LAYERED_CAKE = registerTablessBlock("green_candles_layered_cake", - (settings) -> new CandleLayeredCakeBlock(Blocks.GREEN_CANDLE, settings), AbstractBlock.Settings.copy(Blocks.BLACK_CANDLE_CAKE), false); + (settings) -> new CandleLayeredCakeBlock(Blocks.GREEN_CANDLE, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_CANDLE_CAKE), false); public static final Block RED_CANDLES_LAYERED_CAKE = registerTablessBlock("red_candles_layered_cake", - (settings) -> new CandleLayeredCakeBlock(Blocks.RED_CANDLE, settings), AbstractBlock.Settings.copy(Blocks.BLACK_CANDLE_CAKE), false); + (settings) -> new CandleLayeredCakeBlock(Blocks.RED_CANDLE, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_CANDLE_CAKE), false); public static final Block BLACK_CANDLES_LAYERED_CAKE = registerTablessBlock("black_candles_layered_cake", - (settings) -> new CandleLayeredCakeBlock(Blocks.BLACK_CANDLE, settings), AbstractBlock.Settings.copy(Blocks.BLACK_CANDLE_CAKE), false); + (settings) -> new CandleLayeredCakeBlock(Blocks.BLACK_CANDLE, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_CANDLE_CAKE), false); // - public static Block registerBlock(String name, Function factory, AbstractBlock.Settings settings, boolean drop, List group){ - Block block = (Block)factory.apply(settings.registryKey(keyOfBlock(name))); + public static Block registerBlock(String name, Function factory, BlockBehaviour.Properties settings, boolean drop, List group){ + Block block = factory.apply(settings); registerBlockItem(name, block); if(drop){ - BlockDrops.blocks.add(block); + DynamicBlockDrops.add(block); } - group.add(block.asItem().getDefaultStack()); + group.add(block.asItem().getDefaultInstance()); TranslationEntries.blockEntries.add(block); - RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(Registries.BLOCK, name)); - return Registry.register(Registries.BLOCK, keyOfBlock(name), block); + RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(BuiltInRegistries.BLOCK, name)); + return RegistrationBridge.register(BuiltInRegistries.BLOCK, keyOfBlock(name).location(), block); } - public static Block registerTablessBlock(String name, Function factory, AbstractBlock.Settings settings, boolean drop) { - Block block = factory.apply(settings.registryKey(ModBlocks.keyOfBlock(name))); + public static Block registerTablessBlock(String name, Function factory, BlockBehaviour.Properties settings, boolean drop) { + Block block = factory.apply(settings); if(drop){ - BlockDrops.blocks.add(block); + DynamicBlockDrops.add(block); } - RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(Registries.BLOCK, name)); + RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(BuiltInRegistries.BLOCK, name)); - return Registry.register(Registries.BLOCK, ModBlocks.keyOfBlock(name), block); + return RegistrationBridge.register(BuiltInRegistries.BLOCK, ModBlocks.keyOfBlock(name).location(), block); } - public static Block registerStoneBlock(String name, Function factory, AbstractBlock.Settings settings, boolean drop) { + public static Block registerStoneBlock(String name, Function factory, BlockBehaviour.Properties settings, boolean drop) { return registerBlock(name, factory, settings, drop, ItemGroupsME.STONE_BLOCKS_CONTENTS); } - public static Block registerWoodBlock(String name, Function factory, AbstractBlock.Settings settings, boolean drop) { + public static Block registerWoodBlock(String name, Function factory, BlockBehaviour.Properties settings, boolean drop) { return registerBlock(name, factory, settings, drop, ItemGroupsME.WOOD_BLOCKS_CONTENTS); } - public static Block registerMiscBlock(String name, Function factory, AbstractBlock.Settings settings, boolean drop) { + public static Block registerMiscBlock(String name, Function factory, BlockBehaviour.Properties settings, boolean drop) { return registerBlock(name, factory, settings, drop, ItemGroupsME.MISC_BLOCKS_CONTENTS); } static void registerBlockItem(String name, Block block) { - var item = Registry.register(Registries.ITEM, Identifier.of(MiddleEarth.MOD_ID, name), - new BlockItem(block, new Item.Settings().registryKey(keyOfItem(name)))); - Item.BLOCK_ITEMS.put(block, item); - RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(Registries.ITEM, name)); + var item = RegistrationBridge.register(BuiltInRegistries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, name), + new BlockItem(block, new Item.Properties())); + Item.BY_BLOCK.put(block, item); + RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(BuiltInRegistries.ITEM, name)); + } + + public static ResourceKey keyOfBlock(String id) { + return ResourceKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, id)); + } + + public static ResourceKey keyOfItem(String id) { + return ResourceKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, id)); } - public static RegistryKey keyOfBlock(String id) { - return RegistryKey.of(RegistryKeys.BLOCK, Identifier.of(MiddleEarth.MOD_ID, id)); + public static boolean never(BlockState state, BlockGetter world, BlockPos pos) { + return false; } - public static RegistryKey keyOfItem(String id) { - return RegistryKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, id)); + public static boolean never(BlockState state, BlockGetter world, BlockPos pos, EntityType entityType) { + return false; } public static void registerModBlocks() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/ModDecorativeBlocks.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/ModDecorativeBlocks.java index 51af72c522..ea23eacf0e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/ModDecorativeBlocks.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/ModDecorativeBlocks.java @@ -1,6 +1,8 @@ + package net.sevenstars.middleearth.block.registration; -import net.minecraft.block.piston.PistonBehavior; +import net.sevenstars.api.registries.RegistrationBridge; + import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.*; import net.sevenstars.middleearth.block.special.artefact.arkenstone.ArkenstoneBlock; @@ -8,7 +10,12 @@ import net.sevenstars.middleearth.block.special.artisantable.ArtisanTable; import net.sevenstars.middleearth.block.special.beds.CustomBedBlock; import net.sevenstars.middleearth.block.special.bellows.BellowsBlock; -import net.sevenstars.middleearth.block.special.candles.*; +import net.sevenstars.middleearth.block.special.candles.CandleHolderBlock; +import net.sevenstars.middleearth.block.special.candles.CandleStickBlock; +import net.sevenstars.middleearth.block.special.candles.ChandelierBlock; +import net.sevenstars.middleearth.block.special.candles.CeramicLampBlock; +import net.sevenstars.middleearth.block.special.candles.SmallChandelierBlock; +import net.sevenstars.middleearth.block.special.candles.SkullCandleBlock; import net.sevenstars.middleearth.block.special.coffers.*; import net.sevenstars.middleearth.block.special.curtains.CurtainsBlock; import net.sevenstars.middleearth.block.special.curtains.SmallCurtainsBlock; @@ -41,753 +48,823 @@ import net.sevenstars.middleearth.block.special.wood_pile.WoodPileBlock; import net.sevenstars.middleearth.datageneration.content.TranslationEntries; import net.sevenstars.middleearth.item.utils.ItemGroupsME; -import net.minecraft.block.*; -import net.minecraft.block.enums.NoteBlockInstrument; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.sound.BlockSoundGroup; -import net.minecraft.state.property.Properties; -import net.minecraft.util.DyeColor; +import net.minecraft.world.level.block.*; +import net.minecraft.core.Registry; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ChainBlock; +import net.minecraft.world.level.block.ChiseledBookShelfBlock; +import net.minecraft.world.level.block.FlowerPotBlock; +import net.minecraft.world.level.block.IronBarsBlock; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.TransparentBlock; +import net.minecraft.world.level.block.TrialSpawnerBlock; +import net.minecraft.world.level.block.VaultBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; +import net.minecraft.world.level.material.MapColor; +import net.minecraft.world.level.material.PushReaction; import net.sevenstars.middleearth.registries.RegistryAliasesME; +import java.util.ArrayList; +import java.util.List; import java.util.function.Function; +import java.util.function.Supplier; import java.util.function.ToIntFunction; public class ModDecorativeBlocks { + private record FlowerPotRegistration(Supplier content, FlowerPotBlock pot) { + } + + private static final List FLOWER_POTS = new ArrayList<>(); + private static boolean flowerPotsRegistered; public static final Block SILVER_LANTERN = registerBlock("silver_lantern", - SilverLanternBlock::new, AbstractBlock.Settings.create().luminance(createLightLevelFromLitBlockState(15)).strength(1.0f)); + SilverLanternBlock::new, BlockBehaviour.Properties.of().lightLevel(createLightLevelFromLitBlockState(15)).strength(1.0f)); public static final Block WALL_SILVER_LANTERN = registerBlock("silver_lantern_wall", - WallSilverLanternBlock::new, AbstractBlock.Settings.create().luminance(createLightLevelFromLitBlockState(15)).strength(1.0f)); + WallSilverLanternBlock::new, BlockBehaviour.Properties.of().lightLevel(createLightLevelFromLitBlockState(15)).strength(1.0f)); public static final Block LEAD_LANTERN = registerBlock("lead_lantern", - LeadLanternBlock::new, AbstractBlock.Settings.create().luminance(createLightLevelFromLitBlockState(15)).strength(1.0f)); + LeadLanternBlock::new, BlockBehaviour.Properties.of().lightLevel(createLightLevelFromLitBlockState(15)).strength(1.0f)); public static final Block WALL_LEAD_LANTERN = registerBlock("lead_lantern_wall", - WallLeadLanternBlock::new, AbstractBlock.Settings.create().luminance(createLightLevelFromLitBlockState(15)).strength(1.0f)); + WallLeadLanternBlock::new, BlockBehaviour.Properties.of().lightLevel(createLightLevelFromLitBlockState(15)).strength(1.0f)); public static final Block CRUDE_LANTERN = registerBlock("crude_lantern", - CrudeLanternBlock::new, AbstractBlock.Settings.create().luminance(createLightLevelFromLitBlockState(15)).strength(1.0f).nonOpaque()); + CrudeLanternBlock::new, BlockBehaviour.Properties.of().lightLevel(createLightLevelFromLitBlockState(15)).strength(1.0f).noOcclusion()); public static final Block WALL_CRUDE_LANTERN = registerBlock("crude_lantern_wall", - WallCrudeLanternBlock::new, AbstractBlock.Settings.create().luminance(createLightLevelFromLitBlockState(15)).strength(1.0f)); + WallCrudeLanternBlock::new, BlockBehaviour.Properties.of().lightLevel(createLightLevelFromLitBlockState(15)).strength(1.0f)); public static final Block ELVEN_LANTERN = registerBlock("elven_lantern", - ElvenLanternBlock::new, AbstractBlock.Settings.create().luminance(createLightLevelFromLitBlockState(15)).strength(1.0f)); + ElvenLanternBlock::new, BlockBehaviour.Properties.of().lightLevel(createLightLevelFromLitBlockState(15)).strength(1.0f)); public static final Block WALL_ELVEN_LANTERN = registerBlock("elven_lantern_wall", - WallElvenLanternBlock::new, AbstractBlock.Settings.create().luminance(createLightLevelFromLitBlockState(15)).strength(1.0f)); + WallElvenLanternBlock::new, BlockBehaviour.Properties.of().lightLevel(createLightLevelFromLitBlockState(15)).strength(1.0f)); public static final Block DWARVEN_LANTERN = registerBlock("dwarven_lantern", - DwarvenLanternBlock::new, AbstractBlock.Settings.create().luminance(createLightLevelFromLitBlockState(15)).strength(1.0f).nonOpaque()); + DwarvenLanternBlock::new, BlockBehaviour.Properties.of().lightLevel(createLightLevelFromLitBlockState(15)).strength(1.0f).noOcclusion()); public static final Block WALL_DWARVEN_LANTERN = registerBlock("dwarven_lantern_wall", - WallDwarvenLanternBlock::new, AbstractBlock.Settings.create().luminance(createLightLevelFromLitBlockState(15)).strength(1.0f)); + WallDwarvenLanternBlock::new, BlockBehaviour.Properties.of().lightLevel(createLightLevelFromLitBlockState(15)).strength(1.0f)); public static final Block CRYSTAL_LAMP = registerBlock("crystal_lamp", - CrystalLampBlock::new, AbstractBlock.Settings.create().luminance(createLightLevelFromLitBlockState(15)).strength(1.0f).nonOpaque()); + CrystalLampBlock::new, BlockBehaviour.Properties.of().lightLevel(createLightLevelFromLitBlockState(15)).strength(1.0f).noOcclusion()); public static final Block WALL_CRYSTAL_LAMP = registerBlock("crystal_lamp_wall", - WallCrystalLampBlock::new, AbstractBlock.Settings.create().luminance(createLightLevelFromLitBlockState(15)).strength(1.0f)); + WallCrystalLampBlock::new, BlockBehaviour.Properties.of().lightLevel(createLightLevelFromLitBlockState(15)).strength(1.0f)); public static final Block TREATED_STEEL_LANTERN = registerBlock("treated_steel_lantern", - ShireLanternBlock::new, AbstractBlock.Settings.create().luminance(createLightLevelFromLitBlockState(15)).strength(1.0f).nonOpaque()); + ShireLanternBlock::new, BlockBehaviour.Properties.of().lightLevel(createLightLevelFromLitBlockState(15)).strength(1.0f).noOcclusion()); public static final Block WALL_TREATED_STEEL_LANTERN = registerBlock("treated_steel_lantern_wall", - WallShireLanternBlock::new, AbstractBlock.Settings.create().luminance(createLightLevelFromLitBlockState(15)).strength(1.0f)); + WallShireLanternBlock::new, BlockBehaviour.Properties.of().lightLevel(createLightLevelFromLitBlockState(15)).strength(1.0f)); public static final Block FORGE = registerBlock("forge", - ForgeBlock::new, AbstractBlock.Settings.copy(Blocks.BRICKS).luminance(createLightLevelFromLitBlockState(15)).strength(1.65f).requiresTool()); + ForgeBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BRICKS).lightLevel(createLightLevelFromLitBlockState(15)).strength(1.65f).requiresCorrectToolForDrops()); public static final Block STONE_ANVIL = registerBlock("stone_anvil", - StoneAnvilBlock::new, AbstractBlock.Settings.copy(Blocks.STONE).requiresTool().nonOpaque()); + StoneAnvilBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).requiresCorrectToolForDrops().noOcclusion()); public static final Block TREATED_ANVIL = registerBlock("treated_anvil", - TreatedAnvilblock::new, AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).strength(1.65f).requiresTool().nonOpaque()); + TreatedAnvilblock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).strength(1.65f).requiresCorrectToolForDrops().noOcclusion()); public static final Block DWARVEN_TREATED_ANVIL = registerBlock("dwarven_treated_anvil", - DwarvenShapingAnvilBlock::new, AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).strength(1.65f).requiresTool().nonOpaque()); + DwarvenShapingAnvilBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).strength(1.65f).requiresCorrectToolForDrops().noOcclusion()); public static final Block ELVEN_TREATED_ANVIL = registerBlock("elven_treated_anvil", - ElvenTreatedAnvilblock::new, AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).strength(1.65f).requiresTool().nonOpaque()); + ElvenTreatedAnvilblock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).strength(1.65f).requiresCorrectToolForDrops().noOcclusion()); public static final Block ORCISH_TREATED_ANVIL = registerBlock("orcish_treated_anvil", - OrcishTreatedAnvilblock::new, AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).strength(1.65f).requiresTool().nonOpaque()); + OrcishTreatedAnvilblock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).strength(1.65f).requiresCorrectToolForDrops().noOcclusion()); public static final Block BELLOWS = registerBlock("bellows", - BellowsBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + BellowsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block ARTISAN_TABLE = registerBlock("artisan_table", - ArtisanTable::new, AbstractBlock.Settings.copy(Blocks.SMITHING_TABLE).nonOpaque()); + ArtisanTable::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SMITHING_TABLE).noOcclusion()); public static final Block ORCISH_ARTISAN_TABLE = registerBlock("orcish_artisan_table", - ArtisanTable::new, AbstractBlock.Settings.copy(Blocks.SMITHING_TABLE).nonOpaque()); + ArtisanTable::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SMITHING_TABLE).noOcclusion()); public static final Block INSCRIPTION_TABLE = registerBlock("inscription_table", - InscriptionTableblock::new, AbstractBlock.Settings.copy(Blocks.SMITHING_TABLE).nonOpaque()); + InscriptionTableblock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SMITHING_TABLE).noOcclusion()); public static final Block STRUCTURE_MANAGER = registerBlock("structure_manager", - StructureManagerBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + StructureManagerBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block ORC_STRUCTURE_MANAGER = registerBlock("orc_structure_manager", - StructureManagerBlock::new, AbstractBlock.Settings.copy(Blocks.DARK_OAK_PLANKS).nonOpaque()); + StructureManagerBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DARK_OAK_PLANKS).noOcclusion()); public static final Block STRUCTURE_NEST = registerBlock("structure_nest", - StructureNestBlock::new, AbstractBlock.Settings.create().strength(-1.0F, 3600000.8F).noCollision().dropsNothing().nonOpaque().allowsSpawning(Blocks::never).noBlockBreakParticles().pistonBehavior(PistonBehavior.BLOCK)); + StructureNestBlock::new, BlockBehaviour.Properties.of().strength(-1.0F, 3600000.8F).noCollission().noLootTable().noOcclusion().isValidSpawn(ModBlocks::never).noTerrainParticles().pushReaction(PushReaction.BLOCK)); public static final Block BRIGAND_TRIAL_SPAWNER = registerBlock("brigand_trial_spawner", - TrialSpawnerBlock::new, AbstractBlock.Settings.copy(Blocks.TRIAL_SPAWNER)); + TrialSpawnerBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.TRIAL_SPAWNER)); public static final Block BRIGAND_VAULT = registerBlock("brigand_vault", - VaultBlock::new, AbstractBlock.Settings.copy(Blocks.VAULT).nonOpaque()); + VaultBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.VAULT).noOcclusion()); public static final Block SPIDER_TRIAL_SPAWNER = registerBlock("spider_trial_spawner", - TrialSpawnerBlock::new, AbstractBlock.Settings.copy(Blocks.TRIAL_SPAWNER)); + TrialSpawnerBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.TRIAL_SPAWNER)); public static final Block SPIDER_VAULT = registerBlock("spider_vault", - VaultBlock::new, AbstractBlock.Settings.copy(Blocks.VAULT).nonOpaque()); + VaultBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.VAULT).noOcclusion()); public static final Block SMALL_CRATE = registerBlock("small_crate", - CrateBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.OAK_TAN).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sounds(BlockSoundGroup.WOOD).nonOpaque()); + CrateBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).noOcclusion()); public static final Block THIN_BARREL = registerBlock("thin_barrel", - ThinBarrelBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.OAK_TAN).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sounds(BlockSoundGroup.WOOD).nonOpaque()); + ThinBarrelBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(2.0F, 3.0F).sound(SoundType.WOOD).noOcclusion()); public static final Block LARCH_COFFER = registerBlock("larch_coffer", - LarchCofferBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.OAK_TAN) - .instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0F).sounds(BlockSoundGroup.WOOD).nonOpaque()); + LarchCofferBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.WOOD) + .instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0F).sound(SoundType.WOOD).noOcclusion()); public static final Block PINE_COFFER = registerBlock("pine_coffer", - PineCofferBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.OAK_TAN) - .instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0F).sounds(BlockSoundGroup.WOOD).nonOpaque()); + PineCofferBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.WOOD) + .instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0F).sound(SoundType.WOOD).noOcclusion()); public static final Block SPRUCE_COFFER = registerBlock("spruce_coffer", - SpruceCofferBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.SPRUCE_BROWN) - .instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0F).sounds(BlockSoundGroup.WOOD).nonOpaque()); + SpruceCofferBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.PODZOL) + .instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0F).sound(SoundType.WOOD).noOcclusion()); public static final Block FIR_COFFER = registerBlock("fir_coffer", - FirCofferBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.OAK_TAN) - .instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0F).sounds(BlockSoundGroup.WOOD).nonOpaque()); + FirCofferBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.WOOD) + .instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0F).sound(SoundType.WOOD).noOcclusion()); public static final Block BEECH_COFFER = registerBlock("beech_coffer", - BeechCofferBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.OAK_TAN) - .instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0F).sounds(BlockSoundGroup.WOOD).nonOpaque()); + BeechCofferBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.WOOD) + .instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0F).sound(SoundType.WOOD).noOcclusion()); public static final Block CHESTNUT_COFFER = registerBlock("chestnut_coffer", - ChestnutCofferBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.OAK_TAN) - .instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0F).sounds(BlockSoundGroup.WOOD).nonOpaque()); + ChestnutCofferBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.WOOD) + .instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0F).sound(SoundType.WOOD).noOcclusion()); public static final Block OAK_COFFER = registerBlock("oak_coffer", - OakCofferBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.OAK_TAN) - .instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0F).sounds(BlockSoundGroup.WOOD).nonOpaque()); + OakCofferBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.WOOD) + .instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0F).sound(SoundType.WOOD).noOcclusion()); public static final Block WILLOW_COFFER = registerBlock("willow_coffer", - WillowCofferBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.OAK_TAN) - .instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0F).sounds(BlockSoundGroup.WOOD).nonOpaque()); + WillowCofferBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.WOOD) + .instrument(NoteBlockInstrument.BASS).strength(2.0f, 3.0F).sound(SoundType.WOOD).noOcclusion()); public static final Block REINFORCED_CHEST = registerBlock("reinforced_chest", - ReinforcedChestBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.OAK_TAN).instrument(NoteBlockInstrument.BASS).strength(5.0f).sounds(BlockSoundGroup.WOOD).nonOpaque().requiresTool()); + ReinforcedChestBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.WOOD).instrument(NoteBlockInstrument.BASS).strength(5.0f).sound(SoundType.WOOD).noOcclusion().requiresCorrectToolForDrops()); public static final Block SACK = registerBlock("sack", - SackBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.TERRACOTTA_WHITE).sounds(BlockSoundGroup.WOOL).nonOpaque()); + SackBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.TERRACOTTA_WHITE).sound(SoundType.WOOL).noOcclusion()); public static final Block WOOD_PILE = registerBlock("wood_pile", - WoodPileBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).strength(1.0f).nonOpaque()); + WoodPileBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).strength(1.0f).noOcclusion()); public static final Block OLD_SKULL = registerBlockWithItem("old_skull", - OldSkullBlock::new, AbstractBlock.Settings.copy(Blocks.SKELETON_SKULL).nonOpaque().sounds(BlockSoundGroup.BONE)); + OldSkullBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SKELETON_SKULL) + .noOcclusion().sound(SoundType.BONE_BLOCK)); public static final Block SKELETON = registerBlockWithItem("skeleton", - SkeletonBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.PALE_YELLOW) - .instrument(NoteBlockInstrument.XYLOPHONE).strength(0.5F).sounds(BlockSoundGroup.BONE)); + SkeletonBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.SAND) + .instrument(NoteBlockInstrument.XYLOPHONE).strength(0.5F).sound(SoundType.BONE_BLOCK).noOcclusion()); public static final Block CANDLESTICK = registerBlockWithItem("candlestick", - CandleStickBlock::new, AbstractBlock.Settings.copy(Blocks.CANDLE).luminance(createLightLevelFromLitBlockState(15)).nonOpaque()); + CandleStickBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CANDLE).lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion()); public static final Block CERAMIC_LAMP = registerBlockWithItem("ceramic_lamp", - CeramicLampBlock::new, AbstractBlock.Settings.copy(Blocks.FLOWER_POT).luminance(createLightLevelFromLitBlockState(15)).nonOpaque()); + CeramicLampBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.FLOWER_POT).lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion()); public static final Block CANDLE_HOLDER = registerBlockWithItem("candle_holder", - CandleHolderBlock::new, AbstractBlock.Settings.copy(Blocks.CANDLE).luminance(createLightLevelFromLitBlockState(6)).nonOpaque()); + CandleHolderBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CANDLE).lightLevel(createLightLevelFromLitBlockState(6)).noOcclusion()); public static final Block SKULL_CANDLE = registerBlockWithItem("skull_candle", - SkullCandleBlock::new, AbstractBlock.Settings.copy(Blocks.CANDLE).luminance(createLightLevelFromLitBlockState(15)).nonOpaque()); + SkullCandleBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CANDLE).lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion()); public static final Block CANDLE_HEAP = registerBlockWithItem("candle_heap", - CandleHeapBlock::new, AbstractBlock.Settings.copy(Blocks.CANDLE).nonOpaque().luminance(createLightLevelFromLitBlockState(10))); + CandleHeapBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CANDLE).noOcclusion().lightLevel(createLightLevelFromLitBlockState(10))); public static final Block SMALL_BRONZE_CHANDELIER = registerBlockWithItem("small_bronze_chandelier", - SmallChandelierBlock::new, AbstractBlock.Settings.copy(Blocks.CANDLE).luminance(createLightLevelFromLitBlockState(15)).nonOpaque()); + SmallChandelierBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CANDLE) + .lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion()); public static final Block BRONZE_CHANDELIER = registerBlockWithItem("bronze_chandelier", - ChandelierBlock::new, AbstractBlock.Settings.copy(Blocks.CANDLE).luminance(createLightLevelFromLitBlockState(15)).nonOpaque()); + ChandelierBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CANDLE) + .lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion()); public static final Block SMALL_CHANDELIER = registerBlockWithItem("small_chandelier", - SmallChandelierBlock::new, AbstractBlock.Settings.copy(Blocks.CANDLE).luminance(createLightLevelFromLitBlockState(15)).nonOpaque()); + SmallChandelierBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CANDLE) + .lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion()); public static final Block CHANDELIER = registerBlockWithItem("chandelier", - ChandelierBlock::new, AbstractBlock.Settings.copy(Blocks.CANDLE).luminance(createLightLevelFromLitBlockState(15)).nonOpaque()); + ChandelierBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CANDLE) + .lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion()); public static final Block STONE_LECTERN = registerBlockWithItem("stone_lectern", - StoneLecternBlock::new, AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque().requiresTool()); + StoneLecternBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).noOcclusion().requiresCorrectToolForDrops()); public static final Block CHISELED_DOLOMITE_BOOKSHELF = registerBlockWithItem("chiseled_dolomite_bookshelf", - ChiseledBookshelfBlock::new, AbstractBlock.Settings.copy(Blocks.CHISELED_BOOKSHELF).nonOpaque().requiresTool().sounds(BlockSoundGroup.STONE)); + ChiseledBookShelfBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CHISELED_BOOKSHELF).noOcclusion().requiresCorrectToolForDrops().sound(SoundType.STONE)); public static final Block BASALT_STATUE = registerBlock("basalt_statue", - StatueBlock::new, AbstractBlock.Settings.copy(Blocks.BASALT).nonOpaque().requiresTool()); + StatueBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BASALT).noOcclusion().requiresCorrectToolForDrops()); public static final Block CALCITE_STATUE = registerBlock("calcite_statue", - StatueBlock::new, AbstractBlock.Settings.copy(Blocks.CALCITE).nonOpaque().requiresTool()); + StatueBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CALCITE).noOcclusion().requiresCorrectToolForDrops()); public static final Block DEEPSLATE_STATUE = registerBlock("deepslate_statue", - StatueBlock::new, AbstractBlock.Settings.copy(Blocks.DEEPSLATE).nonOpaque().requiresTool()); + StatueBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DEEPSLATE).noOcclusion().requiresCorrectToolForDrops()); public static final Block DIORITE_STATUE = registerBlock("diorite_statue", - FlipStatueBlock::new, AbstractBlock.Settings.copy(Blocks.DIORITE).nonOpaque().requiresTool()); + FlipStatueBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DIORITE).noOcclusion().requiresCorrectToolForDrops()); public static final Block GABBRO_STATUE = registerBlock("gabbro_statue", - FlipStatueBlock::new, AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque().requiresTool()); + FlipStatueBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).noOcclusion().requiresCorrectToolForDrops()); public static final Block GALONN_STATUE = registerBlock("galonn_statue", - StatueBlock::new, AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque().requiresTool()); + StatueBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).noOcclusion().requiresCorrectToolForDrops()); public static final Block KHAGALABAN_STATUE = registerBlock("khagalaban_statue", - StatueBlock::new, AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque().requiresTool()); + StatueBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).noOcclusion().requiresCorrectToolForDrops()); public static final Block MEDGON_SPIKE = registerBlock("medgon_spike", - StatueBlock::new, AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque().requiresTool()); + StatueBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).noOcclusion().requiresCorrectToolForDrops()); public static final Block PUMICE_STATUE = registerBlock("pumice_statue", - StatueBlock::new, AbstractBlock.Settings.copy(Blocks.BASALT).nonOpaque().requiresTool()); + StatueBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BASALT).noOcclusion().requiresCorrectToolForDrops()); public static final Block TUFF_STATUE = registerBlock("tuff_statue", - StatueBlock::new, AbstractBlock.Settings.copy(Blocks.TUFF).nonOpaque().requiresTool()); + StatueBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.TUFF).noOcclusion().requiresCorrectToolForDrops()); public static final Block ZIGILABAN_STATUE = registerBlock("zigilaban_statue", - StatueBlock::new, AbstractBlock.Settings.copy(Blocks.TUFF).nonOpaque().requiresTool()); + StatueBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.TUFF).noOcclusion().requiresCorrectToolForDrops()); public static final Block ORCISH_DRUM = registerBlockWithItem("orcish_drum", - OrcishDrumBlock::new, AbstractBlock.Settings.copy(Blocks.NOTE_BLOCK).nonOpaque()); + OrcishDrumBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.NOTE_BLOCK).noOcclusion()); public static final Block FIRE_OF_ORTHANC = registerBlock("fire_of_orthanc", - FireOfOrthancBlock::new, AbstractBlock.Settings.create().requiresTool().mapColor(MapColor.BLACK) - .sounds(BlockSoundGroup.METAL).strength(6f).burnable().solidBlock(Blocks::never).nonOpaque()); + FireOfOrthancBlock::new, BlockBehaviour.Properties.of().requiresCorrectToolForDrops().mapColor(MapColor.COLOR_BLACK) + .sound(SoundType.METAL).strength(6f).ignitedByLava().isRedstoneConductor(ModBlocks::never).noOcclusion()); public static final Block TORCH_OF_ORTHANC = registerBlock("torch_of_orthanc", - (settings) -> new TorchOfOrthancBlock(settings, ParticleTypes.FLAME), AbstractBlock.Settings.copy(Blocks.TORCH).luminance(createLightLevelFromLitBlockState(15)).nonOpaque().requiresTool()); + (settings) -> new TorchOfOrthancBlock(settings, ParticleTypes.FLAME), BlockBehaviour.Properties.ofFullCopy(Blocks.TORCH).lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion().requiresCorrectToolForDrops()); public static final Block CERAMIC_PLATE = registerBlockWithItem("ceramic_plate", - PlateBlock::new, AbstractBlock.Settings.copy(Blocks.STONE_PRESSURE_PLATE).breakInstantly()); + PlateBlock::new, BlockBehaviour.Properties.of() + .mapColor(MapColor.STONE) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASEDRUM) + .noCollission() + .strength(0.5F) + .instabreak() + .pushReaction(PushReaction.DESTROY)); public static final Block ROTTEN_PLATE = registerBlockWithItem("rotten_plate", - PlateBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_PRESSURE_PLATE).breakInstantly()); + PlateBlock::new, BlockBehaviour.Properties.of() + .mapColor(Blocks.OAK_PLANKS.defaultMapColor()) + .forceSolidOn() + .instrument(NoteBlockInstrument.BASS) + .noCollission() + .strength(0.5F) + .instabreak() + .ignitedByLava() + .pushReaction(PushReaction.DESTROY)); public static final Block SILVER_PLATE = registerBlockWithItem("silver_plate", - PlateBlock::new, AbstractBlock.Settings.copy(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE).breakInstantly()); + PlateBlock::new, BlockBehaviour.Properties.of() + .mapColor(MapColor.GOLD) + .forceSolidOn() + .noCollission() + .strength(0.5F) + .instabreak() + .pushReaction(PushReaction.DESTROY)); public static final Block TAPPER = registerBlock("tapper", - TapperBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_WOOD).breakInstantly().nonOpaque()); + TapperBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_WOOD).instabreak().noOcclusion()); public static final Block WOOD_FRAMED_WINDOW = registerBlockWithItem("wood_framed_window", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block WOOD_FRAMED_WINDOW_PANE = registerBlockWithItem("wood_framed_window_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block AGED_WOOD_WINDOW = registerBlockWithItem("aged_wood_window", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS).sounds(BlockSoundGroup.WOOD).burnable()); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS).sound(SoundType.WOOD).ignitedByLava()); public static final Block AGED_WOOD_WINDOW_PANE = registerBlockWithItem("aged_wood_window_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE).sounds(BlockSoundGroup.WOOD).burnable()); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE).sound(SoundType.WOOD).ignitedByLava()); public static final Block SIMPLE_OAK_WINDOW = registerBlockWithItem("simple_oak_window", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS).sounds(BlockSoundGroup.WOOD).burnable()); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS).sound(SoundType.WOOD).ignitedByLava()); public static final Block SIMPLE_OAK_WINDOW_PANE = registerBlockWithItem("simple_oak_window_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE).sounds(BlockSoundGroup.WOOD).burnable()); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE).sound(SoundType.WOOD).ignitedByLava()); public static final Block WATTLE_AND_BRICK_WINDOW = registerBlockWithItem("wattle_and_brick_window", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block WATTLE_AND_BRICK_WINDOW_PANE = registerBlockWithItem("wattle_and_brick_window_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block WATTLE_FRAMED_WINDOW = registerBlockWithItem("wattle_framed_window", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block WATTLE_FRAMED_WINDOW_PANE = registerBlockWithItem("wattle_framed_window_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block DARK_WATTLE_FRAMED_WINDOW = registerBlockWithItem("dark_wattle_framed_window", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block DARK_WATTLE_FRAMED_WINDOW_PANE = registerBlockWithItem("dark_wattle_framed_window_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block BLACK_WATTLE_FRAMED_WINDOW = registerBlockWithItem("black_wattle_framed_window", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block BLACK_WATTLE_FRAMED_WINDOW_PANE = registerBlockWithItem("black_wattle_framed_window_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block GREEN_WATTLE_FRAMED_WINDOW = registerBlockWithItem("green_wattle_framed_window", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block GREEN_WATTLE_FRAMED_WINDOW_PANE = registerBlockWithItem("green_wattle_framed_window_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block RED_WATTLE_FRAMED_WINDOW = registerBlockWithItem("red_wattle_framed_window", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block RED_WATTLE_FRAMED_WINDOW_PANE = registerBlockWithItem("red_wattle_framed_window_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block WHITE_WATTLE_FRAMED_WINDOW = registerBlockWithItem("white_wattle_framed_window", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block WHITE_WATTLE_FRAMED_WINDOW_PANE = registerBlockWithItem("white_wattle_framed_window_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block MUD_BRICK_ROUND_WINDOW = registerBlockWithItem("mud_brick_round_window", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block MUD_BRICK_ROUND_WINDOW_PANE = registerBlockWithItem("mud_brick_round_window_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block WHITE_DAUB_ROUND_WINDOW = registerBlockWithItem("white_daub_round_window", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block WHITE_DAUB_ROUND_WINDOW_PANE = registerBlockWithItem("white_daub_round_window_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block YELLOW_DAUB_ROUND_WINDOW = registerBlockWithItem("yellow_daub_round_window", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block YELLOW_DAUB_ROUND_WINDOW_PANE = registerBlockWithItem("yellow_daub_round_window_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block WHITE_DAUB_HOBBIT_WINDOW = registerBlockWithItem("white_daub_hobbit_window", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block WHITE_DAUB_HOBBIT_WINDOW_PANE = registerBlockWithItem("white_daub_hobbit_window_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block YELLOW_DAUB_HOBBIT_WINDOW = registerBlockWithItem("yellow_daub_hobbit_window", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block YELLOW_DAUB_HOBBIT_WINDOW_PANE = registerBlockWithItem("yellow_daub_hobbit_window_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block PLASTER_HOBBIT_WINDOW = registerBlockWithItem("plaster_hobbit_window", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block PLASTER_HOBBIT_WINDOW_PANE = registerBlockWithItem("plaster_hobbit_window_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block PLASTER_ROUND_WINDOW = registerBlockWithItem("plaster_round_window", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block PLASTER_ROUND_WINDOW_PANE = registerBlockWithItem("plaster_round_window_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block LEAD_GLASS = registerBlockWithItem("lead_glass", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block BLACK_STAINED_LEAD_GLASS = registerBlockWithItem("black_stained_lead_glass", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block BLUE_STAINED_LEAD_GLASS = registerBlockWithItem("blue_stained_lead_glass", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block BROWN_STAINED_LEAD_GLASS = registerBlockWithItem("brown_stained_lead_glass", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block CYAN_STAINED_LEAD_GLASS = registerBlockWithItem("cyan_stained_lead_glass", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block GRAY_STAINED_LEAD_GLASS = registerBlockWithItem("gray_stained_lead_glass", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block GREEN_STAINED_LEAD_GLASS = registerBlockWithItem("green_stained_lead_glass", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block LIGHT_BLUE_STAINED_LEAD_GLASS = registerBlockWithItem("light_blue_stained_lead_glass", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block LIGHT_GRAY_STAINED_LEAD_GLASS = registerBlockWithItem("light_gray_stained_lead_glass", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block LIME_STAINED_LEAD_GLASS = registerBlockWithItem("lime_stained_lead_glass", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block MAGENTA_STAINED_LEAD_GLASS = registerBlockWithItem("magenta_stained_lead_glass", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block ORANGE_STAINED_LEAD_GLASS = registerBlockWithItem("orange_stained_lead_glass", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block PINK_STAINED_LEAD_GLASS = registerBlockWithItem("pink_stained_lead_glass", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block PURPLE_STAINED_LEAD_GLASS = registerBlockWithItem("purple_stained_lead_glass", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block RED_STAINED_LEAD_GLASS = registerBlockWithItem("red_stained_lead_glass", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block WHITE_STAINED_LEAD_GLASS = registerBlockWithItem("white_stained_lead_glass", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block YELLOW_STAINED_LEAD_GLASS = registerBlockWithItem("yellow_stained_lead_glass", - TransparentBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS)); + TransparentBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS)); public static final Block LEAD_GLASS_PANE = registerBlockWithItem("lead_glass_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block BLACK_STAINED_LEAD_GLASS_PANE = registerBlockWithItem("black_stained_lead_glass_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block BLUE_STAINED_LEAD_GLASS_PANE = registerBlockWithItem("blue_stained_lead_glass_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block BROWN_STAINED_LEAD_GLASS_PANE = registerBlockWithItem("brown_stained_lead_glass_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block CYAN_STAINED_LEAD_GLASS_PANE = registerBlockWithItem("cyan_stained_lead_glass_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block GRAY_STAINED_LEAD_GLASS_PANE = registerBlockWithItem("gray_stained_lead_glass_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block GREEN_STAINED_LEAD_GLASS_PANE = registerBlockWithItem("green_stained_lead_glass_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block LIGHT_BLUE_STAINED_LEAD_GLASS_PANE = registerBlockWithItem("light_blue_stained_lead_glass_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block LIGHT_GRAY_STAINED_LEAD_GLASS_PANE = registerBlockWithItem("light_gray_stained_lead_glass_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block LIME_STAINED_LEAD_GLASS_PANE = registerBlockWithItem("lime_stained_lead_glass_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block MAGENTA_STAINED_LEAD_GLASS_PANE = registerBlockWithItem("magenta_stained_lead_glass_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block ORANGE_STAINED_LEAD_GLASS_PANE = registerBlockWithItem("orange_stained_lead_glass_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block PINK_STAINED_LEAD_GLASS_PANE = registerBlockWithItem("pink_stained_lead_glass_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block PURPLE_STAINED_LEAD_GLASS_PANE = registerBlockWithItem("purple_stained_lead_glass_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block RED_STAINED_LEAD_GLASS_PANE = registerBlockWithItem("red_stained_lead_glass_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block WHITE_STAINED_LEAD_GLASS_PANE = registerBlockWithItem("white_stained_lead_glass_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block YELLOW_STAINED_LEAD_GLASS_PANE = registerBlockWithItem("yellow_stained_lead_glass_pane", - PaneBlock::new, AbstractBlock.Settings.copy(Blocks.GLASS_PANE)); + IronBarsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GLASS_PANE)); public static final Block BLUE_CUSHION = registerBlockWithItem("blue_cushion", - CushionBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_SLAB).nonOpaque()); + CushionBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_SLAB).noOcclusion()); public static final Block BROWN_CUSHION = registerBlockWithItem("brown_cushion", - CushionBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_SLAB).nonOpaque()); + CushionBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_SLAB).noOcclusion()); public static final Block DARK_BLUE_CUSHION = registerBlockWithItem("dark_blue_cushion", - CushionBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_SLAB).nonOpaque()); + CushionBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_SLAB).noOcclusion()); public static final Block DARK_BROWN_CUSHION = registerBlockWithItem("dark_brown_cushion", - CushionBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_SLAB).nonOpaque()); + CushionBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_SLAB).noOcclusion()); public static final Block DARK_GREEN_CUSHION = registerBlockWithItem("dark_green_cushion", - CushionBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_SLAB).nonOpaque()); + CushionBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_SLAB).noOcclusion()); public static final Block DARK_RED_CUSHION = registerBlockWithItem("dark_red_cushion", - CushionBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_SLAB).nonOpaque()); + CushionBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_SLAB).noOcclusion()); public static final Block GREEN_CUSHION = registerBlockWithItem("green_cushion", - CushionBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_SLAB).nonOpaque()); + CushionBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_SLAB).noOcclusion()); public static final Block RED_CUSHION = registerBlockWithItem("red_cushion", - CushionBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_SLAB).nonOpaque()); + CushionBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_SLAB).noOcclusion()); public static final Block SMALL_BLACK_CURTAIN = registerBlockWithItem("small_black_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block SMALL_BLUE_CURTAIN = registerBlockWithItem("small_blue_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block SMALL_BROWN_CURTAIN = registerBlockWithItem("small_brown_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block SMALL_BURNT_CURTAIN = registerBlockWithItem("small_burnt_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block SMALL_DARK_BLUE_CURTAIN = registerBlockWithItem("small_dark_blue_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block SMALL_DARK_BROWN_CURTAIN = registerBlockWithItem("small_dark_brown_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block SMALL_DARK_GREEN_CURTAIN = registerBlockWithItem("small_dark_green_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block SMALL_DARK_RED_CURTAIN = registerBlockWithItem("small_dark_red_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block SMALL_FANCY_BLUE_CURTAIN = registerBlockWithItem("small_fancy_blue_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block SMALL_FANCY_GREEN_CURTAIN = registerBlockWithItem("small_fancy_green_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block SMALL_FANCY_RED_CURTAIN = registerBlockWithItem("small_fancy_red_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block SMALL_GRAY_CURTAIN = registerBlockWithItem("small_gray_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block SMALL_GREEN_CURTAIN = registerBlockWithItem("small_green_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block SMALL_PURPLE_CURTAIN = registerBlockWithItem("small_purple_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block SMALL_RED_CURTAIN = registerBlockWithItem("small_red_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block SMALL_ROTTEN_CURTAIN = registerBlockWithItem("small_rotten_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block SMALL_WHITE_CURTAIN = registerBlockWithItem("small_white_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block SMALL_YELLOW_CURTAIN = registerBlockWithItem("small_yellow_curtain", - SmallCurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + SmallCurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block BLACK_CURTAIN = registerBlockWithItem("black_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block BLUE_CURTAIN = registerBlockWithItem("blue_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block BROWN_CURTAIN = registerBlockWithItem("brown_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block BURNT_CURTAIN = registerBlockWithItem("burnt_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block DARK_BLUE_CURTAIN = registerBlockWithItem("dark_blue_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block DARK_BROWN_CURTAIN = registerBlockWithItem("dark_brown_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block DARK_GREEN_CURTAIN = registerBlockWithItem("dark_green_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block DARK_RED_CURTAIN = registerBlockWithItem("dark_red_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block FANCY_BLUE_CURTAIN = registerBlockWithItem("fancy_blue_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block FANCY_GREEN_CURTAIN = registerBlockWithItem("fancy_green_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block FANCY_RED_CURTAIN = registerBlockWithItem("fancy_red_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block GRAY_CURTAIN = registerBlockWithItem("gray_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block GREEN_CURTAIN = registerBlockWithItem("green_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block PURPLE_CURTAIN = registerBlockWithItem("purple_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block RED_CURTAIN = registerBlockWithItem("red_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block ROTTEN_CURTAIN = registerBlockWithItem("rotten_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block WHITE_CURTAIN = registerBlockWithItem("white_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block YELLOW_CURTAIN = registerBlockWithItem("yellow_curtain", - CurtainsBlock::new, AbstractBlock.Settings.copy(Blocks.RED_CARPET).noCollision().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + CurtainsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.RED_CARPET).noCollission().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block PAPER_SHEET = registerBlockWithItem("paper_sheet", - PaperSheetBlock::new, AbstractBlock.Settings.copy(Blocks.SUGAR_CANE).nonOpaque()); + PaperSheetBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SUGAR_CANE).noOcclusion()); public static final Block TREATED_WOOD_STOOL = registerBlockWithItem("treated_wood_stool", - WoodStoolBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + WoodStoolBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block TREATED_WOOD_BENCH = registerBlockWithItem("treated_wood_bench", - WoodBenchBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + WoodBenchBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block TREATED_WOOD_TABLE = registerBlockWithItem("treated_wood_table", - WoodTableBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + WoodTableBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block TREATED_WOOD_CHAIR = registerBlockWithItem("treated_wood_chair", - WoodChairBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + WoodChairBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); //endregion public static final Block WOODEN_BUCKET = registerBlockWithItem("wooden_bucket", - WoodenBucketBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + WoodenBucketBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block WATERING_CAN = registerBlock("watering_can", - WateringCanBlock::new, AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).nonOpaque().requiresTool()); - public static final Block POTTED_ASPEN_SAPLING = registerBlock("potted_aspen_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.ASPEN_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_BEECH_SAPLING = registerBlock("potted_beech_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.BEECH_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_CHESTNUT_SAPLING = registerBlock("potted_chestnut_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.CHESTNUT_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_HOLLY_SAPLING = registerBlock("potted_holly_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.HOLLY_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_FIR_SAPLING = registerBlock("potted_fir_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.FIR_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_LARCH_SAPLING = registerBlock("potted_larch_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.LARCH_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_LEBETHRON_SAPLING = registerBlock("potted_lebethron_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.LEBETHRON_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_WHITE_LEBETHRON_SAPLING = registerBlock("potted_white_lebethron_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.WHITE_LEBETHRON_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_MALLORN_SAPLING = registerBlock("potted_mallorn_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.MALLORN_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_MAPLE_SAPLING = registerBlock("potted_maple_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.MAPLE_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_SILVER_MAPLE_SAPLING = registerBlock("potted_silver_maple_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.SILVER_MAPLE_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_MIRKWOOD_SAPLING = registerBlock("potted_mirkwood_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.MIRKWOOD_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_PALM_SAPLING = registerBlock("potted_palm_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.PALM_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_WHITE_PALM_SAPLING = registerBlock("potted_white_palm_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.WHITE_PALM_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_PINE_SAPLING = registerBlock("potted_pine_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.PINE_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_BLACK_PINE_SAPLING = registerBlock("potted_black_pine_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.BLACK_PINE_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_WHITE_SPRUCE_SAPLING = registerBlock("potted_white_spruce_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.WHITE_SPRUCE_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_WILLOW_SAPLING = registerBlock("potted_willow_sapling", - (settings) -> new FlowerPotBlock(ModNatureBlocks.WILLOW_SAPLING, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - - public static final Block POTTED_GREEN_SHRUB = registerBlock("potted_green_shrub", - (settings) -> new FlowerPotBlock(ModNatureBlocks.GREEN_SHRUB, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_ELANOR = registerBlock("potted_elanor", - (settings) -> new FlowerPotBlock(ModNatureBlocks.ELANOR, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_MALLOS = registerBlock("potted_mallos", - (settings) -> new FlowerPotBlock(ModNatureBlocks.MALLOS, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_NIPHREDIL = registerBlock("potted_niphredil", - (settings) -> new FlowerPotBlock(ModNatureBlocks.NIPHREDIL, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_SIMBELMYNE = registerBlock("potted_simbelmyne", - (settings) -> new FlowerPotBlock(ModNatureBlocks.SIMBELMYNE, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_YELLOW_FLOWER = registerBlock("potted_yellow_flower", - (settings) -> new FlowerPotBlock(ModNatureBlocks.YELLOW_FLOWER, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_YELLOW_TROLLIUS = registerBlock("potted_yellow_trollius", - (settings) -> new FlowerPotBlock(ModNatureBlocks.YELLOW_TROLLIUS, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_TAN_SHRUB = registerBlock("potted_tan_shrub", - (settings) -> new FlowerPotBlock(ModNatureBlocks.TAN_SHRUB, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_BLUE_GENTIAN = registerBlock("potted_blue_gentian", - (settings) -> new FlowerPotBlock(ModNatureBlocks.BLUE_GENTIAN, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_GREEN_JEWEL_CORNFLOWER = registerBlock("potted_green_jewel_cornflower", - (settings) -> new FlowerPotBlock(ModNatureBlocks.GREEN_JEWEL_CORNFLOWER, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_NOBLEWHITE = registerBlock("potted_noblewhite", - (settings) -> new FlowerPotBlock(ModNatureBlocks.NOBLEWHITE, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_SCORCHED_SHRUB = registerBlock("potted_scorched_shrub", - (settings) -> new FlowerPotBlock(ModNatureBlocks.SCORCHED_SHRUB, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_FROZEN_SHRUB = registerBlock("potted_frozen_shrub", - (settings) -> new FlowerPotBlock(ModNatureBlocks.FROZEN_SHRUB, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + WateringCanBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).noOcclusion().requiresCorrectToolForDrops()); + public static final Block POTTED_ASPEN_SAPLING = registerPottedBlock("potted_aspen_sapling", + () -> ModNatureBlocks.ASPEN_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_BEECH_SAPLING = registerPottedBlock("potted_beech_sapling", + () -> ModNatureBlocks.BEECH_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_CHESTNUT_SAPLING = registerPottedBlock("potted_chestnut_sapling", + () -> ModNatureBlocks.CHESTNUT_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_HOLLY_SAPLING = registerPottedBlock("potted_holly_sapling", + () -> ModNatureBlocks.HOLLY_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_FIR_SAPLING = registerPottedBlock("potted_fir_sapling", + () -> ModNatureBlocks.FIR_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_LARCH_SAPLING = registerPottedBlock("potted_larch_sapling", + () -> ModNatureBlocks.LARCH_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_LEBETHRON_SAPLING = registerPottedBlock("potted_lebethron_sapling", + () -> ModNatureBlocks.LEBETHRON_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_WHITE_LEBETHRON_SAPLING = registerPottedBlock("potted_white_lebethron_sapling", + () -> ModNatureBlocks.WHITE_LEBETHRON_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_MALLORN_SAPLING = registerPottedBlock("potted_mallorn_sapling", + () -> ModNatureBlocks.MALLORN_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_MAPLE_SAPLING = registerPottedBlock("potted_maple_sapling", + () -> ModNatureBlocks.MAPLE_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_SILVER_MAPLE_SAPLING = registerPottedBlock("potted_silver_maple_sapling", + () -> ModNatureBlocks.SILVER_MAPLE_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_MIRKWOOD_SAPLING = registerPottedBlock("potted_mirkwood_sapling", + () -> ModNatureBlocks.MIRKWOOD_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_PALM_SAPLING = registerPottedBlock("potted_palm_sapling", + () -> ModNatureBlocks.PALM_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_WHITE_PALM_SAPLING = registerPottedBlock("potted_white_palm_sapling", + () -> ModNatureBlocks.WHITE_PALM_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_PINE_SAPLING = registerPottedBlock("potted_pine_sapling", + () -> ModNatureBlocks.PINE_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_BLACK_PINE_SAPLING = registerPottedBlock("potted_black_pine_sapling", + () -> ModNatureBlocks.BLACK_PINE_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_WHITE_SPRUCE_SAPLING = registerPottedBlock("potted_white_spruce_sapling", + () -> ModNatureBlocks.WHITE_SPRUCE_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_WILLOW_SAPLING = registerPottedBlock("potted_willow_sapling", + () -> ModNatureBlocks.WILLOW_SAPLING, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + + public static final Block POTTED_GREEN_SHRUB = registerPottedBlock("potted_green_shrub", + () -> ModNatureBlocks.GREEN_SHRUB, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_ELANOR = registerPottedBlock("potted_elanor", + () -> ModNatureBlocks.ELANOR, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_MALLOS = registerPottedBlock("potted_mallos", + () -> ModNatureBlocks.MALLOS, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_NIPHREDIL = registerPottedBlock("potted_niphredil", + () -> ModNatureBlocks.NIPHREDIL, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_SIMBELMYNE = registerPottedBlock("potted_simbelmyne", + () -> ModNatureBlocks.SIMBELMYNE, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_YELLOW_FLOWER = registerPottedBlock("potted_yellow_flower", + () -> ModNatureBlocks.YELLOW_FLOWER, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_YELLOW_TROLLIUS = registerPottedBlock("potted_yellow_trollius", + () -> ModNatureBlocks.YELLOW_TROLLIUS, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_TAN_SHRUB = registerPottedBlock("potted_tan_shrub", + () -> ModNatureBlocks.TAN_SHRUB, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_BLUE_GENTIAN = registerPottedBlock("potted_blue_gentian", + () -> ModNatureBlocks.BLUE_GENTIAN, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_GREEN_JEWEL_CORNFLOWER = registerPottedBlock("potted_green_jewel_cornflower", + () -> ModNatureBlocks.GREEN_JEWEL_CORNFLOWER, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_NOBLEWHITE = registerPottedBlock("potted_noblewhite", + () -> ModNatureBlocks.NOBLEWHITE, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_SCORCHED_SHRUB = registerPottedBlock("potted_scorched_shrub", + () -> ModNatureBlocks.SCORCHED_SHRUB, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_FROZEN_SHRUB = registerPottedBlock("potted_frozen_shrub", + () -> ModNatureBlocks.FROZEN_SHRUB, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); - public static final Block POTTED_CAVE_AMANITA = registerBlock("potted_cave_amanita", - (settings) -> new FlowerPotBlock(ModNatureBlocks.CAVE_AMANITA, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_DEEP_FIRECAP = registerBlock("potted_deep_firecap", - (settings) -> new FlowerPotBlock(ModNatureBlocks.DEEP_FIRECAP, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_GHOSTSHROOM = registerBlock("potted_ghostshroom", - (settings) -> new FlowerPotBlock(ModNatureBlocks.GHOSTSHROOM, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_MORSEL = registerBlock("potted_morsel", - (settings) -> new FlowerPotBlock(ModNatureBlocks.MORSEL, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_SKYFIRECAP = registerBlock("potted_sky_firecap", - (settings) -> new FlowerPotBlock(ModNatureBlocks.SKY_FIRECAP, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_TRUMPET_SHROOM = registerBlock("potted_trumpet_shroom", - (settings) -> new FlowerPotBlock(ModNatureBlocks.TRUMPET_SHROOM, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_TUBESHROOM = registerBlock("potted_tubeshroom", - (settings) -> new FlowerPotBlock(ModNatureBlocks.TUBESHRROM, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_VIOLET_CAPS = registerBlock("potted_violet_caps", - (settings) -> new FlowerPotBlock(ModNatureBlocks.VIOLET_CAPS, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_WHITE_MUSHROOM = registerBlock("potted_white_mushroom", - (settings) -> new FlowerPotBlock(ModNatureBlocks.WHITE_MUSHROOM, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); - public static final Block POTTED_YELLOW_AMANITA = registerBlock("potted_yellow_amanita", - (settings) -> new FlowerPotBlock(ModNatureBlocks.YELLOW_AMANITA, settings), AbstractBlock.Settings.create().breakInstantly().nonOpaque().pistonBehavior(PistonBehavior.DESTROY)); + public static final Block POTTED_CAVE_AMANITA = registerPottedBlock("potted_cave_amanita", + () -> ModNatureBlocks.CAVE_AMANITA, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_DEEP_FIRECAP = registerPottedBlock("potted_deep_firecap", + () -> ModNatureBlocks.DEEP_FIRECAP, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_GHOSTSHROOM = registerPottedBlock("potted_ghostshroom", + () -> ModNatureBlocks.GHOSTSHROOM, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_MORSEL = registerPottedBlock("potted_morsel", + () -> ModNatureBlocks.MORSEL, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_SKYFIRECAP = registerPottedBlock("potted_sky_firecap", + () -> ModNatureBlocks.SKY_FIRECAP, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_TRUMPET_SHROOM = registerPottedBlock("potted_trumpet_shroom", + () -> ModNatureBlocks.TRUMPET_SHROOM, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_TUBESHROOM = registerPottedBlock("potted_tubeshroom", + () -> ModNatureBlocks.TUBESHRROM, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_VIOLET_CAPS = registerPottedBlock("potted_violet_caps", + () -> ModNatureBlocks.VIOLET_CAPS, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_WHITE_MUSHROOM = registerPottedBlock("potted_white_mushroom", + () -> ModNatureBlocks.WHITE_MUSHROOM, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + public static final Block POTTED_YELLOW_AMANITA = registerPottedBlock("potted_yellow_amanita", + () -> ModNatureBlocks.YELLOW_AMANITA, BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); public static final Block BROWN_JUG = registerBlockWithItem("brown_jug", - JugBlock::new, AbstractBlock.Settings.copy(Blocks.DECORATED_POT).nonOpaque()); + JugBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DECORATED_POT).noOcclusion()); public static final Block GRAY_POT = registerBlockWithItem("gray_pot", - JugBlock::new, AbstractBlock.Settings.copy(Blocks.DECORATED_POT).nonOpaque()); + JugBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DECORATED_POT).noOcclusion()); public static final Block LARGE_JUG = registerBlockWithItem("large_jug", - JugBlock::new, AbstractBlock.Settings.copy(Blocks.DECORATED_POT).nonOpaque()); + JugBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DECORATED_POT).noOcclusion()); public static final Block AMPHORA = registerBlockWithItem("amphora", - AmphoraBlock::new, AbstractBlock.Settings.copy(Blocks.DECORATED_POT).nonOpaque()); + AmphoraBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DECORATED_POT).noOcclusion()); public static final Block BROWN_AMPHORA = registerBlockWithItem("brown_amphora", - AmphoraBlock::new, AbstractBlock.Settings.copy(Blocks.DECORATED_POT).nonOpaque()); + AmphoraBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DECORATED_POT).noOcclusion()); public static final Block GRAY_VASE = registerBlockWithItem("gray_vase", - AmphoraBlock::new, AbstractBlock.Settings.copy(Blocks.DECORATED_POT).nonOpaque()); + AmphoraBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DECORATED_POT).noOcclusion()); public static final Block BROWN_JAR = registerBlockWithItem("brown_jar", - JarBlock::new, AbstractBlock.Settings.copy(Blocks.DECORATED_POT).nonOpaque()); + JarBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DECORATED_POT).noOcclusion()); public static final Block CLAY_JAR = registerBlockWithItem("clay_jar", - JarBlock::new, AbstractBlock.Settings.copy(Blocks.DECORATED_POT).nonOpaque()); + JarBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DECORATED_POT).noOcclusion()); public static final Block GRAY_JAR = registerBlockWithItem("gray_jar", - JarBlock::new, AbstractBlock.Settings.copy(Blocks.DECORATED_POT).nonOpaque()); + JarBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DECORATED_POT).noOcclusion()); public static final Block BROWN_FAT_POT = registerBlockWithItem("brown_fat_pot", - FatPotBlock::new, AbstractBlock.Settings.copy(Blocks.DECORATED_POT).nonOpaque()); + FatPotBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DECORATED_POT).noOcclusion()); public static final Block FAT_POT = registerBlockWithItem("fat_pot", - FatPotBlock::new, AbstractBlock.Settings.copy(Blocks.DECORATED_POT).nonOpaque()); + FatPotBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DECORATED_POT).noOcclusion()); public static final Block GRAY_FAT_POT = registerBlockWithItem("gray_fat_pot", - FatPotBlock::new, AbstractBlock.Settings.copy(Blocks.DECORATED_POT).nonOpaque()); + FatPotBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DECORATED_POT).noOcclusion()); public static final Block POT_OF_GOLD = registerBlockWithItem("pot_of_gold", - FatPotBlock::new, AbstractBlock.Settings.copy(Blocks.DECORATED_POT).nonOpaque()); + FatPotBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DECORATED_POT).noOcclusion()); public static final Block GOLDEN_CHALICE = registerBlockWithItem("golden_chalice", - ChaliceBlock::new, AbstractBlock.Settings.copy(Blocks.GOLD_BLOCK).nonOpaque()); + ChaliceBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GOLD_BLOCK).noOcclusion()); public static final Block COPPER_TREASURE_HEAP_LAYER = registerBlockWithItem("copper_treasure_heap_layer", - LayersAltBlock::new, AbstractBlock.Settings.copy(Blocks.GOLD_BLOCK).nonOpaque()); + LayersAltBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GOLD_BLOCK).noOcclusion()); public static final Block SILVER_TREASURE_HEAP_LAYER = registerBlockWithItem("silver_treasure_heap_layer", - LayersAltBlock::new, AbstractBlock.Settings.copy(Blocks.GOLD_BLOCK).nonOpaque()); + LayersAltBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GOLD_BLOCK).noOcclusion()); public static final Block GOLD_TREASURE_HEAP_LAYER = registerBlockWithItem("gold_treasure_heap_layer", - LayersAltBlock::new, AbstractBlock.Settings.copy(Blocks.GOLD_BLOCK).nonOpaque()); + LayersAltBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GOLD_BLOCK).noOcclusion()); public static final Block COPPER_COIN_PILE = registerBlockWithItem("copper_coin_pile", - CoinPileBlock::new, AbstractBlock.Settings.copy(Blocks.GOLD_BLOCK).noCollision().nonOpaque()); + CoinPileBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GOLD_BLOCK).noCollission().noOcclusion()); public static final Block SILVER_COIN_PILE = registerBlockWithItem("silver_coin_pile", - CoinPileBlock::new, AbstractBlock.Settings.copy(Blocks.GOLD_BLOCK).noCollision().nonOpaque()); + CoinPileBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GOLD_BLOCK).noCollission().noOcclusion()); public static final Block GOLD_COIN_PILE = registerBlockWithItem("gold_coin_pile", - CoinPileBlock::new, AbstractBlock.Settings.copy(Blocks.GOLD_BLOCK).noCollision().nonOpaque()); + CoinPileBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GOLD_BLOCK).noCollission().noOcclusion()); public static final Block CRUDE_ROD = registerBlockWithItem("crude_rod", - DecorativeRodBlock::new, AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).nonOpaque().requiresTool()); + DecorativeRodBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).noOcclusion().requiresCorrectToolForDrops()); public static final Block TREATED_STEEL_ROD = registerBlockWithItem("treated_steel_rod", - DecorativeRodBlock::new, AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).nonOpaque().requiresTool()); + DecorativeRodBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).noOcclusion().requiresCorrectToolForDrops()); public static final Block ROPE = registerBlockWithItem("rope", - ChainBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).noCollision()); + ChainBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).noCollission()); public static final Block BRONZE_CHAIN = registerBlockWithItem("bronze_chain", - ChainBlock::new, AbstractBlock.Settings.copy(Blocks.CHAIN)); + ChainBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CHAIN)); public static final Block BRONZE_BROAD_CHAIN = registerBlockWithItem("bronze_broad_chain", - ChainBlock::new, AbstractBlock.Settings.copy(Blocks.CHAIN)); + ChainBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CHAIN)); public static final Block CRUDE_CHAIN = registerBlockWithItem("crude_chain", - ChainBlock::new, AbstractBlock.Settings.copy(Blocks.CHAIN)); + ChainBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CHAIN)); public static final Block CRUDE_BROAD_CHAIN = registerBlockWithItem("crude_broad_chain", - ChainBlock::new, AbstractBlock.Settings.copy(Blocks.CHAIN)); + ChainBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CHAIN)); public static final Block SPIKY_CHAIN = registerBlockWithItem("spiky_chain", - ChainBlock::new, AbstractBlock.Settings.copy(Blocks.CHAIN)); + ChainBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CHAIN)); public static final Block CHIMNEY = registerBlockWithItem("chimney", - ChimneyBlock::new, AbstractBlock.Settings.copy(Blocks.STONE_BRICKS).requiresTool()); + ChimneyBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.STONE_BRICKS).requiresCorrectToolForDrops()); public static final Block BIG_BRAZIER = registerBlockWithItem("big_brazier", - BrazierBlock::new, AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).luminance(createLightLevelFromLitBlockState(15)).nonOpaque().requiresTool()); + BrazierBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion().requiresCorrectToolForDrops()); public static final Block SMALL_BRAZIER = registerBlockWithItem("small_brazier", - SmallBrazierBlock::new, AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).luminance(createLightLevelFromLitBlockState(15)).nonOpaque().requiresTool()); + SmallBrazierBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion().requiresCorrectToolForDrops()); public static final Block GILDED_BIG_BRAZIER = registerBlockWithItem("gilded_big_brazier", - GildedBrazierBlock::new, AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).luminance(createLightLevelFromLitBlockState(15)).nonOpaque().requiresTool()); + GildedBrazierBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion().requiresCorrectToolForDrops()); public static final Block GILDED_SMALL_BRAZIER = registerBlockWithItem("gilded_small_brazier", - GildedSmallBrazierBlock::new, AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).luminance(createLightLevelFromLitBlockState(15)).nonOpaque().requiresTool()); + GildedSmallBrazierBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion().requiresCorrectToolForDrops()); public static final Block FIRE_BOWL = registerBlockWithItem("fire_bowl", - FireBowlBlock::new, AbstractBlock.Settings.copy(Blocks.IRON_BLOCK).luminance(createLightLevelFromLitBlockState(15)).nonOpaque().requiresTool()); + FireBowlBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_BLOCK).lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion().requiresCorrectToolForDrops()); public static final Block BONFIRE = registerBlockWithItem("bonfire", - BonfireBlock::new, AbstractBlock.Settings.copy(Blocks.CAMPFIRE).luminance(createLightLevelFromLitBlockState(15)).nonOpaque().requiresTool()); + BonfireBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.CAMPFIRE).lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion().requiresCorrectToolForDrops()); public static final Block SCONCE = registerBlock("sconce", - METorchBlock::new, AbstractBlock.Settings.copy(Blocks.LANTERN).luminance(createLightLevelFromLitBlockState(15)).nonOpaque().requiresTool()); + METorchBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.LANTERN).lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion().requiresCorrectToolForDrops()); public static final Block WALL_SCONCE = registerBlock("wall_sconce", - MEWallTorchBlock::new, AbstractBlock.Settings.copy(Blocks.LANTERN).luminance(createLightLevelFromLitBlockState(15)).nonOpaque().requiresTool()); + MEWallTorchBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.LANTERN).lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion().requiresCorrectToolForDrops()); public static final Block GILDED_SCONCE = registerBlock("gilded_sconce", - METorchBlock::new, AbstractBlock.Settings.copy(Blocks.LANTERN).luminance(createLightLevelFromLitBlockState(15)).nonOpaque().requiresTool()); + METorchBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.LANTERN).lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion().requiresCorrectToolForDrops()); public static final Block GILDED_WALL_SCONCE = registerBlock("gilded_wall_sconce", - MEWallTorchBlock::new, AbstractBlock.Settings.copy(Blocks.LANTERN).luminance(createLightLevelFromLitBlockState(15)).nonOpaque().requiresTool()); + MEWallTorchBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.LANTERN).lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion().requiresCorrectToolForDrops()); public static final Block ORCISH_SCONCE = registerBlock("orcish_sconce", - OrcSconceBlock::new, AbstractBlock.Settings.copy(Blocks.LANTERN).luminance(createLightLevelFromLitBlockState(15)).nonOpaque().requiresTool()); + OrcSconceBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.LANTERN).lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion().requiresCorrectToolForDrops()); public static final Block ORCISH_WALL_SCONCE = registerBlock("orcish_wall_sconce", - MEWallTorchBlock::new, AbstractBlock.Settings.copy(Blocks.LANTERN).luminance(createLightLevelFromLitBlockState(15)).nonOpaque().requiresTool()); + MEWallTorchBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.LANTERN).lightLevel(createLightLevelFromLitBlockState(15)).noOcclusion().requiresCorrectToolForDrops()); public static final Block GROUND_BOOK = registerBlockWithItem("ground_book", - GroundBookBlock::new, AbstractBlock.Settings.create().breakInstantly().nonOpaque().noCollision()); + GroundBookBlock::new, BlockBehaviour.Properties.of().instabreak().noOcclusion().noCollission()); public static final Block DWARVEN_GROUND_BOOK = registerBlockWithItem("dwarven_ground_book", - DwarvenGroundBookBlock::new, AbstractBlock.Settings.create().breakInstantly().nonOpaque().noCollision()); + DwarvenGroundBookBlock::new, BlockBehaviour.Properties.of().instabreak().noOcclusion().noCollission()); public static final Block TREATED_WOOD_LADDER = registerBlockWithItem("treated_wood_ladder", - ThickLadderBlock::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).sounds(BlockSoundGroup.LADDER).burnable()); + ThickLadderBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).sound(SoundType.LADDER).ignitedByLava()); public static final Block ROPE_LADDER = registerBlockWithItem("rope_ladder", - ThickLadderBlock::new, AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).sounds(BlockSoundGroup.WOOL).burnable()); + ThickLadderBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WHITE_WOOL).sound(SoundType.WOOL).ignitedByLava()); public static final Block TALL_BLACK_PINE_DOOR = registerBlock("tall_black_pine_door", - LargeDoor3x1::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS)); + LargeDoor3x1::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS)); public static final Block TALL_FIR_DOOR = registerBlock("tall_fir_door", - LargeDoor3x1::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS)); + LargeDoor3x1::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS)); public static final Block OAK_STABLE_DOOR = registerBlock("oak_stable_door", - LargeDoor4x2::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + LargeDoor4x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block REINFORCED_BLACK_PINE_DOOR = registerBlock("reinforced_black_pine_door", - LargeDoor4x2::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + LargeDoor4x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block REINFORCED_SPRUCE_DOOR = registerBlock("reinforced_spruce_door", - LargeDoor4x2::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + LargeDoor4x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block SIMPLE_LARCH_GATE = registerBlock("simple_larch_gate", - LargeDoor4x2::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + LargeDoor4x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block RICKETY_SIMPLE_LARCH_DOOR = registerBlock("rickety_simple_larch_door", - LargeDoor4x2::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + LargeDoor4x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block SPRUCE_STABLE_DOOR = registerBlock("spruce_stable_door", - LargeDoor4x2::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + LargeDoor4x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block LARGE_STURDY_DOOR = registerBlock("large_sturdy_door", - LargeDoor5x3::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + LargeDoor5x3::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block LARGE_BEECH_FENCE_GATE = registerBlock("large_beech_fence_gate", - LargeDoor1x2::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + LargeDoor1x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block LARCH_HOBBIT_DOOR = registerBlock("larch_hobbit_door", - LargeDoor2x2::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + LargeDoor2x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block SPRUCE_HOBBIT_DOOR = registerBlock("spruce_hobbit_door", - LargeDoor2x2::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + LargeDoor2x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block BLUE_HOBBIT_DOOR = registerBlock("blue_hobbit_door", - LargeDoor2x2::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + LargeDoor2x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block GREEN_HOBBIT_DOOR = registerBlock("green_hobbit_door", - LargeDoor2x2::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + LargeDoor2x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block LIGHT_BLUE_HOBBIT_DOOR = registerBlock("light_blue_hobbit_door", - LargeDoor2x2::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + LargeDoor2x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block RED_HOBBIT_DOOR = registerBlock("red_hobbit_door", - LargeDoor2x2::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + LargeDoor2x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block YELLOW_HOBBIT_DOOR = registerBlock("yellow_hobbit_door", - LargeDoor2x2::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + LargeDoor2x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block GREAT_GONDORIAN_GATE = registerBlock("great_gondorian_gate", - LargeDoor10x5::new, AbstractBlock.Settings.copy(Blocks.IRON_DOOR).nonOpaque()); + LargeDoor10x5::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_DOOR).noOcclusion()); public static final Block GREAT_DWARVEN_GATE = registerBlock("great_dwarven_gate", - LargeDoor5x2::new, AbstractBlock.Settings.copy(Blocks.IRON_DOOR).nonOpaque()); + LargeDoor5x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_DOOR).noOcclusion()); public static final Block HIDDEN_DWARVEN_DOOR = registerBlock("hidden_dwarven_door", - LargeThickDoor3x2::new, AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque()); + LargeThickDoor3x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.STONE).noOcclusion()); public static final Block VARNISHED_DWARVEN_DOOR = registerBlock("varnished_dwarven_door", - LargeDoor4x2::new, AbstractBlock.Settings.copy(Blocks.IRON_DOOR).nonOpaque()); + LargeDoor4x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_DOOR).noOcclusion()); public static final Block RUINED_DWARVEN_DOOR = registerBlock("ruined_dwarven_door", - LargeDoor4x2::new, AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque()); + LargeDoor4x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_PLANKS).noOcclusion()); public static final Block GREAT_ELVEN_GATE = registerBlock("great_elven_gate", - LargeDoor6x2::new, AbstractBlock.Settings.copy(Blocks.OAK_DOOR).nonOpaque()); + LargeDoor6x2::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_DOOR).noOcclusion()); public static final Block GREAT_ORCISH_GATE = registerBlock("great_orcish_gate", - LargeDoor10x4::new, AbstractBlock.Settings.copy(Blocks.IRON_DOOR).nonOpaque()); + LargeDoor10x4::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_DOOR).noOcclusion()); public static final Block FANCY_BED = registerBlockWithItem("fancy_bed", - (settings) -> new CustomBedBlock(DyeColor.BLACK, settings), AbstractBlock.Settings.copy(Blocks.BLACK_BED)); + (settings) -> new CustomBedBlock(DyeColor.BLACK, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_BED)); public static final Block FUR_BED = registerBlockWithItem("fur_bed", - (settings) -> new CustomBedBlock(DyeColor.BLACK, settings), AbstractBlock.Settings.copy(Blocks.BLACK_BED)); + (settings) -> new CustomBedBlock(DyeColor.BLACK, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_BED)); public static final Block STRAW_BED = registerBlockWithItem("straw_bed", - (settings) -> new CustomBedBlock(DyeColor.BLACK, settings), AbstractBlock.Settings.copy(Blocks.BLACK_BED)); + (settings) -> new CustomBedBlock(DyeColor.BLACK, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BLACK_BED)); public static final Block ARKENSTONE = registerBlock("arkenstone", - ArkenstoneBlock::new, AbstractBlock.Settings.copy(Blocks.AMETHYST_BLOCK).luminance((state -> 7)).nonOpaque().requiresTool()); + ArkenstoneBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.AMETHYST_BLOCK).lightLevel((state -> 7)).noOcclusion().requiresCorrectToolForDrops()); public static final Block WALL_ARKENSTONE = registerBlock("wall_arkenstone", - ArkenstoneWallBlock::new, AbstractBlock.Settings.copy(Blocks.AMETHYST_BLOCK).luminance((state -> 7)).nonOpaque().requiresTool()); + ArkenstoneWallBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.AMETHYST_BLOCK).lightLevel((state -> 7)).noOcclusion().requiresCorrectToolForDrops()); public static final Block REINFORCED_SCAFFOLDING = registerBlock("reinforced_scaffolding", - ReinforcedScaffoldingBlock::new, AbstractBlock.Settings.copy(Blocks.SCAFFOLDING).mapColor(MapColor.SPRUCE_BROWN) - .sounds(BlockSoundGroup.WOOD).allowsSpawning(Blocks::never).pistonBehavior(PistonBehavior.DESTROY).solidBlock(Blocks::never)); + ReinforcedScaffoldingBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SCAFFOLDING).mapColor(MapColor.PODZOL) + .sound(SoundType.WOOD).isValidSpawn(ModBlocks::never).pushReaction(PushReaction.DESTROY).isRedstoneConductor(ModBlocks::never)); + + public static Block registerBlock(String name, Function factory, BlockBehaviour.Properties settings) { + Block block = factory.apply(settings); + RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(BuiltInRegistries.BLOCK, name)); + return RegistrationBridge.register(BuiltInRegistries.BLOCK, ModBlocks.keyOfBlock(name).location(), block); + } + + private static Block registerPottedBlock(String name, Supplier content, BlockBehaviour.Properties settings) { + FlowerPotBlock pot = new FlowerPotBlock(() -> (FlowerPotBlock) Blocks.FLOWER_POT, content, settings); + FLOWER_POTS.add(new FlowerPotRegistration(content, pot)); + RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(BuiltInRegistries.BLOCK, name)); + return RegistrationBridge.register(BuiltInRegistries.BLOCK, ModBlocks.keyOfBlock(name).location(), pot); + } - public static Block registerBlock(String name, Function factory, AbstractBlock.Settings settings) { - Block block = (Block)factory.apply(settings.registryKey(ModBlocks.keyOfBlock(name))); - RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(Registries.BLOCK, name)); - return Registry.register(Registries.BLOCK, ModBlocks.keyOfBlock(name), block); + public static synchronized void registerFlowerPots() { + if (flowerPotsRegistered) { + return; + } + + FlowerPotBlock emptyPot = (FlowerPotBlock) Blocks.FLOWER_POT; + for (FlowerPotRegistration registration : FLOWER_POTS) { + Block content = registration.content().get(); + if (content == null) { + throw new IllegalStateException("Flower pot content was not registered"); + } + emptyPot.addPlant(BuiltInRegistries.BLOCK.getKey(content), registration::pot); + } + flowerPotsRegistered = true; } - public static Block registerBlockWithItem(String name, Function factory, AbstractBlock.Settings settings) { - Block block = (Block)factory.apply(settings.registryKey(ModBlocks.keyOfBlock(name))); + public static Block registerBlockWithItem(String name, Function factory, BlockBehaviour.Properties settings) { + Block block = factory.apply(settings); ModBlocks.registerBlockItem(name, block); - ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(block.asItem().getDefaultStack()); + ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(block.asItem().getDefaultInstance()); TranslationEntries.blockEntries.add(block); - RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(Registries.BLOCK, name)); - return Registry.register(Registries.BLOCK, ModBlocks.keyOfBlock(name), block); + RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(BuiltInRegistries.BLOCK, name)); + return RegistrationBridge.register(BuiltInRegistries.BLOCK, ModBlocks.keyOfBlock(name).location(), block); } private static ToIntFunction createLightLevelFromLitBlockState(int litLevel) { - return (state) -> (Boolean) state.get(Properties.LIT) ? litLevel : 0; + return (state) -> (Boolean) state.getValue(BlockStateProperties.LIT) ? litLevel : 0; } public static void registerModBlocks() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/ModNatureBlocks.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/ModNatureBlocks.java index ed274e75c2..738917ddb1 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/ModNatureBlocks.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/ModNatureBlocks.java @@ -1,11 +1,16 @@ + package net.sevenstars.middleearth.block.registration; -import net.minecraft.block.piston.PistonBehavior; +import net.sevenstars.api.registries.RegistrationBridge; + import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.*; import net.sevenstars.middleearth.block.special.crop.*; import net.sevenstars.middleearth.block.special.hangingstuff.CustomHangingBlock; import net.sevenstars.middleearth.block.special.hangingstuff.HangingCobwebBlock; +import net.sevenstars.middleearth.block.special.palemoss.PaleHangingMossBlock; +import net.sevenstars.middleearth.block.special.palemoss.PaleMossBlock; +import net.sevenstars.middleearth.block.special.palemoss.PaleMossCarpetBlock; import net.sevenstars.middleearth.block.special.plants.*; import net.sevenstars.middleearth.block.special.saplings.VariantSaplingBlock; import net.sevenstars.middleearth.block.special.saplings.WeightedSaplingBlock; @@ -16,20 +21,37 @@ import net.sevenstars.middleearth.datageneration.content.tags.Saplings; import net.sevenstars.middleearth.item.utils.ItemGroupsME; import net.sevenstars.middleearth.registries.RegistryAliasesME; +import net.sevenstars.middleearth.block.utils.BlockDataMapCollector; import net.sevenstars.middleearth.world.features.tree.ModTreeConfiguredFeatures; import net.sevenstars.middleearth.world.features.tree.MushroomTreeConfiguredFeatures; -import net.minecraft.block.*; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.registry.RegistryKey; -import net.minecraft.sound.BlockSoundGroup; -import net.minecraft.util.DyeColor; -import net.minecraft.util.Identifier; -import net.minecraft.world.gen.feature.ConfiguredFeature; - +import net.minecraft.world.level.block.*; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.CarpetBlock; +import net.minecraft.world.level.block.DoublePlantBlock; +import net.minecraft.world.level.block.PinkPetalsBlock; +import net.minecraft.world.level.block.FlowerBlock; +import net.minecraft.world.level.block.GlowLichenBlock; +import net.minecraft.world.level.block.HangingRootsBlock; +import net.minecraft.world.level.block.HugeMushroomBlock; +import net.minecraft.world.level.block.MangroveRootsBlock; +import net.minecraft.world.level.block.MushroomBlock; +import net.minecraft.world.level.block.SaplingBlock; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.WaterlilyBlock; +import net.minecraft.world.level.block.grower.TreeGrower; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import net.minecraft.world.level.material.MapColor; +import net.minecraft.world.level.material.PushReaction; import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -40,416 +62,460 @@ public class ModNatureBlocks { public static final Block MORGUL_IVY = registerBlock("morgul_ivy", - GlowLichenBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LICHEN_GREEN).replaceable().noCollision().strength(0.2f).sounds(BlockSoundGroup.GLOW_LICHEN) - .mapColor(DyeColor.GREEN).luminance(GlowLichenBlock.getLuminanceSupplier(5)).burnable(), true); + GlowLichenBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.GLOW_LICHEN).replaceable().noCollission().strength(0.2f).sound(SoundType.GLOW_LICHEN) + .mapColor(DyeColor.GREEN).lightLevel(GlowLichenBlock.emission(5)).ignitedByLava(), true); public static final Block CORRUPTED_MOSS_CARPET = registerBlock("corrupted_moss_carpet", - CarpetBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.GREEN).strength(0.1f).sounds(BlockSoundGroup.MOSS_CARPET), true); + CarpetBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).strength(0.1f).sound(SoundType.MOSS_CARPET), true); public static final Block CORRUPTED_MOSS_BLOCK = registerBlock("corrupted_moss_block", - Block::new, AbstractBlock.Settings.create().mapColor(MapColor.GREEN).strength(0.1f).sounds(BlockSoundGroup.MOSS_BLOCK), true); + Block::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).strength(0.1f).sound(SoundType.MOSS), true); public static final Block CORRUPTED_MOSS = registerBlock("corrupted_moss", - GlowLichenBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LICHEN_GREEN).replaceable().noCollision().strength(0.2f).sounds(BlockSoundGroup.GLOW_LICHEN) - .mapColor(DyeColor.GREEN).burnable(), true); + GlowLichenBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.GLOW_LICHEN).replaceable().noCollission().strength(0.2f).sound(SoundType.GLOW_LICHEN) + .mapColor(DyeColor.GREEN).ignitedByLava(), true); public static final Block MOSS = registerBlock("moss", - GlowLichenBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LICHEN_GREEN).replaceable().noCollision().strength(0.2f).sounds(BlockSoundGroup.GLOW_LICHEN) - .mapColor(DyeColor.GREEN).burnable(), true); + GlowLichenBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.GLOW_LICHEN).replaceable().noCollission().strength(0.2f).sound(SoundType.GLOW_LICHEN) + .mapColor(DyeColor.GREEN).ignitedByLava(), true); public static final Block FOREST_MOSS = registerBlock("forest_moss", - GlowLichenBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LICHEN_GREEN).replaceable().noCollision().strength(0.2f).sounds(BlockSoundGroup.GLOW_LICHEN) - .mapColor(DyeColor.GREEN).burnable(), true); + GlowLichenBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.GLOW_LICHEN).replaceable().noCollission().strength(0.2f).sound(SoundType.GLOW_LICHEN) + .mapColor(DyeColor.GREEN).ignitedByLava(), true); public static final Block FOREST_MOSS_CARPET = registerBlock("forest_moss_carpet", - CarpetBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.GREEN).strength(0.1f).sounds(BlockSoundGroup.MOSS_CARPET), true); + CarpetBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).strength(0.1f).sound(SoundType.MOSS_CARPET), true); public static final Block FOREST_MOSS_BLOCK = registerBlock("forest_moss_block", - Block::new, AbstractBlock.Settings.create().mapColor(MapColor.GREEN).strength(0.1f).sounds(BlockSoundGroup.MOSS_BLOCK), true); + Block::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).strength(0.1f).sound(SoundType.MOSS), true); + + public static final Block RESIN_CLUMP = registerBlock("resin_clump", + BackportedResinClumpBlock::new, BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_ORANGE).replaceable().noCollission() + .sound(SoundType.HONEY_BLOCK).ignitedByLava() + .pushReaction(PushReaction.DESTROY), true); + + public static final Block PALE_MOSS_BLOCK = registerBlock("pale_moss_block", + PaleMossBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_GRAY) + .strength(0.1F).sound(SoundType.MOSS).pushReaction(PushReaction.DESTROY).ignitedByLava(), true); + + public static final Block PALE_MOSS_CARPET = registerBlock("pale_moss_carpet", + PaleMossCarpetBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_GRAY) + .strength(0.1F).sound(SoundType.MOSS_CARPET).noOcclusion() + .pushReaction(PushReaction.DESTROY).ignitedByLava(), true); + + public static final Block PALE_HANGING_MOSS = registerBlock("pale_hanging_moss", + PaleHangingMossBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_GRAY) + .noCollission().instabreak().sound(SoundType.MOSS_CARPET) + .pushReaction(PushReaction.DESTROY).ignitedByLava(), true); public static final Block OLD_PODZOL = registerBlock("old_podzol", - Block::new, AbstractBlock.Settings.create().mapColor(MapColor.SPRUCE_BROWN).strength(0.5F).sounds(BlockSoundGroup.GRAVEL), true); + Block::new, BlockBehaviour.Properties.of().mapColor(MapColor.PODZOL).strength(0.5F).sound(SoundType.GRAVEL), true); public static final Block LORIEN_PODZOL = registerBlock("lorien_podzol", - Block::new, AbstractBlock.Settings.create().mapColor(MapColor.SPRUCE_BROWN).strength(0.5F).sounds(BlockSoundGroup.GRAVEL), true); + Block::new, BlockBehaviour.Properties.of().mapColor(MapColor.PODZOL).strength(0.5F).sound(SoundType.GRAVEL), true); public static final Block BLUE_FESCUE = registerBlock("blue_fescue", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block BROWN_GRASS = registerBlock("brown_grass", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block DYING_GRASS = registerBlock("dying_grass", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block GRIM_GRASS = registerBlock("grim_grass", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block MEADOWGRASS = registerBlock("meadowgrass", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block SPARSE_GRASS = registerBlock("sparse_grass", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block TEMPERATE_GRASS = registerBlock("temperate_grass", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block GRASS_TUFT = registerBlock("grass_tuft", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block HEATHER = registerBlock("heather", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block RED_HEATHER = registerBlock("red_heather", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block DEAD_HEATHER = registerBlock("dead_heather", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block DRY_HEATHER = registerBlock("dry_heather", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block HEATH = registerBlock("heath", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block WHEATGRASS = registerBlock("wheatgrass", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block WILDERGRASS = registerBlock("wildergrass", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block MISTWEED = registerBlock("mistweed", - MistweedPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + MistweedPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block SEDUM = registerBlock("sedum", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block ORANGE_SEDUM = registerBlock("orange_sedum", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block RED_SEDUM = registerBlock("red_sedum", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block YELLOW_SEDUM = registerBlock("yellow_sedum", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block GREEN_SHRUB = registerBlock("green_shrub", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block SMALL_DRY_SHRUB = registerBlock("small_dry_shrub", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) - .mapColor(DyeColor.GREEN), true); + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) + .mapColor(DyeColor.GREEN), true); + + public static final Block BUSH = registerCrossBlock("bush", + BackportedBushBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN) + .replaceable().noCollission().instabreak().sound(SoundType.GRASS).ignitedByLava() + .pushReaction(PushReaction.DESTROY), true); + public static final Block SHORT_DRY_GRASS = registerCrossBlock("short_dry_grass", + BackportedShortDryGrassBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW) + .replaceable().noCollission().instabreak().sound(SoundType.GRASS).ignitedByLava() + .offsetType(BlockBehaviour.OffsetType.XYZ).pushReaction(PushReaction.DESTROY), true); + public static final Block TALL_DRY_GRASS = registerCrossBlock("tall_dry_grass", + BackportedTallDryGrassBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_YELLOW) + .replaceable().noCollission().instabreak().sound(SoundType.GRASS).ignitedByLava() + .offsetType(BlockBehaviour.OffsetType.XYZ).pushReaction(PushReaction.DESTROY), true); + public static final Block WILDFLOWERS = registerBlock("wildflowers", + PinkPetalsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.PINK_PETALS) + .mapColor(MapColor.COLOR_GREEN).noCollission().pushReaction(PushReaction.DESTROY), true); + public static final Block LEAF_LITTER = registerBlock("leaf_litter", + BackportedLeafLitterBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.PINK_PETALS) + .mapColor(MapColor.COLOR_BROWN).replaceable().noCollission().sound(SoundType.GRASS) + .pushReaction(PushReaction.DESTROY), true); + public static final Block FIREFLY_BUSH = registerCrossBlock("firefly_bush", + BackportedFireflyBushBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN) + .ignitedByLava().lightLevel(state -> 2).noCollission().instabreak() + .sound(SoundType.SWEET_BERRY_BUSH).pushReaction(PushReaction.DESTROY), true); public static final Block BEACH_GRASS = registerBlock("beach_grass", - DesertPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + DesertPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block COASTAL_PANIC_GRASS = registerBlock("coastal_panic_grass", - DesertPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + DesertPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block SHRIVELED_SHRUB = registerBlock("shriveled_shrub", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.DEAD_BUSH).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DEAD_BUSH).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.BROWN), true); public static final Block CAMPION = registerBlock("campion", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.BROWN), true); public static final Block BLUE_BIGLEAF_HYDRANGEA = registerBlock("blue_bigleaf_hydrangea", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.BROWN), true); public static final Block PINK_BIGLEAF_HYDRANGEA = registerBlock("pink_bigleaf_hydrangea", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.BROWN), true); public static final Block WHITE_BIGLEAF_HYDRANGEA = registerBlock("white_bigleaf_hydrangea", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.BROWN), true); public static final Block DEAD_HEATHER_BUSH = registerBlock("dead_heather_bush", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.BROWN), true); public static final Block DRY_HEATHER_BUSH = registerBlock("dry_heather_bush", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.BROWN), true); public static final Block DEAD_RUSHES = registerBlock("dead_rushes", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.BROWN), true); public static final Block FALSE_OATGRASS = registerBlock("false_oatgrass", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.BROWN), true); public static final Block HEATHER_BUSH = registerBlock("heather_bush", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.BROWN), true); public static final Block LARGE_BLUE_FESCUE = registerBlock("large_blue_fescue", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.BROWN), true); public static final Block LARGE_BUSH = registerBlock("large_bush", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.BROWN), true); public static final Block LARGE_SHRIVELED_SHRUB = registerBlock("large_shriveled_shrub", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.BROWN), true); public static final Block RED_HEATHER_BUSH = registerBlock("red_heather_bush", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.BROWN), true); public static final Block RUSHES = registerBlock("rushes", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.BROWN), true); public static final Block WILD_GRASS = registerBlock("wild_grass", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block BRACKEN = registerBlock("bracken", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XZ) .mapColor(DyeColor.GREEN), true); public static final Block GIANT_BUTTERBUR = registerBlock("giant_butterbur", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XZ) .mapColor(DyeColor.GREEN), true); public static final Block NETTLES = registerBlock("nettles", - PricklyPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + PricklyPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block THISTLE = registerBlock("thistle", - PricklyPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + PricklyPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block ATHELAS = registerBlock("athelas", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block BRAMBLES_OF_MORDOR = registerBlock("brambles_of_mordor", - MordorPricklyPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + MordorPricklyPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block ELANOR = registerBlock("elanor", - (settings) -> new FlowerBlock(StatusEffects.GLOWING, 3, settings), AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly() - .sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ).mapColor(DyeColor.GREEN), true); + (settings) -> new FlowerBlock(MobEffects.GLOWING, 3, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak() + .sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ).mapColor(DyeColor.GREEN), true); public static final Block MALLOS = registerBlock("mallos", - (settings) -> new FlowerBlock(StatusEffects.GLOWING, 3, settings), AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly() - .sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ).mapColor(DyeColor.GREEN), true); + (settings) -> new FlowerBlock(MobEffects.GLOWING, 3, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak() + .sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ).mapColor(DyeColor.GREEN), true); public static final Block NIPHREDIL = registerBlock("niphredil", - (settings) -> new FlowerBlock(StatusEffects.GLOWING, 3, settings), AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly() - .sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ).mapColor(DyeColor.GREEN), true); + (settings) -> new FlowerBlock(MobEffects.GLOWING, 3, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak() + .sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ).mapColor(DyeColor.GREEN), true); public static final Block SIMBELMYNE = registerBlock("simbelmyne", - (settings) -> new FlowerBlock(StatusEffects.GLOWING, 3, settings), AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly() - .sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ).mapColor(DyeColor.GREEN), true); + (settings) -> new FlowerBlock(MobEffects.GLOWING, 3, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak() + .sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ).mapColor(DyeColor.GREEN), true); public static final Block TAN_SHRUB = registerBlock("tan_shrub", - DesertPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + DesertPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block BLUE_GENTIAN = registerBlock("blue_gentian", - (settings) -> new FlowerBlock(StatusEffects.SATURATION, 0, settings), AbstractBlock.Settings.copy(Blocks.DANDELION), true); + (settings) -> new FlowerBlock(MobEffects.SATURATION, 0, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DANDELION), true); public static final Block GREEN_JEWEL_CORNFLOWER = registerBlock("green_jewel_cornflower", - (settings) -> new FlowerBlock(StatusEffects.SATURATION, 0, settings), AbstractBlock.Settings.copy(Blocks.DANDELION), true); + (settings) -> new FlowerBlock(MobEffects.SATURATION, 0, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DANDELION), true); public static final Block NOBLEWHITE = registerBlock("noblewhite", - (settings) -> new FlowerBlock(StatusEffects.SATURATION, 0, settings), AbstractBlock.Settings.copy(Blocks.DANDELION), true); + (settings) -> new FlowerBlock(MobEffects.SATURATION, 0, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DANDELION), true); public static final Block YELLOW_FLOWER = registerBlock("yellow_flower", - (settings) -> new FlowerBlock(StatusEffects.FIRE_RESISTANCE, 0, settings), AbstractBlock.Settings.copy(Blocks.DANDELION), true); + (settings) -> new FlowerBlock(MobEffects.FIRE_RESISTANCE, 0, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DANDELION), true); public static final Block LIGHT_BLUE_FLOWERS = registerBlock("light_blue_flowers", - (settings) -> new FlowerBlock(StatusEffects.SATURATION, 0, settings), AbstractBlock.Settings.copy(Blocks.DANDELION), true); + (settings) -> new FlowerBlock(MobEffects.SATURATION, 0, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DANDELION), true); public static final Block MAGENTA_FLOWERS = registerBlock("magenta_flowers", - (settings) -> new FlowerBlock(StatusEffects.SATURATION, 0, settings), AbstractBlock.Settings.copy(Blocks.DANDELION), true); + (settings) -> new FlowerBlock(MobEffects.SATURATION, 0, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DANDELION), true); public static final Block ORANGE_FLOWERS = registerBlock("orange_flowers", - (settings) -> new FlowerBlock(StatusEffects.SATURATION, 0, settings), AbstractBlock.Settings.copy(Blocks.DANDELION), true); + (settings) -> new FlowerBlock(MobEffects.SATURATION, 0, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DANDELION), true); public static final Block PINK_FLOWERS = registerBlock("pink_flowers", - (settings) -> new FlowerBlock(StatusEffects.SATURATION, 0, settings), AbstractBlock.Settings.copy(Blocks.DANDELION), true); + (settings) -> new FlowerBlock(MobEffects.SATURATION, 0, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DANDELION), true); public static final Block PURPLE_FLOWERS = registerBlock("purple_flowers", - (settings) -> new FlowerBlock(StatusEffects.SATURATION, 0, settings), AbstractBlock.Settings.copy(Blocks.DANDELION), true); + (settings) -> new FlowerBlock(MobEffects.SATURATION, 0, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DANDELION), true); public static final Block RED_FLOWERS = registerBlock("red_flowers", - (settings) -> new FlowerBlock(StatusEffects.SATURATION, 0, settings), AbstractBlock.Settings.copy(Blocks.DANDELION), true); + (settings) -> new FlowerBlock(MobEffects.SATURATION, 0, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DANDELION), true); public static final Block WHITE_FLOWERS = registerBlock("white_flowers", - (settings) -> new FlowerBlock(StatusEffects.SATURATION, 0, settings), AbstractBlock.Settings.copy(Blocks.DANDELION), true); + (settings) -> new FlowerBlock(MobEffects.SATURATION, 0, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DANDELION), true); public static final Block YELLOW_FLOWERS = registerBlock("yellow_flowers", - (settings) -> new FlowerBlock(StatusEffects.SATURATION, 0, settings), AbstractBlock.Settings.copy(Blocks.DANDELION), true); + (settings) -> new FlowerBlock(MobEffects.SATURATION, 0, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DANDELION), true); public static final Block BLUE_LAVENDER = registerBlock("blue_lavender", - (settings) -> new FlowerBlock(StatusEffects.SATURATION, 0, settings), AbstractBlock.Settings.copy(Blocks.DANDELION), true); + (settings) -> new FlowerBlock(MobEffects.SATURATION, 0, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DANDELION), true); public static final Block LAVENDER = registerBlock("lavender", - (settings) -> new FlowerBlock(StatusEffects.SATURATION, 0, settings), AbstractBlock.Settings.copy(Blocks.DANDELION), true); + (settings) -> new FlowerBlock(MobEffects.SATURATION, 0, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DANDELION), true); public static final Block WHITE_LAVENDER = registerBlock("white_lavender", - (settings) -> new FlowerBlock(StatusEffects.SATURATION, 0, settings), AbstractBlock.Settings.copy(Blocks.DANDELION), true); + (settings) -> new FlowerBlock(MobEffects.SATURATION, 0, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DANDELION), true); public static final Block YELLOW_TROLLIUS = registerBlock("yellow_trollius", - (settings) -> new FlowerBlock(StatusEffects.SATURATION, 0, settings), AbstractBlock.Settings.copy(Blocks.DANDELION), true); + (settings) -> new FlowerBlock(MobEffects.SATURATION, 0, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.DANDELION), true); public static final Block HOBBIT_SUNFLOWERS = registerBlock("hobbit_sunflowers", - RotatableTallFlowerBlock::new, AbstractBlock.Settings.copy(Blocks.SUNFLOWER), true); + RotatableTallFlowerBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SUNFLOWER), true); public static final Block HOGWEED = registerBlock("hogweed", - TallPlantBlock::new, AbstractBlock.Settings.copy(Blocks.TALL_GRASS).breakInstantly(), true); + DoublePlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.TALL_GRASS).instabreak(), true); public static final Block SHORT_HOGWEED = registerBlock("short_hogweed", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS), true); + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS), true); public static final Block AZALEA_FLOWER_GROWTH = registerBlock("azalea_flower_growth", - GlowLichenBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LICHEN_GREEN).replaceable().noCollision().strength(0.2f).sounds(BlockSoundGroup.GLOW_LICHEN) - .mapColor(DyeColor.GREEN).burnable(), true); + GlowLichenBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.GLOW_LICHEN).replaceable().noCollission().strength(0.2f).sound(SoundType.GLOW_LICHEN) + .mapColor(DyeColor.GREEN).ignitedByLava(), true); public static final Block DRY_GROWTH = registerBlock("dry_growth", - GlowLichenBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LICHEN_GREEN).replaceable().noCollision().strength(0.2f).sounds(BlockSoundGroup.GLOW_LICHEN) - .mapColor(DyeColor.GREEN).burnable(), true); + GlowLichenBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.GLOW_LICHEN).replaceable().noCollission().strength(0.2f).sound(SoundType.GLOW_LICHEN) + .mapColor(DyeColor.GREEN).ignitedByLava(), true); public static final Block GREEN_GROWTH = registerBlock("green_growth", - GlowLichenBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LICHEN_GREEN).replaceable().noCollision().strength(0.2f).sounds(BlockSoundGroup.GLOW_LICHEN) - .mapColor(DyeColor.GREEN).burnable(), true); + GlowLichenBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.GLOW_LICHEN).replaceable().noCollission().strength(0.2f).sound(SoundType.GLOW_LICHEN) + .mapColor(DyeColor.GREEN).ignitedByLava(), true); public static final Block IVY_GROWTH = registerBlock("ivy_growth", - GlowLichenBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LICHEN_GREEN).replaceable().noCollision().strength(0.2f).sounds(BlockSoundGroup.GLOW_LICHEN) - .mapColor(DyeColor.GREEN).burnable(), true); + GlowLichenBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.GLOW_LICHEN).replaceable().noCollission().strength(0.2f).sound(SoundType.GLOW_LICHEN) + .mapColor(DyeColor.GREEN).ignitedByLava(), true); public static final Block LILAC_FLOWER_GROWTH = registerBlock("lilac_flower_growth", - GlowLichenBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LICHEN_GREEN).replaceable().noCollision().strength(0.2f).sounds(BlockSoundGroup.GLOW_LICHEN) - .mapColor(DyeColor.GREEN).burnable(), true); + GlowLichenBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.GLOW_LICHEN).replaceable().noCollission().strength(0.2f).sound(SoundType.GLOW_LICHEN) + .mapColor(DyeColor.GREEN).ignitedByLava(), true); public static final Block PINK_FLOWER_GROWTH = registerBlock("pink_flower_growth", - GlowLichenBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LICHEN_GREEN).replaceable().noCollision().strength(0.2f).sounds(BlockSoundGroup.GLOW_LICHEN) - .mapColor(DyeColor.GREEN).burnable(), true); + GlowLichenBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.GLOW_LICHEN).replaceable().noCollission().strength(0.2f).sound(SoundType.GLOW_LICHEN) + .mapColor(DyeColor.GREEN).ignitedByLava(), true); public static final Block RED_FLOWER_GROWTH = registerBlock("red_flower_growth", - GlowLichenBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LICHEN_GREEN).replaceable().noCollision().strength(0.2f).sounds(BlockSoundGroup.GLOW_LICHEN) - .mapColor(DyeColor.GREEN).burnable(), true); + GlowLichenBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.GLOW_LICHEN).replaceable().noCollission().strength(0.2f).sound(SoundType.GLOW_LICHEN) + .mapColor(DyeColor.GREEN).ignitedByLava(), true); public static final Block THORNY_GROWTH = registerBlock("thorny_growth", - ThornyGrowthBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LICHEN_GREEN).replaceable().noCollision().strength(0.2f).sounds(BlockSoundGroup.GLOW_LICHEN) - .mapColor(DyeColor.GREEN).burnable(), true); + ThornyGrowthBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.GLOW_LICHEN).replaceable().noCollission().strength(0.2f).sound(SoundType.GLOW_LICHEN) + .mapColor(DyeColor.GREEN).ignitedByLava(), true); public static final Block WHITE_FLOWER_GROWTH = registerBlock("white_flower_growth", - GlowLichenBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LICHEN_GREEN).replaceable().noCollision().strength(0.2f).sounds(BlockSoundGroup.GLOW_LICHEN) - .mapColor(DyeColor.GREEN).burnable(), true); + GlowLichenBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.GLOW_LICHEN).replaceable().noCollission().strength(0.2f).sound(SoundType.GLOW_LICHEN) + .mapColor(DyeColor.GREEN).ignitedByLava(), true); public static final Block YELLOW_FLOWER_GROWTH = registerBlock("yellow_flower_growth", - GlowLichenBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LICHEN_GREEN).replaceable().noCollision().strength(0.2f).sounds(BlockSoundGroup.GLOW_LICHEN) - .mapColor(DyeColor.GREEN).burnable(), true); + GlowLichenBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.GLOW_LICHEN).replaceable().noCollission().strength(0.2f).sound(SoundType.GLOW_LICHEN) + .mapColor(DyeColor.GREEN).ignitedByLava(), true); public static final Block CLOVERS = registerBlock("clovers", - FlowerbedBlock::new, AbstractBlock.Settings.copy(Blocks.PINK_PETALS), true); + PinkPetalsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.PINK_PETALS), true); public static final Block SHORT_DEAD_RUSHES = registerBlock("short_dead_rushes", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block SHORT_RUSHES = registerBlock("short_rushes", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block SHORT_REEDS = registerBlock("short_reeds", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block SHORT_CATTAILS = registerBlock("short_cattails", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(MapColor.TERRACOTTA_BROWN), true); public static final Block SHORT_BULRUSH = registerBlock("short_bulrush", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(MapColor.TERRACOTTA_BROWN), true); public static final Block TALL_CATTAILS = registerBlock("tall_cattails", - (settings) -> new CustomWaterloggableTallPlantBlock(settings, false), AbstractBlock.Settings.copy(Blocks.TALL_GRASS).breakInstantly(), true); + (settings) -> new CustomWaterloggableTallPlantBlock(settings, false), BlockBehaviour.Properties.ofFullCopy(Blocks.TALL_GRASS).instabreak(), true); public static final Block TALL_BULRUSH = registerBlock("tall_bulrush", - (settings) -> new CustomWaterloggableTallPlantBlock(settings, false), AbstractBlock.Settings.copy(Blocks.TALL_GRASS).breakInstantly(), true); + (settings) -> new CustomWaterloggableTallPlantBlock(settings, false), BlockBehaviour.Properties.ofFullCopy(Blocks.TALL_GRASS).instabreak(), true); public static final Block SMALL_LILY_PADS = registerBlock("small_lily_pads", - LilyPadBlock::new, AbstractBlock.Settings.copy(Blocks.LILY_PAD).noCollision(), false); + WaterlilyBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.LILY_PAD).noCollission(), false); public static final Block SMALL_FLOWERING_LILY_PADS = registerBlock("small_flowering_lily_pads", - LilyPadBlock::new, AbstractBlock.Settings.copy(Blocks.LILY_PAD).noCollision(), false); + WaterlilyBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.LILY_PAD).noCollission(), false); public static final Block LILY_PADS = registerBlock("lily_pads", - LilyPadBlock::new, AbstractBlock.Settings.copy(Blocks.LILY_PAD).noCollision(), false); + WaterlilyBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.LILY_PAD).noCollission(), false); public static final Block FLOWERING_LILY_PADS = registerBlock("flowering_lily_pads", - LilyPadBlock::new, AbstractBlock.Settings.copy(Blocks.LILY_PAD).noCollision(), false); + WaterlilyBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.LILY_PAD).noCollission(), false); public static final Block LARGE_LILY_PAD = registerBlock("large_lily_pad", - LilyPadBlock::new, AbstractBlock.Settings.copy(Blocks.LILY_PAD), false); + WaterlilyBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.LILY_PAD), false); public static final Block LARGE_FLOWERING_LILY_PAD = registerBlock("large_flowering_lily_pad", - LilyPadBlock::new, AbstractBlock.Settings.copy(Blocks.LILY_PAD), false); + WaterlilyBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.LILY_PAD), false); public static final Block DUCKWEED = registerBlock("duckweed", - LilyPadBlock::new, AbstractBlock.Settings.copy(Blocks.LILY_PAD).noCollision(), false); + WaterlilyBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.LILY_PAD).noCollission(), false); public static final Block FROZEN_GRASS = registerBlock("frozen_grass", - DesertPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + DesertPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block FROZEN_TUFT = registerBlock("frozen_tuft", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block FROZEN_SHRUB = registerBlock("frozen_shrub", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block FROZEN_GROWTH = registerBlock("frozen_growth", - GlowLichenBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LICHEN_GREEN).replaceable().noCollision().strength(0.2f).sounds(BlockSoundGroup.GLOW_LICHEN) - .mapColor(DyeColor.GREEN).burnable(), true); + GlowLichenBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.GLOW_LICHEN).replaceable().noCollission().strength(0.2f).sound(SoundType.GLOW_LICHEN) + .mapColor(DyeColor.GREEN).ignitedByLava(), true); public static final Block STICKY_SNOW = registerBlock("sticky_snow", - GlowLichenBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.WHITE).replaceable().noCollision() - .strength(0.2f).sounds(BlockSoundGroup.SNOW), true); + GlowLichenBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.SNOW).replaceable().noCollission() + .strength(0.2f).sound(SoundType.SNOW), true); public static final Block STICKY_ICE = registerBlock("sticky_ice", - GlowLichenBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LIGHT_BLUE).replaceable().noCollision() - .strength(0.2f).sounds(BlockSoundGroup.GLASS), true); + GlowLichenBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_BLUE).replaceable().noCollission() + .strength(0.2f).sound(SoundType.GLASS), true); public static final Block SHORT_ICICLES = registerBlock("short_icicles", - ShortIciclesBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LIGHT_BLUE).noCollision() - .strength(0.2f).sounds(BlockSoundGroup.GLASS), true); + ShortIciclesBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_BLUE).noCollission() + .strength(0.2f).sound(SoundType.GLASS), true); public static final Block DROOPING_ICICLES = registerBlock("drooping_icicles", - DroopingIciclesBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.LIGHT_BLUE).noCollision() - .strength(0.2f).sounds(BlockSoundGroup.GLASS), true); + DroopingIciclesBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_LIGHT_BLUE).noCollission() + .strength(0.2f).sound(SoundType.GLASS), true); public static final Block FLOATING_ICE = registerBlock("floating_ice", - FloatingIceBlock::new, AbstractBlock.Settings.copy(Blocks.ICE), false); + FloatingIceBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.ICE), false); public static final Block SCORCHED_GRASS = registerBlock("scorched_grass", - DesertPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + DesertPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block SCORCHED_TUFT = registerBlock("scorched_tuft", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block SCORCHED_SHRUB = registerBlock("scorched_shrub", - CustomPlantBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).noCollision().breakInstantly().sounds(BlockSoundGroup.GRASS).offset(AbstractBlock.OffsetType.XYZ) + CustomPlantBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).noCollission().instabreak().sound(SoundType.GRASS).offsetType(BlockBehaviour.OffsetType.XYZ) .mapColor(DyeColor.GREEN), true); public static final Block BROWN_BOLETE = registerBlock("brown_bolete", - (settings) -> new MushroomPlantBlock(MushroomTreeConfiguredFeatures.BROWN_BOLETTE_TREE_KEY, settings), AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + (settings) -> new MushroomBlock(MushroomTreeConfiguredFeatures.BROWN_BOLETTE_TREE_KEY, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block CAVE_AMANITA = registerBlock("cave_amanita", - (settings) -> new MushroomPlantBlock(MushroomTreeConfiguredFeatures.CAVE_AMANITA_TREE_KEY, settings), AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + (settings) -> new MushroomBlock(MushroomTreeConfiguredFeatures.CAVE_AMANITA_TREE_KEY, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block DEEP_FIRECAP = registerBlock("deep_firecap", - (settings) -> new MushroomPlantBlock(MushroomTreeConfiguredFeatures.DEEP_FIRECAP_TREE_KEY, settings), AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + (settings) -> new MushroomBlock(MushroomTreeConfiguredFeatures.DEEP_FIRECAP_TREE_KEY, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block GHOSTSHROOM = registerBlock("ghostshroom", - (settings) -> new MushroomPlantBlock(null, settings), AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM).luminance(state -> 4), true); + (settings) -> new MushroomBlock(null, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM).lightLevel(state -> 4), true); public static final Block MORSEL = registerBlock("morsel", - (settings) -> new MushroomPlantBlock(null, settings), AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + (settings) -> new MushroomBlock(null, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block SKY_FIRECAP = registerBlock("sky_firecap", - (settings) -> new MushroomPlantBlock(MushroomTreeConfiguredFeatures.SKY_FIRECAP_TREE_KEY, settings), AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + (settings) -> new MushroomBlock(MushroomTreeConfiguredFeatures.SKY_FIRECAP_TREE_KEY, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block TRUMPET_SHROOM = registerBlock("trumpet_shroom", - (settings) -> new MushroomPlantBlock(null, settings), AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + (settings) -> new MushroomBlock(null, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block TALL_TRUMPET_SHROOM = registerBlock("tall_trumpet_shroom", - TallMushroomBlock::new, AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + TallMushroomBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block TUBESHRROM = registerBlock("tubeshroom", - (settings) -> new MushroomPlantBlock(null, settings), AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM).luminance(state -> 4), true); + (settings) -> new MushroomBlock(null, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM).lightLevel(state -> 4), true); public static final Block TALL_TUBESHROOM = registerBlock("tall_tubeshroom", - TallMushroomBlock::new, AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM).luminance(state -> 5), true); + TallMushroomBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM).lightLevel(state -> 5), true); public static final Block VIOLET_CAPS = registerBlock("violet_caps", - (settings) -> new MushroomPlantBlock(null, settings),AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + (settings) -> new MushroomBlock(null, settings),BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block WHITE_MUSHROOM = registerBlock("white_mushroom", - (settings) -> new MushroomPlantBlock(null, settings),AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + (settings) -> new MushroomBlock(null, settings),BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block YELLOW_AMANITA = registerBlock("yellow_amanita", - (settings) -> new MushroomPlantBlock(MushroomTreeConfiguredFeatures.YELLOW_AMANITA_TREE_KEY,settings), AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + (settings) -> new MushroomBlock(MushroomTreeConfiguredFeatures.YELLOW_AMANITA_TREE_KEY,settings), BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block BROWN_BOLETE_TILLER = registerBlock("brown_bolete_tiller", - FlowerbedMushroomBlock::new, AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + FlowerbedMushroomBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block CAVE_AMANITA_TILLER = registerBlock("cave_amanita_tiller", - FlowerbedMushroomBlock::new, AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + FlowerbedMushroomBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block DEEP_FIRECAP_TILLER = registerBlock("deep_firecap_tiller", - FlowerbedMushroomBlock::new, AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + FlowerbedMushroomBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block GHOSTSHROOM_TILLER = registerBlock("ghostshroom_tiller", - FlowerbedMushroomBlock::new, AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM).luminance(state -> 4), true); + FlowerbedMushroomBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM).lightLevel(state -> 4), true); public static final Block MORSEL_TILLER = registerBlock("morsel_tiller", - FlowerbedMushroomBlock::new, AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + FlowerbedMushroomBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block SKY_FIRECAP_TILLER = registerBlock("sky_firecap_tiller", - FlowerbedMushroomBlock::new, AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + FlowerbedMushroomBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block VIOLET_CAPS_TILLER = registerBlock("violet_caps_tiller", - FlowerbedMushroomBlock::new, AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + FlowerbedMushroomBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block WHITE_MUSHROOM_TILLER = registerBlock("white_mushroom_tiller", - FlowerbedMushroomBlock::new, AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + FlowerbedMushroomBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block YELLOW_AMANITA_TILLER = registerBlock("yellow_amanita_tiller", - FlowerbedMushroomBlock::new, AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM), true); + FlowerbedMushroomBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM), true); public static final Block BROWN_BOLETE_BLOCK = registerBlock("brown_bolete_block", - MushroomBlock::new, AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM_BLOCK), true); + HugeMushroomBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM_BLOCK), true); public static final Block CAVE_AMANITA_BLOCK = registerBlock("cave_amanita_block", - MushroomBlock::new, AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM_BLOCK), true); + HugeMushroomBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM_BLOCK), true); public static final Block DEEP_FIRECAP_BLOCK = registerBlock("deep_firecap_block", - MushroomBlock::new, AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM_BLOCK), true); + HugeMushroomBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM_BLOCK), true); public static final Block SKY_FIRECAP_BLOCK = registerBlock("sky_firecap_block", - MushroomBlock::new, AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM_BLOCK), true); + HugeMushroomBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM_BLOCK), true); public static final Block YELLOW_AMANITA_BLOCK = registerBlock("yellow_amanita_block", - MushroomBlock::new, AbstractBlock.Settings.copy(Blocks.BROWN_MUSHROOM_BLOCK), true); + HugeMushroomBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.BROWN_MUSHROOM_BLOCK), true); public static final Block ASPEN_SAPLING = registerSimpleSapling("aspen_sapling", ModTreeConfiguredFeatures.ASPEN_TREE_KEY); public static final Block BEECH_SAPLING = registerSimpleSapling("beech_sapling", ModTreeConfiguredFeatures.BEECH_TREE_KEY); @@ -475,204 +541,248 @@ public class ModNatureBlocks { public static final Block BLACK_PINE_SAPLING = registerSimpleSapling("black_pine_sapling", ModTreeConfiguredFeatures.BLACK_PINE_TREE_KEY); public static final Block WHITE_SPRUCE_SAPLING = registerSimpleSapling("white_spruce_sapling", ModTreeConfiguredFeatures.WHITE_SPRUCE_TREE_KEY); public static final Block WILLOW_SAPLING = registerSimpleSapling("willow_sapling", ModTreeConfiguredFeatures.WILLOW_TREE_KEY); + public static final Block PALE_OAK_SAPLING = registerPaleOakSapling(); + public static final Block POTTED_PALE_OAK_SAPLING = registerPottedPaleOakSapling(); + + static { + BlockDataMapCollector.registerFlammable(PALE_MOSS_BLOCK, 5, 100); + BlockDataMapCollector.registerFlammable(PALE_MOSS_CARPET, 5, 100); + BlockDataMapCollector.registerFlammable(PALE_HANGING_MOSS, 5, 100); + BlockDataMapCollector.registerCompostable(PALE_MOSS_BLOCK, 0.65F); + BlockDataMapCollector.registerCompostable(PALE_MOSS_CARPET, 0.3F); + BlockDataMapCollector.registerCompostable(PALE_HANGING_MOSS, 0.3F); + BlockDataMapCollector.registerCompostable(PALE_OAK_SAPLING, 0.3F); + } public static final Block LEBETHRON_LEAVES = registerBlock("lebethron_leaves", - (settings) -> new TintedParticleLeavesBlock(0.01F, settings), AbstractBlock.Settings.copy(Blocks.OAK_LEAVES).strength(LEAVES_STRENGTH).sounds(BlockSoundGroup.GRASS).burnable(), true); + LeavesBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_LEAVES).strength(LEAVES_STRENGTH).sound(SoundType.GRASS).ignitedByLava(), true); public static final Block BERRY_HOLLY_LEAVES = registerBlock("berry_holly_leaves", - (settings) -> new TintedParticleLeavesBlock(0.01F, settings), AbstractBlock.Settings.copy(Blocks.OAK_LEAVES).strength(LEAVES_STRENGTH).sounds(BlockSoundGroup.GRASS).burnable(), true); + LeavesBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_LEAVES).strength(LEAVES_STRENGTH).sound(SoundType.GRASS).ignitedByLava(), true); public static final Block DRY_LARCH_LEAVES = registerBlock("dry_larch_leaves", - (settings) -> new TintedParticleLeavesBlock(0.01F, settings), AbstractBlock.Settings.copy(Blocks.OAK_LEAVES) - .strength(LEAVES_STRENGTH).mapColor(MapColor.PALE_YELLOW).sounds(BlockSoundGroup.GRASS).burnable(), true); + LeavesBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_LEAVES) + .strength(LEAVES_STRENGTH).mapColor(MapColor.SAND).sound(SoundType.GRASS).ignitedByLava(), true); public static final Block FLOWERING_MALLORN_LEAVES = registerBlock("flowering_mallorn_leaves", - (settings) -> new TintedParticleLeavesBlock(0.01F, settings), AbstractBlock.Settings.copy(Blocks.OAK_LEAVES) - .strength(LEAVES_STRENGTH).mapColor(MapColor.PALE_YELLOW).sounds(BlockSoundGroup.GRASS), true); + LeavesBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_LEAVES) + .strength(LEAVES_STRENGTH).mapColor(MapColor.SAND).sound(SoundType.GRASS), true); public static final Block ORANGE_MAPLE_LEAVES = registerBlock("orange_maple_leaves", - (settings) -> new TintedParticleLeavesBlock(0.01F, settings), AbstractBlock.Settings.copy(Blocks.OAK_LEAVES) - .strength(LEAVES_STRENGTH).mapColor(MapColor.ORANGE).sounds(BlockSoundGroup.GRASS).burnable(), true); + LeavesBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_LEAVES) + .strength(LEAVES_STRENGTH).mapColor(MapColor.COLOR_ORANGE).sound(SoundType.GRASS).ignitedByLava(), true); public static final Block RED_MAPLE_LEAVES = registerBlock("red_maple_leaves", - (settings) -> new TintedParticleLeavesBlock(0.01F, settings), AbstractBlock.Settings.copy(Blocks.OAK_LEAVES) - .strength(LEAVES_STRENGTH).mapColor(MapColor.RED).sounds(BlockSoundGroup.GRASS).burnable(), true); + LeavesBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_LEAVES) + .strength(LEAVES_STRENGTH).mapColor(MapColor.COLOR_RED).sound(SoundType.GRASS).ignitedByLava(), true); public static final Block YELLOW_MAPLE_LEAVES = registerBlock("yellow_maple_leaves", - (settings) -> new TintedParticleLeavesBlock(0.01F, settings), AbstractBlock.Settings.copy(Blocks.OAK_LEAVES) - .strength(LEAVES_STRENGTH).mapColor(MapColor.YELLOW).sounds(BlockSoundGroup.GRASS).burnable(), true); + LeavesBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_LEAVES) + .strength(LEAVES_STRENGTH).mapColor(MapColor.COLOR_YELLOW).sound(SoundType.GRASS).ignitedByLava(), true); public static final Block DRY_PINE_LEAVES = registerBlock("dry_pine_leaves", - (settings) -> new TintedParticleLeavesBlock(0.01F, settings), AbstractBlock.Settings.copy(Blocks.OAK_LEAVES) - .strength(LEAVES_STRENGTH).mapColor(MapColor.PALE_GREEN).sounds(BlockSoundGroup.GRASS).burnable(), true); + LeavesBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_LEAVES) + .strength(LEAVES_STRENGTH).mapColor(MapColor.GRASS).sound(SoundType.GRASS).ignitedByLava(), true); public static final Block PINE_BRANCHES = registerBlock("pine_branches", - Block::new, AbstractBlock.Settings.copy(Blocks.OAK_LEAVES).strength(LEAVES_STRENGTH).sounds(BlockSoundGroup.GRASS).burnable(), true); + Block::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_LEAVES).strength(LEAVES_STRENGTH).sound(SoundType.GRASS).ignitedByLava(), true); public static final Block FALLEN_LEAVES = registerBlock("fallen_leaves", - FallenLeavesBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.GREEN).strength(0.1f).sounds(BlockSoundGroup.MOSS_CARPET).nonOpaque().replaceable().noCollision(), true); + FallenLeavesBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).strength(0.1f).sound(SoundType.MOSS_CARPET).noOcclusion().replaceable().noCollission(), true); public static final Block FALLEN_MALLORN_LEAVES = registerBlock("fallen_mallorn_leaves", - FallenLeavesBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.GREEN).strength(0.1f) - .sounds(BlockSoundGroup.MOSS_CARPET).mapColor(MapColor.YELLOW).nonOpaque().replaceable().noCollision(), true); + FallenLeavesBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_GREEN).strength(0.1f) + .sound(SoundType.MOSS_CARPET).mapColor(MapColor.COLOR_YELLOW).noOcclusion().replaceable().noCollission(), true); public static final Block FALLEN_MIRKWOOD_LEAVES = registerBlock("fallen_mirkwood_leaves", - FallenLeavesBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.DARK_GREEN).strength(0.1f) - .sounds(BlockSoundGroup.MOSS_CARPET).nonOpaque().replaceable().noCollision(), true); + FallenLeavesBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).strength(0.1f) + .sound(SoundType.MOSS_CARPET).noOcclusion().replaceable().noCollission(), true); public static final Block WILLOW_VINES = registerBlock("willow_vines", - CustomHangingBlock::new, AbstractBlock.Settings.copy(Blocks.PALE_HANGING_MOSS), true); + CustomHangingBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.HANGING_ROOTS) + .noCollission().instabreak().sound(SoundType.MOSS_CARPET), true); public static final Block TOUGH_BERRY_BUSH = registerBlock("tough_berry_bush", - ToughBerryBushBlock::new, AbstractBlock.Settings.copy(Blocks.SWEET_BERRY_BUSH).ticksRandomly().noCollision().breakInstantly() - .sounds(BlockSoundGroup.SWEET_BERRY_BUSH), false); + ToughBerryBushBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SWEET_BERRY_BUSH).randomTicks().noCollission().instabreak() + .sound(SoundType.SWEET_BERRY_BUSH), false); public static final Block STRAWBERRY_BUSH = registerBlock("strawberry_bush", - StrawBerryBushBlock::new, AbstractBlock.Settings.copy(Blocks.SWEET_BERRY_BUSH).ticksRandomly().noCollision().breakInstantly().sounds(BlockSoundGroup.SWEET_BERRY_BUSH), false); + StrawBerryBushBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SWEET_BERRY_BUSH).randomTicks().noCollission().instabreak().sound(SoundType.SWEET_BERRY_BUSH), false); public static final Block WILD_WHEAT = registerCrossBlock("wild_wheat", - WildCropBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).sounds(BlockSoundGroup.CROP), true); + WildCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).sound(SoundType.CROP), true); public static final Block TALL_WILD_WHEAT = registerBlock("tall_wild_wheat", - (settings) -> new CustomTallPlantBlock(settings, true), AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).sounds(BlockSoundGroup.CROP), true); + (settings) -> new CustomTallPlantBlock(settings, true), BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).sound(SoundType.CROP), true); public static final Block WILD_PIPEWEED = registerBlock("wild_pipeweed", - (settings) -> new CustomTallPlantBlock(settings, true), AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).sounds(BlockSoundGroup.CROP),true); + (settings) -> new CustomTallPlantBlock(settings, true), BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).sound(SoundType.CROP),true); public static final Block WILD_FLAX = registerCrossBlock("wild_flax", - WildCropBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).sounds(BlockSoundGroup.CROP), true); + WildCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).sound(SoundType.CROP), true); public static final Block WILD_TOMATO = registerCrossBlock("wild_tomato", - WildCropBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).sounds(BlockSoundGroup.CROP), true); + WildCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).sound(SoundType.CROP), true); public static final Block WILD_BELL_PEPPER = registerCrossBlock("wild_bell_pepper", - WildCropBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).sounds(BlockSoundGroup.CROP), true); + WildCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).sound(SoundType.CROP), true); public static final Block WILD_CUCUMBER = registerCrossBlock("wild_cucumber", - WildCropBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).sounds(BlockSoundGroup.CROP), true); + WildCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).sound(SoundType.CROP), true); public static final Block WILD_GARLIC = registerCrossBlock("wild_garlic", - WildCropBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).sounds(BlockSoundGroup.CROP), true); + WildCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).sound(SoundType.CROP), true); public static final Block WILD_ONION = registerCrossBlock("wild_onion", - WildCropBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).sounds(BlockSoundGroup.CROP), true); + WildCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).sound(SoundType.CROP), true); public static final Block WILD_LETTUCE = registerCrossBlock("wild_lettuce", - WildCropBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).sounds(BlockSoundGroup.CROP), true); + WildCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).sound(SoundType.CROP), true); public static final Block WILD_LEEK = registerCrossBlock("wild_leek", - WildCropBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).sounds(BlockSoundGroup.CROP), true); + WildCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).sound(SoundType.CROP), true); public static final Block WILD_POTATO = registerBlock("wild_potato", - WildCropBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).sounds(BlockSoundGroup.CROP), true); + WildCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).sound(SoundType.CROP), true); public static final Block WILD_CARROT = registerBlock("wild_carrot", - WildCropBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).sounds(BlockSoundGroup.CROP), true); + WildCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).sound(SoundType.CROP), true); public static final Block WILD_BEETROOT = registerBlock("wild_beetroot", - WildCropBlock::new, AbstractBlock.Settings.copy(Blocks.SHORT_GRASS).sounds(BlockSoundGroup.CROP), true); + WildCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.SHORT_GRASS).sound(SoundType.CROP), true); public static final Block TOMATO_CROP = registerBlock("tomato_crop", - TomatoCropBlock::new, AbstractBlock.Settings.copy(Blocks.POTATOES), false); + TomatoCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.POTATOES), false); public static final Block BELL_PEPPER_CROP = registerBlock("bell_pepper_crop", - BellpepperCropBlock::new, AbstractBlock.Settings.copy(Blocks.POTATOES), false); + BellpepperCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.POTATOES), false); public static final Block CUCUMBER_CROP = registerBlock("cucumber_crop", - CucumberCropBlock::new, AbstractBlock.Settings.copy(Blocks.POTATOES), false); + CucumberCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.POTATOES), false); public static final Block FLAX_CROP = registerBlock("flax_crop", - FlaxCropBlock::new, AbstractBlock.Settings.copy(Blocks.POTATOES), false); + FlaxCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.POTATOES), false); public static final Block GARLIC_CROP = registerBlock("garlic_crop", - GarlicCropBlock::new, AbstractBlock.Settings.copy(Blocks.POTATOES), false); + GarlicCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.POTATOES), false); public static final Block LEEK_CROP = registerBlock("leek_crop", - LeekCropBlock::new, AbstractBlock.Settings.copy(Blocks.POTATOES), false); + LeekCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.POTATOES), false); public static final Block LETTUCE_CROP = registerBlock("lettuce_crop", - LettuceCropBlock::new, AbstractBlock.Settings.copy(Blocks.POTATOES), false); + LettuceCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.POTATOES), false); public static final Block ONION_CROP = registerBlock("onion_crop", - OnionCropBlock::new, AbstractBlock.Settings.copy(Blocks.POTATOES), false); + OnionCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.POTATOES), false); public static final Block PIPEWEED_CROP = registerBlock("pipeweed_crop", - PipeweedCropBlock::new, AbstractBlock.Settings.copy(Blocks.POTATOES), false); + PipeweedCropBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.POTATOES), false); public static final Block MIRKWOOD_ROOTS = registerBlock("mirkwood_roots", - MangroveRootsBlock::new, AbstractBlock.Settings.copy(Blocks.MANGROVE_ROOTS), true); + MangroveRootsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.MANGROVE_ROOTS), true); public static final Block MIRKWOOD_HANGING_ROOTS = registerBlock("mirkwood_hanging_roots", - HangingRootsBlock::new, AbstractBlock.Settings.copy(Blocks.HANGING_ROOTS), true); + HangingRootsBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.HANGING_ROOTS), true); public static final Block MIRKWOOD_VINES = registerBlock("mirkwood_vines", - CustomHangingBlock::new, AbstractBlock.Settings.copy(Blocks.PALE_HANGING_MOSS), true); + CustomHangingBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.HANGING_ROOTS) + .noCollission().instabreak().sound(SoundType.MOSS_CARPET), true); public static final Block HANGING_WEBS = registerBlock("hanging_webs", - HangingCobwebBlock::new, AbstractBlock.Settings.copy(Blocks.COBWEB), true); + HangingCobwebBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.COBWEB), true); public static final Block CORNER_COBWEB = registerBlock("corner_cobweb", - CornerCobwebBlock::new, AbstractBlock.Settings.copy(Blocks.COBWEB).noCollision().pistonBehavior(PistonBehavior.DESTROY), true); + CornerCobwebBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.COBWEB).noCollission().pushReaction(PushReaction.DESTROY), true); public static final Block WEBBING = registerBlock("webbing", - WebbingBlock::new, AbstractBlock.Settings.create().mapColor(MapColor.WHITE).replaceable().noCollision().strength(0.2f) - .pistonBehavior(PistonBehavior.DESTROY).sounds(BlockSoundGroup.COBWEB).burnable().ticksRandomly(), true); + WebbingBlock::new, BlockBehaviour.Properties.of().mapColor(MapColor.SNOW).replaceable().noCollission().strength(0.2f) + .pushReaction(PushReaction.DESTROY).sound(SoundType.COBWEB).ignitedByLava().randomTicks(), true); public static final Block SHELOBITE_LARVA_EGG = registerBlock("shelobite_larva_egg", - ShelobiteLarvaEggBlock::new, AbstractBlock.Settings.copy(Blocks.TURTLE_EGG), true); + ShelobiteLarvaEggBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.TURTLE_EGG), true); public static final Block HANGING_SHELOBITE_LARVA_EGG = registerBlock("hanging_shelobite_larva_egg", - ShelobiteLarvaEggHangingBlock::new, AbstractBlock.Settings.copy(Blocks.TURTLE_EGG), true); + ShelobiteLarvaEggHangingBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.TURTLE_EGG), true); public static final Block GLOWWORM_WEBBING = registerBlock("glowworm_webbing", - GlowWormBottomBlock::new, AbstractBlock.Settings.copy(Blocks.WEEPING_VINES_PLANT).luminance(state -> 6), true); + GlowWormBottomBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WEEPING_VINES_PLANT).lightLevel(state -> 6), true); public static final Block GLOWWORM_MAIN = registerBlock("glowworm_main", - GlowWormBlock::new, AbstractBlock.Settings.copy(Blocks.WEEPING_VINES).luminance(state -> 6), false); + GlowWormBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.WEEPING_VINES).lightLevel(state -> 6), false); - public static Block registerCrossBlock(String name, Function factory, AbstractBlock.Settings settings, boolean present) { + public static Block registerCrossBlock(String name, Function factory, BlockBehaviour.Properties settings, boolean present) { Block resultBlock = registerBlock(name, factory, settings, present); - TintableCrossModel.notTintedBlocks.add(resultBlock); + TintableCrossModel.addNotTintedBlock(resultBlock); return resultBlock; } - public static Block registerSimpleSapling(String name, RegistryKey> treeFeature) { - SaplingBlock saplingBlock = new SaplingBlock(new SaplingGenerator(name, Optional.empty(), Optional.ofNullable(treeFeature), Optional.empty()), - AbstractBlock.Settings.copy(Blocks.OAK_SAPLING).registryKey(ModBlocks.keyOfBlock(name))); - Block resultBlock = Registry.register(Registries.BLOCK, ModBlocks.keyOfBlock(name), saplingBlock); + public static Block registerSimpleSapling(String name, ResourceKey> treeFeature) { + SaplingBlock saplingBlock = new SaplingBlock(new TreeGrower(name, Optional.empty(), Optional.ofNullable(treeFeature), Optional.empty()), + BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_SAPLING)); + Block resultBlock = RegistrationBridge.register(BuiltInRegistries.BLOCK, ModBlocks.keyOfBlock(name).location(), saplingBlock); registerBlockItem(name, resultBlock); - TintableCrossModel.notTintedBlocks.add(resultBlock); + TintableCrossModel.addNotTintedBlock(resultBlock); Saplings.saplings.add(resultBlock); TranslationEntries.blockEntries.add(resultBlock); - RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(Registries.BLOCK, name)); + RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(BuiltInRegistries.BLOCK, name)); + + return resultBlock; + } + + private static Block registerPaleOakSapling() { + String name = "pale_oak_sapling"; + SaplingBlock saplingBlock = new SaplingBlock( + new TreeGrower("pale_oak", Optional.of(ModTreeConfiguredFeatures.PALE_OAK_BONEMEAL_KEY), + Optional.empty(), Optional.empty()), + BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_SAPLING)); + Block resultBlock = RegistrationBridge.register( + BuiltInRegistries.BLOCK, ModBlocks.keyOfBlock(name).location(), saplingBlock); + registerBlockItem(name, resultBlock); + TintableCrossModel.addNotTintedBlock(resultBlock); + Saplings.saplings.add(resultBlock); + TranslationEntries.blockEntries.add(resultBlock); + RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(BuiltInRegistries.BLOCK, name)); + return resultBlock; + } + private static Block registerPottedPaleOakSapling() { + String name = "potted_pale_oak_sapling"; + FlowerPotBlock pot = new FlowerPotBlock( + () -> (FlowerPotBlock) Blocks.FLOWER_POT, + () -> PALE_OAK_SAPLING, + BlockBehaviour.Properties.of().instabreak().noOcclusion().pushReaction(PushReaction.DESTROY)); + Block resultBlock = RegistrationBridge.register( + BuiltInRegistries.BLOCK, ModBlocks.keyOfBlock(name).location(), pot); + ((FlowerPotBlock) Blocks.FLOWER_POT).addPlant( + BuiltInRegistries.BLOCK.getKey(PALE_OAK_SAPLING), () -> pot); + RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(BuiltInRegistries.BLOCK, name)); return resultBlock; } - public static Block registerVariantSapling(String name, List>> treeFeatures) { - List saplingGenerators = new ArrayList<>(); - for(RegistryKey> treeFeature : treeFeatures) { - saplingGenerators.add(new SaplingGenerator(name, Optional.empty(), Optional.ofNullable(treeFeature), + public static Block registerVariantSapling(String name, List>> treeFeatures) { + List saplingGenerators = new ArrayList<>(); + for(ResourceKey> treeFeature : treeFeatures) { + saplingGenerators.add(new TreeGrower(name, Optional.empty(), Optional.ofNullable(treeFeature), Optional.empty())); } - SaplingBlock saplingBlock = new VariantSaplingBlock(AbstractBlock.Settings.copy(Blocks.OAK_SAPLING).registryKey(ModBlocks.keyOfBlock(name)), saplingGenerators); - Block resultBlock = Registry.register(Registries.BLOCK, ModBlocks.keyOfBlock(name), saplingBlock); + SaplingBlock saplingBlock = new VariantSaplingBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_SAPLING), saplingGenerators); + Block resultBlock = RegistrationBridge.register(BuiltInRegistries.BLOCK, ModBlocks.keyOfBlock(name).location(), saplingBlock); TranslationEntries.blockEntries.add(resultBlock); registerBlockItem(name, resultBlock); - TintableCrossModel.notTintedBlocks.add(resultBlock); + TintableCrossModel.addNotTintedBlock(resultBlock); Saplings.saplings.add(resultBlock); - RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(Registries.BLOCK, name)); + RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(BuiltInRegistries.BLOCK, name)); return resultBlock; } public static Block registerWeightedSapling(String name, List weightedTrees) { - SaplingBlock saplingBlock = new WeightedSaplingBlock(AbstractBlock.Settings.copy(Blocks.OAK_SAPLING).registryKey(ModBlocks.keyOfBlock(name)), weightedTrees); + SaplingBlock saplingBlock = new WeightedSaplingBlock(BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_SAPLING), weightedTrees); - Block resultBlock = Registry.register(Registries.BLOCK, ModBlocks.keyOfBlock(name), saplingBlock); + Block resultBlock = RegistrationBridge.register(BuiltInRegistries.BLOCK, ModBlocks.keyOfBlock(name).location(), saplingBlock); TranslationEntries.blockEntries.add(resultBlock); registerBlockItem(name, resultBlock); - TintableCrossModel.notTintedBlocks.add(resultBlock); + TintableCrossModel.addNotTintedBlock(resultBlock); Saplings.saplings.add(resultBlock); - RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(Registries.BLOCK, name)); + RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(BuiltInRegistries.BLOCK, name)); return resultBlock; } - public static Block registerBlock(String name, Function factory, AbstractBlock.Settings settings, boolean present) { - Block block = (Block)factory.apply(settings.registryKey(ModBlocks.keyOfBlock(name))); + public static Block registerBlock(String name, Function factory, BlockBehaviour.Properties settings, boolean present) { + Block block = factory.apply(settings); if(present){ ModNatureBlocks.registerBlockItem(name, block); TranslationEntries.blockEntries.add(block); } - RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(Registries.BLOCK, name)); + RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(BuiltInRegistries.BLOCK, name)); - return Registry.register(Registries.BLOCK, ModBlocks.keyOfBlock(name), block); + return RegistrationBridge.register(BuiltInRegistries.BLOCK, ModBlocks.keyOfBlock(name).location(), block); } static void registerBlockItem(String name, Block block) { - var item = Registry.register(Registries.ITEM, Identifier.of(MiddleEarth.MOD_ID, name), - new BlockItem(block, new Item.Settings().registryKey(ModBlocks.keyOfItem(name)))); - Item.BLOCK_ITEMS.put(block, item); + var item = RegistrationBridge.register(BuiltInRegistries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, name), + new BlockItem(block, new Item.Properties())); + Item.BY_BLOCK.put(block, item); - ItemGroupsME.NATURE_BLOCKS_CONTENTS.add(item.getDefaultStack()); - RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(Registries.ITEM, name)); + ItemGroupsME.NATURE_BLOCKS_CONTENTS.add(item.getDefaultInstance()); + RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(BuiltInRegistries.ITEM, name)); } public static void registerModBlocks() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/OreRockSets.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/OreRockSets.java index b7e062250b..dec0c4a294 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/OreRockSets.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/OreRockSets.java @@ -1,12 +1,11 @@ package net.sevenstars.middleearth.block.registration; +import net.minecraft.util.valueproviders.UniformInt; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.DropExperienceBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; import net.sevenstars.middleearth.MiddleEarth; -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; -import net.minecraft.block.ExperienceDroppingBlock; -import net.minecraft.util.math.intprovider.UniformIntProvider; - import java.util.Arrays; import java.util.List; @@ -90,74 +89,74 @@ public static OreRockSet registerOreSet(String rockName, float strength_mult, Li if(ores.contains(ORES.COAL_ORE)){ coal_ore = ModNatureBlocks.registerBlock( - rockName + "coal_ore", (settings) -> new ExperienceDroppingBlock(UniformIntProvider.create(0, 2), settings), - AbstractBlock.Settings.copy(Blocks.COAL_ORE).strength(STONE_STRENGTH * strength_mult, 3*strength_mult).requiresTool(), true); + rockName + "coal_ore", (settings) -> new DropExperienceBlock(UniformInt.of(0, 2), settings), + BlockBehaviour.Properties.ofFullCopy(Blocks.COAL_ORE).strength(STONE_STRENGTH * strength_mult, 3*strength_mult).requiresCorrectToolForDrops(), true); } if(ores.contains(ORES.COPPER_ORE)) { copper_ore = ModNatureBlocks.registerBlock( - rockName + "copper_ore", Block::new, AbstractBlock.Settings.copy(Blocks.COPPER_ORE).strength( - STONE_STRENGTH * strength_mult, 3*strength_mult).requiresTool(), true); + rockName + "copper_ore", Block::new, BlockBehaviour.Properties.ofFullCopy(Blocks.COPPER_ORE).strength( + STONE_STRENGTH * strength_mult, 3*strength_mult).requiresCorrectToolForDrops(), true); } if(ores.contains(ORES.TIN_ORE)) { tin_ore = ModNatureBlocks.registerBlock( - rockName + "tin_ore", Block::new, AbstractBlock.Settings.copy(Blocks.IRON_ORE).strength( - STONE_STRENGTH * strength_mult, 3*strength_mult).requiresTool(), true); + rockName + "tin_ore", Block::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_ORE).strength( + STONE_STRENGTH * strength_mult, 3*strength_mult).requiresCorrectToolForDrops(), true); } if(ores.contains(ORES.LEAD_ORE)) { lead_ore = ModNatureBlocks.registerBlock( - rockName + "lead_ore", Block::new, AbstractBlock.Settings.copy(Blocks.IRON_ORE).strength( - STONE_STRENGTH * strength_mult, 3*strength_mult).requiresTool(), true); + rockName + "lead_ore", Block::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_ORE).strength( + STONE_STRENGTH * strength_mult, 3*strength_mult).requiresCorrectToolForDrops(), true); } if(ores.contains(ORES.SILVER_ORE)) { silver_ore = ModNatureBlocks.registerBlock( - rockName + "silver_ore", Block::new, AbstractBlock.Settings.copy(Blocks.GOLD_ORE).strength( - STONE_STRENGTH * strength_mult, 3*strength_mult).requiresTool(), true); + rockName + "silver_ore", Block::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GOLD_ORE).strength( + STONE_STRENGTH * strength_mult, 3*strength_mult).requiresCorrectToolForDrops(), true); } if(ores.contains(ORES.GOLD_ORE)) { gold_ore = ModNatureBlocks.registerBlock( - rockName + "gold_ore", Block::new, AbstractBlock.Settings.copy(Blocks.GOLD_ORE).strength( - STONE_STRENGTH * strength_mult, 3*strength_mult).requiresTool(), true); + rockName + "gold_ore", Block::new, BlockBehaviour.Properties.ofFullCopy(Blocks.GOLD_ORE).strength( + STONE_STRENGTH * strength_mult, 3*strength_mult).requiresCorrectToolForDrops(), true); } if(ores.contains(ORES.IRON_ORE)) { iron_ore = ModNatureBlocks.registerBlock( - rockName + "iron_ore", Block::new, AbstractBlock.Settings.copy(Blocks.IRON_ORE).strength( - STONE_STRENGTH * strength_mult, 3*strength_mult).requiresTool(), true); + rockName + "iron_ore", Block::new, BlockBehaviour.Properties.ofFullCopy(Blocks.IRON_ORE).strength( + STONE_STRENGTH * strength_mult, 3*strength_mult).requiresCorrectToolForDrops(), true); } if(ores.contains(ORES.EMERALD_ORE)) { emerald_ore = ModNatureBlocks.registerBlock( - rockName + "emerald_ore", Block::new, AbstractBlock.Settings.copy(Blocks.EMERALD_ORE).strength( - STONE_STRENGTH * strength_mult, 3*strength_mult).requiresTool(), true); + rockName + "emerald_ore", Block::new, BlockBehaviour.Properties.ofFullCopy(Blocks.EMERALD_ORE).strength( + STONE_STRENGTH * strength_mult, 3*strength_mult).requiresCorrectToolForDrops(), true); } if(ores.contains(ORES.RUBY_ORE)) { ruby_ore = ModNatureBlocks.registerBlock( - rockName + "ruby_ore", Block::new, AbstractBlock.Settings.copy(Blocks.EMERALD_ORE).strength( - STONE_STRENGTH * strength_mult, 3*strength_mult).requiresTool(), true); + rockName + "ruby_ore", Block::new, BlockBehaviour.Properties.ofFullCopy(Blocks.EMERALD_ORE).strength( + STONE_STRENGTH * strength_mult, 3*strength_mult).requiresCorrectToolForDrops(), true); } if(ores.contains(ORES.SAPPHIRE_ORE)) { sapphire_ore = ModNatureBlocks.registerBlock( - rockName + "sapphire_ore", Block::new, AbstractBlock.Settings.copy(Blocks.EMERALD_ORE).strength( - STONE_STRENGTH * strength_mult, 3*strength_mult).requiresTool(), true); + rockName + "sapphire_ore", Block::new, BlockBehaviour.Properties.ofFullCopy(Blocks.EMERALD_ORE).strength( + STONE_STRENGTH * strength_mult, 3*strength_mult).requiresCorrectToolForDrops(), true); } if(ores.contains(ORES.ADAMANT_ORE)) { adamant_ore = ModNatureBlocks.registerBlock( - rockName + "adamant_ore", Block::new, AbstractBlock.Settings.copy(Blocks.DIAMOND_ORE).strength( - STONE_STRENGTH * strength_mult, 3*strength_mult).requiresTool(), true); + rockName + "adamant_ore", Block::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DIAMOND_ORE).strength( + STONE_STRENGTH * strength_mult, 3*strength_mult).requiresCorrectToolForDrops(), true); } if(ores.contains(ORES.MITHRIL_ORE)) { mithril_ore = ModNatureBlocks.registerBlock( - rockName + "mithril_ore", Block::new, AbstractBlock.Settings.copy(Blocks.DIAMOND_ORE).strength( - STONE_STRENGTH * strength_mult, 3*strength_mult).requiresTool(), true); + rockName + "mithril_ore", Block::new, BlockBehaviour.Properties.ofFullCopy(Blocks.DIAMOND_ORE).strength( + STONE_STRENGTH * strength_mult, 3*strength_mult).requiresCorrectToolForDrops(), true); } return new OreRockSet(coal_ore, copper_ore, tin_ore, lead_ore, silver_ore, gold_ore, iron_ore, mithril_ore, diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/StoneBlockSets.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/StoneBlockSets.java index 3f31405619..4ec2b19e43 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/StoneBlockSets.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/StoneBlockSets.java @@ -1,24 +1,26 @@ package net.sevenstars.middleearth.block.registration; -import net.minecraft.block.enums.NoteBlockInstrument; -import net.minecraft.item.ItemStack; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.utils.BlockSetRegistration; import net.sevenstars.middleearth.block.utils.setBuilders.StoneBlockSetBuilder; import net.sevenstars.middleearth.block.utils.StoneBlockTypes; -import net.minecraft.block.*; -import net.minecraft.sound.BlockSoundGroup; +import net.minecraft.world.level.block.*; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; +import net.minecraft.world.level.material.MapColor; import net.sevenstars.middleearth.item.utils.ItemGroupsME; import java.util.ArrayList; import java.util.List; public class StoneBlockSets { - public static final float STONE_HARDNESS = Blocks.STONE.getHardness(); //1.5f - public static final float STONE_BLAST_RESISTANCE = Blocks.STONE.getBlastResistance(); //6.0f + public static final float STONE_HARDNESS = Blocks.STONE.defaultDestroyTime(); //1.5f + public static final float STONE_BLAST_RESISTANCE = Blocks.STONE.getExplosionResistance(); //6.0f - public static final float DEEPSLATE_HARDNESS = Blocks.DEEPSLATE.getHardness(); - public static final float DEEPSLATE_BLAST_RESISTANCE = Blocks.DEEPSLATE.getBlastResistance(); + public static final float DEEPSLATE_HARDNESS = Blocks.DEEPSLATE.defaultDestroyTime(); + public static final float DEEPSLATE_BLAST_RESISTANCE = Blocks.DEEPSLATE.getExplosionResistance(); public static final float NURGON_HARDNESS = 5.0F; public static final float NURGON_BLAST_RESISTANCE = 7.0F; @@ -29,7 +31,7 @@ public class StoneBlockSets { public static List stoneSetsList = new ArrayList<>(); public static StoneBlockSetBuilder STONE_SET = registerStoneSet(new StoneBlockSetBuilder("stone", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.STONE_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.STONE, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true, true, true, false) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLESTONE_BLOCKS) @@ -44,7 +46,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder GRANITE_SET = registerStoneSet(new StoneBlockSetBuilder("granite", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.ORANGE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.COLOR_ORANGE, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true, true, false, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) @@ -58,7 +60,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.OLD_BLOCKS)); public static StoneBlockSetBuilder DIORITE_SET = registerStoneSet(new StoneBlockSetBuilder("diorite", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.WHITE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.SNOW, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true, true, false, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) @@ -72,7 +74,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.OLD_BLOCKS)); public static StoneBlockSetBuilder ANDESITE_SET = registerStoneSet(new StoneBlockSetBuilder("andesite", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.WHITE_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.WOOL, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true, true, false, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) @@ -86,7 +88,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.OLD_BLOCKS)); public static StoneBlockSetBuilder CALCITE_SET = registerStoneSet(new StoneBlockSetBuilder("calcite", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.WHITE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.CALCITE, true, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.SNOW, NoteBlockInstrument.BASEDRUM, SoundType.CALCITE, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -100,14 +102,14 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder DRIPSTONE_SET = registerStoneSet(new StoneBlockSetBuilder("dripstone", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.WHITE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.DRIPSTONE_BLOCK, false, false) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.SNOW, NoteBlockInstrument.BASEDRUM, SoundType.DRIPSTONE_BLOCK, false, false) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) .addToSet(StoneBlockTypes.POLISHED_BLOCKS) .addToSet(StoneBlockTypes.BRICK_BLOCKS)); public static StoneBlockSetBuilder DEEPSLATE_SET = registerStoneSet(new StoneBlockSetBuilder("deepslate", - DEEPSLATE_HARDNESS, DEEPSLATE_BLAST_RESISTANCE, MapColor.DEEPSLATE_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.DEEPSLATE, + DEEPSLATE_HARDNESS, DEEPSLATE_BLAST_RESISTANCE, MapColor.DEEPSLATE, NoteBlockInstrument.BASEDRUM, SoundType.DEEPSLATE, true, true, true, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) @@ -122,7 +124,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder TUFF_SET = registerStoneSet(new StoneBlockSetBuilder("tuff", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.WHITE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.TUFF, true, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.SNOW, NoteBlockInstrument.BASEDRUM, SoundType.TUFF, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -136,7 +138,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder BASALT_SET = registerStoneSet(new StoneBlockSetBuilder("basalt", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.BASALT, true, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.COLOR_GRAY, NoteBlockInstrument.BASEDRUM, SoundType.BASALT, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -150,7 +152,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder BLACKSTONE_SET = registerStoneSet(new StoneBlockSetBuilder("blackstone", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.BLACK, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.COLOR_BLACK, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true, true, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) @@ -165,7 +167,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder DOLOMITE_SET = registerStoneSet(new StoneBlockSetBuilder("dolomite", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.LIGHT_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.COLOR_LIGHT_GRAY, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -179,7 +181,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder SLATE_SET = registerStoneSet(new StoneBlockSetBuilder("slate", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.STONE_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.STONE, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -193,7 +195,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder NURGON_SET = registerStoneSet(new StoneBlockSetBuilder("nurgon", - NURGON_HARDNESS, NURGON_BLAST_RESISTANCE, MapColor.TERRACOTTA_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, true) + NURGON_HARDNESS, NURGON_BLAST_RESISTANCE, MapColor.TERRACOTTA_GRAY, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -207,7 +209,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder MEDGON_SET = registerStoneSet(new StoneBlockSetBuilder("medgon", - MEDGON_HARDNESS, MEDGON_BLAST_RESISTANCE, MapColor.TERRACOTTA_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, true) + MEDGON_HARDNESS, MEDGON_BLAST_RESISTANCE, MapColor.TERRACOTTA_GRAY, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -221,13 +223,13 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder CHALK_SET = registerStoneSet(new StoneBlockSetBuilder("chalk", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.WHITE_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, false, false) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.WOOL, NoteBlockInstrument.BASEDRUM, SoundType.STONE, false, false) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.BRICK_BLOCKS) .addToSet(StoneBlockTypes.OLD_BLOCKS)); public static StoneBlockSetBuilder GNEISS_SET = registerStoneSet(new StoneBlockSetBuilder("gneiss", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.WHITE_GRAY, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.WOOL, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -241,7 +243,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder ZIGILABAN_SET = registerStoneSet(new StoneBlockSetBuilder("zigilaban", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.WHITE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.SNOW, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -255,7 +257,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder GALONN_SET = registerStoneSet(new StoneBlockSetBuilder("galonn", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.PALE_YELLOW, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.SAND, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -269,7 +271,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder LIMESTONE_SET = registerStoneSet(new StoneBlockSetBuilder("limestone", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.YELLOW, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.COLOR_YELLOW, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -283,7 +285,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder IZHERABAN_SET = registerStoneSet(new StoneBlockSetBuilder("izheraban", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.PALE_YELLOW, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.SAND, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -297,7 +299,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder TRAVERTINE_SET = registerStoneSet(new StoneBlockSetBuilder("travertine", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.PALE_YELLOW, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, false, false) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.SAND, NoteBlockInstrument.BASEDRUM, SoundType.STONE, false, false) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) .addToSet(StoneBlockTypes.POLISHED_BLOCKS) @@ -305,7 +307,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.OLD_BLOCKS_PILLAR)); public static StoneBlockSetBuilder GABBRO_SET = registerStoneSet(new StoneBlockSetBuilder("gabbro", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.BROWN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.COLOR_BROWN, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -319,11 +321,11 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder BURZUM_GABBRO_SET = registerStoneSet(new StoneBlockSetBuilder("burzum_gabbro", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.BROWN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, false, false) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.COLOR_BROWN, NoteBlockInstrument.BASEDRUM, SoundType.STONE, false, false) .addToSet(StoneBlockTypes.CHISELED_BLOCKS_NO_RESTRICTION)); public static StoneBlockSetBuilder ASHENSTONE_SET = registerStoneSet(new StoneBlockSetBuilder("ashenstone", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.BLACK, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.DEEPSLATE, false, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.COLOR_BLACK, NoteBlockInstrument.BASEDRUM, SoundType.DEEPSLATE, false, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -337,7 +339,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder PUMICE_SET = registerStoneSet(new StoneBlockSetBuilder("pumice", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.BLACK, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.COLOR_BLACK, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -351,7 +353,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder KHAGALABAN_SET = registerStoneSet(new StoneBlockSetBuilder("khagalaban", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.BLUE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.COLOR_BLUE, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -365,7 +367,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder BLUE_TUFF_SET = registerStoneSet(new StoneBlockSetBuilder("blue_tuff", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.BLUE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.COLOR_BLUE, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -379,7 +381,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder SCHIST_SET = registerStoneSet(new StoneBlockSetBuilder("schist", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.LAPIS_BLUE, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, false, false) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.LAPIS, NoteBlockInstrument.BASEDRUM, SoundType.STONE, false, false) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.POLISHED_BLOCKS) @@ -388,7 +390,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.PILLAR_BLOCKS)); public static StoneBlockSetBuilder IRONSTONE_SET = registerStoneSet(new StoneBlockSetBuilder("ironstone", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.DARK_RED, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.NETHER, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -402,7 +404,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder HEMATITE_SET = registerStoneSet(new StoneBlockSetBuilder("hematite", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.RED, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, true, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.COLOR_RED, NoteBlockInstrument.BASEDRUM, SoundType.STONE, true, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) @@ -416,7 +418,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder GREEN_TUFF_SET = registerStoneSet(new StoneBlockSetBuilder("green_tuff", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.GREEN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, false, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.COLOR_GREEN, NoteBlockInstrument.BASEDRUM, SoundType.STONE, false, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.SMOOTH_BLOCKS) .addToSet(StoneBlockTypes.POLISHED_BLOCKS) @@ -428,12 +430,12 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.CARVED_WINDOW)); public static StoneBlockSetBuilder GILDED_GREEN_TUFF_SET = registerStoneSet(new StoneBlockSetBuilder("gilded_green_tuff", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.GREEN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, false, false) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.COLOR_GREEN, NoteBlockInstrument.BASEDRUM, SoundType.STONE, false, false) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.CHISELED_BLOCKS_NO_RESTRICTION)); public static StoneBlockSetBuilder JADEITE_SET = registerStoneSet(new StoneBlockSetBuilder("jadeite", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.EMERALD_GREEN, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, false, true) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.EMERALD, NoteBlockInstrument.BASEDRUM, SoundType.STONE, false, true) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.POLISHED_BLOCKS) @@ -442,7 +444,7 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.PILLAR_BLOCKS)); public static StoneBlockSetBuilder QUARTZITE_SET = registerStoneSet(new StoneBlockSetBuilder("quartzite", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.RAW_IRON_PINK, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, false, false) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.RAW_IRON, NoteBlockInstrument.BASEDRUM, SoundType.STONE, false, false) .addToSet(StoneBlockTypes.BASE_BLOCKS) .addToSet(StoneBlockTypes.COBBLED_BLOCKS) .addToSet(StoneBlockTypes.POLISHED_BLOCKS) @@ -450,14 +452,14 @@ public class StoneBlockSets { .addToSet(StoneBlockTypes.TILE_BLOCKS)); public static StoneBlockSetBuilder TAN_CLAY = registerStoneSet(new StoneBlockSetBuilder("tan_clay", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.RAW_IRON_PINK, NoteBlockInstrument.BASEDRUM, BlockSoundGroup.STONE, false, false) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.RAW_IRON, NoteBlockInstrument.BASEDRUM, SoundType.STONE, false, false) .addToSet(StoneBlockTypes.BRICK_BLOCKS) .addToSet(StoneBlockTypes.TILE_BLOCKS) .addToSet(StoneBlockTypes.BRICKWORK_BLOCKS)); public static StoneBlockSetBuilder DRYSTONE_SET = registerStoneSet(new StoneBlockSetBuilder("drystone", - STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.DEEPSLATE_GRAY, NoteBlockInstrument.BASEDRUM, - BlockSoundGroup.STONE, true, false) + STONE_HARDNESS, STONE_BLAST_RESISTANCE, MapColor.DEEPSLATE, NoteBlockInstrument.BASEDRUM, + SoundType.STONE, true, false) .addToSet(StoneBlockTypes.PILLAR_BASE_BLOCKS) .addToSet(StoneBlockTypes.CARVED_WINDOW)); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/WoodBlockSets.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/WoodBlockSets.java index 902307afdd..ceade34531 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/WoodBlockSets.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/registration/WoodBlockSets.java @@ -1,17 +1,29 @@ + package net.sevenstars.middleearth.block.registration; -import net.fabricmc.fabric.api.registry.FlammableBlockRegistry; -import net.fabricmc.fabric.api.registry.StrippableBlockRegistry; -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Blocks; -import net.minecraft.block.MapColor; -import net.minecraft.block.TintedParticleLeavesBlock; -import net.minecraft.block.enums.NoteBlockInstrument; -import net.minecraft.item.ItemStack; -import net.minecraft.sound.BlockSoundGroup; +import net.sevenstars.api.registries.RegistrationBridge; + +import net.minecraft.world.item.ItemStack; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.FenceBlock; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.LeavesBlock; +import net.minecraft.world.level.block.RotatedPillarBlock; +import net.minecraft.world.level.block.SlabBlock; +import net.minecraft.world.level.block.StairBlock; +import net.minecraft.world.level.block.WallBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; +import net.minecraft.world.level.material.MapColor; import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.middleearth.block.special.palemoss.PaleOakLeavesBlock; import net.sevenstars.middleearth.block.special.plants.BerryHollyLeavesBlock; import net.sevenstars.middleearth.block.special.plants.ModLeavesBlock; +import net.sevenstars.middleearth.block.special.verticalSlabs.VerticalSlabBlock; +import net.sevenstars.middleearth.block.utils.BlockDataMapCollector; +import net.sevenstars.middleearth.block.utils.BlockRecordTypes; import net.sevenstars.middleearth.block.utils.BlockSetRegistration; import net.sevenstars.middleearth.block.utils.WoodBlockTypes; import net.sevenstars.middleearth.block.utils.setBuilders.WoodBlockSetBuilder; @@ -31,7 +43,7 @@ public class WoodBlockSets { public static List woodSetsList = new ArrayList<>(); public static WoodBlockSetBuilder OAK_SET = registerWoodSet(new WoodBlockSetBuilder("oak", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.OAK_TAN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, Blocks.OAK_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.WOOD, NoteBlockInstrument.BASS, SoundType.WOOD, Blocks.OAK_SAPLING) .vanilla(true) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) @@ -43,7 +55,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.LEAVES)); public static WoodBlockSetBuilder SPRUCE_SET = registerWoodSet(new WoodBlockSetBuilder("spruce", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.SPRUCE_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, Blocks.SPRUCE_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.PODZOL, NoteBlockInstrument.BASS, SoundType.WOOD, Blocks.SPRUCE_SAPLING) .vanilla(true) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) @@ -55,7 +67,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.LEAVES)); public static WoodBlockSetBuilder BIRCH_SET = registerWoodSet(new WoodBlockSetBuilder("birch", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.PALE_YELLOW, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, Blocks.BIRCH_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.SAND, NoteBlockInstrument.BASS, SoundType.WOOD, Blocks.BIRCH_SAPLING) .vanilla(true) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) @@ -67,7 +79,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.LEAVES)); public static WoodBlockSetBuilder JUNGLE_SET = registerWoodSet(new WoodBlockSetBuilder("jungle", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.DIRT_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, Blocks.JUNGLE_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.DIRT, NoteBlockInstrument.BASS, SoundType.WOOD, Blocks.JUNGLE_SAPLING) .vanilla(true) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) @@ -79,7 +91,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.LEAVES)); public static WoodBlockSetBuilder ACACIA_SET = registerWoodSet(new WoodBlockSetBuilder("acacia", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.ORANGE, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, Blocks.ACACIA_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.COLOR_ORANGE, NoteBlockInstrument.BASS, SoundType.WOOD, Blocks.ACACIA_SAPLING) .vanilla(true) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) @@ -91,7 +103,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.LEAVES)); public static WoodBlockSetBuilder DAK_OAK_SET = registerWoodSet(new WoodBlockSetBuilder("dark_oak", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, Blocks.DARK_OAK_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.COLOR_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, Blocks.DARK_OAK_SAPLING) .vanilla(true) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) @@ -103,7 +115,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.LEAVES)); public static WoodBlockSetBuilder MANGROVE_SET = registerWoodSet(new WoodBlockSetBuilder("mangrove", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.RED, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, Blocks.MANGROVE_PROPAGULE) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.COLOR_RED, NoteBlockInstrument.BASS, SoundType.WOOD, Blocks.MANGROVE_PROPAGULE) .vanilla(true) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) @@ -115,7 +127,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.LEAVES)); public static WoodBlockSetBuilder CHERRY_SET = registerWoodSet(new WoodBlockSetBuilder("cherry", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.TERRACOTTA_WHITE, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, Blocks.CHERRY_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.TERRACOTTA_WHITE, NoteBlockInstrument.BASS, SoundType.WOOD, Blocks.CHERRY_SAPLING) .vanilla(true) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) @@ -127,16 +139,17 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.LEAVES)); public static WoodBlockSetBuilder PALE_OAK_SET = registerWoodSet(new WoodBlockSetBuilder("pale_oak", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.OFF_WHITE, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, Blocks.PALE_OAK_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.QUARTZ, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.PALE_OAK_SAPLING) .vanilla(true) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) .addToSet(WoodBlockTypes.REDSTONE_BLOCKS) - .addToSet(WoodBlockTypes.LEAVES)); + .addToSet(WoodBlockTypes.LEAVES) + .leavesColor(MapColor.COLOR_LIGHT_GRAY)); public static WoodBlockSetBuilder BAMBOO = registerWoodSet(new WoodBlockSetBuilder("bamboo", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.OFF_WHITE, NoteBlockInstrument.BASS, BlockSoundGroup.BAMBOO_WOOD, Blocks.BAMBOO_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.QUARTZ, NoteBlockInstrument.BASS, SoundType.BAMBOO_WOOD, Blocks.BAMBOO_SAPLING) .vanilla(true) .addToSet(WoodBlockTypes.PLANK_BLOCKS) .addToSet(WoodBlockTypes.FURNITURE_BLOCKS) @@ -144,7 +157,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.ROOFING_BLOCKS)); public static WoodBlockSetBuilder CRIMSON_SET = registerWoodSet(new WoodBlockSetBuilder("crimson", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.DULL_PINK, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, Blocks.CRIMSON_FUNGUS) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.CRIMSON_STEM, NoteBlockInstrument.BASS, SoundType.WOOD, Blocks.CRIMSON_FUNGUS) .vanilla(true) .addToSet(WoodBlockTypes.NETHER_STEM_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_STEM_BLOCKS) @@ -155,7 +168,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.ROOFING_BLOCKS)); public static WoodBlockSetBuilder WARPED_SET = registerWoodSet(new WoodBlockSetBuilder("warped", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.DARK_AQUA, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, Blocks.WARPED_FUNGUS) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.WARPED_STEM, NoteBlockInstrument.BASS, SoundType.WOOD, Blocks.WARPED_FUNGUS) .vanilla(true) .addToSet(WoodBlockTypes.NETHER_STEM_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_STEM_BLOCKS) @@ -166,7 +179,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.ROOFING_BLOCKS)); public static WoodBlockSetBuilder ASPEN_SET = registerWoodSet(new WoodBlockSetBuilder("aspen", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.SPRUCE_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.ASPEN_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.PODZOL, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.ASPEN_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -174,10 +187,10 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.SHINGLE_BLOCKS) .addToSet(WoodBlockTypes.ROOFING_BLOCKS) .addToSet(WoodBlockTypes.LEAVES) - .leavesColor(MapColor.YELLOW)); + .leavesColor(MapColor.COLOR_YELLOW)); public static WoodBlockSetBuilder BEECH_SET = registerWoodSet(new WoodBlockSetBuilder("beech", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.LIGHT_GRAY, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.BEECH_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.COLOR_LIGHT_GRAY, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.BEECH_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -186,16 +199,16 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.ROOFING_BLOCKS) .addToSet(WoodBlockTypes.SHINGLE_BLOCKS) .addToSet(WoodBlockTypes.LEAVES) - .leavesColor(MapColor.DARK_GREEN)); + .leavesColor(MapColor.PLANT)); public static WoodBlockSetBuilder DEADWOOD_SET = registerWoodSet(new WoodBlockSetBuilder("deadwood", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.LIGHT_GRAY, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, null) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.COLOR_LIGHT_GRAY, NoteBlockInstrument.BASS, SoundType.WOOD, null) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS)); public static WoodBlockSetBuilder LARCH_SET = registerWoodSet(new WoodBlockSetBuilder("larch", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.DIRT_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.LARCH_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.DIRT, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.LARCH_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -206,7 +219,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.LEAVES)); public static WoodBlockSetBuilder BLACK_LEBETHRON_SET = registerWoodSet(new WoodBlockSetBuilder("black_lebethron", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.BLACK, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.LEBETHRON_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.COLOR_BLACK, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.LEBETHRON_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -216,7 +229,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.SHINGLE_BLOCKS)); public static WoodBlockSetBuilder WHITE_LEBETHRON_SET = registerWoodSet(new WoodBlockSetBuilder("white_lebethron", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.WHITE, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.WHITE_LEBETHRON_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.SNOW, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.WHITE_LEBETHRON_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -226,7 +239,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.SHINGLE_BLOCKS)); public static WoodBlockSetBuilder CHESTNUT_SET = registerWoodSet(new WoodBlockSetBuilder("chestnut", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.TERRACOTTA_YELLOW, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.CHESTNUT_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.TERRACOTTA_YELLOW, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.CHESTNUT_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -235,10 +248,10 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.ROOFING_BLOCKS) .addToSet(WoodBlockTypes.SHINGLE_BLOCKS) .addToSet(WoodBlockTypes.LEAVES) - .leavesColor(MapColor.PALE_GREEN)); + .leavesColor(MapColor.GRASS)); public static WoodBlockSetBuilder FIR_SET = registerWoodSet(new WoodBlockSetBuilder("fir", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.SPRUCE_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.FIR_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.PODZOL, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.FIR_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -249,7 +262,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.LEAVES)); public static WoodBlockSetBuilder HOLLY_SET = registerWoodSet(new WoodBlockSetBuilder("holly", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.WHITE_GRAY, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.HOLLY_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.WOOL, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.HOLLY_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -260,7 +273,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.LEAVES)); public static WoodBlockSetBuilder MALLORN_SET = registerWoodSet(new WoodBlockSetBuilder("mallorn", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.WHITE, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.MALLORN_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.SNOW, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.MALLORN_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -271,7 +284,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.LEAVES)); public static WoodBlockSetBuilder MAPLE_SET = registerWoodSet(new WoodBlockSetBuilder("maple", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.MAPLE_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.COLOR_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.MAPLE_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -280,10 +293,10 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.ROOFING_BLOCKS) .addToSet(WoodBlockTypes.SHINGLE_BLOCKS) .addToSet(WoodBlockTypes.LEAVES) - .leavesColor(MapColor.TERRACOTTA_LIME)); + .leavesColor(MapColor.TERRACOTTA_LIGHT_GREEN)); public static WoodBlockSetBuilder SILVER_MAPLE_SET = registerWoodSet(new WoodBlockSetBuilder("silver_maple", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.OFF_WHITE, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.SILVER_MAPLE_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.QUARTZ, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.SILVER_MAPLE_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -293,7 +306,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.SHINGLE_BLOCKS)); public static WoodBlockSetBuilder MIRKWOOD_SET = registerWoodSet(new WoodBlockSetBuilder("mirkwood", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.MIRKWOOD_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.TERRACOTTA_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.MIRKWOOD_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -302,10 +315,10 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.ROOFING_BLOCKS) .addToSet(WoodBlockTypes.SHINGLE_BLOCKS) .addToSet(WoodBlockTypes.LEAVES) - .leavesColor(MapColor.DARK_GREEN)); + .leavesColor(MapColor.PLANT)); public static WoodBlockSetBuilder PALM_SET = registerWoodSet(new WoodBlockSetBuilder("palm", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.DIRT_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.PALM_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.DIRT, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.PALM_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -316,7 +329,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.LEAVES)); public static WoodBlockSetBuilder WHITE_PALM_SET = registerWoodSet(new WoodBlockSetBuilder("white_palm", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.OFF_WHITE, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.WHITE_PALM_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.QUARTZ, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.WHITE_PALM_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -326,7 +339,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.SHINGLE_BLOCKS)); public static WoodBlockSetBuilder PINE_SET = registerWoodSet(new WoodBlockSetBuilder("pine", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.PINE_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.COLOR_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.PINE_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -337,7 +350,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.LEAVES)); public static WoodBlockSetBuilder BLACK_PINE_SET = registerWoodSet(new WoodBlockSetBuilder("black_pine", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.TERRACOTTA_ORANGE, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.BLACK_PINE_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.TERRACOTTA_ORANGE, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.BLACK_PINE_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -348,7 +361,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.LEAVES)); public static WoodBlockSetBuilder WHITE_SPRUCE_SET = registerWoodSet(new WoodBlockSetBuilder("white_spruce", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.SPRUCE_BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.WHITE_SPRUCE_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.PODZOL, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.WHITE_SPRUCE_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -357,7 +370,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.LEAVES)); public static WoodBlockSetBuilder WILLOW_SET = registerWoodSet(new WoodBlockSetBuilder("willow", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.BROWN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, ModNatureBlocks.WILLOW_SAPLING) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.COLOR_BROWN, NoteBlockInstrument.BASS, SoundType.WOOD, ModNatureBlocks.WILLOW_SAPLING) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -369,7 +382,7 @@ public class WoodBlockSets { .leavesColor(MapColor.TERRACOTTA_GREEN)); public static WoodBlockSetBuilder ROTTEN_SET = registerWoodSet(new WoodBlockSetBuilder("rotten", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.PALE_GREEN, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, null) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.GRASS, NoteBlockInstrument.BASS, SoundType.WOOD, null) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -379,7 +392,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.SHINGLE_BLOCKS)); public static WoodBlockSetBuilder SCORCHED_SET = registerWoodSet(new WoodBlockSetBuilder("scorched", - WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.BLACK, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, null) + WOOD_STRENGTH, WOOD_BLAST_RESISTANCE, MapColor.COLOR_BLACK, NoteBlockInstrument.BASS, SoundType.WOOD, null) .addToSet(WoodBlockTypes.LOG_BLOCKS) .addToSet(WoodBlockTypes.STRIPPED_LOG_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) @@ -389,7 +402,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.SHINGLE_BLOCKS)); public static WoodBlockSetBuilder MUSHROOM_SET = registerWoodSet(new WoodBlockSetBuilder("mushroom", - 2f, 0f, MapColor.WHITE_GRAY, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, null) + 2f, 0f, MapColor.WOOL, NoteBlockInstrument.BASS, SoundType.WOOD, null) .addToSet(WoodBlockTypes.MUSHROOM_STEM_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) .addToSet(WoodBlockTypes.REDSTONE_BLOCKS) @@ -397,7 +410,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.SHINGLE_BLOCKS)); public static WoodBlockSetBuilder DARK_MUSHROOM_SET = registerWoodSet(new WoodBlockSetBuilder("dark_mushroom", - 2f, 0f, MapColor.TERRACOTTA_BLACK, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, null) + 2f, 0f, MapColor.TERRACOTTA_BLACK, NoteBlockInstrument.BASS, SoundType.WOOD, null) .addToSet(WoodBlockTypes.MUSHROOM_STEM_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) .addToSet(WoodBlockTypes.REDSTONE_BLOCKS) @@ -405,7 +418,7 @@ public class WoodBlockSets { .addToSet(WoodBlockTypes.SHINGLE_BLOCKS)); public static WoodBlockSetBuilder GRAY_MUSHROOM_SET = registerWoodSet(new WoodBlockSetBuilder("gray_mushroom", - 2f, 0f, MapColor.GRAY, NoteBlockInstrument.BASS, BlockSoundGroup.WOOD, null) + 2f, 0f, MapColor.COLOR_GRAY, NoteBlockInstrument.BASS, SoundType.WOOD, null) .addToSet(WoodBlockTypes.MUSHROOM_STEM_BLOCKS) .addToSet(WoodBlockTypes.PLANK_BLOCKS) .addToSet(WoodBlockTypes.REDSTONE_BLOCKS) @@ -418,27 +431,31 @@ private static WoodBlockSetBuilder registerWoodSet(WoodBlockSetBuilder set) { set.existingList.forEach((woodStoneTypes) -> { switch (woodStoneTypes) { case LOG_BLOCKS -> { - set.logBlocks = BlockSetRegistration.createWoodSet(woodStoneTypes.getPrefix() + set.setName + woodStoneTypes.getSuffix(), set.hardness, set.blastResistance, set.mapColor, set.instrument, set.soundGroup, itemGroup); - ItemGroupsME.NATURE_BLOCKS_CONTENTS.add(set.logBlocks.log().asItem().getDefaultStack()); + set.logBlocks = set.setName.equals("pale_oak") + ? createPaleOakWoodSet(woodStoneTypes.getPrefix() + set.setName + woodStoneTypes.getSuffix(), false, itemGroup) + : BlockSetRegistration.createWoodSet(woodStoneTypes.getPrefix() + set.setName + woodStoneTypes.getSuffix(), set.hardness, set.blastResistance, set.mapColor, set.instrument, set.soundGroup, itemGroup); + ItemGroupsME.NATURE_BLOCKS_CONTENTS.add(set.logBlocks.log().asItem().getDefaultInstance()); } case MUSHROOM_STEM_BLOCKS -> { set.mushroomStemBlocks = BlockSetRegistration.createMushroomStemSet(woodStoneTypes.getPrefix() + set.setName + woodStoneTypes.getSuffix(), set.hardness, set.blastResistance, set.mapColor, set.instrument, set.soundGroup, itemGroup); - ItemGroupsME.NATURE_BLOCKS_CONTENTS.add(set.mushroomStemBlocks.stem().asItem().getDefaultStack()); + ItemGroupsME.NATURE_BLOCKS_CONTENTS.add(set.mushroomStemBlocks.stem().asItem().getDefaultInstance()); } case NETHER_STEM_BLOCKS -> { set.logBlocks = BlockSetRegistration.createStemSet(woodStoneTypes.getPrefix() + set.setName + woodStoneTypes.getSuffix(), set.hardness, set.blastResistance, set.mapColor, set.instrument, set.soundGroup, itemGroup); - ItemGroupsME.NATURE_BLOCKS_CONTENTS.add(set.logBlocks.log().asItem().getDefaultStack()); + ItemGroupsME.NATURE_BLOCKS_CONTENTS.add(set.logBlocks.log().asItem().getDefaultInstance()); } case STRIPPED_LOG_BLOCKS -> { - set.strippedLogBlocks = BlockSetRegistration.createWoodSet(woodStoneTypes.getPrefix() + set.setName + woodStoneTypes.getSuffix(), set.hardness, set.blastResistance, set.mapColor, set.instrument, set.soundGroup, itemGroup); - StrippableBlockRegistry.register(set.logBlocks.log(), set.strippedLogBlocks.log()); - StrippableBlockRegistry.register(set.logBlocks.wood(), set.strippedLogBlocks.wood()); + set.strippedLogBlocks = set.setName.equals("pale_oak") + ? createPaleOakWoodSet(woodStoneTypes.getPrefix() + set.setName + woodStoneTypes.getSuffix(), true, itemGroup) + : BlockSetRegistration.createWoodSet(woodStoneTypes.getPrefix() + set.setName + woodStoneTypes.getSuffix(), set.hardness, set.blastResistance, set.mapColor, set.instrument, set.soundGroup, itemGroup); + BlockDataMapCollector.registerStrippable(set.logBlocks.log(), set.strippedLogBlocks.log()); + BlockDataMapCollector.registerStrippable(set.logBlocks.wood(), set.strippedLogBlocks.wood()); ModdedStrippedLogs.strippedLogs.add(set.strippedLogBlocks.log()); } case STRIPPED_STEM_BLOCKS -> { set.strippedLogBlocks = BlockSetRegistration.createStemSet(woodStoneTypes.getPrefix() + set.setName + woodStoneTypes.getSuffix(), set.hardness, set.blastResistance, set.mapColor, set.instrument, set.soundGroup, itemGroup); - StrippableBlockRegistry.register(set.logBlocks.log(), set.strippedLogBlocks.log()); - StrippableBlockRegistry.register(set.logBlocks.wood(), set.strippedLogBlocks.wood()); + BlockDataMapCollector.registerStrippable(set.logBlocks.log(), set.strippedLogBlocks.log()); + BlockDataMapCollector.registerStrippable(set.logBlocks.wood(), set.strippedLogBlocks.wood()); ModdedStrippedLogs.strippedLogs.add(set.strippedLogBlocks.log()); } case PLANK_BLOCKS -> @@ -447,11 +464,11 @@ private static WoodBlockSetBuilder registerWoodSet(WoodBlockSetBuilder set) { set.redstoneBlocks = BlockSetRegistration.createWoodRedstoneSet(woodStoneTypes.getPrefix() + set.setName + woodStoneTypes.getSuffix(), set.hardness, set.blastResistance, set.mapColor, set.soundGroup, set.planksBlocks.base(), itemGroup); case FURNITURE_BLOCKS -> { set.furnitureBlocks = BlockSetRegistration.createWoodFurnitureSet(woodStoneTypes.getPrefix() + set.setName + woodStoneTypes.getSuffix(), set.hardness, set.blastResistance, set.mapColor, set.soundGroup, set.planksBlocks.base(), itemGroup); - ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(set.furnitureBlocks.stool().asItem().getDefaultStack()); - ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(set.furnitureBlocks.bench().asItem().getDefaultStack()); - ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(set.furnitureBlocks.table().asItem().getDefaultStack()); - ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(set.furnitureBlocks.chair().asItem().getDefaultStack()); - ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(set.furnitureBlocks.ladder().asItem().getDefaultStack()); + ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(set.furnitureBlocks.stool().asItem().getDefaultInstance()); + ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(set.furnitureBlocks.bench().asItem().getDefaultInstance()); + ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(set.furnitureBlocks.table().asItem().getDefaultInstance()); + ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(set.furnitureBlocks.chair().asItem().getDefaultInstance()); + ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(set.furnitureBlocks.ladder().asItem().getDefaultInstance()); } case ROOFING_BLOCKS -> set.roofingBlocks = BlockSetRegistration.createRegularSet(woodStoneTypes.getPrefix() + set.setName + woodStoneTypes.getSuffix(), set.hardness, set.blastResistance, set.mapColor, set.instrument, set.soundGroup, false, itemGroup, false); @@ -460,18 +477,23 @@ private static WoodBlockSetBuilder registerWoodSet(WoodBlockSetBuilder set) { case LEAVES -> { if(set.setName.equals("mallorn")){ set.leaves = getVanillaOrCreateNew(woodStoneTypes.getPrefix() + set.setName + woodStoneTypes.getSuffix(), - (settings) -> new ModLeavesBlock(0.01F, settings, false), AbstractBlock.Settings.copy(Blocks.OAK_LEAVES) - .strength(LEAVES_STRENGTH).mapColor(MapColor.YELLOW).sounds(BlockSoundGroup.GRASS).burnable(), itemGroup); - } else if(set.setName.equals("holly")){ + (settings) -> new ModLeavesBlock(0.01F, settings, false), BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_LEAVES) + .strength(LEAVES_STRENGTH).mapColor(MapColor.COLOR_YELLOW).sound(SoundType.GRASS).ignitedByLava(), itemGroup); + } else if (set.setName.equals("holly")) { set.leaves = getVanillaOrCreateNew(woodStoneTypes.getPrefix() + set.setName + woodStoneTypes.getSuffix(), - (settings) -> new BerryHollyLeavesBlock(0.01F, settings), AbstractBlock.Settings.copy(Blocks.OAK_LEAVES) - .strength(LEAVES_STRENGTH).mapColor(MapColor.YELLOW).sounds(BlockSoundGroup.GRASS).burnable(), itemGroup); + (settings) -> new BerryHollyLeavesBlock(0.01F, settings), BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_LEAVES) + .strength(LEAVES_STRENGTH).mapColor(MapColor.COLOR_YELLOW).sound(SoundType.GRASS).ignitedByLava(), itemGroup); + } else if (set.setName.equals("pale_oak")) { + set.leaves = getVanillaOrCreateNew(woodStoneTypes.getPrefix() + set.setName + woodStoneTypes.getSuffix(), + PaleOakLeavesBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_LEAVES) + .strength(0.2F).mapColor(MapColor.COLOR_LIGHT_GRAY).sound(SoundType.GRASS).ignitedByLava(), itemGroup); + BlockDataMapCollector.registerCompostable(set.leaves, 0.3F); } else { set.leaves = getVanillaOrCreateNew(woodStoneTypes.getPrefix() + set.setName + woodStoneTypes.getSuffix(), - (settings) -> new TintedParticleLeavesBlock(0.01F, settings), AbstractBlock.Settings.copy(Blocks.OAK_LEAVES) - .strength(LEAVES_STRENGTH).mapColor(set.leavesMapColor).sounds(BlockSoundGroup.GRASS).burnable(), itemGroup); + LeavesBlock::new, BlockBehaviour.Properties.ofFullCopy(Blocks.OAK_LEAVES) + .strength(LEAVES_STRENGTH).mapColor(set.leavesMapColor).sound(SoundType.GRASS).ignitedByLava(), itemGroup); } - FlammableBlockRegistry.getDefaultInstance().add(set.leaves, 5, 60); + BlockDataMapCollector.registerFlammable(set.leaves, 5, 60); } } }); @@ -481,6 +503,42 @@ private static WoodBlockSetBuilder registerWoodSet(WoodBlockSetBuilder set) { return set; } + private static BlockRecordTypes.WoodSet createPaleOakWoodSet(String name, boolean stripped, List group) { + MapColor endColor = MapColor.QUARTZ; + MapColor barkColor = stripped ? MapColor.QUARTZ : MapColor.STONE; + BlockBehaviour.Properties logProperties = BlockBehaviour.Properties.of() + .mapColor(state -> state.getValue(RotatedPillarBlock.AXIS) == Direction.Axis.Y ? endColor : barkColor) + .instrument(NoteBlockInstrument.BASS).sound(SoundType.WOOD).strength(2.0F).ignitedByLava(); + BlockBehaviour.Properties woodProperties = BlockBehaviour.Properties.of() + .mapColor(barkColor).instrument(NoteBlockInstrument.BASS).sound(SoundType.WOOD) + .strength(2.0F).ignitedByLava(); + + Block log = getVanillaOrCreateNew(name + "_log", RotatedPillarBlock::new, logProperties, group); + Block wood = getVanillaOrCreateNew(name + "_wood", RotatedPillarBlock::new, woodProperties, group); + BlockBehaviour.Properties derived = BlockBehaviour.Properties.ofFullCopy(wood) + .mapColor(barkColor).strength(2.0F); + Block slab = getVanillaOrCreateNew(name + "_wood_slab", SlabBlock::new, derived, group); + Block verticalSlab = getVanillaOrCreateNew(name + "_wood_vertical_slab", VerticalSlabBlock::new, + BlockBehaviour.Properties.ofFullCopy(wood).mapColor(barkColor).strength(2.0F), group); + Block stairs = getVanillaOrCreateNew(name + "_wood_stairs", + properties -> new StairBlock(wood.defaultBlockState(), properties), + BlockBehaviour.Properties.ofFullCopy(wood).mapColor(barkColor).strength(2.0F), group); + Block wall = getVanillaOrCreateNew(name + "_wood_wall", WallBlock::new, + BlockBehaviour.Properties.ofFullCopy(wood).mapColor(barkColor).strength(2.0F), group); + Block fence = getVanillaOrCreateNew(name + "_wood_fence", FenceBlock::new, + BlockBehaviour.Properties.ofFullCopy(wood).mapColor(barkColor).strength(2.0F), group); + + for (Block block : List.of(log, wood, slab, verticalSlab, stairs, wall, fence)) { + BlockDataMapCollector.registerFlammable(block, 5, 5); + } + BlockDataMapCollector.registerFuel(slab, 150); + BlockDataMapCollector.registerFuel(verticalSlab, 150); + BlockDataMapCollector.registerFuel(stairs, 300); + BlockDataMapCollector.registerFuel(wall, 300); + BlockDataMapCollector.registerFuel(fence, 300); + return new BlockRecordTypes.WoodSet(log, wood, slab, verticalSlab, stairs, wall, fence); + } + public static void registerModBlockSets() { MiddleEarth.LOGGER.logDebugMsg("Registering Wood Block Sets for " + MiddleEarth.MOD_ID); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CandleHeapBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CandleHeapBlock.java index bd372a00fd..765d56cf00 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CandleHeapBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CandleHeapBlock.java @@ -2,136 +2,138 @@ import com.google.common.collect.ImmutableList; import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockRenderType; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.particle.SimpleParticleType; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.event.GameEvent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.particles.SimpleParticleType; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; public class CandleHeapBlock extends Block { - public static final BooleanProperty LIT = Properties.LIT; - - private final ImmutableList particles = ImmutableList.of( - new Vec3d(0.875, 0.34375, 0.875), - new Vec3d(0.3125, 0.25, 0.875), - new Vec3d(0.125, 0.34375, 0.875), - new Vec3d(0.8125, 0.25, 0.5625), - new Vec3d(0.625, 0.53125, 0.625), - new Vec3d(0.375, 0.46875, 0.6875), - new Vec3d(0.1875, 0.28125, 0.5625), - new Vec3d(0.5, 0.46875, 0.375), - new Vec3d(0.1875, 0.25, 0.3125), - new Vec3d(0.8125, 0.34375, 0.125), - new Vec3d(0.5625, 0.25, 0.1875), - new Vec3d(0.3125, 0.34375, 0.125) + public static final BooleanProperty LIT = BlockStateProperties.LIT; + + private final ImmutableList particles = ImmutableList.of( + new Vec3(0.875, 0.34375, 0.875), + new Vec3(0.3125, 0.25, 0.875), + new Vec3(0.125, 0.34375, 0.875), + new Vec3(0.8125, 0.25, 0.5625), + new Vec3(0.625, 0.53125, 0.625), + new Vec3(0.375, 0.46875, 0.6875), + new Vec3(0.1875, 0.28125, 0.5625), + new Vec3(0.5, 0.46875, 0.375), + new Vec3(0.1875, 0.25, 0.3125), + new Vec3(0.8125, 0.34375, 0.125), + new Vec3(0.5625, 0.25, 0.1875), + new Vec3(0.3125, 0.34375, 0.125) ); - public CandleHeapBlock(Settings settings) { + public CandleHeapBlock(Properties settings) { super(settings); - this.setDefaultState(this.stateManager.getDefaultState().with(LIT, false)); + this.registerDefaultState(this.stateDefinition.any().setValue(LIT, false)); } @Override - protected MapCodec getCodec() { - return CandleHeapBlock.createCodec(CandleHeapBlock::new); + protected MapCodec codec() { + return CandleHeapBlock.simpleCodec(CandleHeapBlock::new); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - Hand hand = player.getActiveHand(); - if (!world.isClient && player.getAbilities().allowModifyWorld) { - if(player.isInCreativeMode()){ - world.setBlockState(pos, state.cycle(LIT)); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + InteractionHand hand = player.getUsedItemHand(); + if (!world.isClientSide && player.getAbilities().mayBuild) { + if(player.hasInfiniteMaterials()){ + world.setBlockAndUpdate(pos, state.cycle(LIT)); } else { - ItemStack itemStack = player.getStackInHand(hand); - if (state.get(LIT) && player.getMainHandStack().isEmpty()) { + ItemStack itemStack = player.getItemInHand(hand); + if (state.getValue(LIT) && player.getMainHandItem().isEmpty()) { extinguish((Entity)null, world, pos, state); - } else if (!state.get(LIT) && itemStack.isOf(Items.FLINT_AND_STEEL) || itemStack.isOf(Items.TORCH)) { + } else if (!state.getValue(LIT) + && (itemStack.is(Items.FLINT_AND_STEEL) || itemStack.is(Items.TORCH))) { setLit(world, state, pos, true); } } } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } - protected static void setLit(WorldAccess world, BlockState state, BlockPos pos, boolean lit) { - world.setBlockState(pos, state.with(LIT, lit), 2 | 3); + protected static void setLit(LevelAccessor world, BlockState state, BlockPos pos, boolean lit) { + world.setBlock(pos, state.setValue(LIT, lit), 2 | 3); if(lit){ - world.playSound(null, pos, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.5F, 1.0F); + world.playSound(null, pos, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.5F, 1.0F); } } - public static void extinguish(@Nullable Entity entity, WorldAccess world, BlockPos pos, BlockState state) { - if (world.isClient()) { + public static void extinguish(@Nullable Entity entity, LevelAccessor world, BlockPos pos, BlockState state) { + setLit(world, state, pos, false); + if (world.isClientSide()) { for(int i = 0; i < 20; ++i) { - spawnSmokeParticle((World)world, pos, true, true); + spawnSmokeParticle((Level)world, pos, true, true); } } - world.emitGameEvent(entity, GameEvent.BLOCK_CHANGE, pos); + world.gameEvent(entity, GameEvent.BLOCK_CHANGE, pos); } - public static void spawnSmokeParticle(World world, BlockPos pos, boolean isSignal, boolean lotsOfSmoke) { - Random random = world.getRandom(); + public static void spawnSmokeParticle(Level world, BlockPos pos, boolean isSignal, boolean lotsOfSmoke) { + RandomSource random = world.getRandom(); SimpleParticleType simpleParticleType = isSignal ? ParticleTypes.CAMPFIRE_SIGNAL_SMOKE : ParticleTypes.CAMPFIRE_COSY_SMOKE; - world.addImportantParticleClient(simpleParticleType, true, (double)pos.getX() + 0.5 + random.nextDouble() / 3.0 * (double)(random.nextBoolean() ? 1 : -1), (double)pos.getY() + random.nextDouble() + random.nextDouble(), (double)pos.getZ() + 0.5 + random.nextDouble() / 3.0 * (double)(random.nextBoolean() ? 1 : -1), 0.0, 0.07, 0.0); + world.addAlwaysVisibleParticle(simpleParticleType, true, (double)pos.getX() + 0.5 + random.nextDouble() / 3.0 * (double)(random.nextBoolean() ? 1 : -1), (double)pos.getY() + random.nextDouble() + random.nextDouble(), (double)pos.getZ() + 0.5 + random.nextDouble() / 3.0 * (double)(random.nextBoolean() ? 1 : -1), 0.0, 0.07, 0.0); if (lotsOfSmoke) { - world.addParticleClient(ParticleTypes.SMOKE, (double)pos.getX() + 0.5 + random.nextDouble() / 4.0 * (double)(random.nextBoolean() ? 1 : -1), (double)pos.getY() + 0.4, (double)pos.getZ() + 0.5 + random.nextDouble() / 4.0 * (double)(random.nextBoolean() ? 1 : -1), 0.0, 0.005, 0.0); + world.addParticle(ParticleTypes.SMOKE, (double)pos.getX() + 0.5 + random.nextDouble() / 4.0 * (double)(random.nextBoolean() ? 1 : -1), (double)pos.getY() + 0.4, (double)pos.getZ() + 0.5 + random.nextDouble() / 4.0 * (double)(random.nextBoolean() ? 1 : -1), 0.0, 0.005, 0.0); } } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(LIT); } - protected BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 8.0, 16.0); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(0.0, 0.0, 0.0, 16.0, 8.0, 16.0); } - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { - if ((Boolean)state.get(LIT)) { + public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { + if ((Boolean)state.getValue(LIT)) { this.particles.forEach((offset) -> { spawnCandleParticles(world, offset.add((double)pos.getX(), (double)pos.getY(), (double)pos.getZ()), random); }); } } - private static void spawnCandleParticles(World world, Vec3d vec3d, Random random) { + private static void spawnCandleParticles(Level world, Vec3 vec3d, RandomSource random) { float f = random.nextFloat(); if (f < 0.3F) { - world.addParticleClient(ParticleTypes.SMOKE, vec3d.x, vec3d.y, vec3d.z, 0.0, 0.0, 0.0); + world.addParticle(ParticleTypes.SMOKE, vec3d.x, vec3d.y, vec3d.z, 0.0, 0.0, 0.0); if (f < 0.17F) { - world.playSoundClient(vec3d.x + 0.5, vec3d.y + 0.5, vec3d.z + 0.5, SoundEvents.BLOCK_CANDLE_AMBIENT, SoundCategory.BLOCKS, 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F, false); + world.playLocalSound(vec3d.x + 0.5, vec3d.y + 0.5, vec3d.z + 0.5, SoundEvents.CANDLE_AMBIENT, SoundSource.BLOCKS, 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F, false); } } - world.addParticleClient(ParticleTypes.SMALL_FLAME, vec3d.x, vec3d.y, vec3d.z, 0.0, 0.0, 0.0); + world.addParticle(ParticleTypes.SMALL_FLAME, vec3d.x, vec3d.y, vec3d.z, 0.0, 0.0, 0.0); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CandleLayeredCakeBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CandleLayeredCakeBlock.java index dd9475d9bc..514d7d90ca 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CandleLayeredCakeBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CandleLayeredCakeBlock.java @@ -3,29 +3,38 @@ import com.google.common.collect.Maps; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.block.*; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.registry.Registries; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Property; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.AbstractCandleBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.CakeBlock; +import net.minecraft.world.level.block.CandleBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlocks; import java.util.List; @@ -33,23 +42,23 @@ public class CandleLayeredCakeBlock extends AbstractCandleBlock { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec((instance) -> { - return instance.group(Registries.BLOCK.getCodec().fieldOf("candle").forGetter((block) -> { + return instance.group(BuiltInRegistries.BLOCK.byNameCodec().fieldOf("candle").forGetter((block) -> { return block.candle; - }), createSettingsCodec()).apply(instance, CandleLayeredCakeBlock::new); + }), propertiesCodec()).apply(instance, CandleLayeredCakeBlock::new); }); public static final BooleanProperty LIT; private static final VoxelShape SHAPE; private static final Map CANDLES_TO_CANDLE_CAKES; - private static final Iterable PARTICLE_OFFSETS; + private static final Iterable PARTICLE_OFFSETS; private final CandleBlock candle; - public MapCodec getCodec() { + public MapCodec codec() { return CODEC; } - public CandleLayeredCakeBlock(Block candle, AbstractBlock.Settings settings) { + public CandleLayeredCakeBlock(Block candle, BlockBehaviour.Properties settings) { super(settings); - this.setDefaultState((BlockState)((BlockState)this.stateManager.getDefaultState()).with(LIT, false)); + this.registerDefaultState((BlockState)((BlockState)this.stateDefinition.any()).setValue(LIT, false)); if (candle instanceof CandleBlock candleBlock) { CANDLES_TO_CANDLE_CAKES.put(candleBlock, this); this.candle = candleBlock; @@ -59,93 +68,95 @@ public CandleLayeredCakeBlock(Block candle, AbstractBlock.Settings settings) { } } - protected Iterable getParticleOffsets(BlockState state) { + protected Iterable getParticleOffsets(BlockState state) { return PARTICLE_OFFSETS; } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } - protected ActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - if (stack.isOf(Items.FLINT_AND_STEEL) || stack.isOf(Items.FIRE_CHARGE)) { + protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + if (stack.is(Items.FLINT_AND_STEEL) || stack.is(Items.FIRE_CHARGE)) { if(canBeLit(state)) { setLit(world, state, pos, true); - return ActionResult.CONSUME; + return ItemInteractionResult.CONSUME; } - return ActionResult.PASS; + return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; } else { - if (isHittingCandle(hit) && stack.isEmpty() && (Boolean)state.get(LIT)) { + if (isHittingCandle(hit) && stack.isEmpty() && (Boolean)state.getValue(LIT)) { extinguish(player, state, world, pos); - return ActionResult.SUCCESS; + return ItemInteractionResult.SUCCESS; } else { - return super.onUseWithItem(stack, state, world, pos, player, hand, hit); + return super.useItemOn(stack, state, world, pos, player, hand, hit); } } } - private static void setLit(WorldAccess world, BlockState state, BlockPos pos, boolean lit) { - world.setBlockState(pos, state.with(LIT, lit), 11); + private static void setLit(LevelAccessor world, BlockState state, BlockPos pos, boolean lit) { + world.setBlock(pos, state.setValue(LIT, lit), 11); } - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - ActionResult actionResult = LayeredCakeBlock.tryEat(world, pos, ModBlocks.LAYERED_CAKE.getDefaultState(), player); - if (actionResult.isAccepted()) { - dropStacks(state, world, pos); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + InteractionResult actionResult = LayeredCakeBlock.tryEat(world, pos, ModBlocks.LAYERED_CAKE.defaultBlockState(), player); + if (actionResult.consumesAction()) { + dropResources(state, world, pos); } return actionResult; } private static boolean isHittingCandle(BlockHitResult hitResult) { - return hitResult.getPos().y - (double)hitResult.getBlockPos().getY() > 0.5; + return hitResult.getLocation().y - (double)hitResult.getBlockPos().getY() > 0.5; } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(new Property[]{LIT}); } - protected ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData) { + @Override + public ItemStack getCloneItemStack(LevelReader world, BlockPos pos, BlockState state) { return new ItemStack(ModBlocks.LAYERED_CAKE); } - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - return direction == Direction.DOWN && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + return direction == Direction.DOWN && !state.canSurvive(world, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - return world.getBlockState(pos.down()).isSolid(); + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + return world.getBlockState(pos.below()).isSolid(); } - protected int getComparatorOutput(BlockState state, World world, BlockPos pos) { - return CakeBlock.DEFAULT_COMPARATOR_OUTPUT; + protected int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) { + return CakeBlock.FULL_CAKE_SIGNAL; } - protected boolean hasComparatorOutput(BlockState state) { + protected boolean hasAnalogOutputSignal(BlockState state) { return true; } - protected boolean canPathfindThrough(BlockState state, NavigationType type) { + protected boolean isPathfindable(BlockState state, PathComputationType type) { return false; } public static BlockState getCandleCakeFromCandle(CandleBlock candle) { - return ((CandleLayeredCakeBlock)CANDLES_TO_CANDLE_CAKES.get(candle)).getDefaultState(); + return ((CandleLayeredCakeBlock)CANDLES_TO_CANDLE_CAKES.get(candle)).defaultBlockState(); } - public static boolean canBeLit(BlockState state) { - return state.contains(LIT) && !(Boolean)state.get(LIT); + @Override + protected boolean canBeLit(BlockState state) { + return state.hasProperty(LIT) && !(Boolean)state.getValue(LIT); } static { LIT = AbstractCandleBlock.LIT; - SHAPE = VoxelShapes.union(Block.createCuboidShape(0, 0.0, 0, 16.0, 8.0, 16.0), - Block.createCuboidShape(2, 8, 2, 14, 16, 14)); + SHAPE = Shapes.or(Block.box(0, 0.0, 0, 16.0, 8.0, 16.0), + Block.box(2, 8, 2, 14, 16, 14)); CANDLES_TO_CANDLE_CAKES = Maps.newHashMap(); - PARTICLE_OFFSETS = List.of((new Vec3d(5.0, 23, 5.0)).multiply(0.0625), - (new Vec3d(5.0, 23, 11.0)).multiply(0.0625), - (new Vec3d(11.0, 23, 5.0)).multiply(0.0625), - (new Vec3d(11.0, 23, 11.0)).multiply(0.0625) + PARTICLE_OFFSETS = List.of((new Vec3(5.0, 23, 5.0)).scale(0.0625), + (new Vec3(5.0, 23, 11.0)).scale(0.0625), + (new Vec3(11.0, 23, 5.0)).scale(0.0625), + (new Vec3(11.0, 23, 11.0)).scale(0.0625) ); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ChaliceBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ChaliceBlock.java index d243b97afe..13ba73e306 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ChaliceBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ChaliceBlock.java @@ -1,79 +1,79 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; public class ChaliceBlock extends Block { - public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - public ChaliceBlock(Settings settings) { + public ChaliceBlock(Properties settings) { super(settings); - setDefaultState(getDefaultState().with(WATERLOGGED, false)); + registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false)); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(WATERLOGGED); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState().setValue(WATERLOGGED, ctx.getLevel().getFluidState(ctx.getClickedPos()).getType() == Fluids.WATER); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if (player.getStackInHand(player.getActiveHand()).isEmpty() && !player.isInCreativeMode()){ - world.setBlockState(pos, Blocks.AIR.getDefaultState()); - player.equipStack(EquipmentSlot.MAINHAND, new ItemStack(ModDecorativeBlocks.GOLDEN_CHALICE.asItem())); - world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ENTITY_CHICKEN_EGG, SoundCategory.BLOCKS, 0.5f, world.random.nextFloat() * 0.1f - 1.0f); - return ActionResult.PASS; + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (player.getItemInHand(player.getUsedItemHand()).isEmpty() && !player.hasInfiniteMaterials()){ + world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); + player.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(ModDecorativeBlocks.GOLDEN_CHALICE.asItem())); + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.CHICKEN_EGG, SoundSource.BLOCKS, 0.5f, world.random.nextFloat() * 0.1f - 1.0f); + return InteractionResult.PASS; } else{ - return super.onUse(state, world, pos, player, hit); + return super.useWithoutItem(state, world, pos, player, hit); } } @Override public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(3, 0, 3, 13, 16, 13); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(3, 0, 3, 13, 16, 13); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CoinPileBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CoinPileBlock.java index da18b1e5e4..b6240730ba 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CoinPileBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CoinPileBlock.java @@ -1,20 +1,20 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class CoinPileBlock extends RocksBlock { - public CoinPileBlock(Settings settings) { + public CoinPileBlock(Properties settings) { super(settings); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(0, 0, 0, 16, 3, 16); + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(0, 0, 0, 16, 3, 16); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CornerCobwebBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CornerCobwebBlock.java index ef510d219a..34c9480a5c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CornerCobwebBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CornerCobwebBlock.java @@ -1,100 +1,97 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.CobwebBlock; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.block.WireOrientation; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.WebBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import org.jetbrains.annotations.Nullable; -public class CornerCobwebBlock extends CobwebBlock { +public class CornerCobwebBlock extends WebBlock { public static final BooleanProperty HANGING; private static final EnumProperty FACING; - public CornerCobwebBlock(Settings settings) { + public CornerCobwebBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(HANGING, false).with(FACING, Direction.EAST)); + this.registerDefaultState(this.defaultBlockState().setValue(HANGING, false).setValue(FACING, Direction.EAST)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add (HANGING).add(FACING); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction direction = ctx.getSide(); - BlockPos blockPos = ctx.getBlockPos(); - return this.getDefaultState() - .with(FACING, ctx.getHorizontalPlayerFacing()) - .with(HANGING, !(direction != Direction.DOWN && (direction == Direction.UP || !(ctx.getHitPos().y - (double)blockPos.getY() > 0.5)))); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction direction = ctx.getClickedFace(); + BlockPos blockPos = ctx.getClickedPos(); + return this.defaultBlockState() + .setValue(FACING, ctx.getHorizontalDirection()) + .setValue(HANGING, !(direction != Direction.DOWN && (direction == Direction.UP || !(ctx.getClickLocation().y - (double)blockPos.getY() > 0.5)))); } @Override - public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - BlockPos sidePos = pos.offset(state.get(FACING)); - BlockPos verticalPos = pos.offset(state.get(HANGING) ? Direction.UP : Direction.DOWN); + public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + BlockPos sidePos = pos.relative(state.getValue(FACING)); + BlockPos verticalPos = pos.relative(state.getValue(HANGING) ? Direction.UP : Direction.DOWN); - return world.getBlockState(verticalPos).isSolidBlock(world, verticalPos) || - world.getBlockState(sidePos).isSolidBlock(world, sidePos); + return world.getBlockState(verticalPos).isRedstoneConductor(world, verticalPos) || + world.getBlockState(sidePos).isRedstoneConductor(world, sidePos); } @Override - protected void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, @Nullable WireOrientation wireOrientation, boolean notify) { - if (!world.isClient) { + protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) { + if (!world.isClientSide) { for (Direction direction : Direction.values()) { - if (world.getFluidState(pos.offset(direction)).isIn(net.minecraft.registry.tag.FluidTags.WATER)) { - world.breakBlock(pos, true); + if (world.getFluidState(pos.relative(direction)).is(net.minecraft.tags.FluidTags.WATER)) { + world.destroyBlock(pos, true); return; } } } - super.neighborUpdate(state, world, pos, sourceBlock, wireOrientation, notify); + super.neighborChanged(state, world, pos, sourceBlock, sourcePos, notify); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - return !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + return !state.canSurvive(world, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); } static { - HANGING = Properties.HANGING; - FACING = Properties.HORIZONTAL_FACING; + HANGING = BlockStateProperties.HANGING; + FACING = BlockStateProperties.HORIZONTAL_FACING; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CrateBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CrateBlock.java index 1db7def090..850d8971dc 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CrateBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CrateBlock.java @@ -1,45 +1,45 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.BarrelBlock; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BarrelBlockEntity; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.property.Properties; -import net.minecraft.text.Text; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.BarrelBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BarrelBlockEntity; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.MiddleEarth; import org.jetbrains.annotations.Nullable; public class CrateBlock extends BarrelBlock { - public CrateBlock(Settings settings) { + public CrateBlock(Properties settings) { super(settings); } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(Properties.FACING, ctx.getHorizontalPlayerFacing().getOpposite()); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState().setValue(BlockStateProperties.FACING, ctx.getHorizontalDirection().getOpposite()); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return switch (state.get(FACING)) { - case DOWN, UP, NORTH, SOUTH -> Block.createCuboidShape(0, 0, 3, 16, 7, 13); - case WEST,EAST -> Block.createCuboidShape(3, 0, 0, 13, 7, 16); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return switch (state.getValue(FACING)) { + case DOWN, UP, NORTH, SOUTH -> Block.box(0, 0, 3, 16, 7, 13); + case WEST,EAST -> Block.box(3, 0, 0, 13, 7, 16); }; } @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new BarrelBlockEntity(pos, state){ @Override - protected Text getContainerName() { - return Text.translatable("container.%s.small_crate".formatted(MiddleEarth.MOD_ID)); + protected Component getDefaultName() { + return Component.translatable("container.%s.small_crate".formatted(MiddleEarth.MOD_ID)); } }; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CushionBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CushionBlock.java index 46c96d66e9..af5ce009fb 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CushionBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CushionBlock.java @@ -1,34 +1,36 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class CushionBlock extends SeatBlock { - protected static final VoxelShape SHAPE = Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 9.0, 16.0); + protected static final VoxelShape SHAPE = Block.box(0.0, 0.0, 0.0, 16.0, 9.0, 16.0); - public CushionBlock(Settings settings) { + public CushionBlock(Properties settings) { super(settings); } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } - public void onLandedUpon(World world, BlockState state, BlockPos pos, Entity entity, float fallDistance) { - super.onLandedUpon(world, state, pos, entity, fallDistance * 0.5F); + @Override + public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) { + super.fallOn(world, state, pos, entity, fallDistance * 0.5F); } - public void onEntityLand(BlockView world, Entity entity) { - if (entity.bypassesLandingEffects()) { - super.onEntityLand(world, entity); + @Override + public void updateEntityAfterFallOn(BlockGetter world, Entity entity) { + if (entity.isSuppressingBounce()) { + super.updateEntityAfterFallOn(world, entity); } else { this.bounceEntity(entity); } @@ -36,10 +38,10 @@ public void onEntityLand(BlockView world, Entity entity) { } private void bounceEntity(Entity entity) { - Vec3d vec3d = entity.getVelocity(); + Vec3 vec3d = entity.getDeltaMovement(); if (vec3d.y < 0.0) { double d = entity instanceof LivingEntity ? 1.0 : 0.8; - entity.setVelocity(vec3d.x, -vec3d.y * 0.6600000262260437 * d, vec3d.z); + entity.setDeltaMovement(vec3d.x, -vec3d.y * 0.6600000262260437 * d, vec3d.z); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CustomWaterloggableTallPlantBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CustomWaterloggableTallPlantBlock.java index 4b26c807d6..c77620558b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CustomWaterloggableTallPlantBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/CustomWaterloggableTallPlantBlock.java @@ -1,80 +1,86 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.*; -import net.minecraft.block.enums.DoubleBlockHalf; -import net.minecraft.entity.LivingEntity; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.block.WireOrientation; -import net.minecraft.world.tick.ScheduledTickView; - -public class CustomWaterloggableTallPlantBlock extends TallPlantBlock implements Fertilizable, Waterloggable { - public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.DoublePlantBlock; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; + +public class CustomWaterloggableTallPlantBlock extends DoublePlantBlock implements BonemealableBlock, SimpleWaterloggedBlock { + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; private final boolean randomBoneMeal; - public CustomWaterloggableTallPlantBlock(Settings settings, boolean random) { + public CustomWaterloggableTallPlantBlock(Properties settings, boolean random) { super(settings); this.randomBoneMeal = random; - this.setDefaultState((BlockState)((BlockState)this.stateManager.getDefaultState()).with(HALF, DoubleBlockHalf.LOWER).with(WATERLOGGED, false)); + this.registerDefaultState((BlockState)((BlockState)this.stateDefinition.any()).setValue(HALF, DoubleBlockHalf.LOWER).setValue(WATERLOGGED, false)); } - public void placeAt(WorldAccess world, BlockPos pos, boolean waterlogged, int flags) { - world.setBlockState(pos, this.getDefaultState().with(HALF, DoubleBlockHalf.LOWER).with(WATERLOGGED, waterlogged), flags); - world.setBlockState(pos.up(), this.getDefaultState().with(HALF, DoubleBlockHalf.UPPER).with(WATERLOGGED, false), flags); + public void placeAt(LevelAccessor world, BlockPos pos, boolean waterlogged, int flags) { + world.setBlock(pos, this.defaultBlockState().setValue(HALF, DoubleBlockHalf.LOWER).setValue(WATERLOGGED, waterlogged), flags); + world.setBlock(pos.above(), this.defaultBlockState().setValue(HALF, DoubleBlockHalf.UPPER).setValue(WATERLOGGED, false), flags); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(HALF) == DoubleBlockHalf.LOWER && state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(HALF) == DoubleBlockHalf.LOWER && state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - DoubleBlockHalf doubleBlockHalf = (DoubleBlockHalf)state.get(HALF); - if (direction.getAxis() == Direction.Axis.Y && doubleBlockHalf == DoubleBlockHalf.LOWER == (direction == Direction.UP) && (!neighborState.isOf(this) || neighborState.get(HALF) == doubleBlockHalf)) { - return Blocks.AIR.getDefaultState(); + DoubleBlockHalf doubleBlockHalf = (DoubleBlockHalf)state.getValue(HALF); + if (direction.getAxis() == Direction.Axis.Y && doubleBlockHalf == DoubleBlockHalf.LOWER == (direction == Direction.UP) && (!neighborState.is(this) || neighborState.getValue(HALF) == doubleBlockHalf)) { + return Blocks.AIR.defaultBlockState(); } else { - return doubleBlockHalf == DoubleBlockHalf.LOWER && direction == Direction.DOWN && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return doubleBlockHalf == DoubleBlockHalf.LOWER && direction == Direction.DOWN && !state.canSurvive(world, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } } @Override - protected void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, WireOrientation orientation, boolean notify) { - if (!world.isClient && state.get(HALF) == DoubleBlockHalf.UPPER && ( - world.getBlockState(pos.up()).getFluidState().isOf(Fluids.WATER) - || world.getBlockState(pos.north()).getFluidState().isOf(Fluids.WATER) - || world.getBlockState(pos.south()).getFluidState().isOf(Fluids.WATER) - || world.getBlockState(pos.east()).getFluidState().isOf(Fluids.WATER) - || world.getBlockState(pos.west()).getFluidState().isOf(Fluids.WATER))) { - this.breakUpperFromWater(world, pos, Blocks.AIR.getDefaultState()); + protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) { + if (!world.isClientSide && state.getValue(HALF) == DoubleBlockHalf.UPPER && ( + world.getBlockState(pos.above()).getFluidState().is(Fluids.WATER) + || world.getBlockState(pos.north()).getFluidState().is(Fluids.WATER) + || world.getBlockState(pos.south()).getFluidState().is(Fluids.WATER) + || world.getBlockState(pos.east()).getFluidState().is(Fluids.WATER) + || world.getBlockState(pos.west()).getFluidState().is(Fluids.WATER))) { + this.breakUpperFromWater(world, pos, Blocks.AIR.defaultBlockState()); return; } - super.neighborUpdate(state, world, pos, sourceBlock, orientation, notify); + super.neighborChanged(state, world, pos, sourceBlock, sourcePos, notify); } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - BlockPos blockPos = ctx.getBlockPos(); - BlockState blockState = ctx.getWorld().getBlockState(ctx.getBlockPos()); - World world = ctx.getWorld(); - if(blockPos.getY() < world.getTopYInclusive() - 1 && world.getBlockState(blockPos.up()).canReplace(ctx)){ - if(blockState.isOf(Blocks.WATER)){ - return this.getDefaultState().with(WATERLOGGED, true); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + BlockPos blockPos = ctx.getClickedPos(); + BlockState blockState = ctx.getLevel().getBlockState(ctx.getClickedPos()); + Level world = ctx.getLevel(); + if(blockPos.getY() < world.getMaxBuildHeight() - 1 && world.getBlockState(blockPos.above()).canBeReplaced(ctx)){ + if(blockState.is(Blocks.WATER)){ + return this.defaultBlockState().setValue(WATERLOGGED, true); } else{ - return this.getDefaultState(); + return this.defaultBlockState(); } } else { return null; @@ -82,87 +88,87 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(HALF, WATERLOGGED); } @Override public FluidState getFluidState(BlockState state) { - return state.get(HALF) == DoubleBlockHalf.LOWER && state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return state.getValue(HALF) == DoubleBlockHalf.LOWER && state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Override - protected boolean canBucketPlace(BlockState state, Fluid fluid) { - return state.get(HALF) == DoubleBlockHalf.LOWER && super.canBucketPlace(state, fluid); + protected boolean canBeReplaced(BlockState state, Fluid fluid) { + return state.getValue(HALF) == DoubleBlockHalf.LOWER && super.canBeReplaced(state, fluid); } @Override - public boolean canFillWithFluid(LivingEntity filler, BlockView world, BlockPos pos, BlockState state, Fluid fluid) { + public boolean canPlaceLiquid(Player filler, BlockGetter world, BlockPos pos, BlockState state, Fluid fluid) { if (fluid != Fluids.WATER) { return false; } - if (state.get(HALF) == DoubleBlockHalf.UPPER) { + if (state.getValue(HALF) == DoubleBlockHalf.UPPER) { return true; } - return Waterloggable.super.canFillWithFluid(filler, world, pos, state, fluid); + return SimpleWaterloggedBlock.super.canPlaceLiquid(filler, world, pos, state, fluid); } @Override - public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) { - if (!fluidState.isOf(Fluids.WATER)) { + public boolean placeLiquid(LevelAccessor world, BlockPos pos, BlockState state, FluidState fluidState) { + if (!fluidState.is(Fluids.WATER)) { return false; } - if (state.get(HALF) == DoubleBlockHalf.UPPER) { - this.breakUpperFromWater(world, pos, Blocks.WATER.getDefaultState()); + if (state.getValue(HALF) == DoubleBlockHalf.UPPER) { + this.breakUpperFromWater(world, pos, Blocks.WATER.defaultBlockState()); return true; } - return Waterloggable.super.tryFillWithFluid(world, pos, state, fluidState); + return SimpleWaterloggedBlock.super.placeLiquid(world, pos, state, fluidState); } @Override - public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { - world.setBlockState(pos.up(), state.with(HALF, DoubleBlockHalf.UPPER).with(WATERLOGGED, false), 3); + public void setPlacedBy(Level world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { + world.setBlock(pos.above(), state.setValue(HALF, DoubleBlockHalf.UPPER).setValue(WATERLOGGED, false), 3); } @Override - public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state) { + public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state) { return true; } - public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { + public boolean isBonemealSuccess(Level world, RandomSource random, BlockPos pos, BlockState state) { return true; } - public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) { + public void performBonemeal(ServerLevel world, RandomSource random, BlockPos pos, BlockState state) { if(this.randomBoneMeal) { float val = random.nextFloat(); if(val > 0.90f){ - dropStack(world, pos, new ItemStack(this)); + popResource(world, pos, new ItemStack(this)); } } else { - dropStack(world, pos, new ItemStack(this)); + popResource(world, pos, new ItemStack(this)); } } - private void breakUpperFromWater(WorldAccess world, BlockPos upperPos, BlockState upperReplacementState) { + private void breakUpperFromWater(LevelAccessor world, BlockPos upperPos, BlockState upperReplacementState) { BlockState upperState = world.getBlockState(upperPos); - if (!upperState.isOf(this) || upperState.get(HALF) != DoubleBlockHalf.UPPER) { + if (!upperState.is(this) || upperState.getValue(HALF) != DoubleBlockHalf.UPPER) { return; } - if (world instanceof World actualWorld && !actualWorld.isClient) { - dropStacks(upperState, actualWorld, upperPos); + if (world instanceof Level actualWorld && !actualWorld.isClientSide) { + dropResources(upperState, actualWorld, upperPos); } - BlockPos lowerPos = upperPos.down(); + BlockPos lowerPos = upperPos.below(); BlockState lowerState = world.getBlockState(lowerPos); - if (lowerState.isOf(this) && lowerState.get(HALF) == DoubleBlockHalf.LOWER) { - BlockState lowerReplacementState = lowerState.get(WATERLOGGED) ? Blocks.WATER.getDefaultState() : Blocks.AIR.getDefaultState(); - world.setBlockState(lowerPos, lowerReplacementState, 3); + if (lowerState.is(this) && lowerState.getValue(HALF) == DoubleBlockHalf.LOWER) { + BlockState lowerReplacementState = lowerState.getValue(WATERLOGGED) ? Blocks.WATER.defaultBlockState() : Blocks.AIR.defaultBlockState(); + world.setBlock(lowerPos, lowerReplacementState, 3); } - world.setBlockState(upperPos, upperReplacementState, 3); + world.setBlock(upperPos, upperReplacementState, 3); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/DecorativeRodBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/DecorativeRodBlock.java index ddf002009b..dbafa21f59 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/DecorativeRodBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/DecorativeRodBlock.java @@ -1,58 +1,57 @@ package net.sevenstars.middleearth.block.special; import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.RodBlock; -import net.minecraft.block.Waterloggable; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.state.property.Property; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; - -public class DecorativeRodBlock extends RodBlock implements Waterloggable { - public static final MapCodec CODEC = createCodec(DecorativeRodBlock::new); - public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; - - public DecorativeRodBlock(Settings settings) { +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.RodBlock; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; + +public class DecorativeRodBlock extends RodBlock implements SimpleWaterloggedBlock { + public static final MapCodec CODEC = simpleCodec(DecorativeRodBlock::new); + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; + + public DecorativeRodBlock(Properties settings) { super(settings); - this.setDefaultState((BlockState)((BlockState)this.stateManager.getDefaultState()).with(FACING, Direction.UP).with(WATERLOGGED, false)); + this.registerDefaultState((BlockState)((BlockState)this.stateDefinition.any()).setValue(FACING, Direction.UP).setValue(WATERLOGGED, false)); } - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - boolean bl = fluidState.getFluid() == Fluids.WATER; - return (BlockState)((BlockState)this.getDefaultState().with(FACING, ctx.getSide())).with(WATERLOGGED, bl); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + FluidState fluidState = ctx.getLevel().getFluidState(ctx.getClickedPos()); + boolean bl = fluidState.getType() == Fluids.WATER; + return (BlockState)((BlockState)this.defaultBlockState().setValue(FACING, ctx.getClickedFace())).setValue(WATERLOGGED, bl); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(new Property[]{FACING, WATERLOGGED}); } - protected MapCodec getCodec(){ + protected MapCodec codec(){ return CODEC; }; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/DroopingIciclesBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/DroopingIciclesBlock.java index 99589b516f..feb5b5f4e7 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/DroopingIciclesBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/DroopingIciclesBlock.java @@ -1,93 +1,93 @@ package net.sevenstars.middleearth.block.special; import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.enums.DoubleBlockHalf; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.entity.projectile.TridentEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.entity.projectile.ThrownTrident; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class DroopingIciclesBlock extends Block { - public static final MapCodec CODEC = createCodec(DroopingIciclesBlock::new); - protected static final VoxelShape SHAPE = Block.createCuboidShape(2.0, 10.0, 2.0, 14.0, 16.0, 14.0); - public static final EnumProperty HALF = Properties.DOUBLE_BLOCK_HALF; + public static final MapCodec CODEC = simpleCodec(DroopingIciclesBlock::new); + protected static final VoxelShape SHAPE = Block.box(2.0, 10.0, 2.0, 14.0, 16.0, 14.0); + public static final EnumProperty HALF = BlockStateProperties.DOUBLE_BLOCK_HALF; - public DroopingIciclesBlock(Settings settings) { + public DroopingIciclesBlock(Properties settings) { super(settings); - setDefaultState(getDefaultState().with(HALF, DoubleBlockHalf.UPPER)); + registerDefaultState(defaultBlockState().setValue(HALF, DoubleBlockHalf.UPPER)); } - public MapCodec getCodec() { + public MapCodec codec() { return CODEC; } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(HALF); } - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - BlockPos blockPos = pos.up(); + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + BlockPos blockPos = pos.above(); BlockState blockState = world.getBlockState(blockPos); - return blockState.isSideSolidFullSquare(world, blockPos, Direction.DOWN) || blockState.isOf(this); + return blockState.isFaceSturdy(world, blockPos, Direction.DOWN) || blockState.is(this); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - DoubleBlockHalf doubleBlockHalf = state.get(HALF); - BlockState upState = world.getBlockState(pos.up()); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + DoubleBlockHalf doubleBlockHalf = state.getValue(HALF); + BlockState upState = world.getBlockState(pos.above()); - if(!upState.isOf(this) && !upState.isSideSolidFullSquare(world, pos, Direction.DOWN)){ - return Blocks.AIR.getDefaultState(); - } else if (doubleBlockHalf == DoubleBlockHalf.UPPER && world.getBlockState(pos.down()).isAir()){ - return state.with(HALF, DoubleBlockHalf.LOWER); + if(!upState.is(this) && !upState.isFaceSturdy(world, pos, Direction.DOWN)){ + return Blocks.AIR.defaultBlockState(); + } else if (doubleBlockHalf == DoubleBlockHalf.UPPER && world.getBlockState(pos.below()).isAir()){ + return state.setValue(HALF, DoubleBlockHalf.LOWER); } else { - return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return super.updateShape(state, direction, neighborState, world, pos, neighborPos); } } - public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { - BlockState upState = world.getBlockState(pos.up()); - if (upState.isOf(this)){ - world.setBlockState(pos.up(), upState.with(HALF, DoubleBlockHalf.UPPER)); - world.setBlockState(pos, (BlockState)state.with(HALF, DoubleBlockHalf.LOWER), 3); + public void setPlacedBy(Level world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { + BlockState upState = world.getBlockState(pos.above()); + if (upState.is(this)){ + world.setBlockAndUpdate(pos.above(), upState.setValue(HALF, DoubleBlockHalf.UPPER)); + world.setBlock(pos, (BlockState)state.setValue(HALF, DoubleBlockHalf.LOWER), 3); } else { - world.setBlockState(pos, (BlockState)state.with(HALF, DoubleBlockHalf.LOWER), 3); + world.setBlock(pos, (BlockState)state.setValue(HALF, DoubleBlockHalf.LOWER), 3); } } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if (state.get(HALF) == DoubleBlockHalf.UPPER){ - return super.getOutlineShape(state, world, pos, context); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + if (state.getValue(HALF) == DoubleBlockHalf.UPPER){ + return super.getShape(state, world, pos, context); } else { return SHAPE; } } - protected void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient) { + protected void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!world.isClientSide) { BlockPos blockPos = hit.getBlockPos(); - if (world instanceof ServerWorld) { - ServerWorld serverWorld = (ServerWorld)world; - if (projectile.canModifyAt(serverWorld, blockPos) && projectile.canBreakBlocks(serverWorld) && projectile instanceof TridentEntity && projectile.getVelocity().length() > 0.6) { - world.breakBlock(blockPos, true); + if (world instanceof ServerLevel) { + ServerLevel serverWorld = (ServerLevel)world; + if (projectile.mayInteract(serverWorld, blockPos) && projectile.mayBreak(serverWorld) && projectile instanceof ThrownTrident && projectile.getDeltaMovement().length() > 0.6) { + world.destroyBlock(blockPos, true); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/DwarvenGroundBookBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/DwarvenGroundBookBlock.java index 7154de2f5f..bdf25f1f70 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/DwarvenGroundBookBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/DwarvenGroundBookBlock.java @@ -1,87 +1,87 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.HorizontalFacingBlock; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; public class DwarvenGroundBookBlock extends Block { - public static final EnumProperty HORIZONTAL_FACING = HorizontalFacingBlock.FACING; - public static final BooleanProperty OPEN = BooleanProperty.of("open"); + public static final EnumProperty HORIZONTAL_FACING = HorizontalDirectionalBlock.FACING; + public static final BooleanProperty OPEN = BooleanProperty.create("open"); - public DwarvenGroundBookBlock(Settings settings) { + public DwarvenGroundBookBlock(Properties settings) { super(settings); - setDefaultState(getDefaultState().with(HORIZONTAL_FACING, Direction.NORTH).with(OPEN, false)); + registerDefaultState(defaultBlockState().setValue(HORIZONTAL_FACING, Direction.NORTH).setValue(OPEN, false)); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if(!world.isClient && player.getAbilities().allowModifyWorld){ - world.setBlockState(pos, state.cycle(OPEN), 2 | 3); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if(!world.isClientSide && player.getAbilities().mayBuild){ + world.setBlock(pos, state.cycle(OPEN), 2 | 3); } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(HORIZONTAL_FACING, OPEN); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()).with(OPEN, false); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()).setValue(OPEN, false); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(HORIZONTAL_FACING, rotation.rotate(state.get(HORIZONTAL_FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(HORIZONTAL_FACING, rotation.rotate(state.getValue(HORIZONTAL_FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(HORIZONTAL_FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(HORIZONTAL_FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if(state.get(OPEN)){ - return switch(state.get(Properties.HORIZONTAL_FACING)) { - case WEST, EAST -> Block.createCuboidShape(2, 0, 0, 14, 5, 16); - case SOUTH, NORTH -> Block.createCuboidShape(0, 0, 2, 16, 5, 14); - default -> VoxelShapes.cuboid(1,1,1,1,1,1); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + if(state.getValue(OPEN)){ + return switch(state.getValue(BlockStateProperties.HORIZONTAL_FACING)) { + case WEST, EAST -> Block.box(2, 0, 0, 14, 5, 16); + case SOUTH, NORTH -> Block.box(0, 0, 2, 16, 5, 14); + default -> Shapes.box(1,1,1,1,1,1); }; }else { - return switch(state.get(Properties.HORIZONTAL_FACING)) { - case WEST, EAST -> Block.createCuboidShape(2, 0, 3, 14, 5, 13); - case SOUTH, NORTH -> Block.createCuboidShape(3, 0, 2, 13, 5, 14); - default -> VoxelShapes.cuboid(1,1,1,1,1,1); + return switch(state.getValue(BlockStateProperties.HORIZONTAL_FACING)) { + case WEST, EAST -> Block.box(2, 0, 3, 14, 5, 13); + case SOUTH, NORTH -> Block.box(3, 0, 2, 13, 5, 14); + default -> Shapes.box(1,1,1,1,1,1); }; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/FloatingIceBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/FloatingIceBlock.java index 540771d2bf..ad6b9a9184 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/FloatingIceBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/FloatingIceBlock.java @@ -1,60 +1,58 @@ package net.sevenstars.middleearth.block.special; import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCollisionHandler; -import net.minecraft.entity.vehicle.BoatEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class FloatingIceBlock extends Block { - public static final MapCodec CODEC = createCodec(FloatingIceBlock::new); - protected static final VoxelShape SHAPE = Block.createCuboidShape(1.0, 0.0, 1.0, 15.0, 1.5, 15.0); + public static final MapCodec CODEC = simpleCodec(FloatingIceBlock::new); + protected static final VoxelShape SHAPE = Block.box(1.0, 0.0, 1.0, 15.0, 1.5, 15.0); - public FloatingIceBlock(Settings settings) { + public FloatingIceBlock(Properties settings) { super(settings); } - public MapCodec getCodec() { + public MapCodec codec() { return CODEC; } @Override - protected void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler) { - super.onEntityCollision(state, world, pos, entity, handler); - if (world instanceof ServerWorld && entity instanceof BoatEntity) { - world.breakBlock(new BlockPos(pos), true, entity); + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + super.entityInside(state, world, pos, entity); + if (world instanceof ServerLevel && entity instanceof Boat) { + world.destroyBlock(new BlockPos(pos), true, entity); } } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - FluidState fluidState = world.getFluidState(pos.down()); + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + FluidState fluidState = world.getFluidState(pos.below()); FluidState fluidState2 = world.getFluidState(pos); - return fluidState.getFluid() == Fluids.WATER && fluidState2.getFluid() == Fluids.EMPTY; + return fluidState.getType() == Fluids.WATER && fluidState2.getType() == Fluids.EMPTY; } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - return !this.canPlaceAt(state, world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + return !this.canSurvive(state, world, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/GlowWormBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/GlowWormBlock.java index da5da4a4a0..ba813d3648 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/GlowWormBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/GlowWormBlock.java @@ -1,57 +1,57 @@ package net.sevenstars.middleearth.block.special; import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.GrowingPlantBodyBlock; +import net.minecraft.world.level.block.GrowingPlantHeadBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; import net.sevenstars.middleearth.item.ResourceItemsME; -import net.minecraft.block.AbstractPlantBlock; -import net.minecraft.block.AbstractPlantStemBlock; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.World; -public class GlowWormBlock extends AbstractPlantBlock { - public static final MapCodec CODEC = GlowWormBlock.createCodec(GlowWormBlock::new); - public static final VoxelShape SHAPE = Block.createCuboidShape(1.0, 0.0, 1.0, 15.0, 16.0, 15.0); +public class GlowWormBlock extends GrowingPlantBodyBlock { + public static final MapCodec CODEC = GlowWormBlock.simpleCodec(GlowWormBlock::new); + public static final VoxelShape SHAPE = Block.box(1.0, 0.0, 1.0, 15.0, 16.0, 15.0); - public GlowWormBlock(Settings settings) { + public GlowWormBlock(Properties settings) { super(settings, Direction.DOWN, SHAPE, false); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - Hand hand = player.getActiveHand(); - ItemStack itemStack = player.getStackInHand(hand); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + InteractionHand hand = player.getUsedItemHand(); + ItemStack itemStack = player.getItemInHand(hand); - if (itemStack.isOf(Items.GLASS_BOTTLE)) { - itemStack.decrement(1); - world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F); + if (itemStack.is(Items.GLASS_BOTTLE)) { + itemStack.shrink(1); + world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BOTTLE_FILL, SoundSource.BLOCKS, 1.0F, 1.0F); if (itemStack.isEmpty()) { - player.setStackInHand(hand, new ItemStack(ResourceItemsME.GLOWWORM_BOTTLE)); - } else if (!player.getInventory().insertStack(new ItemStack(ResourceItemsME.GLOWWORM_BOTTLE))) { - player.dropItem(new ItemStack(ResourceItemsME.GLOWWORM_BOTTLE), false); + player.setItemInHand(hand, new ItemStack(ResourceItemsME.GLOWWORM_BOTTLE)); + } else if (!player.getInventory().add(new ItemStack(ResourceItemsME.GLOWWORM_BOTTLE))) { + player.drop(new ItemStack(ResourceItemsME.GLOWWORM_BOTTLE), false); } world.removeBlock(pos,false); } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } - protected AbstractPlantStemBlock getStem() { - return (AbstractPlantStemBlock) ModNatureBlocks.GLOWWORM_WEBBING; + protected GrowingPlantHeadBlock getHeadBlock() { + return (GrowingPlantHeadBlock) ModNatureBlocks.GLOWWORM_WEBBING; } @Override - protected MapCodec getCodec() { + protected MapCodec codec() { return CODEC; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/GlowWormBottomBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/GlowWormBottomBlock.java index 2e41f8030c..10ec8e3ba5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/GlowWormBottomBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/GlowWormBottomBlock.java @@ -1,38 +1,38 @@ package net.sevenstars.middleearth.block.special; import com.mojang.serialization.MapCodec; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.GrowingPlantHeadBlock; +import net.minecraft.world.level.block.NetherVines; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; -import net.minecraft.block.AbstractPlantStemBlock; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.VineLogic; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -public class GlowWormBottomBlock extends AbstractPlantStemBlock { - public static final MapCodec CODEC = GlowWormBottomBlock.createCodec(GlowWormBottomBlock::new); +public class GlowWormBottomBlock extends GrowingPlantHeadBlock { + public static final MapCodec CODEC = GlowWormBottomBlock.simpleCodec(GlowWormBottomBlock::new); - protected static final VoxelShape SHAPE = Block.createCuboidShape(4.0, 9.0, 4.0, 12.0, 16.0, 12.0); + protected static final VoxelShape SHAPE = Block.box(4.0, 9.0, 4.0, 12.0, 16.0, 12.0); - public GlowWormBottomBlock(Settings settings) { + public GlowWormBottomBlock(Properties settings) { super(settings, Direction.DOWN, SHAPE, false, 0.05); } @Override - protected MapCodec getCodec() { + protected MapCodec codec() { return CODEC; } - protected int getGrowthLength(Random random) { + protected int getBlocksToGrowWhenBonemealed(RandomSource random) { return random.nextInt(5); } - protected Block getPlant() { + protected Block getBodyBlock() { return ModNatureBlocks.GLOWWORM_MAIN; } - protected boolean chooseStemState(BlockState state) { - return VineLogic.isValidForWeepingStem(state); + protected boolean canGrowInto(BlockState state) { + return NetherVines.isValidGrowthState(state); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/GroundBookBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/GroundBookBlock.java index 0216b21489..bf26db9934 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/GroundBookBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/GroundBookBlock.java @@ -1,87 +1,87 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.HorizontalFacingBlock; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; public class GroundBookBlock extends Block { - public static final EnumProperty HORIZONTAL_FACING = HorizontalFacingBlock.FACING; - public static final BooleanProperty OPEN = BooleanProperty.of("open"); + public static final EnumProperty HORIZONTAL_FACING = HorizontalDirectionalBlock.FACING; + public static final BooleanProperty OPEN = BooleanProperty.create("open"); - public GroundBookBlock(Settings settings) { + public GroundBookBlock(Properties settings) { super(settings); - setDefaultState(getDefaultState().with(HORIZONTAL_FACING, Direction.NORTH).with(OPEN, false)); + registerDefaultState(defaultBlockState().setValue(HORIZONTAL_FACING, Direction.NORTH).setValue(OPEN, false)); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if(!world.isClient && player.getAbilities().allowModifyWorld){ - world.setBlockState(pos, state.cycle(OPEN), 2 | 3); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if(!world.isClientSide && player.getAbilities().mayBuild){ + world.setBlock(pos, state.cycle(OPEN), 2 | 3); } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(HORIZONTAL_FACING, OPEN); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()).with(OPEN, false); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()).setValue(OPEN, false); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(HORIZONTAL_FACING, rotation.rotate(state.get(HORIZONTAL_FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(HORIZONTAL_FACING, rotation.rotate(state.getValue(HORIZONTAL_FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(HORIZONTAL_FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(HORIZONTAL_FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if(state.get(OPEN)){ - return switch(state.get(Properties.HORIZONTAL_FACING)) { - case WEST, EAST -> Block.createCuboidShape(2, 0, 0, 14, 5, 16); - case SOUTH, NORTH -> Block.createCuboidShape(0, 0, 2, 16, 5, 14); - default -> VoxelShapes.cuboid(1,1,1,1,1,1); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + if(state.getValue(OPEN)){ + return switch(state.getValue(BlockStateProperties.HORIZONTAL_FACING)) { + case WEST, EAST -> Block.box(2, 0, 0, 14, 5, 16); + case SOUTH, NORTH -> Block.box(0, 0, 2, 16, 5, 14); + default -> Shapes.box(1,1,1,1,1,1); }; } else { - return switch(state.get(Properties.HORIZONTAL_FACING)) { - case WEST, EAST -> Block.createCuboidShape(3, 0, 4, 13, 3, 12); - case SOUTH, NORTH -> Block.createCuboidShape(4, 0, 3, 12, 3, 13); - default -> VoxelShapes.cuboid(1,1,1,1,1,1); + return switch(state.getValue(BlockStateProperties.HORIZONTAL_FACING)) { + case WEST, EAST -> Block.box(3, 0, 4, 13, 3, 12); + case SOUTH, NORTH -> Block.box(4, 0, 3, 12, 3, 13); + default -> Shapes.box(1,1,1,1,1,1); }; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/LargeDoorBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/LargeDoorBlock.java index ed4557d98a..24ac5a67d8 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/LargeDoorBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/LargeDoorBlock.java @@ -1,35 +1,38 @@ package net.sevenstars.middleearth.block.special; import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.enums.DoorHinge; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.*; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.event.GameEvent; -import net.minecraft.world.explosion.Explosion; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.network.chat.Component; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.level.block.state.properties.*; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Explosion; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.DoorHingeSide; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.MiddleEarth; import org.jetbrains.annotations.Nullable; @@ -39,63 +42,63 @@ public class LargeDoorBlock extends Block { //TODO CLEAN CLASS - public static final IntProperty PART = IntProperty.of("part", 0, 127); - public static final EnumProperty HORIZONTAL_FACING = Properties.HORIZONTAL_FACING; - public static final BooleanProperty OPEN = Properties.OPEN; - public static final EnumProperty HINGE = Properties.DOOR_HINGE; + public static final IntegerProperty PART = IntegerProperty.create("part", 0, 127); + public static final EnumProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING; + public static final BooleanProperty OPEN = BlockStateProperties.OPEN; + public static final EnumProperty HINGE = BlockStateProperties.DOOR_HINGE; - public static final MapCodec CODEC = LargeDoorBlock.createCodec(LargeDoorBlock::new); + public static final MapCodec CODEC = LargeDoorBlock.simpleCodec(LargeDoorBlock::new); protected int doorHeight; protected int doorWidth; - protected static final VoxelShape NORTH_SHAPE = Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 16.0, 3.0); - protected static final VoxelShape SOUTH_SHAPE = Block.createCuboidShape(0.0, 0.0, 13.0, 16.0, 16.0, 16.0); - protected static final VoxelShape EAST_SHAPE = Block.createCuboidShape(13.0, 0.0, 0.0, 16.0, 16.0, 16.0); - protected static final VoxelShape WEST_SHAPE = Block.createCuboidShape(0.0, 0.0, 0.0, 3.0, 16.0, 16.0); + protected static final VoxelShape NORTH_SHAPE = Block.box(0.0, 0.0, 0.0, 16.0, 16.0, 3.0); + protected static final VoxelShape SOUTH_SHAPE = Block.box(0.0, 0.0, 13.0, 16.0, 16.0, 16.0); + protected static final VoxelShape EAST_SHAPE = Block.box(13.0, 0.0, 0.0, 16.0, 16.0, 16.0); + protected static final VoxelShape WEST_SHAPE = Block.box(0.0, 0.0, 0.0, 3.0, 16.0, 16.0); - public MapCodec getCodec() { + public MapCodec codec() { return CODEC; } - public LargeDoorBlock(Settings settings) { - super(settings.nonOpaque()); + public LargeDoorBlock(Properties settings) { + super(settings.noOcclusion()); doorHeight = 1; doorWidth = 1; - this.setDefaultState((((this.stateManager.getDefaultState()).with(HORIZONTAL_FACING, Direction.NORTH)).with(getPart(), 0)).with(OPEN, false).with(HINGE, DoorHinge.LEFT)); + this.registerDefaultState((((this.stateDefinition.any()).setValue(HORIZONTAL_FACING, Direction.NORTH)).setValue(getPart(), 0)).setValue(OPEN, false).setValue(HINGE, DoorHingeSide.LEFT)); } //TODO improve this door to door invisibility - protected boolean isSideInvisible(BlockState state, BlockState stateFrom, Direction direction) { - return stateFrom.isOf(this) || super.isSideInvisible(state, stateFrom, direction); + protected boolean skipRendering(BlockState state, BlockState stateFrom, Direction direction) { + return stateFrom.is(this) || super.skipRendering(state, stateFrom, direction); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(getPart(), HORIZONTAL_FACING, OPEN, HINGE); } //Get the origin of the door based on the state and pos private BlockPos getOrigin(BlockPos pos, BlockState state){ BlockPos blockPos; - int part = state.get(getPart()); + int part = state.getValue(getPart()); int column = part / doorHeight; int line = part % doorHeight; - if (state.get(OPEN)) { - blockPos = pos.offset(state.get(HORIZONTAL_FACING).rotateYClockwise().rotateYClockwise(), column); + if (state.getValue(OPEN)) { + blockPos = pos.relative(state.getValue(HORIZONTAL_FACING).getClockWise().getClockWise(), column); for (int i = 0; i < line; i++) { - blockPos = blockPos.down(); + blockPos = blockPos.below(); } } else { - if(state.get(HINGE) == DoorHinge.LEFT) { - blockPos = pos.offset(state.get(HORIZONTAL_FACING).rotateYCounterclockwise(), column); + if(state.getValue(HINGE) == DoorHingeSide.LEFT) { + blockPos = pos.relative(state.getValue(HORIZONTAL_FACING).getCounterClockWise(), column); }else{ - blockPos = pos.offset(state.get(HORIZONTAL_FACING).rotateYClockwise(), column); + blockPos = pos.relative(state.getValue(HORIZONTAL_FACING).getClockWise(), column); } for (int i = 0; i < line; i++) { - blockPos = blockPos.down(); + blockPos = blockPos.below(); } } @@ -103,153 +106,153 @@ private BlockPos getOrigin(BlockPos pos, BlockState state){ } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction direction = ctx.getHorizontalPlayerFacing(); - BlockPos blockPos = ctx.getBlockPos(); - BlockPos blockPos1 = ctx.getBlockPos(); - World world = ctx.getWorld(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction direction = ctx.getHorizontalDirection(); + BlockPos blockPos = ctx.getClickedPos(); + BlockPos blockPos1 = ctx.getClickedPos(); + Level world = ctx.getLevel(); boolean canPlace = true; //Check space for placement for (int j = 0; j < doorWidth; j++){ for (int k = 0; k < doorHeight; k++) { - if(!world.getBlockState(blockPos).canReplace(ctx)){ + if(!world.getBlockState(blockPos).canBeReplaced(ctx)){ canPlace = false; } - blockPos = blockPos.up(); + blockPos = blockPos.above(); } - if(getHinge(ctx) == DoorHinge.LEFT) { - blockPos = blockPos1.offset(direction.rotateYClockwise(), j + 1); + if(getHinge(ctx) == DoorHingeSide.LEFT) { + blockPos = blockPos1.relative(direction.getClockWise(), j + 1); }else{ - blockPos = blockPos1.offset(direction.rotateYCounterclockwise(), j + 1); + blockPos = blockPos1.relative(direction.getCounterClockWise(), j + 1); } } if(canPlace){ - return this.getDefaultState().with(HORIZONTAL_FACING, direction).with(OPEN, false).with(getPart(), 0).with(HINGE, this.getHinge(ctx)); + return this.defaultBlockState().setValue(HORIZONTAL_FACING, direction).setValue(OPEN, false).setValue(getPart(), 0).setValue(HINGE, this.getHinge(ctx)); } else{ return null; } } - private DoorHinge getHinge(ItemPlacementContext ctx) { - BlockView blockView = ctx.getWorld(); - BlockPos blockPos = ctx.getBlockPos(); - Direction direction = ctx.getHorizontalPlayerFacing(); - BlockPos blockPos2 = blockPos.up(); - Direction direction2 = direction.rotateYCounterclockwise(); - BlockPos blockPos3 = blockPos.offset(direction2); + private DoorHingeSide getHinge(BlockPlaceContext ctx) { + BlockGetter blockView = ctx.getLevel(); + BlockPos blockPos = ctx.getClickedPos(); + Direction direction = ctx.getHorizontalDirection(); + BlockPos blockPos2 = blockPos.above(); + Direction direction2 = direction.getCounterClockWise(); + BlockPos blockPos3 = blockPos.relative(direction2); BlockState blockState = blockView.getBlockState(blockPos3); - BlockPos blockPos4 = blockPos2.offset(direction2); + BlockPos blockPos4 = blockPos2.relative(direction2); BlockState blockState2 = blockView.getBlockState(blockPos4); - Direction direction3 = direction.rotateYClockwise(); - BlockPos blockPos5 = blockPos.offset(direction3); + Direction direction3 = direction.getClockWise(); + BlockPos blockPos5 = blockPos.relative(direction3); BlockState blockState3 = blockView.getBlockState(blockPos5); - BlockPos blockPos6 = blockPos2.offset(direction3); + BlockPos blockPos6 = blockPos2.relative(direction3); BlockState blockState4 = blockView.getBlockState(blockPos6); - int i = (blockState.isFullCube(blockView, blockPos3) ? -1 : 0) + (blockState2.isFullCube(blockView, blockPos4) ? -1 : 0) + (blockState3.isFullCube(blockView, blockPos5) ? 1 : 0) + (blockState4.isFullCube(blockView, blockPos6) ? 1 : 0); - int j = direction.getOffsetX(); - int k = direction.getOffsetZ(); - Vec3d vec3d = ctx.getHitPos(); + int i = (blockState.isCollisionShapeFullBlock(blockView, blockPos3) ? -1 : 0) + (blockState2.isCollisionShapeFullBlock(blockView, blockPos4) ? -1 : 0) + (blockState3.isCollisionShapeFullBlock(blockView, blockPos5) ? 1 : 0) + (blockState4.isCollisionShapeFullBlock(blockView, blockPos6) ? 1 : 0); + int j = direction.getStepX(); + int k = direction.getStepZ(); + Vec3 vec3d = ctx.getClickLocation(); double d = vec3d.x - (double)blockPos.getX(); double e = vec3d.z - (double)blockPos.getZ(); - return (j >= 0 || !(e < 0.5)) && (j <= 0 || !(e > 0.5)) && (k >= 0 || !(d > 0.5)) && (k <= 0 || !(d < 0.5)) ? DoorHinge.LEFT : DoorHinge.RIGHT; + return (j >= 0 || !(e < 0.5)) && (j <= 0 || !(e > 0.5)) && (k >= 0 || !(d > 0.5)) && (k <= 0 || !(d < 0.5)) ? DoorHingeSide.LEFT : DoorHingeSide.RIGHT; } - public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { - if (!world.isClient){ + public void setPlacedBy(Level world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { + if (!world.isClientSide){ BlockPos blockPos = pos; //Places all additional blocks after placement is checked for (int i = 0; i < doorWidth; i++){ int partIndex = doorHeight * i; for (int j = 0; j < doorHeight; j++) { - world.setBlockState(blockPos, (BlockState)state.with(getPart(), partIndex), 3); - blockPos = blockPos.up(); + world.setBlock(blockPos, (BlockState)state.setValue(getPart(), partIndex), 3); + blockPos = blockPos.above(); partIndex++; } - if(state.get(HINGE) == DoorHinge.LEFT) { - blockPos = pos.offset((Direction)state.get(HORIZONTAL_FACING).rotateYClockwise(), i + 1); + if(state.getValue(HINGE) == DoorHingeSide.LEFT) { + blockPos = pos.relative((Direction)state.getValue(HORIZONTAL_FACING).getClockWise(), i + 1); }else { - blockPos = pos.offset((Direction) state.get(HORIZONTAL_FACING).rotateYCounterclockwise(), i + 1); + blockPos = pos.relative((Direction) state.getValue(HORIZONTAL_FACING).getCounterClockWise(), i + 1); } } } } @Override - public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { + public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { BlockPos blockPos = getOrigin(pos, state); BlockPos blockPos1 = blockPos; //Breaks all blocks based on origin for (int j = 0; j < doorWidth; j++){ for (int k = 0; k < doorHeight; k++) { - world.breakBlock(blockPos, j == 0 && k == 0 && !player.isCreative()); - blockPos = blockPos.up(); + world.destroyBlock(blockPos, j == 0 && k == 0 && !player.isCreative()); + blockPos = blockPos.above(); } - if(state.get(OPEN)){ - blockPos = blockPos1.offset((Direction)state.get(HORIZONTAL_FACING), j + 1); - } else if(state.get(HINGE) == DoorHinge.LEFT) { - blockPos = blockPos1.offset((Direction)state.get(HORIZONTAL_FACING).rotateYClockwise(), j + 1); + if(state.getValue(OPEN)){ + blockPos = blockPos1.relative((Direction)state.getValue(HORIZONTAL_FACING), j + 1); + } else if(state.getValue(HINGE) == DoorHingeSide.LEFT) { + blockPos = blockPos1.relative((Direction)state.getValue(HORIZONTAL_FACING).getClockWise(), j + 1); }else { - blockPos = blockPos1.offset((Direction)state.get(HORIZONTAL_FACING).rotateYCounterclockwise(), j + 1); + blockPos = blockPos1.relative((Direction)state.getValue(HORIZONTAL_FACING).getCounterClockWise(), j + 1); } } - return super.onBreak(world, pos, state, player); + return super.playerWillDestroy(world, pos, state, player); } @Override - protected void onExploded(BlockState state, ServerWorld world, BlockPos pos, Explosion explosion, BiConsumer stackMerger) { + protected void onExplosionHit(BlockState state, Level world, BlockPos pos, Explosion explosion, BiConsumer stackMerger) { BlockPos blockPos = getOrigin(pos, state); BlockPos blockPos1 = blockPos; //Breaks all blocks based on origin for (int j = 0; j < doorWidth; j++){ for (int k = 0; k < doorHeight; k++) { - world.breakBlock(blockPos, j == 0 && k == 0); - blockPos = blockPos.up(); + world.destroyBlock(blockPos, j == 0 && k == 0); + blockPos = blockPos.above(); } - if(state.get(OPEN)){ - blockPos = blockPos1.offset((Direction)state.get(HORIZONTAL_FACING), j + 1); - } else if(state.get(HINGE) == DoorHinge.LEFT) { - blockPos = blockPos1.offset((Direction)state.get(HORIZONTAL_FACING).rotateYClockwise(), j + 1); + if(state.getValue(OPEN)){ + blockPos = blockPos1.relative((Direction)state.getValue(HORIZONTAL_FACING), j + 1); + } else if(state.getValue(HINGE) == DoorHingeSide.LEFT) { + blockPos = blockPos1.relative((Direction)state.getValue(HORIZONTAL_FACING).getClockWise(), j + 1); }else { - blockPos = blockPos1.offset((Direction)state.get(HORIZONTAL_FACING).rotateYCounterclockwise(), j + 1); + blockPos = blockPos1.relative((Direction)state.getValue(HORIZONTAL_FACING).getCounterClockWise(), j + 1); } } - super.onExploded(state, world, pos, explosion, stackMerger); + super.onExplosionHit(state, world, pos, explosion, stackMerger); } //Check space for door opening/closing - private boolean canToggle(BlockPos origin, BlockState state, World world) { + private boolean canToggle(BlockPos origin, BlockState state, Level world) { BlockPos blockPos = origin; BlockPos blockPos1 = blockPos; for (int j = 0; j < doorWidth; j++){ for (int k = 0; k < doorHeight; k++) { if(j != 0){ - if(!world.getBlockState(blockPos).isReplaceable()){ + if(!world.getBlockState(blockPos).canBeReplaced()){ return false; } } - blockPos = blockPos.up(); + blockPos = blockPos.above(); } - if(state.get(OPEN)){ - if(state.get(HINGE) == DoorHinge.LEFT) { - blockPos = blockPos1.offset((Direction)state.get(HORIZONTAL_FACING).rotateYClockwise(), j + 1); + if(state.getValue(OPEN)){ + if(state.getValue(HINGE) == DoorHingeSide.LEFT) { + blockPos = blockPos1.relative((Direction)state.getValue(HORIZONTAL_FACING).getClockWise(), j + 1); } else { - blockPos = blockPos1.offset((Direction) state.get(HORIZONTAL_FACING).rotateYCounterclockwise(), j + 1); + blockPos = blockPos1.relative((Direction) state.getValue(HORIZONTAL_FACING).getCounterClockWise(), j + 1); } } else { - blockPos = blockPos1.offset((Direction)state.get(HORIZONTAL_FACING), j + 1); + blockPos = blockPos1.relative((Direction)state.getValue(HORIZONTAL_FACING), j + 1); } } return true; } //Door opening - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { BlockPos blockPos = getOrigin(pos, state); BlockPos blockPos1 = blockPos; @@ -257,16 +260,16 @@ protected ActionResult onUse(BlockState state, World world, BlockPos pos, Player //Remove blocks for (int j = 0; j < doorWidth; j++){ for (int k = 0; k < doorHeight; k++) { - world.setBlockState(blockPos, (BlockState)Blocks.AIR.getDefaultState(), 3); - blockPos = blockPos.up(); + world.setBlock(blockPos, (BlockState)Blocks.AIR.defaultBlockState(), 3); + blockPos = blockPos.above(); } - if(state.get(OPEN)) { - blockPos = blockPos1.offset((Direction)state.get(HORIZONTAL_FACING), j + 1); + if(state.getValue(OPEN)) { + blockPos = blockPos1.relative((Direction)state.getValue(HORIZONTAL_FACING), j + 1); }else { - if (state.get(HINGE) == DoorHinge.LEFT) { - blockPos = blockPos1.offset((Direction)state.get(HORIZONTAL_FACING).rotateYClockwise(), j + 1); + if (state.getValue(HINGE) == DoorHingeSide.LEFT) { + blockPos = blockPos1.relative((Direction)state.getValue(HORIZONTAL_FACING).getClockWise(), j + 1); }else{ - blockPos = blockPos1.offset((Direction)state.get(HORIZONTAL_FACING).rotateYCounterclockwise(), j + 1); + blockPos = blockPos1.relative((Direction)state.getValue(HORIZONTAL_FACING).getCounterClockWise(), j + 1); } } } @@ -277,49 +280,49 @@ protected ActionResult onUse(BlockState state, World world, BlockPos pos, Player for (int i = 0; i < doorWidth; i++){ int partIndex = doorHeight * i; for (int j = 0; j < doorHeight; j++) { - if(state.get(OPEN)){ - world.setBlockState(blockPos, state.with(OPEN, false).with(getPart(), partIndex), 3); + if(state.getValue(OPEN)){ + world.setBlock(blockPos, state.setValue(OPEN, false).setValue(getPart(), partIndex), 3); } else { - world.setBlockState(blockPos, state.with(OPEN, true).with(getPart(), partIndex), 3); + world.setBlock(blockPos, state.setValue(OPEN, true).setValue(getPart(), partIndex), 3); } - blockPos = blockPos.up(); + blockPos = blockPos.above(); partIndex++; } - if(!state.get(OPEN)){ - blockPos = blockPos1.offset((Direction)state.get(HORIZONTAL_FACING), i + 1); + if(!state.getValue(OPEN)){ + blockPos = blockPos1.relative((Direction)state.getValue(HORIZONTAL_FACING), i + 1); }else{ - if(state.get(HINGE) == DoorHinge.LEFT){ - blockPos = blockPos1.offset((Direction)state.get(HORIZONTAL_FACING).rotateYClockwise(), i + 1); + if(state.getValue(HINGE) == DoorHingeSide.LEFT){ + blockPos = blockPos1.relative((Direction)state.getValue(HORIZONTAL_FACING).getClockWise(), i + 1); } else { - blockPos = blockPos1.offset((Direction)state.get(HORIZONTAL_FACING).rotateYCounterclockwise(), i + 1); + blockPos = blockPos1.relative((Direction)state.getValue(HORIZONTAL_FACING).getCounterClockWise(), i + 1); } } } - this.playOpenCloseSound(player, world, pos, (Boolean)state.get(OPEN)); - world.emitGameEvent(player, this.isOpen(state) ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pos); + this.playOpenCloseSound(player, world, pos, (Boolean)state.getValue(OPEN)); + world.gameEvent(player, this.isOpen(state) ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pos); } else { - player.sendMessage(Text.translatable("alert.%s.large_door.blocked".formatted(MiddleEarth.MOD_ID)), true); + player.displayClientMessage(Component.translatable("alert.%s.large_door.blocked".formatted(MiddleEarth.MOD_ID)), true); } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } - private void playOpenCloseSound(@Nullable Entity entity, World world, BlockPos pos, boolean open) { - world.playSound(entity, pos, open ? SoundEvents.BLOCK_WOODEN_DOOR_OPEN : SoundEvents.BLOCK_WOODEN_DOOR_CLOSE, SoundCategory.BLOCKS, 1.5F, world.getRandom().nextFloat() * 0.1F + 0.4F); + private void playOpenCloseSound(@Nullable Entity entity, Level world, BlockPos pos, boolean open) { + world.playSound(entity, pos, open ? SoundEvents.WOODEN_DOOR_OPEN : SoundEvents.WOODEN_DOOR_CLOSE, SoundSource.BLOCKS, 1.5F, world.getRandom().nextFloat() * 0.1F + 0.4F); } public boolean isOpen(BlockState state) { - return (Boolean)state.get(OPEN); + return (Boolean)state.getValue(OPEN); } - protected BlockState rotate(BlockState state, BlockRotation rotation) { - return (BlockState)state.with(HORIZONTAL_FACING, rotation.rotate((Direction)state.get(HORIZONTAL_FACING))); + protected BlockState rotate(BlockState state, Rotation rotation) { + return (BlockState)state.setValue(HORIZONTAL_FACING, rotation.rotate((Direction)state.getValue(HORIZONTAL_FACING))); } - protected BlockState mirror(BlockState state, BlockMirror mirror) { - return mirror == BlockMirror.NONE ? state : (BlockState)state.rotate(mirror.getRotation((Direction)state.get(HORIZONTAL_FACING))); + protected BlockState mirror(BlockState state, Mirror mirror) { + return mirror == Mirror.NONE ? state : (BlockState)state.rotate(mirror.getRotation((Direction)state.getValue(HORIZONTAL_FACING))); } public int getDoorHeight() { @@ -330,23 +333,23 @@ public int getDoorWidth() { return doorWidth; } - public IntProperty getPart() { + public IntegerProperty getPart() { return PART; } - protected boolean canPathfindThrough(BlockState state, NavigationType type) { + protected boolean isPathfindable(BlockState state, PathComputationType type) { return switch (type) { - case LAND, AIR -> (Boolean) state.get(OPEN); + case LAND, AIR -> (Boolean) state.getValue(OPEN); case WATER -> false; default -> throw new MatchException((String) null, (Throwable) null); }; } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - Direction direction = (Direction) state.get(HORIZONTAL_FACING); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + Direction direction = (Direction) state.getValue(HORIZONTAL_FACING); VoxelShape var10000 = null; - if (state.get(HINGE) == DoorHinge.LEFT) { - if (!state.get(OPEN)) { + if (state.getValue(HINGE) == DoorHingeSide.LEFT) { + if (!state.getValue(OPEN)) { return switch (direction) { case WEST -> EAST_SHAPE; case EAST -> WEST_SHAPE; @@ -362,7 +365,7 @@ protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos }; } } else { - if (!state.get(OPEN)) { + if (!state.getValue(OPEN)) { return switch (direction) { case WEST -> EAST_SHAPE; case EAST -> WEST_SHAPE; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/LayeredCakeBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/LayeredCakeBlock.java index 1cb3781a31..dbeb5c5fcf 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/LayeredCakeBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/LayeredCakeBlock.java @@ -1,137 +1,147 @@ package net.sevenstars.middleearth.block.special; import com.mojang.serialization.MapCodec; -import net.minecraft.block.*; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.stat.Stats; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.IntProperty; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.stats.Stats; +import net.minecraft.tags.ItemTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.CandleBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; public class LayeredCakeBlock extends Block { - public static final MapCodec CODEC = createCodec(net.minecraft.block.CakeBlock::new); + public static final MapCodec CODEC = simpleCodec(LayeredCakeBlock::new); public static final int MAX_BITES = 8; - public static final IntProperty BITES; + public static final IntegerProperty BITES; public static final int DEFAULT_COMPARATOR_OUTPUT; private static final VoxelShape[] SHAPES_BY_BITES; - public MapCodec getCodec() { + public MapCodec codec() { return CODEC; } - public LayeredCakeBlock(AbstractBlock.Settings settings) { + public LayeredCakeBlock(BlockBehaviour.Properties settings) { super(settings); - this.setDefaultState((this.stateManager.getDefaultState())); + this.registerDefaultState((this.stateDefinition.any())); } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return SHAPES_BY_BITES[state.get(BITES)]; + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return SHAPES_BY_BITES[state.getValue(BITES)]; } - protected ActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { Item item = stack.getItem(); - if (stack.isIn(ItemTags.CANDLES) && (Integer)state.get(BITES) == 0) { - Block var10 = Block.getBlockFromItem(item); + if (stack.is(ItemTags.CANDLES) && (Integer)state.getValue(BITES) == 0) { + Block var10 = Block.byItem(item); if (var10 instanceof CandleBlock) { CandleBlock candleBlock = (CandleBlock)var10; - stack.decrementUnlessCreative(1, player); - world.playSound(null, pos, SoundEvents.BLOCK_CAKE_ADD_CANDLE, SoundCategory.BLOCKS, 1.0F, 1.0F); - world.setBlockState(pos, CandleLayeredCakeBlock.getCandleCakeFromCandle(candleBlock)); - world.emitGameEvent(player, GameEvent.BLOCK_CHANGE, pos); - player.incrementStat(Stats.USED.getOrCreateStat(item)); - return ActionResult.SUCCESS; + stack.consume(1, player); + world.playSound(null, pos, SoundEvents.CAKE_ADD_CANDLE, SoundSource.BLOCKS, 1.0F, 1.0F); + world.setBlockAndUpdate(pos, CandleLayeredCakeBlock.getCandleCakeFromCandle(candleBlock)); + world.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); + player.awardStat(Stats.ITEM_USED.get(item)); + return ItemInteractionResult.SUCCESS; } } - return ActionResult.PASS_TO_DEFAULT_BLOCK_ACTION; + return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; } - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if (world.isClient) { - if (tryEat(world, pos, state, player).isAccepted()) { - return ActionResult.SUCCESS; + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (world.isClientSide) { + if (tryEat(world, pos, state, player).consumesAction()) { + return InteractionResult.SUCCESS; } - if (player.getStackInHand(Hand.MAIN_HAND).isEmpty()) { - return ActionResult.CONSUME; + if (player.getItemInHand(InteractionHand.MAIN_HAND).isEmpty()) { + return InteractionResult.CONSUME; } } return tryEat(world, pos, state, player); } - protected static ActionResult tryEat(WorldAccess world, BlockPos pos, BlockState state, PlayerEntity player) { - if (!player.canConsume(false)) { - return ActionResult.PASS; + protected static InteractionResult tryEat(LevelAccessor world, BlockPos pos, BlockState state, Player player) { + if (!player.canEat(false)) { + return InteractionResult.PASS; } else { - player.incrementStat(Stats.EAT_CAKE_SLICE); - player.getHungerManager().add(3, 0.15F); - int i = state.get(BITES); - world.emitGameEvent(player, GameEvent.EAT, pos); + player.awardStat(Stats.EAT_CAKE_SLICE); + player.getFoodData().eat(3, 0.15F); + int i = state.getValue(BITES); + world.gameEvent(player, GameEvent.EAT, pos); if (i < MAX_BITES) { - world.setBlockState(pos, state.with(BITES, i + 1), 3); + world.setBlock(pos, state.setValue(BITES, i + 1), 3); } else { world.removeBlock(pos, false); - world.emitGameEvent(player, GameEvent.BLOCK_DESTROY, pos); + world.gameEvent(player, GameEvent.BLOCK_DESTROY, pos); } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } } - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - return direction == Direction.DOWN && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + return direction == Direction.DOWN && !state.canSurvive(world, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - return world.getBlockState(pos.down()).isSolid(); + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + return world.getBlockState(pos.below()).isSolid(); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(BITES); } - protected int getComparatorOutput(BlockState state, World world, BlockPos pos) { - return getComparatorOutput(state.get(BITES)); + protected int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) { + return getComparatorOutput(state.getValue(BITES)); } public static int getComparatorOutput(int bites) { return (MAX_BITES - bites) * 2; } - protected boolean hasComparatorOutput(BlockState state) { + protected boolean hasAnalogOutputSignal(BlockState state) { return true; } - protected boolean canPathfindThrough(BlockState state, NavigationType type) { + protected boolean isPathfindable(BlockState state, PathComputationType type) { return false; } static { - BITES = IntProperty.of("bites", 0, MAX_BITES);; + BITES = IntegerProperty.create("bites", 0, MAX_BITES);; DEFAULT_COMPARATOR_OUTPUT = getComparatorOutput(0); - SHAPES_BY_BITES = Block.createShapeArray(MAX_BITES, (bites) -> { - return VoxelShapes.union(Block.createCuboidShape(0, 0.0, 0, 16.0, 8.0, 16.0 - (Math.clamp(bites - 4, 0, 4) * 4) + Math.clamp(bites - 4, 0, 1) * 2), - Block.createCuboidShape(2, 8, 2, 14, 16, 14 - (Math.clamp(bites, 0, 4) * 3))); - }); + SHAPES_BY_BITES = new VoxelShape[MAX_BITES + 1]; + for (int bites = 0; bites <= MAX_BITES; bites++) { + SHAPES_BY_BITES[bites] = Shapes.or( + Block.box(0, 0.0, 0, 16.0, 8.0, 16.0 - (Math.clamp(bites - 4, 0, 4) * 4) + Math.clamp(bites - 4, 0, 1) * 2), + Block.box(2, 8, 2, 14, 16, 14 - (Math.clamp(bites, 0, 4) * 3)) + ); + } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/LayersAltBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/LayersAltBlock.java index 6ec50d6a23..e22e1276f2 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/LayersAltBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/LayersAltBlock.java @@ -1,72 +1,76 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.*; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.SnowLayerBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; -public class LayersAltBlock extends SnowBlock implements Waterloggable { - public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; +public class LayersAltBlock extends SnowLayerBlock implements SimpleWaterloggedBlock { + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - public LayersAltBlock(Settings settings) { + public LayersAltBlock(Properties settings) { super(settings); - this.setDefaultState((BlockState)((BlockState)this.stateManager.getDefaultState()).with(LAYERS, 1).with(WATERLOGGED, false)); + this.registerDefaultState((BlockState)((BlockState)this.stateDefinition.any()).setValue(LAYERS, 1).setValue(WATERLOGGED, false)); } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - BlockState blockState = ctx.getWorld().getBlockState(ctx.getBlockPos()); - if (blockState.isOf(this)) { - int i = (Integer)blockState.get(LAYERS); - if (blockState.get(WATERLOGGED)){ - return (BlockState)blockState.with(LAYERS, Math.min(8, i + 1)).with(WATERLOGGED, true); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + BlockState blockState = ctx.getLevel().getBlockState(ctx.getClickedPos()); + if (blockState.is(this)) { + int i = (Integer)blockState.getValue(LAYERS); + if (blockState.getValue(WATERLOGGED)){ + return (BlockState)blockState.setValue(LAYERS, Math.min(8, i + 1)).setValue(WATERLOGGED, true); } else { - return (BlockState)blockState.with(LAYERS, Math.min(8, i + 1)); + return (BlockState)blockState.setValue(LAYERS, Math.min(8, i + 1)); } } else { - if(blockState.isOf(Blocks.WATER)){ - return super.getPlacementState(ctx).with(WATERLOGGED, true); + if(blockState.is(Blocks.WATER)){ + return super.getStateForPlacement(ctx).setValue(WATERLOGGED, true); } else { - return super.getPlacementState(ctx); + return super.getStateForPlacement(ctx); } } } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(LAYERS, WATERLOGGED); } @Override - protected boolean canReplace(BlockState state, ItemPlacementContext context) { - int i = state.get(LAYERS); - if (context.getStack().isOf(this.asItem()) && i < 8) { - if (context.canReplaceExisting()) { - return context.getSide() == Direction.UP; + protected boolean canBeReplaced(BlockState state, BlockPlaceContext context) { + int i = state.getValue(LAYERS); + if (context.getItemInHand().is(this.asItem()) && i < 8) { + if (context.replacingClickedOnBlock()) { + return context.getClickedFace() == Direction.UP; } else { return true; } @@ -76,7 +80,7 @@ protected boolean canReplace(BlockState state, ItemPlacementContext context) { } @Override - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { return true; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/LayersBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/LayersBlock.java index f505fda849..ea7562d409 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/LayersBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/LayersBlock.java @@ -1,70 +1,74 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.*; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.SnowLayerBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; -public class LayersBlock extends SnowBlock implements Waterloggable { - public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; +public class LayersBlock extends SnowLayerBlock implements SimpleWaterloggedBlock { + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; public Block fullBlock; - public LayersBlock(Settings settings, Block fullBlockIn) { + public LayersBlock(Properties settings, Block fullBlockIn) { super(settings); - this.setDefaultState((BlockState)((BlockState)this.stateManager.getDefaultState()).with(LAYERS, 1).with(WATERLOGGED, false)); + this.registerDefaultState((BlockState)((BlockState)this.stateDefinition.any()).setValue(LAYERS, 1).setValue(WATERLOGGED, false)); fullBlock = fullBlockIn; } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - BlockState blockState = ctx.getWorld().getBlockState(ctx.getBlockPos()); - if (blockState.isOf(this)) { - int i = (Integer)blockState.get(LAYERS); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + BlockState blockState = ctx.getLevel().getBlockState(ctx.getClickedPos()); + if (blockState.is(this)) { + int i = (Integer)blockState.getValue(LAYERS); if(i == 7){ - return fullBlock.getDefaultState(); + return fullBlock.defaultBlockState(); } else { - if (blockState.get(WATERLOGGED)){ - return (BlockState)blockState.with(LAYERS, Math.min(8, i + 1)).with(WATERLOGGED, true); + if (blockState.getValue(WATERLOGGED)){ + return (BlockState)blockState.setValue(LAYERS, Math.min(8, i + 1)).setValue(WATERLOGGED, true); } else { - return (BlockState)blockState.with(LAYERS, Math.min(8, i + 1)); + return (BlockState)blockState.setValue(LAYERS, Math.min(8, i + 1)); } } } else { - if(blockState.isOf(Blocks.WATER)){ - return super.getPlacementState(ctx).with(WATERLOGGED, true); + if(blockState.is(Blocks.WATER)){ + return super.getStateForPlacement(ctx).setValue(WATERLOGGED, true); } else { - return super.getPlacementState(ctx); + return super.getStateForPlacement(ctx); } } } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(LAYERS, WATERLOGGED); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/OrcishDrumBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/OrcishDrumBlock.java index 992d62d055..df111d5573 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/OrcishDrumBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/OrcishDrumBlock.java @@ -1,33 +1,33 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.sound.SoundCategory; -import net.minecraft.util.ActionResult; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; -import net.minecraft.world.event.GameEvent; +import net.minecraft.core.BlockPos; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.phys.BlockHitResult; import net.sevenstars.middleearth.sound.SoundsME; public class OrcishDrumBlock extends Block { - public OrcishDrumBlock(Settings settings) { + public OrcishDrumBlock(Properties settings) { super(settings); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if (world.getBlockState(pos.up()).isAir()) { - Random random = world.getRandom(); - world.addSyncedBlockEvent(pos, this, 0, 0); - world.playSound(player, pos, SoundsME.ORC_DRUM, SoundCategory.BLOCKS, 1.0F + random.nextFloat(), (float)(0.75F + (random.nextFloat() * 0.4))); - world.emitGameEvent(player, GameEvent.BLOCK_ACTIVATE, pos); - return ActionResult.SUCCESS; + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (world.getBlockState(pos.above()).isAir()) { + RandomSource random = world.getRandom(); + world.blockEvent(pos, this, 0, 0); + world.playSound(player, pos, SoundsME.ORC_DRUM, SoundSource.BLOCKS, 1.0F + random.nextFloat(), (float)(0.75F + (random.nextFloat() * 0.4))); + world.gameEvent(player, GameEvent.BLOCK_ACTIVATE, pos); + return InteractionResult.SUCCESS; } - return super.onUse(state, world, pos, player, hit); + return super.useWithoutItem(state, world, pos, player, hit); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/OxidizablePaneBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/OxidizablePaneBlock.java index 18c62868a9..e968f45f13 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/OxidizablePaneBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/OxidizablePaneBlock.java @@ -1,29 +1,29 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.BlockState; -import net.minecraft.block.Oxidizable; -import net.minecraft.block.PaneBlock; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.block.IronBarsBlock; +import net.minecraft.world.level.block.WeatheringCopper; +import net.minecraft.world.level.block.state.BlockState; -public class OxidizablePaneBlock extends PaneBlock implements Oxidizable { - private final OxidationLevel oxidationLevel; +public class OxidizablePaneBlock extends IronBarsBlock implements WeatheringCopper { + private final WeatherState oxidationLevel; - public OxidizablePaneBlock(OxidationLevel oxidationLevel, Settings settings) { + public OxidizablePaneBlock(WeatherState oxidationLevel, Properties settings) { super(settings); this.oxidationLevel = oxidationLevel; } - public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - this.tickDegradation(state, world, pos, random); + public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + this.changeOverTime(state, world, pos, random); } - public boolean hasRandomTicks(BlockState state) { - return Oxidizable.getIncreasedOxidationBlock(state.getBlock()).isPresent(); + public boolean isRandomlyTicking(BlockState state) { + return WeatheringCopper.getNext(state.getBlock()).isPresent(); } - public OxidationLevel getDegradationLevel() { + public WeatherState getAge() { return this.oxidationLevel; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/OxidizableVerticalSlabBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/OxidizableVerticalSlabBlock.java index a68c8496ee..3d280dd2c3 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/OxidizableVerticalSlabBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/OxidizableVerticalSlabBlock.java @@ -1,29 +1,29 @@ package net.sevenstars.middleearth.block.special; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.block.WeatheringCopper; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.block.special.verticalSlabs.VerticalSlabBlock; -import net.minecraft.block.BlockState; -import net.minecraft.block.Oxidizable; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -public class OxidizableVerticalSlabBlock extends VerticalSlabBlock implements Oxidizable { - private final OxidationLevel oxidationLevel; +public class OxidizableVerticalSlabBlock extends VerticalSlabBlock implements WeatheringCopper { + private final WeatherState oxidationLevel; - public OxidizableVerticalSlabBlock(OxidationLevel oxidationLevel, Settings settings) { + public OxidizableVerticalSlabBlock(WeatherState oxidationLevel, Properties settings) { super(settings); this.oxidationLevel = oxidationLevel; } - public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - this.tickDegradation(state, world, pos, random); + public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + this.changeOverTime(state, world, pos, random); } - public boolean hasRandomTicks(BlockState state) { - return Oxidizable.getIncreasedOxidationBlock(state.getBlock()).isPresent(); + public boolean isRandomlyTicking(BlockState state) { + return WeatheringCopper.getNext(state.getBlock()).isPresent(); } - public OxidationLevel getDegradationLevel() { + public WeatherState getAge() { return this.oxidationLevel; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/OxidizableWallBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/OxidizableWallBlock.java index 60fb5d65ab..92d354d67a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/OxidizableWallBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/OxidizableWallBlock.java @@ -1,29 +1,29 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.BlockState; -import net.minecraft.block.Oxidizable; -import net.minecraft.block.WallBlock; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.block.WallBlock; +import net.minecraft.world.level.block.WeatheringCopper; +import net.minecraft.world.level.block.state.BlockState; -public class OxidizableWallBlock extends WallBlock implements Oxidizable { - private final OxidationLevel oxidationLevel; +public class OxidizableWallBlock extends WallBlock implements WeatheringCopper { + private final WeatherState oxidationLevel; - public OxidizableWallBlock(OxidationLevel oxidationLevel, Settings settings) { + public OxidizableWallBlock(WeatherState oxidationLevel, Properties settings) { super(settings); this.oxidationLevel = oxidationLevel; } - public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - this.tickDegradation(state, world, pos, random); + public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + this.changeOverTime(state, world, pos, random); } - public boolean hasRandomTicks(BlockState state) { - return Oxidizable.getIncreasedOxidationBlock(state.getBlock()).isPresent(); + public boolean isRandomlyTicking(BlockState state) { + return WeatheringCopper.getNext(state.getBlock()).isPresent(); } - public OxidationLevel getDegradationLevel() { + public WeatherState getAge() { return this.oxidationLevel; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/PaperSheetBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/PaperSheetBlock.java index ce7b503fd5..a47c35f315 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/PaperSheetBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/PaperSheetBlock.java @@ -1,117 +1,114 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; - import java.util.Objects; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class PaperSheetBlock extends Block { private static final int MAX_PAPERS = 6; - public static final IntProperty PAPERS = IntProperty.of("papers", 1, MAX_PAPERS); - public static final EnumProperty HORIZONTAL_FACING = Properties.HORIZONTAL_FACING; + public static final IntegerProperty PAPERS = IntegerProperty.create("papers", 1, MAX_PAPERS); + public static final EnumProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING; private static final VoxelShape[] SHAPES_BY_PAPERS; - public PaperSheetBlock(Settings settings) { + public PaperSheetBlock(Properties settings) { super(settings); - this.setDefaultState((this.stateManager.getDefaultState()).with(HORIZONTAL_FACING, Direction.NORTH).with(PAPERS, 1)); + this.registerDefaultState((this.stateDefinition.any()).setValue(HORIZONTAL_FACING, Direction.NORTH).setValue(PAPERS, 1)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(HORIZONTAL_FACING, PAPERS); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return SHAPES_BY_PAPERS[state.get(PAPERS) - 1]; + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return SHAPES_BY_PAPERS[state.getValue(PAPERS) - 1]; } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if (world.isClient) { - return ActionResult.SUCCESS; + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (world.isClientSide) { + return InteractionResult.SUCCESS; } else { - if (player.isInCreativeMode()) { - world.setBlockState(pos, state.cycle(PAPERS)); + if (player.hasInfiniteMaterials()) { + world.setBlockAndUpdate(pos, state.cycle(PAPERS)); } } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } @Override - protected ActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - ItemStack itemStack = player.getStackInHand(hand); - if(itemStack.getItem() == this.asItem() && state.get(PAPERS) < MAX_PAPERS) { - stack.decrementUnlessCreative(1, player); - world.setBlockState(pos, state.cycle(PAPERS)); - return ActionResult.CONSUME; + protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + ItemStack itemStack = player.getItemInHand(hand); + if(itemStack.getItem() == this.asItem() && state.getValue(PAPERS) < MAX_PAPERS) { + stack.consume(1, player); + world.setBlockAndUpdate(pos, state.cycle(PAPERS)); + return ItemInteractionResult.CONSUME; } - return super.onUseWithItem(stack, state, world, pos, player, hand, hit); + return super.useItemOn(stack, state, world, pos, player, hand, hit); } @Override - protected boolean canReplace(BlockState state, ItemPlacementContext context) { - boolean bl1 = !context.shouldCancelInteraction(); - boolean bl2 = context.getStack().getItem() == this.asItem(); - boolean bl3 = state.get(PAPERS) <= MAX_PAPERS; - return bl1 && bl2 && bl3 || super.canReplace(state, context); + protected boolean canBeReplaced(BlockState state, BlockPlaceContext context) { + boolean bl1 = !context.isSecondaryUseActive(); + boolean bl2 = context.getItemInHand().getItem() == this.asItem(); + boolean bl3 = state.getValue(PAPERS) <= MAX_PAPERS; + return bl1 && bl2 && bl3 || super.canBeReplaced(state, context); } - public BlockState getPlacementState(ItemPlacementContext ctx) { - BlockState blockState = ctx.getWorld().getBlockState(ctx.getBlockPos()); - if (blockState.isOf(this)) { - return blockState.cycle(PAPERS).with(HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + BlockState blockState = ctx.getLevel().getBlockState(ctx.getClickedPos()); + if (blockState.is(this)) { + return blockState.cycle(PAPERS).setValue(HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()); } else { - return Objects.requireNonNull(super.getPlacementState(ctx)).with(HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); + return Objects.requireNonNull(super.getStateForPlacement(ctx)).setValue(HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()); } } - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - return direction == Direction.DOWN && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : - super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + return direction == Direction.DOWN && !state.canSurvive(world, pos) ? Blocks.AIR.defaultBlockState() : + super.updateShape(state, direction, neighborState, world, pos, neighborPos); } - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(HORIZONTAL_FACING, rotation.rotate(state.get(HORIZONTAL_FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(HORIZONTAL_FACING, rotation.rotate(state.getValue(HORIZONTAL_FACING))); } - public BlockState mirror(BlockState state, BlockMirror mirror) { - return state.rotate(mirror.getRotation(state.get(HORIZONTAL_FACING))); + public BlockState mirror(BlockState state, Mirror mirror) { + return state.rotate(mirror.getRotation(state.getValue(HORIZONTAL_FACING))); } static { SHAPES_BY_PAPERS = new VoxelShape[]{ - Block.createColumnShape(8.0, 0.0, 1.0), - Block.createColumnShape(12.0, 0.0, 1.0), - Block.createColumnShape(14.0, 0.0, 1.0), - Block.createColumnShape(16.0, 0.0, 3.0), - Block.createColumnShape(16.0, 0.0, 8.0), - Block.createColumnShape(16.0, 0.0, 12.0), + Block.box(4, 0, 4, 12, 1, 12), + Block.box(2, 0, 2, 14, 1, 14), + Block.box(1, 0, 1, 15, 1, 15), + Block.box(0, 0, 0, 16, 3, 16), + Block.box(0, 0, 0, 16, 8, 16), + Block.box(0, 0, 0, 16, 12, 16), }; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ReinforcedScaffoldingBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ReinforcedScaffoldingBlock.java index f4cc788ed0..5d4f1639bd 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ReinforcedScaffoldingBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ReinforcedScaffoldingBlock.java @@ -1,25 +1,26 @@ package net.sevenstars.middleearth.block.special; import com.mojang.serialization.MapCodec; -import net.minecraft.block.AbstractBlock; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ScaffoldingBlock; -import net.minecraft.entity.FallingBlockEntity; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.IntProperty; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.item.FallingBlockEntity; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.ScaffoldingBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.material.Fluids; import net.sevenstars.middleearth.item.DecorativeItemsME; import java.util.ArrayDeque; import java.util.HashMap; @@ -28,91 +29,96 @@ public class ReinforcedScaffoldingBlock extends ScaffoldingBlock { public static final int MAX_SUPPORT_DISTANCE = 14; private static final int MAX_STORED_DISTANCE = 7; - public static final IntProperty SUPPORT_DISTANCE = IntProperty.of("support_distance", 0, MAX_SUPPORT_DISTANCE); - public static final MapCodec CODEC = createCodec(ReinforcedScaffoldingBlock::new); + public static final IntegerProperty SUPPORT_DISTANCE = IntegerProperty.create("support_distance", 0, MAX_SUPPORT_DISTANCE); + public static final MapCodec CODEC = simpleCodec(ReinforcedScaffoldingBlock::new); - public ReinforcedScaffoldingBlock(AbstractBlock.Settings settings) { + public ReinforcedScaffoldingBlock(BlockBehaviour.Properties settings) { super(settings); - this.setDefaultState(this.stateManager.getDefaultState().with(SUPPORT_DISTANCE, 0)); + this.registerDefaultState(this.stateDefinition.any().setValue(SUPPORT_DISTANCE, 0)); } @Override - public MapCodec getCodec() { + public MapCodec codec() { return CODEC; } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - BlockPos pos = ctx.getBlockPos(); - World world = ctx.getWorld(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + BlockPos pos = ctx.getClickedPos(); + Level world = ctx.getLevel(); int distance = calculateDistance(world, pos, this); - return this.getDefaultState() - .with(WATERLOGGED, world.getFluidState(pos).getFluid() == Fluids.WATER) - .with(DISTANCE, toStoredDistance(distance)) - .with(SUPPORT_DISTANCE, distance) - .with(BOTTOM, shouldBeBottom(world, pos, distance, this)); + return this.defaultBlockState() + .setValue(WATERLOGGED, world.getFluidState(pos).getType() == Fluids.WATER) + .setValue(DISTANCE, toStoredDistance(distance)) + .setValue(SUPPORT_DISTANCE, distance) + .setValue(BOTTOM, shouldBeBottom(world, pos, distance, this)); } @Override - public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData) { - return DecorativeItemsME.REINFORCED_SCAFFOLDING.getDefaultStack(); + public ItemStack getCloneItemStack(LevelReader world, BlockPos pos, BlockState state) { + return DecorativeItemsME.REINFORCED_SCAFFOLDING.getDefaultInstance(); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - if (!world.isClient()) { - tickView.scheduleBlockTick(pos, this, 1); + if (!world.isClientSide()) { + world.scheduleTick(pos, this, 1); } return state; } @Override - protected void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { int distance = calculateDistance(world, pos, this); - BlockState updatedState = state.with(DISTANCE, toStoredDistance(distance)) - .with(SUPPORT_DISTANCE, distance) - .with(BOTTOM, shouldBeBottom(world, pos, distance, this)); + BlockState updatedState = state.setValue(DISTANCE, toStoredDistance(distance)) + .setValue(SUPPORT_DISTANCE, distance) + .setValue(BOTTOM, shouldBeBottom(world, pos, distance, this)); if (distance == MAX_SUPPORT_DISTANCE) { - if (state.get(SUPPORT_DISTANCE) == MAX_SUPPORT_DISTANCE) { - FallingBlockEntity.spawnFromBlock(world, pos, updatedState); + if (state.getValue(SUPPORT_DISTANCE) == MAX_SUPPORT_DISTANCE) { + FallingBlockEntity.fall(world, pos, updatedState); } else { - world.breakBlock(pos, true); + world.destroyBlock(pos, true); } } else if (state != updatedState) { - world.setBlockState(pos, updatedState, 3); + world.setBlock(pos, updatedState, 3); } } @Override - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { return calculateDistance(world, pos, this) < MAX_SUPPORT_DISTANCE; } @Override - protected boolean canReplace(BlockState state, ItemPlacementContext context) { - return context.getStack().getItem() instanceof BlockItem blockItem + protected boolean canBeReplaced(BlockState state, BlockPlaceContext context) { + return context.getItemInHand().getItem() instanceof BlockItem blockItem && blockItem.getBlock() == this; } @Override - protected void appendProperties(StateManager.Builder builder) { - super.appendProperties(builder); + public boolean isScaffolding(BlockState state, LevelReader world, BlockPos pos, LivingEntity entity) { + return true; + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + super.createBlockStateDefinition(builder); builder.add(SUPPORT_DISTANCE); } - public static boolean shouldBeBottom(BlockView world, BlockPos pos, int distance, Block scaffoldingBlock) { - return distance > 0 && !world.getBlockState(pos.down()).isOf(scaffoldingBlock); + public static boolean shouldBeBottom(BlockGetter world, BlockPos pos, int distance, Block scaffoldingBlock) { + return distance > 0 && !world.getBlockState(pos.below()).is(scaffoldingBlock); } - public static int calculateDistance(BlockView world, BlockPos pos, Block scaffoldingBlock) { + public static int calculateDistance(BlockGetter world, BlockPos pos, Block scaffoldingBlock) { Map supportDistances = new HashMap<>(); ArrayDeque positionsToCheck = new ArrayDeque<>(); - BlockPos startPos = pos.toImmutable(); + BlockPos startPos = pos.immutable(); supportDistances.put(startPos, 0); positionsToCheck.add(startPos); @@ -120,12 +126,12 @@ public static int calculateDistance(BlockView world, BlockPos pos, Block scaffol while (!positionsToCheck.isEmpty()) { BlockPos currentPos = positionsToCheck.removeFirst(); int currentDistance = supportDistances.get(currentPos); - BlockPos belowPos = currentPos.down(); + BlockPos belowPos = currentPos.below(); BlockState belowState = world.getBlockState(belowPos); - if (belowState.isOf(scaffoldingBlock)) { + if (belowState.is(scaffoldingBlock)) { addSupportPosition(positionsToCheck, supportDistances, belowPos, currentDistance, true); - } else if (belowState.isSideSolidFullSquare(world, belowPos, Direction.UP)) { + } else if (belowState.isFaceSturdy(world, belowPos, Direction.UP)) { return Math.min(currentDistance, MAX_SUPPORT_DISTANCE); } @@ -133,9 +139,9 @@ public static int calculateDistance(BlockView world, BlockPos pos, Block scaffol continue; } - for (Direction direction : Direction.Type.HORIZONTAL) { - BlockPos horizontalPos = currentPos.offset(direction); - if (world.getBlockState(horizontalPos).isOf(scaffoldingBlock)) { + for (Direction direction : Direction.Plane.HORIZONTAL) { + BlockPos horizontalPos = currentPos.relative(direction); + if (world.getBlockState(horizontalPos).is(scaffoldingBlock)) { addSupportPosition(positionsToCheck, supportDistances, horizontalPos, currentDistance + 1, false); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/RocksBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/RocksBlock.java index 26934d79f2..9837318213 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/RocksBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/RocksBlock.java @@ -1,92 +1,97 @@ package net.sevenstars.middleearth.block.special; import com.mojang.serialization.MapCodec; -import net.minecraft.block.*; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; -public class RocksBlock extends HorizontalFacingBlock implements Waterloggable { - public static final IntProperty STAGE = IntProperty.of("stage", 0, 3); +public class RocksBlock extends HorizontalDirectionalBlock implements SimpleWaterloggedBlock { + public static final IntegerProperty STAGE = IntegerProperty.create("stage", 0, 3); - public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - public RocksBlock(Settings settings) { + public RocksBlock(Properties settings) { super(settings); - this.setDefaultState((this.stateManager.getDefaultState()).with(FACING, Direction.NORTH).with(STAGE, 0).with(WATERLOGGED, false)); + this.registerDefaultState((this.stateDefinition.any()).setValue(FACING, Direction.NORTH).setValue(STAGE, 0).setValue(WATERLOGGED, false)); } @Override - protected MapCodec getCodec() { - return RocksBlock.createCodec(RocksBlock::new); + protected MapCodec codec() { + return RocksBlock.simpleCodec(RocksBlock::new); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if (!world.isClient && player.getAbilities().allowModifyWorld) { - if (player.getMainHandStack().isOf(this.asItem()) && state.get(STAGE) < 3){ - world.setBlockState(pos, state.cycle(STAGE)); - if(!player.isInCreativeMode()){ - player.getMainHandStack().decrement(1); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (!world.isClientSide && player.getAbilities().mayBuild) { + if (player.getMainHandItem().is(this.asItem()) && state.getValue(STAGE) < 3){ + world.setBlockAndUpdate(pos, state.cycle(STAGE)); + if(!player.hasInfiniteMaterials()){ + player.getMainHandItem().shrink(1); } } } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } @Override - public BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + public RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING, STAGE, WATERLOGGED); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()).with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER).with(STAGE, 0); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()).setValue(WATERLOGGED, ctx.getLevel().getFluidState(ctx.getClickedPos()).getType() == Fluids.WATER).setValue(STAGE, 0); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return switch (state.get(STAGE)) { - case 3 -> Block.createCuboidShape(0, 0, 0, 16, 10, 16); - case 2 -> Block.createCuboidShape(0, 0, 0, 16, 8, 16); - case 1 -> Block.createCuboidShape(0, 0, 0, 16, 4, 16); - default -> Block.createCuboidShape(0, 0, 0, 16, 3, 16); + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return switch (state.getValue(STAGE)) { + case 3 -> Block.box(0, 0, 0, 16, 10, 16); + case 2 -> Block.box(0, 0, 0, 16, 8, 16); + case 1 -> Block.box(0, 0, 0, 16, 4, 16); + default -> Block.box(0, 0, 0, 16, 3, 16); }; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/SeatBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/SeatBlock.java index 3a7bb3d91e..1760544635 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/SeatBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/SeatBlock.java @@ -1,27 +1,27 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.HorizontalFacingBlock; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.network.chat.Component; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.BlockHitResult; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntitiesME; import net.sevenstars.middleearth.entity.seat.SeatEntity; @@ -30,94 +30,94 @@ import org.joml.Vector3f; public class SeatBlock extends Block { - public static final EnumProperty FACING = HorizontalFacingBlock.FACING; - public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; - public static final BooleanProperty OCCUPIED = Properties.OCCUPIED; + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; + public static final BooleanProperty OCCUPIED = BlockStateProperties.OCCUPIED; - public SeatBlock(Settings settings) { + public SeatBlock(Properties settings) { super(settings); - setDefaultState(getDefaultState().with(FACING, Direction.NORTH).with(WATERLOGGED, false).with(OCCUPIED, false)); + registerDefaultState(defaultBlockState().setValue(FACING, Direction.NORTH).setValue(WATERLOGGED, false).setValue(OCCUPIED, false)); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - Quaternionf quaternion = state.get(FACING).getOpposite().getRotationQuaternion().normalize(); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + Quaternionf quaternion = state.getValue(FACING).getOpposite().getRotation().normalize(); Vector3f eulerAngles = new Vector3f(0, 0, 0); eulerAngles = quaternion.getEulerAnglesXYZ(eulerAngles); float yaw = (float) Math.atan2(eulerAngles.x, eulerAngles.z); SeatEntity seat = new SeatEntity(EntitiesME.SEAT_ENTITY, world); - seat.setPos(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); - seat.refreshPositionAndAngles(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, yaw, 0); + seat.setPosRaw(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); + seat.moveTo(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, yaw, 0); seat.setNoGravity(true); seat.setSilent(true); seat.setInvisible(true); seat.setInvulnerable(true); - if(world.isClient) { - return ActionResult.CONSUME; - } else if(player.isSneaking() || player.isSpectator() || player.hasVehicle()) { - return ActionResult.FAIL; - } else if (player.shouldCancelInteraction()) { - return ActionResult.SUCCESS; - } else if (world.getBlockState(pos.up()).isOpaque()){ - player.sendMessage(Text.translatable("alert.%s.seat.space_not_empty".formatted(MiddleEarth.MOD_ID)), true); - return ActionResult.SUCCESS; - }else if (state.get(OCCUPIED)){ - player.sendMessage(Text.translatable("alert.%s.seat.occupied".formatted(MiddleEarth.MOD_ID)), true); - return ActionResult.SUCCESS; + if(world.isClientSide) { + return InteractionResult.CONSUME; + } else if(player.isShiftKeyDown() || player.isSpectator() || player.isPassenger()) { + return InteractionResult.FAIL; + } else if (player.isSecondaryUseActive()) { + return InteractionResult.SUCCESS; + } else if (world.getBlockState(pos.above()).canOcclude()){ + player.displayClientMessage(Component.translatable("alert.%s.seat.space_not_empty".formatted(MiddleEarth.MOD_ID)), true); + return InteractionResult.SUCCESS; + }else if (state.getValue(OCCUPIED)){ + player.displayClientMessage(Component.translatable("alert.%s.seat.occupied".formatted(MiddleEarth.MOD_ID)), true); + return InteractionResult.SUCCESS; } else { - if(world.spawnEntity(seat)) { + if(world.addFreshEntity(seat)) { player.startRiding(seat, true); - player.setYaw(yaw); - player.setHeadYaw(yaw); - world.setBlockState(pos, state.with(OCCUPIED, true)); - return ActionResult.SUCCESS; + player.setYRot(yaw); + player.setYHeadRot(yaw); + world.setBlockAndUpdate(pos, state.setValue(OCCUPIED, true)); + return InteractionResult.SUCCESS; } else { - return ActionResult.CONSUME; + return InteractionResult.CONSUME; } } } - protected void appendProperties(StateManager.Builder builder) { - builder.add(Properties.HORIZONTAL_FACING, WATERLOGGED, OCCUPIED); + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(BlockStateProperties.HORIZONTAL_FACING, WATERLOGGED, OCCUPIED); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()).with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()).setValue(WATERLOGGED, ctx.getLevel().getFluidState(ctx.getClickedPos()).getType() == Fluids.WATER); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ShortIciclesBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ShortIciclesBlock.java index 0a2bf9e5d4..d002f8931d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ShortIciclesBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ShortIciclesBlock.java @@ -1,47 +1,46 @@ package net.sevenstars.middleearth.block.special; import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class ShortIciclesBlock extends Block { - public static final MapCodec CODEC = createCodec(ShortIciclesBlock::new); - protected static final VoxelShape SHAPE = Block.createCuboidShape(2.0, 10.0, 2.0, 14.0, 16.0, 14.0);; + public static final MapCodec CODEC = simpleCodec(ShortIciclesBlock::new); + protected static final VoxelShape SHAPE = Block.box(2.0, 10.0, 2.0, 14.0, 16.0, 14.0);; - public ShortIciclesBlock(Settings settings) { + public ShortIciclesBlock(Properties settings) { super(settings); } - public MapCodec getCodec() { + public MapCodec codec() { return CODEC; } - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - BlockPos blockPos = pos.up(); + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + BlockPos blockPos = pos.above(); BlockState blockState = world.getBlockState(blockPos); - return blockState.isSideSolidFullSquare(world, blockPos, Direction.DOWN); + return blockState.isFaceSturdy(world, blockPos, Direction.DOWN); } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (direction == Direction.UP && !this.canPlaceAt(state, world, pos)) { - return Blocks.AIR.getDefaultState(); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (direction == Direction.UP && !this.canSurvive(state, world, pos)) { + return Blocks.AIR.defaultBlockState(); } else { - return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return super.updateShape(state, direction, neighborState, world, pos, neighborPos); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/SkeletonBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/SkeletonBlock.java index 433c7cc2af..bd3e7f23eb 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/SkeletonBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/SkeletonBlock.java @@ -1,84 +1,94 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; - -import java.util.Objects; +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class SkeletonBlock extends Block { - private static final int MAX_POSES = 9; - public static final IntProperty POSE = IntProperty.of("pose", 1, MAX_POSES); - public static final EnumProperty HORIZONTAL_FACING = Properties.HORIZONTAL_FACING; + public static final MapCodec CODEC = simpleCodec(SkeletonBlock::new); + public static final IntegerProperty POSE = IntegerProperty.create("pose", 1, 9); + public static final EnumProperty HORIZONTAL_FACING = HorizontalDirectionalBlock.FACING; + + private static final VoxelShape TALL_SHAPE = Block.box(2.0, 0.0, 2.0, 14.0, 12.0, 14.0); + private static final VoxelShape MEDIUM_SHAPE = Block.box(2.0, 0.0, 2.0, 14.0, 8.0, 14.0); + private static final VoxelShape SHORT_SHAPE = Block.box(2.0, 0.0, 2.0, 14.0, 4.0, 14.0); - public SkeletonBlock(Settings settings) { - super(settings); - this.setDefaultState((this.stateManager.getDefaultState()).with(HORIZONTAL_FACING, Direction.NORTH).with(POSE, 1)); + public SkeletonBlock(Properties properties) { + super(properties); + registerDefaultState(defaultBlockState().setValue(HORIZONTAL_FACING, Direction.NORTH).setValue(POSE, 1)); + } + + @Override + protected MapCodec codec() { + return CODEC; } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(HORIZONTAL_FACING, POSE); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if (world.isClient) { - return ActionResult.SUCCESS; - } else { - world.setBlockState(pos, state.cycle(POSE)); + protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, + Player player, BlockHitResult hit) { + if (!level.isClientSide) { + level.setBlock(pos, state.cycle(POSE), Block.UPDATE_ALL_IMMEDIATE); } - return ActionResult.SUCCESS; + return InteractionResult.sidedSuccess(level.isClientSide); } - public BlockState getPlacementState(ItemPlacementContext ctx) { - BlockState blockState = ctx.getWorld().getBlockState(ctx.getBlockPos()); - if (blockState.isOf(this)) { - return blockState.cycle(POSE).with(HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); - } else { - return Objects.requireNonNull(super.getPlacementState(ctx)).with(HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + BlockState existing = context.getLevel().getBlockState(context.getClickedPos()); + Direction facing = context.getHorizontalDirection().getOpposite(); + if (existing.is(this)) { + return existing.cycle(POSE).setValue(HORIZONTAL_FACING, facing); } + return defaultBlockState().setValue(HORIZONTAL_FACING, facing); } - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - return direction == Direction.DOWN && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : - super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + @Override + protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, + LevelAccessor level, BlockPos pos, BlockPos neighborPos) { + return direction == Direction.DOWN && !state.canSurvive(level, pos) + ? Blocks.AIR.defaultBlockState() + : super.updateShape(state, direction, neighborState, level, pos, neighborPos); } - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(HORIZONTAL_FACING, rotation.rotate(state.get(HORIZONTAL_FACING))); + @Override + protected BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(HORIZONTAL_FACING, rotation.rotate(state.getValue(HORIZONTAL_FACING))); } - public BlockState mirror(BlockState state, BlockMirror mirror) { - return state.rotate(mirror.getRotation(state.get(HORIZONTAL_FACING))); + @Override + protected BlockState mirror(BlockState state, Mirror mirror) { + return state.rotate(mirror.getRotation(state.getValue(HORIZONTAL_FACING))); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - int pose = state.get(POSE); - if(pose == 1 || pose == 2 || pose == 9) return Block.createCuboidShape(2.0, 0.0, 2.0, 14.0, 12.0, 14.0); - else if(pose == 6 || pose == 7) return Block.createCuboidShape(2.0, 0.0, 2.0, 14.0, 4.0, 14.0); - else return Block.createCuboidShape(2.0, 0.0, 2.0, 14.0, 8.0, 14.0); + protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { + int pose = state.getValue(POSE); + if (pose == 1 || pose == 2 || pose == 9) { + return TALL_SHAPE; + } + return pose == 6 || pose == 7 ? SHORT_SHAPE : MEDIUM_SHAPE; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/SpikesBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/SpikesBlock.java index d17f577f64..19c69be097 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/SpikesBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/SpikesBlock.java @@ -1,91 +1,88 @@ package net.sevenstars.middleearth.block.special; import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.enums.DoubleBlockHalf; -import net.minecraft.block.enums.Thickness; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.entity.projectile.TridentEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.entity.projectile.ThrownTrident; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.phys.BlockHitResult; public class SpikesBlock extends Block { - public static final MapCodec CODEC = createCodec(SpikesBlock::new); - public static final EnumProperty HALF = Properties.DOUBLE_BLOCK_HALF; + public static final MapCodec CODEC = simpleCodec(SpikesBlock::new); + public static final EnumProperty HALF = BlockStateProperties.DOUBLE_BLOCK_HALF; - public SpikesBlock(Settings settings) { + public SpikesBlock(Properties settings) { super(settings); - setDefaultState(getDefaultState().with(HALF, DoubleBlockHalf.LOWER)); + registerDefaultState(defaultBlockState().setValue(HALF, DoubleBlockHalf.LOWER)); } - public MapCodec getCodec() { + public MapCodec codec() { return CODEC; } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(HALF); } - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - BlockPos blockPos = pos.down(); + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + BlockPos blockPos = pos.below(); BlockState blockState = world.getBlockState(blockPos); - return blockState.isSideSolidFullSquare(world, blockPos, Direction.UP) || blockState.isOf(this); + return blockState.isFaceSturdy(world, blockPos, Direction.UP) || blockState.is(this); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - DoubleBlockHalf doubleBlockHalf = state.get(HALF); - BlockState downState = world.getBlockState(pos.down()); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + DoubleBlockHalf doubleBlockHalf = state.getValue(HALF); + BlockState downState = world.getBlockState(pos.below()); - if(!downState.isOf(this) && !downState.isSideSolidFullSquare(world, pos, Direction.UP)){ - return Blocks.AIR.getDefaultState(); - } else if (doubleBlockHalf == DoubleBlockHalf.LOWER && world.getBlockState(pos.up()).isAir()){ - return state.with(HALF, DoubleBlockHalf.UPPER); + if(!downState.is(this) && !downState.isFaceSturdy(world, pos, Direction.UP)){ + return Blocks.AIR.defaultBlockState(); + } else if (doubleBlockHalf == DoubleBlockHalf.LOWER && world.getBlockState(pos.above()).isAir()){ + return state.setValue(HALF, DoubleBlockHalf.UPPER); } else { - return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return super.updateShape(state, direction, neighborState, world, pos, neighborPos); } } - public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { - BlockState downState = world.getBlockState(pos.down()); - if (downState.isOf(this)){ - world.setBlockState(pos.down(), downState.with(HALF, DoubleBlockHalf.LOWER)); - world.setBlockState(pos, (BlockState)state.with(HALF, DoubleBlockHalf.UPPER), 3); + public void setPlacedBy(Level world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { + BlockState downState = world.getBlockState(pos.below()); + if (downState.is(this)){ + world.setBlockAndUpdate(pos.below(), downState.setValue(HALF, DoubleBlockHalf.LOWER)); + world.setBlock(pos, (BlockState)state.setValue(HALF, DoubleBlockHalf.UPPER), 3); } else { - world.setBlockState(pos, (BlockState)state.with(HALF, DoubleBlockHalf.UPPER), 3); + world.setBlock(pos, (BlockState)state.setValue(HALF, DoubleBlockHalf.UPPER), 3); } } - protected void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient) { + protected void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!world.isClientSide) { BlockPos blockPos = hit.getBlockPos(); - if (world instanceof ServerWorld) { - ServerWorld serverWorld = (ServerWorld)world; - if (projectile.canModifyAt(serverWorld, blockPos) && projectile.canBreakBlocks(serverWorld) && projectile instanceof TridentEntity && projectile.getVelocity().length() > 0.6) { - world.breakBlock(blockPos, true); + if (world instanceof ServerLevel) { + ServerLevel serverWorld = (ServerLevel)world; + if (projectile.mayInteract(serverWorld, blockPos) && projectile.mayBreak(serverWorld) && projectile instanceof ThrownTrident && projectile.getDeltaMovement().length() > 0.6) { + world.destroyBlock(blockPos, true); } } } } - public void onLandedUpon(World world, BlockState state, BlockPos pos, Entity entity, double fallDistance) { - entity.handleFallDamage(fallDistance + 2.5, 2.0F, world.getDamageSources().fall()); + @Override + public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) { + entity.causeFallDamage(fallDistance + 2.5F, 2.0F, world.damageSources().fall()); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoneChairBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoneChairBlock.java index f026a5c666..2c35d955ab 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoneChairBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoneChairBlock.java @@ -1,30 +1,30 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.Waterloggable; -import net.minecraft.state.property.Properties; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; -public class StoneChairBlock extends SeatBlock implements Waterloggable { +public class StoneChairBlock extends SeatBlock implements SimpleWaterloggedBlock { - public StoneChairBlock(Settings settings) { + public StoneChairBlock(Properties settings) { super(settings); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return switch(state.get(Properties.HORIZONTAL_FACING)) { - case WEST -> VoxelShapes.combineAndSimplify(Block.createCuboidShape(2, 0, 0, 16, 10, 16), Block.createCuboidShape(13, 10, 0, 16, 16, 16), BooleanBiFunction.OR); - case EAST -> VoxelShapes.combineAndSimplify(Block.createCuboidShape(0, 0, 0, 14, 10, 16), Block.createCuboidShape(0, 10, 0, 3, 16, 16), BooleanBiFunction.OR); - case SOUTH -> VoxelShapes.combineAndSimplify(Block.createCuboidShape(0, 0, 0, 16, 10, 14), Block.createCuboidShape(0, 10, 0, 16, 16, 3), BooleanBiFunction.OR); - case NORTH -> VoxelShapes.combineAndSimplify(Block.createCuboidShape(0, 0, 2, 16, 10, 16), Block.createCuboidShape(0, 10, 13, 16, 16, 16), BooleanBiFunction.OR); - default -> VoxelShapes.cuboid(1,1,1,1,1,1); + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return switch(state.getValue(BlockStateProperties.HORIZONTAL_FACING)) { + case WEST -> Shapes.join(Block.box(2, 0, 0, 16, 10, 16), Block.box(13, 10, 0, 16, 16, 16), BooleanOp.OR); + case EAST -> Shapes.join(Block.box(0, 0, 0, 14, 10, 16), Block.box(0, 10, 0, 3, 16, 16), BooleanOp.OR); + case SOUTH -> Shapes.join(Block.box(0, 0, 0, 16, 10, 14), Block.box(0, 10, 0, 16, 16, 3), BooleanOp.OR); + case NORTH -> Shapes.join(Block.box(0, 0, 2, 16, 10, 16), Block.box(0, 10, 13, 16, 16, 16), BooleanOp.OR); + default -> Shapes.box(1,1,1,1,1,1); }; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoneLecternBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoneLecternBlock.java index a767c8a9db..08693a99e8 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoneLecternBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoneLecternBlock.java @@ -1,39 +1,71 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.*; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; - +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.LecternBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import java.util.Map; public class StoneLecternBlock extends LecternBlock { private static final VoxelShape BASE_SHAPE; private static final Map OUTLINE_SHAPES_BY_DIRECTION; - public StoneLecternBlock(Settings settings) { + public StoneLecternBlock(Properties settings) { super(settings); } @Override - protected VoxelShape getCullingShape(BlockState state) { + protected VoxelShape getOcclusionShape(BlockState state, BlockGetter world, BlockPos pos) { return BASE_SHAPE; } @Override - protected VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return BASE_SHAPE; } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return (VoxelShape)OUTLINE_SHAPES_BY_DIRECTION.get(state.get(FACING)); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return (VoxelShape)OUTLINE_SHAPES_BY_DIRECTION.get(state.getValue(FACING)); } static { - BASE_SHAPE = VoxelShapes.union(Block.createColumnShape(16.0, 0.0, 2.0), Block.createColumnShape(12.0, 2.0, 14.0)); - OUTLINE_SHAPES_BY_DIRECTION = VoxelShapes.createHorizontalFacingShapeMap(VoxelShapes.union(Block.createCuboidZShape(16.0, 10.0, 14.0, 1.0, 5.333333), new VoxelShape[]{Block.createCuboidZShape(16.0, 12.0, 16.0, 5.333333, 9.666667), Block.createCuboidZShape(16.0, 14.0, 18.0, 9.666667, 14.0), BASE_SHAPE})); + BASE_SHAPE = Shapes.or(Block.box(0, 0, 0, 16, 2, 16), Block.box(2, 2, 2, 14, 14, 14)); + VoxelShape north = Shapes.or( + Block.box(0, 10, 1, 16, 14, 5.333333), + Block.box(0, 12, 5.333333, 16, 16, 9.666667), + Block.box(0, 14, 9.666667, 16, 18, 14), + BASE_SHAPE + ); + VoxelShape south = Shapes.or( + Block.box(0, 10, 10.666667, 16, 14, 15), + Block.box(0, 12, 6.333333, 16, 16, 10.666667), + Block.box(0, 14, 2, 16, 18, 6.333333), + BASE_SHAPE + ); + VoxelShape west = Shapes.or( + Block.box(1, 10, 0, 5.333333, 14, 16), + Block.box(5.333333, 12, 0, 9.666667, 16, 16), + Block.box(9.666667, 14, 0, 14, 18, 16), + BASE_SHAPE + ); + VoxelShape east = Shapes.or( + Block.box(10.666667, 10, 0, 15, 14, 16), + Block.box(6.333333, 12, 0, 10.666667, 16, 16), + Block.box(2, 14, 0, 6.333333, 18, 16), + BASE_SHAPE + ); + OUTLINE_SHAPES_BY_DIRECTION = Map.of( + Direction.NORTH, north, + Direction.SOUTH, south, + Direction.WEST, west, + Direction.EAST, east + ); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoneMyceliumBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoneMyceliumBlock.java index 33d35a41d3..ff349bd0e6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoneMyceliumBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoneMyceliumBlock.java @@ -1,36 +1,36 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.SnowBlock; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.tag.FluidTags; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.chunk.light.ChunkLightProvider; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.tags.FluidTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.SnowLayerBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.lighting.LightEngine; public class StoneMyceliumBlock extends Block { - public StoneMyceliumBlock(Settings settings) { + public StoneMyceliumBlock(Properties settings) { super(settings); } - public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - if (!canSurvive(state, world, pos)) { - world.setBlockState(pos, Blocks.STONE.getDefaultState()); + public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + if (!canRemain(state, world, pos)) { + world.setBlockAndUpdate(pos, Blocks.STONE.defaultBlockState()); } else { - if (world.getLightLevel(pos.up()) <= 9) { - BlockState blockState = this.getDefaultState(); + if (world.getMaxLocalRawBrightness(pos.above()) <= 9) { + BlockState blockState = this.defaultBlockState(); for(int i = 0; i < 4; ++i) { - BlockPos blockPos = pos.add(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); - if (world.getBlockState(blockPos).isOf(Blocks.STONE) && canSpread(blockState, world, blockPos)) { - world.setBlockState(blockPos, (BlockState)blockState); + BlockPos blockPos = pos.offset(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); + if (world.getBlockState(blockPos).is(Blocks.STONE) && canSpread(blockState, world, blockPos)) { + world.setBlockAndUpdate(blockPos, (BlockState)blockState); } } } @@ -38,28 +38,36 @@ public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random } } - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { - super.randomDisplayTick(state, world, pos, random); + public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { + super.animateTick(state, world, pos, random); if (random.nextInt(10) == 0) { - world.addParticleClient(ParticleTypes.MYCELIUM, (double)pos.getX() + random.nextDouble(), (double)pos.getY() + 1.1, (double)pos.getZ() + random.nextDouble(), 0.0, 0.0, 0.0); + world.addParticle(ParticleTypes.MYCELIUM, (double)pos.getX() + random.nextDouble(), (double)pos.getY() + 1.1, (double)pos.getZ() + random.nextDouble(), 0.0, 0.0, 0.0); } } - private static boolean canSurvive(BlockState state, WorldView world, BlockPos pos) { - BlockPos blockPos = pos.up(); + private static boolean canRemain(BlockState state, LevelReader world, BlockPos pos) { + BlockPos blockPos = pos.above(); BlockState blockState = world.getBlockState(blockPos); - if (blockState.isOf(Blocks.SNOW) && (Integer)blockState.get(SnowBlock.LAYERS) == 1) { + if (blockState.is(Blocks.SNOW) && (Integer)blockState.getValue(SnowLayerBlock.LAYERS) == 1) { return true; - } else if (blockState.getFluidState().getLevel() == 8) { + } else if (blockState.getFluidState().getAmount() == 8) { return false; } else { - int i = ChunkLightProvider.getRealisticOpacity(state, blockState, Direction.UP, blockState.getOpacity()); + int i = LightEngine.getLightBlockInto( + world, + state, + pos, + blockState, + blockPos, + Direction.UP, + blockState.getLightBlock(world, blockPos) + ); return i < 15; } } - private static boolean canSpread(BlockState state, WorldView world, BlockPos pos) { - BlockPos blockPos = pos.up(); - return canSurvive(state, world, pos) && !world.getFluidState(blockPos).isIn(FluidTags.WATER); + private static boolean canSpread(BlockState state, LevelReader world, BlockPos pos) { + BlockPos blockPos = pos.above(); + return canRemain(state, world, pos) && !world.getFluidState(blockPos).is(FluidTags.WATER); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoneTableBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoneTableBlock.java index 72f6cb0ae0..9828149d64 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoneTableBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoneTableBlock.java @@ -1,67 +1,66 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.Waterloggable; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; import org.jetbrains.annotations.Nullable; import java.util.stream.Stream; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; -public class StoneTableBlock extends Block implements Waterloggable { - public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; +public class StoneTableBlock extends Block implements SimpleWaterloggedBlock { + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - public StoneTableBlock(Settings settings) { + public StoneTableBlock(Properties settings) { super(settings); - setDefaultState(getDefaultState().with(WATERLOGGED, false)); + registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false)); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(WATERLOGGED); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState().setValue(WATERLOGGED, ctx.getLevel().getFluidState(ctx.getClickedPos()).getType() == Fluids.WATER); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return Stream.of( - Block.createCuboidShape(2, 0, 2, 14, 4, 14), - Block.createCuboidShape(0, 13, 0, 16, 16, 16), - Block.createCuboidShape(4, 4, 4, 12, 13, 12) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(2, 0, 2, 14, 4, 14), + Block.box(0, 13, 0, 16, 16, 16), + Block.box(4, 4, 4, 12, 13, 12) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoolBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoolBlock.java index c441596f4d..d77918ef8e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoolBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/StoolBlock.java @@ -1,26 +1,26 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.Waterloggable; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; -public class StoolBlock extends SeatBlock implements Waterloggable { +public class StoolBlock extends SeatBlock implements SimpleWaterloggedBlock { - public StoolBlock(Settings settings) { + public StoolBlock(Properties settings) { super(settings); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return switch(state.get(FACING)) { - case WEST, EAST -> Block.createCuboidShape(2, 0, 0, 14, 9, 16); - case SOUTH, NORTH -> Block.createCuboidShape(0, 0, 2, 16, 9, 14); - default -> VoxelShapes.cuboid(1,1,1,1,1,1); + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return switch(state.getValue(FACING)) { + case WEST, EAST -> Block.box(2, 0, 0, 14, 9, 16); + case SOUTH, NORTH -> Block.box(0, 0, 2, 16, 9, 14); + default -> Shapes.box(1,1,1,1,1,1); }; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/TapperBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/TapperBlock.java index 2dd5b18341..e48f278d77 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/TapperBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/TapperBlock.java @@ -1,87 +1,97 @@ package net.sevenstars.middleearth.block.special; import com.mojang.serialization.MapCodec; -import net.minecraft.block.*; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.registry.tag.BlockTags; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.stat.Stats; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.IntProperty; -import net.minecraft.util.ActionResult; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.stats.Stats; +import net.minecraft.tags.BlockTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.WoodBlockSets; +import net.sevenstars.middleearth.block.registration.ModNatureBlocks; import net.sevenstars.middleearth.item.FoodItemsME; -public class TapperBlock extends HorizontalFacingBlock { +public class TapperBlock extends HorizontalDirectionalBlock { + public static final MapCodec CODEC = simpleCodec(TapperBlock::new); public static final int FULL_TAP_LEVEL = 5; - public static final IntProperty TAP_LEVEL = IntProperty.of("tap_level", 0, FULL_TAP_LEVEL); + public static final IntegerProperty TAP_LEVEL = IntegerProperty.create("tap_level", 0, FULL_TAP_LEVEL); public static final int RANDOM_TICK_CHANCE = 7; + private static final Item RESIN_CLUMP = ModNatureBlocks.RESIN_CLUMP.asItem(); - public TapperBlock(Settings settings) { - super(settings.ticksRandomly()); + public TapperBlock(Properties settings) { + super(settings.randomTicks()); - this.setDefaultState(((this.stateManager.getDefaultState()) - .with(TAP_LEVEL, 0)) - .with(FACING, Direction.NORTH)); + this.registerDefaultState(((this.stateDefinition.any()) + .setValue(TAP_LEVEL, 0)) + .setValue(FACING, Direction.NORTH)); } - protected int getComparatorOutput(BlockState state, World world, BlockPos pos) { - return state.get(TAP_LEVEL); + protected int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) { + return state.getValue(TAP_LEVEL); } @Override - protected MapCodec getCodec() { - return null; + protected MapCodec codec() { + return CODEC; } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(FACING, ctx.getHorizontalPlayerFacing().getOpposite()); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState().setValue(FACING, ctx.getHorizontalDirection().getOpposite()); } - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - BlockState behindBlock = world.getBlockState(pos.offset(state.get(FACING).getOpposite())); - return behindBlock.isIn(BlockTags.LOGS); + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + BlockState behindBlock = world.getBlockState(pos.relative(state.getValue(FACING).getOpposite())); + return behindBlock.is(BlockTags.LOGS); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return switch (state.get(FACING)) { - case SOUTH -> Block.createCuboidShape(4.0, 0.0, 0.0, 12.0, 10.0, 8.0); - default -> Block.createCuboidShape(4.0, 0.0, 8.0, 12.0, 10.0, 16.0); - case WEST -> Block.createCuboidShape(8.0, 0.0, 4.0, 16.0, 10.0, 12.0); - case EAST -> Block.createCuboidShape(0.0, 0.0, 4.0, 8.0, 10.0, 12.0); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return switch (state.getValue(FACING)) { + case SOUTH -> Block.box(4.0, 0.0, 0.0, 12.0, 10.0, 8.0); + default -> Block.box(4.0, 0.0, 8.0, 12.0, 10.0, 16.0); + case WEST -> Block.box(8.0, 0.0, 4.0, 16.0, 10.0, 12.0); + case EAST -> Block.box(0.0, 0.0, 4.0, 8.0, 10.0, 12.0); }; } @Override - protected ActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - int i = state.get(TAP_LEVEL); + protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + int i = state.getValue(TAP_LEVEL); boolean bl = false; if (i >= FULL_TAP_LEVEL) { Item item = stack.getItem(); - BlockState behindBlock = world.getBlockState(pos.offset(state.get(FACING).getOpposite())); + BlockState behindBlock = world.getBlockState(pos.relative(state.getValue(FACING).getOpposite())); - Item result = Items.RESIN_CLUMP; + Item result = RESIN_CLUMP; if(behindBlock.getBlock() == WoodBlockSets.MAPLE_SET.logBlocks.log() || behindBlock.getBlock() == WoodBlockSets.SILVER_MAPLE_SET.logBlocks.log()) { result = FoodItemsME.MAPLE_SYRUP; } else if (behindBlock.getBlock() == Blocks.BIRCH_LOG) { @@ -89,72 +99,72 @@ protected ActionResult onUseWithItem(ItemStack stack, BlockState state, World wo } ItemStack stackResult = new ItemStack(result); - if(result.equals(Items.RESIN_CLUMP)) { - if (!player.getInventory().insertStack(stackResult)) { - player.dropItem(stackResult, false); + if(result.equals(RESIN_CLUMP)) { + if (!player.getInventory().add(stackResult)) { + player.drop(stackResult, false); } - world.emitGameEvent(player, GameEvent.FLUID_PICKUP, pos); + world.gameEvent(player, GameEvent.FLUID_PICKUP, pos); emptyBucket(state, world, pos); } - else if (stack.isOf(Items.GLASS_BOTTLE)) { - if(result != Items.RESIN_CLUMP) stack.decrement(1); - world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.1F); + else if (stack.is(Items.GLASS_BOTTLE)) { + if(result != RESIN_CLUMP) stack.shrink(1); + world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BOTTLE_FILL, SoundSource.BLOCKS, 1.0F, 1.1F); if (stack.isEmpty()) { - player.setStackInHand(hand, stackResult); - } else if (!player.getInventory().insertStack(stackResult)) { - player.dropItem(stackResult, false); + player.setItemInHand(hand, stackResult); + } else if (!player.getInventory().add(stackResult)) { + player.drop(stackResult, false); } bl = true; - world.emitGameEvent(player, GameEvent.FLUID_PICKUP, pos); + world.gameEvent(player, GameEvent.FLUID_PICKUP, pos); emptyBucket(state, world, pos); } - if (!world.isClient() && bl) { - player.incrementStat(Stats.USED.getOrCreateStat(item)); + if (!world.isClientSide() && bl) { + player.awardStat(Stats.ITEM_USED.get(item)); } } if (bl) { - return ActionResult.SUCCESS; + return ItemInteractionResult.SUCCESS; } else { - return super.onUseWithItem(stack, state, world, pos, player, hand, hit); + return super.useItemOn(stack, state, world, pos, player, hand, hit); } } - private void emptyBucket(BlockState state, World world, BlockPos pos) { - if(world instanceof ServerWorld serverWorld) { - serverWorld.setBlockState(pos, state.with(TAP_LEVEL, 0), 2); + private void emptyBucket(BlockState state, Level world, BlockPos pos) { + if(world instanceof ServerLevel serverWorld) { + serverWorld.setBlock(pos, state.setValue(TAP_LEVEL, 0), 2); } } - protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { int rand = world.random.nextInt(RANDOM_TICK_CHANCE); if (rand == 0) { - int i = state.get(TAP_LEVEL); + int i = state.getValue(TAP_LEVEL); if (i < FULL_TAP_LEVEL) { - world.setBlockState(pos, state.with(TAP_LEVEL, i + 1), 2); + world.setBlock(pos, state.setValue(TAP_LEVEL, i + 1), 2); } } } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(TAP_LEVEL, FACING); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - return state.rotate(mirror.getRotation(state.get(FACING))); + public BlockState mirror(BlockState state, Mirror mirror) { + return state.rotate(mirror.getRotation(state.getValue(FACING))); } @Override - protected BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ThickLadderBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ThickLadderBlock.java index 010fed64c2..c80cb26752 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ThickLadderBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ThickLadderBlock.java @@ -1,95 +1,99 @@ package net.sevenstars.middleearth.block.special; import com.mojang.serialization.MapCodec; -import net.minecraft.block.*; -import net.minecraft.block.enums.BlockFace; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.state.property.Property; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; - +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.AttachFace; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import java.util.Objects; -public class ThickLadderBlock extends WallMountedBlock implements Waterloggable { - public static final MapCodec CODEC = createCodec(ThickLadderBlock::new); +public class ThickLadderBlock extends FaceAttachedHorizontalDirectionalBlock implements SimpleWaterloggedBlock { + public static final MapCodec CODEC = simpleCodec(ThickLadderBlock::new); - public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - protected static final VoxelShape EAST_SHAPE = Block.createCuboidShape(0.0, 0.0, 0.0, 3.0, 16.0, 16.0); - protected static final VoxelShape WEST_SHAPE = Block.createCuboidShape(13.0, 0.0, 0.0, 16.0, 16.0, 16.0); - protected static final VoxelShape SOUTH_SHAPE = Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 16.0, 3.0); - protected static final VoxelShape NORTH_SHAPE = Block.createCuboidShape(0.0, 0.0, 13.0, 16.0, 16.0, 16.0); - protected static final VoxelShape BOTTOM_SHAPE = Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 3.0, 16.0); - protected static final VoxelShape TOP_SHAPE = Block.createCuboidShape(0.0, 13.0, 0.0, 16.0, 16.0, 16.0); + protected static final VoxelShape EAST_SHAPE = Block.box(0.0, 0.0, 0.0, 3.0, 16.0, 16.0); + protected static final VoxelShape WEST_SHAPE = Block.box(13.0, 0.0, 0.0, 16.0, 16.0, 16.0); + protected static final VoxelShape SOUTH_SHAPE = Block.box(0.0, 0.0, 0.0, 16.0, 16.0, 3.0); + protected static final VoxelShape NORTH_SHAPE = Block.box(0.0, 0.0, 13.0, 16.0, 16.0, 16.0); + protected static final VoxelShape BOTTOM_SHAPE = Block.box(0.0, 0.0, 0.0, 16.0, 3.0, 16.0); + protected static final VoxelShape TOP_SHAPE = Block.box(0.0, 13.0, 0.0, 16.0, 16.0, 16.0); @Override - protected MapCodec getCodec() { + protected MapCodec codec() { return CODEC; } - public ThickLadderBlock(Settings settings) { - super(settings.nonOpaque()); - this.setDefaultState((BlockState)((BlockState)((BlockState)this.stateManager.getDefaultState()).with(FACING, Direction.NORTH)).with(FACE, BlockFace.WALL).with(WATERLOGGED, false)); + public ThickLadderBlock(Properties settings) { + super(settings.noOcclusion()); + this.registerDefaultState((BlockState)((BlockState)((BlockState)this.stateDefinition.any()).setValue(FACING, Direction.NORTH)).setValue(FACE, AttachFace.WALL).setValue(WATERLOGGED, false)); } - protected BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(new Property[]{FACING, FACE, WATERLOGGED}); } - protected boolean canPathfindThrough(BlockState state, NavigationType type) { + protected boolean isPathfindable(BlockState state, PathComputationType type) { return false; } - protected BlockState rotate(BlockState state, BlockRotation rotation) { - return (BlockState)state.with(FACING, rotation.rotate((Direction)state.get(FACING))); + protected BlockState rotate(BlockState state, Rotation rotation) { + return (BlockState)state.setValue(FACING, rotation.rotate((Direction)state.getValue(FACING))); } - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { return true; } - protected BlockState mirror(BlockState state, BlockMirror mirror) { - return state.rotate(mirror.getRotation((Direction)state.get(FACING))); + protected BlockState mirror(BlockState state, Mirror mirror) { + return state.rotate(mirror.getRotation((Direction)state.getValue(FACING))); } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction[] var2 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction[] var2 = ctx.getNearestLookingDirections(); for (Direction direction : var2) { BlockState blockState; if (direction.getAxis() == Direction.Axis.Y) { - if(!Objects.requireNonNull(ctx.getPlayer()).isSneaking()){ - blockState = (BlockState) ((BlockState) this.getDefaultState().with(FACE, BlockFace.WALL)).with(FACING, ctx.getHorizontalPlayerFacing().getOpposite()).with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER);; + if(!Objects.requireNonNull(ctx.getPlayer()).isShiftKeyDown()){ + blockState = (BlockState) ((BlockState) this.defaultBlockState().setValue(FACE, AttachFace.WALL)).setValue(FACING, ctx.getHorizontalDirection().getOpposite()).setValue(WATERLOGGED, ctx.getLevel().getFluidState(ctx.getClickedPos()).getType() == Fluids.WATER);; } else { - blockState = (BlockState) ((BlockState) this.getDefaultState().with(FACE, direction == Direction.UP ? BlockFace.CEILING : BlockFace.FLOOR)).with(FACING, ctx.getHorizontalPlayerFacing()).with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER);; + blockState = (BlockState) ((BlockState) this.defaultBlockState().setValue(FACE, direction == Direction.UP ? AttachFace.CEILING : AttachFace.FLOOR)).setValue(FACING, ctx.getHorizontalDirection()).setValue(WATERLOGGED, ctx.getLevel().getFluidState(ctx.getClickedPos()).getType() == Fluids.WATER);; } } else { - if(!Objects.requireNonNull(ctx.getPlayer()).isSneaking()) { - blockState = (BlockState) ((BlockState) this.getDefaultState().with(FACE, BlockFace.WALL)).with(FACING, direction.getOpposite()).with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER);; + if(!Objects.requireNonNull(ctx.getPlayer()).isShiftKeyDown()) { + blockState = (BlockState) ((BlockState) this.defaultBlockState().setValue(FACE, AttachFace.WALL)).setValue(FACING, direction.getOpposite()).setValue(WATERLOGGED, ctx.getLevel().getFluidState(ctx.getClickedPos()).getType() == Fluids.WATER);; } else { - blockState = (BlockState) ((BlockState) this.getDefaultState().with(FACE, (ctx.getHitPos().y - (double)ctx.getBlockPos().getY() > 0.5) ? BlockFace.CEILING : BlockFace.FLOOR)).with(FACING, direction.getOpposite()).with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER);; + blockState = (BlockState) ((BlockState) this.defaultBlockState().setValue(FACE, (ctx.getClickLocation().y - (double)ctx.getClickedPos().getY() > 0.5) ? AttachFace.CEILING : AttachFace.FLOOR)).setValue(FACING, direction.getOpposite()).setValue(WATERLOGGED, ctx.getLevel().getFluidState(ctx.getClickedPos()).getType() == Fluids.WATER);; } } - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { return blockState; } } @@ -99,26 +103,26 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { @Override public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if(state.get(FACE) == BlockFace.CEILING){ + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + if(state.getValue(FACE) == AttachFace.CEILING){ return TOP_SHAPE; - } else if (state.get(FACE) == BlockFace.FLOOR){ + } else if (state.getValue(FACE) == AttachFace.FLOOR){ return BOTTOM_SHAPE; } else { - return switch ((Direction) state.get(FACING)) { + return switch ((Direction) state.getValue(FACING)) { default -> NORTH_SHAPE; case SOUTH -> SOUTH_SHAPE; case WEST -> WEST_SHAPE; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ThinBarrelBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ThinBarrelBlock.java index ab6e468bfa..addec188fa 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ThinBarrelBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ThinBarrelBlock.java @@ -1,39 +1,39 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.BarrelBlock; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BarrelBlockEntity; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.text.Text; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.BarrelBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BarrelBlockEntity; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.MiddleEarth; import org.jetbrains.annotations.Nullable; public class ThinBarrelBlock extends BarrelBlock { - public ThinBarrelBlock(Settings settings) { + public ThinBarrelBlock(Properties settings) { super(settings); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return switch (state.get(FACING)){ - case UP,DOWN -> Block.createCuboidShape(1, 0, 1, 15, 16, 15); - case NORTH,SOUTH -> Block.createCuboidShape(1, 0, 0, 15, 14, 16); - case EAST,WEST -> Block.createCuboidShape(0, 0, 1, 16, 14, 15); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return switch (state.getValue(FACING)){ + case UP,DOWN -> Block.box(1, 0, 1, 15, 16, 15); + case NORTH,SOUTH -> Block.box(1, 0, 0, 15, 14, 16); + case EAST,WEST -> Block.box(0, 0, 1, 16, 14, 15); }; } @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new BarrelBlockEntity(pos, state){ @Override - protected Text getContainerName() { - return Text.translatable("container.%s.thin_barrel".formatted(MiddleEarth.MOD_ID)); + protected Component getDefaultName() { + return Component.translatable("container.%s.thin_barrel".formatted(MiddleEarth.MOD_ID)); } }; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ThornyGrowthBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ThornyGrowthBlock.java index 59021092d7..5bc0906a9e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ThornyGrowthBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/ThornyGrowthBlock.java @@ -1,32 +1,26 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.BlockState; -import net.minecraft.block.GlowLichenBlock; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCollisionHandler; -import net.minecraft.entity.LivingEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; -import net.sevenstars.middleearth.MiddleEarthClient; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.GlowLichenBlock; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.utils.DamageablePlantsUtil; public class ThornyGrowthBlock extends GlowLichenBlock { - public ThornyGrowthBlock(Settings settings) { + public ThornyGrowthBlock(Properties settings) { super(settings); } @Override - protected void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler) { - if (entity instanceof LivingEntity livingEntity && world instanceof ServerWorld serverWorld) { - Vec3d movement = livingEntity.isControlledByPlayer() ? livingEntity.getMovement() : livingEntity.getLastRenderPos().subtract(livingEntity.getPos()); - if (movement.horizontalLengthSquared() > 0.0) { - double d = Math.abs(movement.getX()); - double e = Math.abs(movement.getZ()); - if (d >= 0.003000000026077032 || e >= 0.003000000026077032) { - DamageablePlantsUtil.tryDamageEntity(livingEntity, serverWorld, serverWorld.getDamageSources().sweetBerryBush()); - } + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (entity instanceof LivingEntity livingEntity && world instanceof ServerLevel serverWorld) { + double xMovement = Math.abs(livingEntity.getX() - livingEntity.xOld); + double zMovement = Math.abs(livingEntity.getZ() - livingEntity.zOld); + if (xMovement >= 0.003000000026077032 || zMovement >= 0.003000000026077032) { + DamageablePlantsUtil.tryDamageEntity(livingEntity, serverWorld, serverWorld.damageSources().sweetBerryBush()); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/TorchOfOrthancBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/TorchOfOrthancBlock.java index 76af639cef..64ed6942fa 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/TorchOfOrthancBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/TorchOfOrthancBlock.java @@ -1,70 +1,75 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.*; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Items; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.particle.SimpleParticleType; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.state.property.Property; -import net.minecraft.util.ActionResult; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.particles.SimpleParticleType; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.ItemTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.TorchBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class TorchOfOrthancBlock extends TorchBlock { - protected static final VoxelShape SHAPE = Block.createCuboidShape(5.0, 0.0, 5.0, 11.0, 18.0, 11.0); - public static final BooleanProperty LIT = Properties.LIT; + protected static final VoxelShape SHAPE = Block.box(5.0, 0.0, 5.0, 11.0, 18.0, 11.0); + public static final BooleanProperty LIT = BlockStateProperties.LIT; - public TorchOfOrthancBlock(Settings settings, SimpleParticleType particleEffect) { + public TorchOfOrthancBlock(Properties settings, SimpleParticleType particleEffect) { super(particleEffect, settings); - this.setDefaultState((((this.stateManager.getDefaultState().with(LIT, true))))); + this.registerDefaultState((((this.stateDefinition.any().setValue(LIT, true))))); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if(world.isClient){ - return ActionResult.SUCCESS; + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if(world.isClientSide){ + return InteractionResult.SUCCESS; } else { - if(player.getStackInHand(player.getActiveHand()).isOf(Items.FLINT_AND_STEEL) && !state.get(LIT)){ - world.playSound(null, pos, SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 1.0F, 1.5F); - world.setBlockState(pos, state.cycle(LIT)); - } else if (player.getStackInHand(player.getActiveHand()).isIn(ItemTags.SHOVELS) && state.get(LIT)) { - world.playSound(null, pos, SoundEvents.BLOCK_CANDLE_EXTINGUISH, SoundCategory.BLOCKS, 1.0F, 1.0F); - world.setBlockState(pos, state.cycle(LIT)); + if(player.getItemInHand(player.getUsedItemHand()).is(Items.FLINT_AND_STEEL) && !state.getValue(LIT)){ + world.playSound(null, pos, SoundEvents.FIRECHARGE_USE, SoundSource.BLOCKS, 1.0F, 1.5F); + world.setBlockAndUpdate(pos, state.cycle(LIT)); + } else if (player.getItemInHand(player.getUsedItemHand()).is(ItemTags.SHOVELS) && state.getValue(LIT)) { + world.playSound(null, pos, SoundEvents.CANDLE_EXTINGUISH, SoundSource.BLOCKS, 1.0F, 1.0F); + world.setBlockAndUpdate(pos, state.cycle(LIT)); } } - return super.onUse(state, world, pos, player, hit); + return super.useWithoutItem(state, world, pos, player, hit); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(new Property[]{LIT}); } - protected BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } @Override - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { - if(state.get(LIT)){ + public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { + if(state.getValue(LIT)){ double d = (double)pos.getX() + 0.5; double e = (double)pos.getY() + 1.4; double f = (double)pos.getZ() + 0.5; - world.addParticleClient(ParticleTypes.SMOKE, d, e, f, 0.0, 0.0, 0.0); + world.addParticle(ParticleTypes.SMOKE, d, e, f, 0.0, 0.0, 0.0); } } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WateringCanBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WateringCanBlock.java index c44ea6f7fd..396a169a60 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WateringCanBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WateringCanBlock.java @@ -1,100 +1,106 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; -import net.minecraft.block.*; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; -public class WateringCanBlock extends Block implements Waterloggable { - public static final EnumProperty FACING = HorizontalFacingBlock.FACING; - public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; +public class WateringCanBlock extends Block implements SimpleWaterloggedBlock { + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - public WateringCanBlock(Settings settings) { + public WateringCanBlock(Properties settings) { super(settings); - setDefaultState(getDefaultState().with(FACING, Direction.NORTH).with(WATERLOGGED, false)); + registerDefaultState(defaultBlockState().setValue(FACING, Direction.NORTH).setValue(WATERLOGGED, false)); } - protected void appendProperties(StateManager.Builder builder) { - builder.add(Properties.HORIZONTAL_FACING, WATERLOGGED); + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(BlockStateProperties.HORIZONTAL_FACING, WATERLOGGED); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()).with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()).setValue(WATERLOGGED, ctx.getLevel().getFluidState(ctx.getClickedPos()).getType() == Fluids.WATER); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if (player.getEquippedStack(EquipmentSlot.MAINHAND).isEmpty() && !player.isInCreativeMode()){ - world.setBlockState(pos, Blocks.AIR.getDefaultState()); - player.equipStack(EquipmentSlot.MAINHAND, new ItemStack(ModDecorativeBlocks.WATERING_CAN.asItem())); - world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ENTITY_CHICKEN_EGG, SoundCategory.BLOCKS, 0.5f, world.random.nextFloat() * 0.1f - 1.0f); - return ActionResult.PASS; + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (player.getMainHandItem().isEmpty() && !player.hasInfiniteMaterials()){ + world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); + player.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(ModDecorativeBlocks.WATERING_CAN.asItem())); + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.CHICKEN_EGG, SoundSource.BLOCKS, 0.5f, world.random.nextFloat() * 0.1f - 1.0f); + return InteractionResult.PASS; } else{ - return super.onUse(state, world, pos, player, hit); + return super.useWithoutItem(state, world, pos, player, hit); } } @Override public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(3, 0, 3, 13, 14, 13); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(3, 0, 3, 13, 14, 13); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WebbingBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WebbingBlock.java index 67c2c98763..8465f313c4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WebbingBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WebbingBlock.java @@ -1,85 +1,86 @@ package net.sevenstars.middleearth.block.special; import com.mojang.serialization.MapCodec; -import net.minecraft.block.*; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCollisionHandler; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.block.WireOrientation; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.MultifaceBlock; +import net.minecraft.world.level.block.MultifaceSpreader; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; -public class WebbingBlock extends MultifaceGrowthBlock { - public static final BooleanProperty PERSISTENT = Properties.PERSISTENT; - public static final MapCodec CODEC = createCodec(WebbingBlock::new); - private final MultifaceGrower grower = new MultifaceGrower(this); +public class WebbingBlock extends MultifaceBlock { + public static final BooleanProperty PERSISTENT = BlockStateProperties.PERSISTENT; + public static final MapCodec CODEC = simpleCodec(WebbingBlock::new); + private final MultifaceSpreader grower = new MultifaceSpreader(this); - public WebbingBlock(Settings settings) { + public WebbingBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(PERSISTENT, true)); + this.registerDefaultState(this.defaultBlockState().setValue(PERSISTENT, true)); } @Override - public MapCodec getCodec() { + public MapCodec codec() { return CODEC; } @Override - public MultifaceGrower getGrower() { + public MultifaceSpreader getSpreader() { return this.grower; } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(PERSISTENT); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } - protected void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler) { - Vec3d vec3d = new Vec3d(0.75, 0.50, 0.75); + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + Vec3 vec3d = new Vec3(0.75, 0.50, 0.75); if (entity instanceof LivingEntity livingEntity) { - if (livingEntity.hasStatusEffect(StatusEffects.WEAVING)) { - vec3d = new Vec3d(0.90, 0.75, 0.90); + if (livingEntity.hasEffect(MobEffects.WEAVING)) { + vec3d = new Vec3(0.90, 0.75, 0.90); } } - entity.slowMovement(state, vec3d); + entity.makeStuckInBlock(state, vec3d); } @Override - protected void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, @Nullable WireOrientation wireOrientation, boolean notify) { - if (!world.isClient) { + protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) { + if (!world.isClientSide) { for (Direction direction : Direction.values()) { - if (world.getFluidState(pos.offset(direction)).isIn(net.minecraft.registry.tag.FluidTags.WATER)) { - world.breakBlock(pos, true); + if (world.getFluidState(pos.relative(direction)).is(net.minecraft.tags.FluidTags.WATER)) { + world.destroyBlock(pos, true); return; } } } - super.neighborUpdate(state, world, pos, sourceBlock, wireOrientation, notify); + super.neighborChanged(state, world, pos, sourceBlock, sourcePos, notify); } - protected boolean hasRandomTicks(BlockState state) { - return !(Boolean)state.get(PERSISTENT); + protected boolean isRandomlyTicking(BlockState state) { + return !(Boolean)state.getValue(PERSISTENT); } - protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { if (this.shouldDecay(state)) { world.removeBlock(pos, false); } } protected boolean shouldDecay(BlockState state) { - return !(Boolean)state.get(PERSISTENT); + return !(Boolean)state.getValue(PERSISTENT); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodBenchBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodBenchBlock.java index 6db220349a..a8a1e6a75e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodBenchBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodBenchBlock.java @@ -1,26 +1,26 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.Waterloggable; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; -public class WoodBenchBlock extends SeatBlock implements Waterloggable { +public class WoodBenchBlock extends SeatBlock implements SimpleWaterloggedBlock { - public WoodBenchBlock(Settings settings) { + public WoodBenchBlock(Properties settings) { super(settings); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return switch(state.get(FACING)) { - case WEST, EAST -> Block.createCuboidShape(2, 0, 0, 14, 9, 16); - case SOUTH, NORTH -> Block.createCuboidShape(0, 0, 2, 16, 9, 14); - default -> VoxelShapes.cuboid(1,1,1,1,1,1); + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return switch(state.getValue(FACING)) { + case WEST, EAST -> Block.box(2, 0, 0, 14, 9, 16); + case SOUTH, NORTH -> Block.box(0, 0, 2, 16, 9, 14); + default -> Shapes.box(1,1,1,1,1,1); }; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodChairBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodChairBlock.java index a3d318a882..ebf341de45 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodChairBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodChairBlock.java @@ -1,28 +1,28 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.Waterloggable; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; -public class WoodChairBlock extends SeatBlock implements Waterloggable { +public class WoodChairBlock extends SeatBlock implements SimpleWaterloggedBlock { - public WoodChairBlock(Settings settings) { + public WoodChairBlock(Properties settings) { super(settings); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return switch (state.get(FACING)){ - default -> VoxelShapes.combineAndSimplify(Block.createCuboidShape(2, 0, 4, 14, 9, 16), Block.createCuboidShape(2, 9, 13, 14, 16, 16), BooleanBiFunction.OR); - case SOUTH -> VoxelShapes.combineAndSimplify(Block.createCuboidShape(2, 0, 0, 14, 9, 12), Block.createCuboidShape(2, 9, 0, 14, 16, 3), BooleanBiFunction.OR); - case EAST -> VoxelShapes.combineAndSimplify(Block.createCuboidShape(0, 0, 2, 12, 9, 14), Block.createCuboidShape(0, 9, 2, 3, 16, 14), BooleanBiFunction.OR); - case WEST -> VoxelShapes.combineAndSimplify(Block.createCuboidShape(4, 0, 2, 16, 9, 14), Block.createCuboidShape(13, 9, 2, 16, 16, 14), BooleanBiFunction.OR); + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return switch (state.getValue(FACING)){ + default -> Shapes.join(Block.box(2, 0, 4, 14, 9, 16), Block.box(2, 9, 13, 14, 16, 16), BooleanOp.OR); + case SOUTH -> Shapes.join(Block.box(2, 0, 0, 14, 9, 12), Block.box(2, 9, 0, 14, 16, 3), BooleanOp.OR); + case EAST -> Shapes.join(Block.box(0, 0, 2, 12, 9, 14), Block.box(0, 9, 2, 3, 16, 14), BooleanOp.OR); + case WEST -> Shapes.join(Block.box(4, 0, 2, 16, 9, 14), Block.box(13, 9, 2, 16, 16, 14), BooleanOp.OR); }; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodStoolBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodStoolBlock.java index b7e2e3d178..9b79a00791 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodStoolBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodStoolBlock.java @@ -1,21 +1,21 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.Waterloggable; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; -public class WoodStoolBlock extends SeatBlock implements Waterloggable { +public class WoodStoolBlock extends SeatBlock implements SimpleWaterloggedBlock { - public WoodStoolBlock(Settings settings) { + public WoodStoolBlock(Properties settings) { super(settings); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(2, 0, 2, 14, 9, 14); + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(2, 0, 2, 14, 9, 14); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodTableBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodTableBlock.java index 33785e9607..63dcc111c8 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodTableBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodTableBlock.java @@ -1,69 +1,68 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.Waterloggable; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; import org.jetbrains.annotations.Nullable; import java.util.stream.Stream; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; -public class WoodTableBlock extends Block implements Waterloggable { - public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; +public class WoodTableBlock extends Block implements SimpleWaterloggedBlock { + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - public WoodTableBlock(Settings settings) { + public WoodTableBlock(Properties settings) { super(settings); - setDefaultState(getDefaultState().with(WATERLOGGED, false)); + registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false)); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(WATERLOGGED); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState().setValue(WATERLOGGED, ctx.getLevel().getFluidState(ctx.getClickedPos()).getType() == Fluids.WATER); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return Stream.of( - Block.createCuboidShape(13, 0, 0, 16, 13, 3), - Block.createCuboidShape(0, 0, 0, 3, 13, 3), - Block.createCuboidShape(0, 0, 13, 3, 13, 16), - Block.createCuboidShape(13, 0, 13, 16, 13, 16), - Block.createCuboidShape(0, 13, 0, 16, 16, 16) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(13, 0, 0, 16, 13, 3), + Block.box(0, 0, 0, 3, 13, 3), + Block.box(0, 0, 13, 3, 13, 16), + Block.box(13, 0, 13, 16, 13, 16), + Block.box(0, 13, 0, 16, 16, 16) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodenBucketBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodenBucketBlock.java index 374b464132..8ee6a27668 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodenBucketBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/WoodenBucketBlock.java @@ -1,90 +1,95 @@ package net.sevenstars.middleearth.block.special; -import net.minecraft.block.*; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import org.jetbrains.annotations.Nullable; -public class WoodenBucketBlock extends Block implements Waterloggable { - private static final EnumProperty HORIZONTAL_FACING= Properties.HORIZONTAL_FACING; - public static final BooleanProperty HANGING = Properties.HANGING; - public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; +public class WoodenBucketBlock extends Block implements SimpleWaterloggedBlock { + private static final EnumProperty HORIZONTAL_FACING= BlockStateProperties.HORIZONTAL_FACING; + public static final BooleanProperty HANGING = BlockStateProperties.HANGING; + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - public WoodenBucketBlock(Settings settings) { + public WoodenBucketBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(HORIZONTAL_FACING, Direction.NORTH).with(HANGING, false).with(WATERLOGGED, false)); + this.registerDefaultState(this.defaultBlockState().setValue(HORIZONTAL_FACING, Direction.NORTH).setValue(HANGING, false).setValue(WATERLOGGED, false)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(HORIZONTAL_FACING, HANGING, WATERLOGGED); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(HORIZONTAL_FACING, rotation.rotate(state.get(HORIZONTAL_FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(HORIZONTAL_FACING, rotation.rotate(state.getValue(HORIZONTAL_FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(HORIZONTAL_FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(HORIZONTAL_FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if (player.getStackInHand(player.getActiveHand()).isEmpty() && !player.isInCreativeMode()){ - world.setBlockState(pos, Blocks.AIR.getDefaultState()); - player.equipStack(EquipmentSlot.MAINHAND, new ItemStack(ModDecorativeBlocks.WOODEN_BUCKET.asItem())); - world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ENTITY_CHICKEN_EGG, SoundCategory.BLOCKS, 0.5f, world.random.nextFloat() * 0.1f - 1.0f); - return ActionResult.PASS; + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (player.getItemInHand(player.getUsedItemHand()).isEmpty() && !player.hasInfiniteMaterials()){ + world.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); + player.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(ModDecorativeBlocks.WOODEN_BUCKET.asItem())); + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.CHICKEN_EGG, SoundSource.BLOCKS, 0.5f, world.random.nextFloat() * 0.1f - 1.0f); + return InteractionResult.PASS; } else{ - return super.onUse(state, world, pos, player, hit); + return super.useWithoutItem(state, world, pos, player, hit); } } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; if (direction.getAxis() == Direction.Axis.Y) { - return this.getDefaultState().with(HANGING, direction == Direction.UP).with(HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing()).with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); + return this.defaultBlockState().setValue(HANGING, direction == Direction.UP).setValue(HORIZONTAL_FACING, ctx.getHorizontalDirection()).setValue(WATERLOGGED, ctx.getLevel().getFluidState(ctx.getClickedPos()).getType() == Fluids.WATER); } } @@ -93,28 +98,28 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { @Override public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if(state.get(HANGING)){ - return Block.createCuboidShape(4, 0, 4, 12, 16, 12); + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + if(state.getValue(HANGING)){ + return Block.box(4, 0, 4, 12, 16, 12); } else { - return Block.createCuboidShape(4, 0, 4, 12, 10, 12); + return Block.box(4, 0, 4, 12, 10, 12); } } protected Direction attachedDirection(BlockState state) { - return state.get(HANGING) ? Direction.DOWN : Direction.UP; + return state.getValue(HANGING) ? Direction.DOWN : Direction.UP; } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return attachedDirection(state).getOpposite() == direction && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return attachedDirection(state).getOpposite() == direction && !state.canSurvive(world, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/artefact/arkenstone/ArkenstoneBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/artefact/arkenstone/ArkenstoneBlock.java index 0be8a3a03b..03a4861be8 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/artefact/arkenstone/ArkenstoneBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/artefact/arkenstone/ArkenstoneBlock.java @@ -1,20 +1,20 @@ package net.sevenstars.middleearth.block.special.artefact.arkenstone; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class ArkenstoneBlock extends Block { - public ArkenstoneBlock(Settings settings) { + public ArkenstoneBlock(Properties settings) { super(settings); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(6, 0.5, 6, 10, 4.5, 10); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(6, 0.5, 6, 10, 4.5, 10); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/artefact/arkenstone/ArkenstoneWallBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/artefact/arkenstone/ArkenstoneWallBlock.java index d983ed645c..ffba973ebe 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/artefact/arkenstone/ArkenstoneWallBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/artefact/arkenstone/ArkenstoneWallBlock.java @@ -1,45 +1,50 @@ package net.sevenstars.middleearth.block.special.artefact.arkenstone; import com.mojang.serialization.MapCodec; -import net.minecraft.block.*; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; - -public class ArkenstoneWallBlock extends HorizontalFacingBlock { - - public ArkenstoneWallBlock(Settings settings) { +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +public class ArkenstoneWallBlock extends HorizontalDirectionalBlock { + + public ArkenstoneWallBlock(Properties settings) { super(settings); - this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH)); + this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.NORTH)); } @Override - protected MapCodec getCodec() { - return ArkenstoneWallBlock.createCodec(ArkenstoneWallBlock::new); + protected MapCodec codec() { + return ArkenstoneWallBlock.simpleCodec(ArkenstoneWallBlock::new); } - public BlockState getPlacementState(ItemPlacementContext ctx) { - return (BlockState)((BlockState)this.getDefaultState().with(FACING, ctx.getHorizontalPlayerFacing())); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return (BlockState)((BlockState)this.defaultBlockState().setValue(FACING, ctx.getHorizontalDirection())); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); } - protected BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return switch (state.get(FACING)){ - default -> Block.createCuboidShape(6, 6, 0, 10, 10, 4); - case SOUTH -> Block.createCuboidShape(6, 6, 12, 10, 10, 16); - case EAST -> Block.createCuboidShape(12, 6, 6, 16, 10, 10); - case WEST -> Block.createCuboidShape(0, 6, 6, 4, 10, 10); + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return switch (state.getValue(FACING)){ + default -> Block.box(6, 6, 0, 10, 10, 4); + case SOUTH -> Block.box(6, 6, 12, 10, 10, 16); + case EAST -> Block.box(12, 6, 6, 16, 10, 10); + case WEST -> Block.box(0, 6, 6, 4, 10, 10); }; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/artisantable/ArtisanTable.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/artisantable/ArtisanTable.java index 4f2cf82ddd..ed351b1d47 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/artisantable/ArtisanTable.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/artisantable/ArtisanTable.java @@ -1,32 +1,40 @@ package net.sevenstars.middleearth.block.special.artisantable; import com.mojang.serialization.MapCodec; -import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; -import net.minecraft.block.*; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.network.chat.Component; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerLevelAccess; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.middleearth.block.utils.ExtendedMenuProviderME; import net.sevenstars.middleearth.gui.artisantable.ArtisanTableScreenHandler; import net.sevenstars.middleearth.resources.datas.common.DispositionType; import net.sevenstars.middleearth.resources.persistent_datas.PlayerDataService; @@ -34,80 +42,85 @@ import java.util.stream.Stream; -public class ArtisanTable extends HorizontalFacingBlock { - public static final EnumProperty PART = EnumProperty.of("part", ArtisanTablePart.class); - private static final Text TITLE = Text.translatable("container.%s.artisan_table".formatted(MiddleEarth.MOD_ID)); +public class ArtisanTable extends HorizontalDirectionalBlock { + public static final EnumProperty PART = EnumProperty.create("part", ArtisanTablePart.class); + private static final Component TITLE = Component.translatable("container.%s.artisan_table".formatted(MiddleEarth.MOD_ID)); - public ArtisanTable(Settings settings) { + public ArtisanTable(Properties settings) { super(settings); - this.setDefaultState(this.stateManager.getDefaultState().with(PART, ArtisanTablePart.LEFT).with(FACING, Direction.NORTH)); + this.registerDefaultState(this.stateDefinition.any().setValue(PART, ArtisanTablePart.LEFT).setValue(FACING, Direction.NORTH)); } @Override - protected MapCodec getCodec() { - return createCodec(ArtisanTable::new); + protected MapCodec codec() { + return simpleCodec(ArtisanTable::new); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if(!world.isClient) { - player.openHandledScreen(new ExtendedScreenHandlerFactory<>() { + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if(!world.isClientSide) { + ExtendedMenuProviderME.open(player, new ExtendedMenuProviderME() { @Override - public Object getScreenOpeningData(ServerPlayerEntity player) { + public void writeOpeningData(RegistryFriendlyByteBuf buffer) { + ServerPlayer serverPlayer = (ServerPlayer) player; DispositionType dispositionType = PlayerDataService.getPlayerDisposition(player, world); if (dispositionType == null){ dispositionType = DispositionType.NEUTRAL; } - - return dispositionType + "/" + player.isCreative(); + buffer.writeUtf(dispositionType + "/" + serverPlayer.isCreative()); } @Override - public Text getDisplayName() { + public Component getDisplayName() { return TITLE; } @Nullable @Override - public ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) { + public AbstractContainerMenu createMenu(int syncId, Inventory playerInventory, Player player) { DispositionType dispositionType = PlayerDataService.getPlayerDisposition(player, world); if (dispositionType == null){ dispositionType = DispositionType.NEUTRAL; } - return new ArtisanTableScreenHandler(syncId, playerInventory, dispositionType + "/" + player.isCreative()); + return new ArtisanTableScreenHandler( + syncId, + playerInventory, + ContainerLevelAccess.create(world, pos), + dispositionType + "/" + player.isCreative() + ); } }); } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (direction == getDirectionTowardsOtherPart((ArtisanTablePart)state.get(PART), (Direction)state.get(FACING).rotateYClockwise())) { - return neighborState.isOf(this) && neighborState.get(PART) != state.get(PART) ? (BlockState)state : Blocks.AIR.getDefaultState(); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (direction == getDirectionTowardsOtherPart((ArtisanTablePart)state.getValue(PART), (Direction)state.getValue(FACING).getClockWise())) { + return neighborState.is(this) && neighborState.getValue(PART) != state.getValue(PART) ? (BlockState)state : Blocks.AIR.defaultBlockState(); } else { - return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return super.updateShape(state, direction, neighborState, world, pos, neighborPos); } } @Override - public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { - ArtisanTablePart tablePart = (ArtisanTablePart)state.get(PART); - ArtisanTablePart tablePartOpposite = (ArtisanTablePart)state.get(PART).getOpposite(state.get(PART)); + public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { + ArtisanTablePart tablePart = (ArtisanTablePart)state.getValue(PART); + ArtisanTablePart tablePartOpposite = (ArtisanTablePart)state.getValue(PART).getOpposite(state.getValue(PART)); - if (!world.isClient && (player.isCreative() || !player.canHarvest(state))) { + if (!world.isClientSide && (player.isCreative() || !player.hasCorrectToolForDrops(state))) { if (tablePart == ArtisanTablePart.RIGHT) { - BlockPos blockPos = pos.offset(state.get(FACING).rotateYCounterclockwise()); + BlockPos blockPos = pos.relative(state.getValue(FACING).getCounterClockWise()); BlockState blockState = world.getBlockState(blockPos); - if (blockState.isOf(state.getBlock()) && blockState.get(PART) == ArtisanTablePart.LEFT) { - world.breakBlock(blockPos, false); - world.syncWorldEvent(player, 2001, blockPos, Block.getRawIdFromState(blockState)); + if (blockState.is(state.getBlock()) && blockState.getValue(PART) == ArtisanTablePart.LEFT) { + world.destroyBlock(blockPos, false); + world.levelEvent(player, 2001, blockPos, Block.getId(blockState)); } } } - return super.onBreak(world, pos, state, player); + return super.playerWillDestroy(world, pos, state, player); } private static Direction getDirectionTowardsOtherPart(ArtisanTablePart part, Direction direction) { @@ -115,90 +128,90 @@ private static Direction getDirectionTowardsOtherPart(ArtisanTablePart part, Dir } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction direction = ctx.getHorizontalPlayerFacing(); - BlockPos blockPos = ctx.getBlockPos(); - BlockPos blockPos2 = blockPos.offset(direction.rotateYClockwise()); - World world = ctx.getWorld(); - return world.getBlockState(blockPos2).canReplace(ctx) && world.getWorldBorder().contains(blockPos2) ? (BlockState)this.getDefaultState().with(FACING, direction).with(PART, ArtisanTablePart.LEFT) : null; + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction direction = ctx.getHorizontalDirection(); + BlockPos blockPos = ctx.getClickedPos(); + BlockPos blockPos2 = blockPos.relative(direction.getClockWise()); + Level world = ctx.getLevel(); + return world.getBlockState(blockPos2).canBeReplaced(ctx) && world.getWorldBorder().isWithinBounds(blockPos2) ? (BlockState)this.defaultBlockState().setValue(FACING, direction).setValue(PART, ArtisanTablePart.LEFT) : null; } - public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { - super.onPlaced(world, pos, state, placer, itemStack); - if (!world.isClient) { - BlockPos blockPos = pos.offset((Direction)state.get(FACING).rotateYClockwise()); - world.setBlockState(blockPos, (BlockState)state.with(PART, ArtisanTablePart.RIGHT), 3); - world.updateNeighbors(pos, Blocks.AIR); - state.updateNeighbors(world, pos, 3); + public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { + super.setPlacedBy(world, pos, state, placer, itemStack); + if (!world.isClientSide) { + BlockPos blockPos = pos.relative((Direction)state.getValue(FACING).getClockWise()); + world.setBlock(blockPos, (BlockState)state.setValue(PART, ArtisanTablePart.RIGHT), 3); + world.updateNeighborsAt(pos, Blocks.AIR); + state.updateNeighbourShapes(world, pos, 3); } } - public long getRenderingSeed(BlockState state, BlockPos pos) { - BlockPos blockPos = pos.offset((Direction)state.get(FACING), state.get(PART) == ArtisanTablePart.RIGHT ? 0 : 1); - return MathHelper.hashCode(blockPos.getX(), pos.getY(), blockPos.getZ()); + public long getSeed(BlockState state, BlockPos pos) { + BlockPos blockPos = pos.relative((Direction)state.getValue(FACING), state.getValue(PART) == ArtisanTablePart.RIGHT ? 0 : 1); + return Mth.getSeed(blockPos.getX(), pos.getY(), blockPos.getZ()); } @Override - public BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + public RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } - protected void appendProperties(StateManager.Builder builder) { - super.appendProperties(builder); + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + super.createBlockStateDefinition(builder); builder.add(FACING, PART); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return switch (state.get(PART)){ + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return switch (state.getValue(PART)){ case LEFT -> - switch (state.get(FACING)){ + switch (state.getValue(FACING)){ case DOWN, UP -> null; case NORTH -> Stream.of( - Block.createCuboidShape(1, 0, 1, 4, 12, 15), - Block.createCuboidShape(0, 12, 0, 16, 16, 16), - Block.createCuboidShape(4, 4, 7, 16, 8, 9) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(1, 0, 1, 4, 12, 15), + Block.box(0, 12, 0, 16, 16, 16), + Block.box(4, 4, 7, 16, 8, 9) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); case SOUTH -> Stream.of( - Block.createCuboidShape(12, 0, 1, 15, 12, 15), - Block.createCuboidShape(0, 12, 0, 16, 16, 16), - Block.createCuboidShape(0, 4, 7, 12, 8, 9) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(12, 0, 1, 15, 12, 15), + Block.box(0, 12, 0, 16, 16, 16), + Block.box(0, 4, 7, 12, 8, 9) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); case WEST -> Stream.of( - Block.createCuboidShape(1, 0, 12, 15, 12, 15), - Block.createCuboidShape(0, 12, 0, 16, 16, 16), - Block.createCuboidShape(7, 4, 0, 9, 8, 12) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(1, 0, 12, 15, 12, 15), + Block.box(0, 12, 0, 16, 16, 16), + Block.box(7, 4, 0, 9, 8, 12) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); case EAST -> Stream.of( - Block.createCuboidShape(1, 0, 1, 15, 12, 4), - Block.createCuboidShape(0, 12, 0, 16, 16, 16), - Block.createCuboidShape(7, 4, 4, 9, 8, 16) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(1, 0, 1, 15, 12, 4), + Block.box(0, 12, 0, 16, 16, 16), + Block.box(7, 4, 4, 9, 8, 16) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); }; case RIGHT -> - switch (state.get(FACING)) { + switch (state.getValue(FACING)) { case DOWN -> null; case UP -> null; case NORTH -> Stream.of( - Block.createCuboidShape(12, 0, 1, 15, 12, 15), - Block.createCuboidShape(0, 12, 0, 16, 16, 16), - Block.createCuboidShape(0, 4, 7, 12, 8, 9) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(12, 0, 1, 15, 12, 15), + Block.box(0, 12, 0, 16, 16, 16), + Block.box(0, 4, 7, 12, 8, 9) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); case SOUTH -> Stream.of( - Block.createCuboidShape(1, 0, 1, 4, 12, 15), - Block.createCuboidShape(0, 12, 0, 16, 16, 16), - Block.createCuboidShape(4, 4, 7, 16, 8, 9) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(1, 0, 1, 4, 12, 15), + Block.box(0, 12, 0, 16, 16, 16), + Block.box(4, 4, 7, 16, 8, 9) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); case WEST -> Stream.of( - Block.createCuboidShape(1, 0, 1, 15, 12, 4), - Block.createCuboidShape(0, 12, 0, 16, 16, 16), - Block.createCuboidShape(7, 4, 4, 9, 8, 16) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(1, 0, 1, 15, 12, 4), + Block.box(0, 12, 0, 16, 16, 16), + Block.box(7, 4, 4, 9, 8, 16) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); case EAST -> Stream.of( - Block.createCuboidShape(1, 0, 12, 15, 12, 15), - Block.createCuboidShape(0, 12, 0, 16, 16, 16), - Block.createCuboidShape(7, 4, 0, 9, 8, 12) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(1, 0, 12, 15, 12, 15), + Block.box(0, 12, 0, 16, 16, 16), + Block.box(7, 4, 0, 9, 8, 12) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); }; }; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/artisantable/ArtisanTablePart.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/artisantable/ArtisanTablePart.java index 65b69ae77a..a8ac5449e7 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/artisantable/ArtisanTablePart.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/artisantable/ArtisanTablePart.java @@ -1,8 +1,8 @@ package net.sevenstars.middleearth.block.special.artisantable; -import net.minecraft.util.StringIdentifiable; +import net.minecraft.util.StringRepresentable; -public enum ArtisanTablePart implements StringIdentifiable { +public enum ArtisanTablePart implements StringRepresentable { LEFT("left"), RIGHT("right"); @@ -16,7 +16,7 @@ public String toString() { return this.name; } - public String asString() { + public String getSerializedName() { return this.name; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/beds/CustomBedBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/beds/CustomBedBlock.java index 815cfeae43..f6a8a8acb4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/beds/CustomBedBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/beds/CustomBedBlock.java @@ -1,26 +1,26 @@ package net.sevenstars.middleearth.block.special.beds; +import net.minecraft.core.BlockPos; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.level.block.BedBlock; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.BedBlock; -import net.minecraft.block.BlockRenderType; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.util.DyeColor; -import net.minecraft.util.math.BlockPos; public class CustomBedBlock extends BedBlock { - public CustomBedBlock(DyeColor color, Settings settings) { + public CustomBedBlock(DyeColor color, Properties settings) { super(color, settings); } @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new CustomBedBlockEntity(ModBlockEntities.BED, pos, state); } @Override - protected BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/beds/CustomBedBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/beds/CustomBedBlockEntity.java index 9ae80e6a36..a3b8cee974 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/beds/CustomBedBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/beds/CustomBedBlockEntity.java @@ -1,10 +1,10 @@ package net.sevenstars.middleearth.block.special.beds; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.util.math.BlockPos; public class CustomBedBlockEntity extends BlockEntity { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/bellows/BellowsBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/bellows/BellowsBlock.java index 470505806b..21c32036dd 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/bellows/BellowsBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/bellows/BellowsBlock.java @@ -1,132 +1,137 @@ package net.sevenstars.middleearth.block.special.bellows; import com.mojang.serialization.MapCodec; -import net.minecraft.entity.EntityCollisionHandler; -import net.minecraft.state.property.EnumProperty; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.*; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; -public class BellowsBlock extends BlockWithEntity { - public static final EnumProperty FACING = Properties.HORIZONTAL_FACING; +public class BellowsBlock extends BaseEntityBlock { + public static final EnumProperty FACING = BlockStateProperties.HORIZONTAL_FACING; - public BellowsBlock(Settings settings) { + public BellowsBlock(Properties settings) { super(settings); - this.setDefaultState(((this.stateManager.getDefaultState()).with(FACING, Direction.NORTH))); + this.registerDefaultState(((this.stateDefinition.any()).setValue(FACING, Direction.NORTH))); } @Override - protected MapCodec getCodec() { - return createCodec(BellowsBlock::new); + protected MapCodec codec() { + return simpleCodec(BellowsBlock::new); } @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new BellowsBlockEntity(pos, state); } @Nullable @Override - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { + public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { return BellowsBlock.validateTicker(world, type, ModBlockEntities.BELLOWS); } @Nullable - protected static BlockEntityTicker validateTicker(World world, BlockEntityType givenType, BlockEntityType expectedType) { - return world.isClient - ? BellowsBlock.validateTicker(givenType, expectedType, BellowsBlockEntity::clientTick) - : BellowsBlock.validateTicker(givenType, expectedType, BellowsBlockEntity::serverTick); + protected static BlockEntityTicker validateTicker(Level world, BlockEntityType givenType, BlockEntityType expectedType) { + return world.isClientSide + ? BellowsBlock.createTickerHelper(givenType, expectedType, BellowsBlockEntity::clientTick) + : BellowsBlock.createTickerHelper(givenType, expectedType, BellowsBlockEntity::serverTick); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(3, 0, 3, 13, 7, 13); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(3, 0, 3, 13, 7, 13); } @Override - protected BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - player.swingHand(player.getActiveHand()); - return this.pump(world, pos, state, player) ? ActionResult.SUCCESS : ActionResult.CONSUME; + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + player.swing(player.getUsedItemHand()); + return this.pump(world, pos, state, player) ? InteractionResult.SUCCESS : InteractionResult.CONSUME; } @Override - protected void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler) { - if(!world.isClient){ - if (entity.getVelocity().y < -0.1f && entity instanceof LivingEntity) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if(!world.isClientSide){ + if (entity.getDeltaMovement().y < -0.1f && entity instanceof LivingEntity) { this.pump(world, pos, state, entity); } } - super.onEntityCollision(state, world, pos, entity, handler); + super.entityInside(state, world, pos, entity); } - public void onEntityLand(BlockView world, Entity entity) { - if (entity.bypassesLandingEffects()) { - super.onEntityLand(world, entity); + @Override + public void updateEntityAfterFallOn(BlockGetter world, Entity entity) { + if (entity.isSuppressingBounce()) { + super.updateEntityAfterFallOn(world, entity); } else { this.bounceEntity(entity); } } private void bounceEntity(Entity entity) { - Vec3d vec3d = entity.getVelocity(); + Vec3 vec3d = entity.getDeltaMovement(); if (vec3d.y < 0.0) { double d = entity instanceof LivingEntity ? 1.0 : 0.8; - entity.setVelocity(vec3d.x, -vec3d.y * 0.6 * d, vec3d.z); + entity.setDeltaMovement(vec3d.x, -vec3d.y * 0.6 * d, vec3d.z); } } - public boolean pump(World world, BlockPos pos, BlockState state, Entity entity) { - if (world.isClient) return false; + public boolean pump(Level world, BlockPos pos, BlockState state, Entity entity) { + if (world.isClientSide) return false; BlockEntity blockEntity = world.getBlockEntity(pos); if(blockEntity instanceof BellowsBlockEntity bellowsBlockEntity){ - return bellowsBlockEntity.tryPumpingBellow(state, world, pos, bellowsBlockEntity, world.getBlockState(pos).get(FACING), entity); + return bellowsBlockEntity.tryPumpingBellow(state, world, pos, bellowsBlockEntity, world.getBlockState(pos).getValue(FACING), entity); } return false; } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - return state.rotate(mirror.getRotation(state.get(FACING))); + public BlockState mirror(BlockState state, Mirror mirror) { + return state.rotate(mirror.getRotation(state.getValue(FACING))); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(FACING, ctx.getHorizontalPlayerFacing()); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState().setValue(FACING, ctx.getHorizontalDirection()); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/bellows/BellowsBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/bellows/BellowsBlockEntity.java index d978bcd7a2..c2bce70747 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/bellows/BellowsBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/bellows/BellowsBlockEntity.java @@ -1,28 +1,27 @@ package net.sevenstars.middleearth.block.special.bellows; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.util.Identifier; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Vec3i; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.TagKey; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import net.sevenstars.middleearth.block.special.forge.ForgeBlockEntity; import net.sevenstars.middleearth.sound.SoundsME; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.network.listener.ClientPlayPacketListener; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.sound.SoundCategory; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.Vec3i; -import net.minecraft.world.World; -import net.minecraft.world.event.GameEvent; import org.jetbrains.annotations.Nullable; import java.util.Random; @@ -46,23 +45,23 @@ public BellowsBlockEntity(BlockPos pos, BlockState state) { @Nullable @Override - public Packet toUpdatePacket() { - return BlockEntityUpdateS2CPacket.create(this); + public Packet getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); } - public boolean tryPumpingBellow(BlockState state, World world, BlockPos pos, BellowsBlockEntity blockEntity, Direction direction, Entity entity) { + public boolean tryPumpingBellow(BlockState state, Level world, BlockPos pos, BellowsBlockEntity blockEntity, Direction direction, Entity entity) { if(blockEntity.animationProgress == 0) { - if (!world.isClient){ + if (!world.isClientSide){ if(blockEntity.activate(direction)){ - BlockPos forgePos = pos.offset(state.get(BellowsBlock.FACING)); - if(world.getBlockState(forgePos).isIn(TagKey.of(RegistryKeys.BLOCK, MiddleEarth.of("forge")))) { + BlockPos forgePos = pos.relative(state.getValue(BellowsBlock.FACING)); + if(world.getBlockState(forgePos).is(TagKey.create(Registries.BLOCK, MiddleEarth.of("forge")))) { ForgeBlockEntity forgeBlockEntity = (ForgeBlockEntity) world.getBlockEntity(forgePos); if(forgeBlockEntity != null) { forgeBlockEntity.bellowsBoost(); } } - world.playSound((PlayerEntity)null, pos, SoundsME.BELLOWS_PUSH, SoundCategory.BLOCKS, 2.0F, 1.0F); - world.emitGameEvent(entity, GameEvent.BLOCK_CHANGE, pos); + world.playSound((Player)null, pos, SoundsME.BELLOWS_PUSH, SoundSource.BLOCKS, 2.0F, 1.0F); + world.gameEvent(entity, GameEvent.BLOCK_CHANGE, pos); return true; } } @@ -74,9 +73,9 @@ public boolean activate(Direction direction) { if (!this.pumping) { this.pumping = true; this.animationProgress = 0; - if(this.world != null){ - BlockPos blockPos = this.getPos(); - this.world.addSyncedBlockEvent(blockPos, this.getCachedState().getBlock(), 1, direction.getIndex()); + if(this.level != null){ + BlockPos blockPos = this.getBlockPos(); + this.level.blockEvent(blockPos, this.getBlockState().getBlock(), 1, direction.get3DDataValue()); } return true; } @@ -85,13 +84,13 @@ public boolean activate(Direction direction) { } @Override - public boolean onSyncedBlockEvent(int type, int data) { + public boolean triggerEvent(int type, int data) { if (type == 1) { this.pumping = true; this.animationProgress = 0; return true; } else { - return super.onSyncedBlockEvent(type, data); + return super.triggerEvent(type, data); } } @@ -105,19 +104,19 @@ private static void tick(BellowsBlockEntity blockEntity) { } } - public static void clientTick(World world, BlockPos pos, BlockState state, BellowsBlockEntity blockEntity) { + public static void clientTick(Level world, BlockPos pos, BlockState state, BellowsBlockEntity blockEntity) { // Only occurs if it's the initial tick if(blockEntity.pumping && blockEntity.animationProgress == 0) { - Vec3i directionVec = state.get(BellowsBlock.FACING).getVector(); - Vec3d center = pos.toCenterPos(); + Vec3i directionVec = state.getValue(BellowsBlock.FACING).getNormal(); + Vec3 center = pos.getCenter(); int particleAmount = RANDOM.nextInt(AVERAGE_PARTICLES - PARTICLE_AMOUNT_MODIFIER, AVERAGE_PARTICLES + PARTICLE_AMOUNT_MODIFIER); for(int i = 0; i < particleAmount; i++){ - world.addParticleClient(ParticleTypes.POOF, - center.getX() + directionVec.getX() * 0.4f, - center.getY() - 0.2f, - center.getZ() + directionVec.getZ() * 0.4f, + world.addParticle(ParticleTypes.POOF, + center.x() + directionVec.getX() * 0.4f, + center.y() - 0.2f, + center.z() + directionVec.getZ() * 0.4f, 0, 0, 0); } } @@ -125,7 +124,7 @@ public static void clientTick(World world, BlockPos pos, BlockState state, Bello tick(blockEntity); } - public static void serverTick(World world, BlockPos pos, BlockState state, BellowsBlockEntity blockEntity) { + public static void serverTick(Level world, BlockPos pos, BlockState state, BellowsBlockEntity blockEntity) { tick(blockEntity); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/bellows/BellowsBlockEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/bellows/BellowsBlockEntityRenderer.java index f6cb3c7bd3..69e8b02b76 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/bellows/BellowsBlockEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/bellows/BellowsBlockEntityRenderer.java @@ -1,84 +1,102 @@ package net.sevenstars.middleearth.block.special.bellows; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.util.math.Vec3d; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Axis; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import net.minecraft.block.BlockState; -import net.minecraft.block.ChestBlock; import net.minecraft.client.model.*; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BlockEntityRenderer; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.texture.SpriteAtlasTexture; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.world.World; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.resources.model.Material; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; -@Environment(EnvType.CLIENT) public class BellowsBlockEntityRenderer implements BlockEntityRenderer { + private static final Material[] MATERIALS = { + new Material( + TextureAtlas.LOCATION_BLOCKS, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "model/bellows/bellows_0") + ), + new Material( + TextureAtlas.LOCATION_BLOCKS, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "model/bellows/bellows_1") + ), + new Material( + TextureAtlas.LOCATION_BLOCKS, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "model/bellows/bellows_2") + ) + }; private final float BELLOW_MAX_ANGLE = 0.72f; private final ModelPart bottom; private final ModelPart top; private final ModelPart cavity; - public BellowsBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) { - ModelPart modelPart = ctx.getLayerModelPart(EntityModelLayersME.BELLOWS); + public BellowsBlockEntityRenderer(BlockEntityRendererProvider.Context ctx) { + ModelPart modelPart = ctx.bakeLayer(EntityModelLayersME.BELLOWS); this.bottom = modelPart.getChild("bottom"); this.top = modelPart.getChild("top"); this.cavity = modelPart.getChild("cavity"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - modelPartData.addChild("bottom", ModelPartBuilder.create().uv(0, 12) - .cuboid(-9.0F, -1.0F, 14.0F, 2.0F, 1.0F, 3.0F, new Dilation(0.0F)) - .uv(10, 12).cuboid(-9.0F, -3.0F, 1.0F, 2.0F, 2.0F, 2.0F, - new Dilation(0.0F)) - .uv(1, 1).mirrored().cuboid(-13.0F, -1.0F, 4.0F, 10.0F, 1.0F, 10.0F, - new Dilation(0.0F)).mirrored(false) - .uv(1, 1).mirrored().cuboid(-13.0F, -3.0F, 4.0F, 10.0F, 1.0F, 10.0F, - new Dilation(0.0F)).mirrored(false) - .uv(0, 17).cuboid(-10.0F, -4.0F, 3.0F, 4.0F, 4.0F, 3.0F, - new Dilation(0.0F)), ModelTransform.origin(8.0F, 24.0F, -9.0F)); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + modelPartData.addOrReplaceChild("bottom", CubeListBuilder.create().texOffs(0, 12) + .addBox(-9.0F, -1.0F, 14.0F, 2.0F, 1.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(10, 12).addBox(-9.0F, -3.0F, 1.0F, 2.0F, 2.0F, 2.0F, + new CubeDeformation(0.0F)) + .texOffs(1, 1).mirror().addBox(-13.0F, -1.0F, 4.0F, 10.0F, 1.0F, 10.0F, + new CubeDeformation(0.0F)).mirror(false) + .texOffs(1, 1).mirror().addBox(-13.0F, -3.0F, 4.0F, 10.0F, 1.0F, 10.0F, + new CubeDeformation(0.0F)).mirror(false) + .texOffs(0, 17).addBox(-10.0F, -4.0F, 3.0F, 4.0F, 4.0F, 3.0F, + new CubeDeformation(0.0F)), PartPose.offset(8.0F, 24.0F, -9.0F)); - modelPartData.addChild("top", ModelPartBuilder.create().uv(0, 0) - .cuboid(-5.0F, 0.0F, 0.0F, 10.0F, 1.0F, 11.0F, new Dilation(0.0F)) - .uv(18, 12).cuboid(-1.0F, 0.0F, 11.0F, 2.0F, 1.0F, 4.0F, - new Dilation(0.0F)), ModelTransform.of(0.0F, 19.0F, -5.0F, 0.3316F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild("top", CubeListBuilder.create().texOffs(0, 0) + .addBox(-5.0F, 0.0F, 0.0F, 10.0F, 1.0F, 11.0F, new CubeDeformation(0.0F)) + .texOffs(18, 12).addBox(-1.0F, 0.0F, 11.0F, 2.0F, 1.0F, 4.0F, + new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 19.0F, -5.0F, 0.3316F, 0.0F, 0.0F)); - modelPartData.addChild("cavity", ModelPartBuilder.create().uv(10, 17).mirrored() - .cuboid(-4.0F, -7.0F, -4.0F, 8.0F, 6.0F, 8.0F, - new Dilation(0.0F)).mirrored(false), ModelTransform.origin(0.0F, 24.0F, 0.0F)); + modelPartData.addOrReplaceChild("cavity", CubeListBuilder.create().texOffs(10, 17).mirror() + .addBox(-4.0F, -7.0F, -4.0F, 8.0F, 6.0F, 8.0F, + new CubeDeformation(0.0F)).mirror(false), PartPose.offset(0.0F, 24.0F, 0.0F)); - return TexturedModelData.of(modelData, 48, 48); + return LayerDefinition.create(modelData, 48, 48); } @Override - public void render(BellowsBlockEntity entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { - World world = entity.getWorld(); + public void render(BellowsBlockEntity entity, float tickProgress, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { + Level world = entity.getLevel(); BlockState blockState = world != null - ? entity.getCachedState() - : ModDecorativeBlocks.BELLOWS.getDefaultState().with(BellowsBlock.FACING, Direction.SOUTH); + ? entity.getBlockState() + : ModDecorativeBlocks.BELLOWS.defaultBlockState().setValue(BellowsBlock.FACING, Direction.SOUTH); float animationProgress = getAnimationProgress(entity); - float rotation = blockState.get(ChestBlock.FACING).getPositiveHorizontalDegrees(); + float rotation = blockState.getValue(ChestBlock.FACING).toYRot(); matrices.translate(0.5D, 1.5D, 0.5D); - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-rotation)); - matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(180)); + matrices.mulPose(Axis.YP.rotationDegrees(-rotation)); + matrices.mulPose(Axis.XP.rotationDegrees(180)); - VertexConsumer vertexConsumer = getSpriteIdentifier(animationProgress).getVertexConsumer(vertexConsumers, RenderLayer::getEntityCutout); + VertexConsumer vertexConsumer = getSpriteIdentifier(animationProgress).buffer(vertexConsumers, RenderType::entityCutout); - this.top.pitch = 0.37f + (animationProgress * -BELLOW_MAX_ANGLE); + this.top.xRot = 0.37f + (animationProgress * -BELLOW_MAX_ANGLE); this.top.render(matrices, vertexConsumer, light, overlay); this.bottom.render(matrices, vertexConsumer, light, overlay); this.cavity.render(matrices, vertexConsumer, light, overlay); @@ -95,9 +113,8 @@ private float getAnimationProgress(BellowsBlockEntity bellowsBlockEntity){ return animationProgress; } - private SpriteIdentifier getSpriteIdentifier(float animationProgress){ + private Material getSpriteIdentifier(float animationProgress){ int spriteState = (int) Math.max(0, Math.min(2, animationProgress * 7.5f)); - return new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, - Identifier.of(MiddleEarth.MOD_ID, "model/bellows/bellows_" + spriteState)); + return MATERIALS[spriteState]; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/AbstractChandelierBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/AbstractChandelierBlock.java new file mode 100644 index 0000000000..41cd419d1c --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/AbstractChandelierBlock.java @@ -0,0 +1,164 @@ +package net.sevenstars.middleearth.block.special.candles; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.ItemTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.Nullable; + +import java.util.function.ToIntFunction; + +public abstract class AbstractChandelierBlock extends Block { + public static final IntegerProperty VARIANT = IntegerProperty.create("variant", 1, 2); + public static final BooleanProperty LIT = BlockStateProperties.LIT; + public static final ToIntFunction STATE_TO_LUMINANCE = state -> state.getValue(LIT) ? 15 : 0; + + protected AbstractChandelierBlock(Properties properties) { + super(properties); + registerDefaultState(defaultBlockState().setValue(VARIANT, 1).setValue(LIT, false)); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(VARIANT, LIT); + } + + @Nullable + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + BlockState state = defaultBlockState().setValue(VARIANT, 1).setValue(LIT, false); + return state.canSurvive(context.getLevel(), context.getClickedPos()) ? state : null; + } + + @Override + protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, + LevelAccessor level, BlockPos pos, BlockPos neighborPos) { + return state.canSurvive(level, pos) + ? super.updateShape(state, direction, neighborState, level, pos, neighborPos) + : Blocks.AIR.defaultBlockState(); + } + + @Override + protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { + return Block.canSupportCenter(level, pos.above(), Direction.DOWN); + } + + @Override + protected boolean isPathfindable(BlockState state, PathComputationType type) { + return false; + } + + @Override + protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, + Player player, BlockHitResult hit) { + if (!player.getAbilities().mayBuild + || !player.hasInfiniteMaterials() + || !player.getMainHandItem().isEmpty()) { + return super.useWithoutItem(state, level, pos, player, hit); + } + + if (!level.isClientSide) { + level.setBlock(pos, state.cycle(VARIANT), Block.UPDATE_ALL_IMMEDIATE); + } + return InteractionResult.sidedSuccess(level.isClientSide); + } + + @Override + protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level level, BlockPos pos, + Player player, InteractionHand hand, BlockHitResult hit) { + if (!player.getAbilities().mayBuild) { + return super.useItemOn(stack, state, level, pos, player, hand, hit); + } + + if (state.getValue(LIT) && stack.is(ItemTags.SHOVELS)) { + if (!level.isClientSide) { + extinguish(player, state, level, pos); + } + return ItemInteractionResult.sidedSuccess(level.isClientSide); + } + + if (!state.getValue(LIT) && (stack.is(Items.FLINT_AND_STEEL) || stack.is(Items.TORCH))) { + if (!level.isClientSide) { + setLit(level, state, pos, true); + } + return ItemInteractionResult.sidedSuccess(level.isClientSide); + } + + return super.useItemOn(stack, state, level, pos, player, hand, hit); + } + + @Override + public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource random) { + if (state.getValue(LIT)) { + particleOffsets(state).forEach(offset -> + spawnCandleParticles(level, offset.add(pos.getX(), pos.getY(), pos.getZ()), random)); + } + } + + protected abstract Iterable particleOffsets(BlockState state); + + private static void spawnCandleParticles(Level level, Vec3 position, RandomSource random) { + float chance = random.nextFloat(); + if (chance < 0.3F) { + level.addParticle(ParticleTypes.SMOKE, position.x, position.y, position.z, 0.0, 0.0, 0.0); + if (chance < 0.17F) { + level.playLocalSound(position.x + 0.5, position.y + 0.5, position.z + 0.5, + SoundEvents.CANDLE_AMBIENT, SoundSource.BLOCKS, + 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F, false); + } + } + level.addParticle(ParticleTypes.SMALL_FLAME, position.x, position.y, position.z, 0.0, 0.0, 0.0); + } + + protected static void setLit(LevelAccessor level, BlockState state, BlockPos pos, boolean lit) { + level.setBlock(pos, state.setValue(LIT, lit), Block.UPDATE_ALL_IMMEDIATE); + if (lit) { + level.playSound(null, pos, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.5F, 1.0F); + } + } + + protected static void extinguish(@Nullable Player player, BlockState state, LevelAccessor level, BlockPos pos) { + setLit(level, state, pos, false); + level.playSound(null, pos, SoundEvents.CANDLE_EXTINGUISH, SoundSource.BLOCKS, 1.5F, 1.0F); + level.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); + } + + @Override + public FluidState getFluidState(BlockState state) { + return Fluids.EMPTY.defaultFluidState(); + } + + @Override + protected void onProjectileHit(Level level, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!level.isClientSide && projectile.isOnFire() && !state.getValue(LIT)) { + level.setBlock(hit.getBlockPos(), state.setValue(LIT, true), Block.UPDATE_ALL_IMMEDIATE); + } + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/CandleHolderBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/CandleHolderBlock.java index ca47a16228..f663396431 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/CandleHolderBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/CandleHolderBlock.java @@ -2,70 +2,77 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import net.minecraft.block.*; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.ItemTags; import net.minecraft.util.*; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.function.ToIntFunction; public class CandleHolderBlock extends Block { - public static final EnumProperty HORIZONTAL_FACING = HorizontalFacingBlock.FACING; + public static final EnumProperty HORIZONTAL_FACING = HorizontalDirectionalBlock.FACING; public static final BooleanProperty LIT; public static final ToIntFunction STATE_TO_LUMINANCE; private static final VoxelShape SHAPE; - public CandleHolderBlock(Settings settings) { + public CandleHolderBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(LIT, false).with(HORIZONTAL_FACING, Direction.NORTH)); + this.registerDefaultState(this.defaultBlockState().setValue(LIT, false).setValue(HORIZONTAL_FACING, Direction.NORTH)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(LIT, HORIZONTAL_FACING); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; if (direction.getAxis() == Direction.Axis.Y) { - BlockState blockState = this.getDefaultState().with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { + BlockState blockState = this.defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()); + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { return blockState; } } @@ -74,110 +81,110 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - return !state.canPlaceAt(world, pos) ? - Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + return !state.canSurvive(world, pos) ? + Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override - protected boolean canPathfindThrough(BlockState state, NavigationType type) { + protected boolean isPathfindable(BlockState state, PathComputationType type) { return false; } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - Hand hand = player.getActiveHand(); - if (!world.isClient && player.getAbilities().allowModifyWorld) { - ItemStack itemStack = player.getStackInHand(hand); - if(player.isInCreativeMode() && itemStack == ItemStack.EMPTY){ - world.setBlockState(pos, state.cycle(LIT)); - return ActionResult.SUCCESS; + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + InteractionHand hand = player.getUsedItemHand(); + if (!world.isClientSide && player.getAbilities().mayBuild) { + ItemStack itemStack = player.getItemInHand(hand); + if(player.hasInfiniteMaterials() && itemStack == ItemStack.EMPTY){ + world.setBlockAndUpdate(pos, state.cycle(LIT)); + return InteractionResult.SUCCESS; } - if (state.get(LIT) && itemStack.isIn(ItemTags.SHOVELS)) { + if (state.getValue(LIT) && itemStack.is(ItemTags.SHOVELS)) { extinguish(null, state, world, pos); - } else if (!state.get(LIT) && itemStack.isOf(Items.FLINT_AND_STEEL) || itemStack.isOf(Items.TORCH)) { + } else if (!state.getValue(LIT) && itemStack.is(Items.FLINT_AND_STEEL) || itemStack.is(Items.TORCH)) { setLit(world, state, pos, true); } } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { - if (state.get(LIT)) { - spawnCandleParticles(world, pos.toCenterPos().add(0, 4 * 0.0625, 0), random); + public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { + if (state.getValue(LIT)) { + spawnCandleParticles(world, pos.getCenter().add(0, 4 * 0.0625, 0), random); } } - protected static void spawnCandleParticles(World world, Vec3d vec3d, Random random) { + protected static void spawnCandleParticles(Level world, Vec3 vec3d, RandomSource random) { float f = random.nextFloat(); if (f < 0.3F) { - world.addParticleClient(ParticleTypes.SMOKE, vec3d.x, vec3d.y, vec3d.z, 0.0, 0.0, 0.0); + world.addParticle(ParticleTypes.SMOKE, vec3d.x, vec3d.y, vec3d.z, 0.0, 0.0, 0.0); if (f < 0.17F) { - world.playSoundClient(vec3d.x + 0.5, vec3d.y + 0.5, vec3d.z + 0.5, SoundEvents.BLOCK_CANDLE_AMBIENT, SoundCategory.BLOCKS, 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F, false); + world.playLocalSound(vec3d.x + 0.5, vec3d.y + 0.5, vec3d.z + 0.5, SoundEvents.CANDLE_AMBIENT, SoundSource.BLOCKS, 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F, false); } } - world.addParticleClient(ParticleTypes.SMALL_FLAME, vec3d.x, vec3d.y, vec3d.z, 0.0, 0.0, 0.0); + world.addParticle(ParticleTypes.SMALL_FLAME, vec3d.x, vec3d.y, vec3d.z, 0.0, 0.0, 0.0); } - protected static void setLit(WorldAccess world, BlockState state, BlockPos pos, boolean lit) { - world.setBlockState(pos, state.with(LIT, lit), 2 | 3); + protected static void setLit(LevelAccessor world, BlockState state, BlockPos pos, boolean lit) { + world.setBlock(pos, state.setValue(LIT, lit), 2 | 3); if(lit){ - world.playSound(null, pos, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.5F, 1.0F); + world.playSound(null, pos, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.5F, 1.0F); } } - protected static void extinguish(@Nullable PlayerEntity player, BlockState state, WorldAccess world, BlockPos pos) { + protected static void extinguish(@Nullable Player player, BlockState state, LevelAccessor world, BlockPos pos) { setLit(world, state, pos, false); - world.playSound(null, pos, SoundEvents.BLOCK_CANDLE_EXTINGUISH, SoundCategory.BLOCKS, 1.5F, 1.0F); - world.emitGameEvent(player, GameEvent.BLOCK_CHANGE, pos); + world.playSound(null, pos, SoundEvents.CANDLE_EXTINGUISH, SoundSource.BLOCKS, 1.5F, 1.0F); + world.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); } @Override - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - return Block.sideCoversSmallSquare(world, pos.down(), Direction.UP); + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + return Block.canSupportCenter(world, pos.below(), Direction.UP); } @Override public FluidState getFluidState(BlockState state) { - return Fluids.EMPTY.getDefaultState(); + return Fluids.EMPTY.defaultFluidState(); } - public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient && projectile.isOnFire() && !state.get(LIT)) { - world.setBlockState(hit.getBlockPos(), state.with(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); + public void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!world.isClientSide && projectile.isOnFire() && !state.getValue(LIT)) { + world.setBlock(hit.getBlockPos(), state.setValue(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); } } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(HORIZONTAL_FACING, rotation.rotate(state.get(HORIZONTAL_FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(HORIZONTAL_FACING, rotation.rotate(state.getValue(HORIZONTAL_FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(HORIZONTAL_FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(HORIZONTAL_FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); } static { - LIT = Properties.LIT; - STATE_TO_LUMINANCE = (state) -> state.get(LIT) ? 6 : 0; - SHAPE = VoxelShapes.union(Block.createColumnShape(2.0, 2.0, 10.0),Block.createCuboidShape(5, 0, 5, 11, 2.0, 11)); + LIT = BlockStateProperties.LIT; + STATE_TO_LUMINANCE = (state) -> state.getValue(LIT) ? 6 : 0; + SHAPE = Shapes.or(Block.box(7, 2, 7, 9, 10, 9), Block.box(5, 0, 5, 11, 2, 11)); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/CandleStickBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/CandleStickBlock.java index ad18063102..74aacaebf2 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/CandleStickBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/CandleStickBlock.java @@ -2,45 +2,55 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import net.minecraft.block.*; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; +import net.minecraft.Util; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.ItemTags; import net.minecraft.util.*; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.function.ToIntFunction; public class CandleStickBlock extends Block { - public static final EnumProperty HORIZONTAL_FACING = HorizontalFacingBlock.FACING; - public static final IntProperty CANDLES = IntProperty.of("candles", 1, 4); + public static final EnumProperty HORIZONTAL_FACING = HorizontalDirectionalBlock.FACING; + public static final IntegerProperty CANDLES = IntegerProperty.create("candles", 1, 4); public static final BooleanProperty ATTACHED; public static final BooleanProperty LIT; private static final Int2ObjectMap CANDLES_TO_PARTICLE_OFFSETS; @@ -49,30 +59,30 @@ public class CandleStickBlock extends Block { public static final ToIntFunction STATE_TO_LUMINANCE; private static final VoxelShape SHAPE; - public CandleStickBlock(Settings settings) { + public CandleStickBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(LIT, false).with(ATTACHED, false).with(CANDLES, 1) - .with(HORIZONTAL_FACING, Direction.NORTH)); + this.registerDefaultState(this.defaultBlockState().setValue(LIT, false).setValue(ATTACHED, false).setValue(CANDLES, 1) + .setValue(HORIZONTAL_FACING, Direction.NORTH)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(LIT, ATTACHED, CANDLES, HORIZONTAL_FACING); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; if (direction.getAxis() == Direction.Axis.Y) { - BlockState blockState = this.getDefaultState().with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); - if(ctx.getSide() != Direction.UP) { - blockState = blockState.with(ATTACHED, true); + BlockState blockState = this.defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()); + if(ctx.getClickedFace() != Direction.UP) { + blockState = blockState.setValue(ATTACHED, true); } - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { return blockState; } } @@ -81,152 +91,152 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - return attachedDirection(state).getOpposite() == direction && !state.canPlaceAt(world, pos) ? - Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + return attachedDirection(state).getOpposite() == direction && !state.canSurvive(world, pos) ? + Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - if(state.get(ATTACHED)) { - return Block.sideCoversSmallSquare(world, pos.offset(state.get(HORIZONTAL_FACING).getOpposite()), state.get(HORIZONTAL_FACING)); - } else return Block.sideCoversSmallSquare(world, pos.down(), Direction.UP); + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + if(state.getValue(ATTACHED)) { + return Block.canSupportCenter(world, pos.relative(state.getValue(HORIZONTAL_FACING).getOpposite()), state.getValue(HORIZONTAL_FACING)); + } else return Block.canSupportCenter(world, pos.below(), Direction.UP); } @Override - protected boolean canPathfindThrough(BlockState state, NavigationType type) { + protected boolean isPathfindable(BlockState state, PathComputationType type) { return false; } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - Hand hand = player.getActiveHand(); - if (!world.isClient && player.getAbilities().allowModifyWorld) { - ItemStack itemStack = player.getStackInHand(hand); - if(player.isInCreativeMode() && itemStack == ItemStack.EMPTY){ - world.setBlockState(pos, state.cycle(LIT)); - return ActionResult.SUCCESS; + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + InteractionHand hand = player.getUsedItemHand(); + if (!world.isClientSide && player.getAbilities().mayBuild) { + ItemStack itemStack = player.getItemInHand(hand); + if(player.hasInfiniteMaterials() && itemStack == ItemStack.EMPTY){ + world.setBlockAndUpdate(pos, state.cycle(LIT)); + return InteractionResult.SUCCESS; } - if (state.get(LIT) && itemStack.isIn(ItemTags.SHOVELS)) { + if (state.getValue(LIT) && itemStack.is(ItemTags.SHOVELS)) { extinguish(null, state, world, pos); - } else if (!state.get(LIT) && itemStack.isOf(Items.FLINT_AND_STEEL) || itemStack.isOf(Items.TORCH)) { + } else if (!state.getValue(LIT) && itemStack.is(Items.FLINT_AND_STEEL) || itemStack.is(Items.TORCH)) { setLit(world, state, pos, true); } } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } @Override - protected ActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - ItemStack itemStack = player.getStackInHand(hand); - if(itemStack.getItem() == this.asItem() && state.get(CANDLES) < 4) { - stack.decrementUnlessCreative(1, player); - world.setBlockState(pos, state.cycle(CANDLES)); - return ActionResult.CONSUME; + protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + ItemStack itemStack = player.getItemInHand(hand); + if(itemStack.getItem() == this.asItem() && state.getValue(CANDLES) < 4) { + stack.consume(1, player); + world.setBlockAndUpdate(pos, state.cycle(CANDLES)); + return ItemInteractionResult.CONSUME; } - return super.onUseWithItem(stack, state, world, pos, player, hand, hit); + return super.useItemOn(stack, state, world, pos, player, hand, hit); } - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { - if (state.get(LIT)) { + public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { + if (state.getValue(LIT)) { this.getParticleOffsets(state).forEach((offset) -> { - int quarter = state.get(HORIZONTAL_FACING).getHorizontalQuarterTurns(); - Vec3d rotatedOffset = offset.add(-0.5, -0.5, -0.5).rotateY(quarter * -90 * ((float)Math.PI / 180)).add(0.5, 0.5, 0.5); + int quarter = state.getValue(HORIZONTAL_FACING).get2DDataValue(); + Vec3 rotatedOffset = offset.add(-0.5, -0.5, -0.5).yRot(quarter * -90 * ((float)Math.PI / 180)).add(0.5, 0.5, 0.5); spawnCandleParticles(world, rotatedOffset.add(pos.getX(), pos.getY(), pos.getZ()), random); }); } } - private static void spawnCandleParticles(World world, Vec3d vec3d, Random random) { + private static void spawnCandleParticles(Level world, Vec3 vec3d, RandomSource random) { float f = random.nextFloat(); if (f < 0.3F) { - world.addParticleClient(ParticleTypes.SMOKE, vec3d.x, vec3d.y, vec3d.z, 0.0, 0.0, 0.0); + world.addParticle(ParticleTypes.SMOKE, vec3d.x, vec3d.y, vec3d.z, 0.0, 0.0, 0.0); if (f < 0.17F) { - world.playSoundClient(vec3d.x + 0.5, vec3d.y + 0.5, vec3d.z + 0.5, SoundEvents.BLOCK_CANDLE_AMBIENT, SoundCategory.BLOCKS, 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F, false); + world.playLocalSound(vec3d.x + 0.5, vec3d.y + 0.5, vec3d.z + 0.5, SoundEvents.CANDLE_AMBIENT, SoundSource.BLOCKS, 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F, false); } } - world.addParticleClient(ParticleTypes.SMALL_FLAME, vec3d.x, vec3d.y, vec3d.z, 0.0, 0.0, 0.0); + world.addParticle(ParticleTypes.SMALL_FLAME, vec3d.x, vec3d.y, vec3d.z, 0.0, 0.0, 0.0); } - protected static void setLit(WorldAccess world, BlockState state, BlockPos pos, boolean lit) { - world.setBlockState(pos, state.with(LIT, lit), 2 | 3); + protected static void setLit(LevelAccessor world, BlockState state, BlockPos pos, boolean lit) { + world.setBlock(pos, state.setValue(LIT, lit), 2 | 3); if(lit){ - world.playSound(null, pos, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.5F, 1.0F); + world.playSound(null, pos, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.5F, 1.0F); } } - protected static void extinguish(@Nullable PlayerEntity player, BlockState state, WorldAccess world, BlockPos pos) { + protected static void extinguish(@Nullable Player player, BlockState state, LevelAccessor world, BlockPos pos) { setLit(world, state, pos, false); - world.playSound(null, pos, SoundEvents.BLOCK_CANDLE_EXTINGUISH, SoundCategory.BLOCKS, 1.5F, 1.0F); - world.emitGameEvent(player, GameEvent.BLOCK_CHANGE, pos); + world.playSound(null, pos, SoundEvents.CANDLE_EXTINGUISH, SoundSource.BLOCKS, 1.5F, 1.0F); + world.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); } @Override public FluidState getFluidState(BlockState state) { - return Fluids.EMPTY.getDefaultState(); + return Fluids.EMPTY.defaultFluidState(); } - public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient && projectile.isOnFire() && !state.get(LIT)) { - world.setBlockState(hit.getBlockPos(), state.with(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); + public void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!world.isClientSide && projectile.isOnFire() && !state.getValue(LIT)) { + world.setBlock(hit.getBlockPos(), state.setValue(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); } } - protected Iterable getParticleOffsets(BlockState state) { - if(state.get(ATTACHED)) return (Iterable)WALL_CANDLES_TO_PARTICLE_OFFSETS.get(state.get(CANDLES)); - else return (Iterable)CANDLES_TO_PARTICLE_OFFSETS.get(state.get(CANDLES)); + protected Iterable getParticleOffsets(BlockState state) { + if(state.getValue(ATTACHED)) return (Iterable)WALL_CANDLES_TO_PARTICLE_OFFSETS.get(state.getValue(CANDLES)); + else return (Iterable)CANDLES_TO_PARTICLE_OFFSETS.get(state.getValue(CANDLES)); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } protected Direction attachedDirection(BlockState state) { - return state.get(ATTACHED) ? Direction.DOWN : Direction.UP; + return state.getValue(ATTACHED) ? Direction.DOWN : Direction.UP; } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(HORIZONTAL_FACING, rotation.rotate(state.get(HORIZONTAL_FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(HORIZONTAL_FACING, rotation.rotate(state.getValue(HORIZONTAL_FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(HORIZONTAL_FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(HORIZONTAL_FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); } static { - ATTACHED = BooleanProperty.of("attached"); - LIT = Properties.LIT; - STATE_TO_LUMINANCE = (state) -> state.get(LIT) ? (int)(state.get(CANDLES) * 3.5f) : 0; + ATTACHED = BooleanProperty.create("attached"); + LIT = BlockStateProperties.LIT; + STATE_TO_LUMINANCE = (state) -> state.getValue(LIT) ? (int)(state.getValue(CANDLES) * 3.5f) : 0; CANDLES_TO_PARTICLE_OFFSETS = Util.make(new Int2ObjectOpenHashMap(4), (int2ObjectOpenHashMap) -> { - int2ObjectOpenHashMap.put(1, List.of((new Vec3d(8.0, 17.0, 8.0)).multiply(0.0625))); - int2ObjectOpenHashMap.put(2, List.of((new Vec3d(5.0, 17.0, 8.0)).multiply(0.0625), (new Vec3d(11.0, 17.0, 8.0)).multiply(0.0625))); - int2ObjectOpenHashMap.put(3, List.of((new Vec3d(8.0, 17.0, 8.0)).multiply(0.0625), (new Vec3d(3.0, 17.0, 8.0)).multiply(0.0625), (new Vec3d(13.0, 17.0, 8.0)).multiply(0.0625))); - int2ObjectOpenHashMap.put(4, List.of((new Vec3d(8.0, 17.0, 8.0)).multiply(0.0625), (new Vec3d(3.0, 16.0, 8.0)).multiply(0.0625), - (new Vec3d(13.0, 16.0, 8.0)).multiply(0.0625), (new Vec3d(8.0, 16.0, 3.0)).multiply(0.0625), (new Vec3d(8.0, 16.0, 13.0)).multiply(0.0625))); + int2ObjectOpenHashMap.put(1, List.of((new Vec3(8.0, 17.0, 8.0)).scale(0.0625))); + int2ObjectOpenHashMap.put(2, List.of((new Vec3(5.0, 17.0, 8.0)).scale(0.0625), (new Vec3(11.0, 17.0, 8.0)).scale(0.0625))); + int2ObjectOpenHashMap.put(3, List.of((new Vec3(8.0, 17.0, 8.0)).scale(0.0625), (new Vec3(3.0, 17.0, 8.0)).scale(0.0625), (new Vec3(13.0, 17.0, 8.0)).scale(0.0625))); + int2ObjectOpenHashMap.put(4, List.of((new Vec3(8.0, 17.0, 8.0)).scale(0.0625), (new Vec3(3.0, 16.0, 8.0)).scale(0.0625), + (new Vec3(13.0, 16.0, 8.0)).scale(0.0625), (new Vec3(8.0, 16.0, 3.0)).scale(0.0625), (new Vec3(8.0, 16.0, 13.0)).scale(0.0625))); }); WALL_CANDLES_TO_PARTICLE_OFFSETS = Util.make(new Int2ObjectOpenHashMap(4), (int2ObjectOpenHashMap) -> { - int2ObjectOpenHashMap.put(1, List.of((new Vec3d(8.0, 17.0, 7.0)).multiply(0.0625))); - int2ObjectOpenHashMap.put(2, List.of((new Vec3d(3.0, 17.0, 6.0)).multiply(0.0625), (new Vec3d(13.0, 17.0, 6.0)).multiply(0.0625))); - int2ObjectOpenHashMap.put(3, List.of((new Vec3d(8.0, 14.0, 8.0)).multiply(0.0625), (new Vec3d(3.0, 17.0, 6.0)).multiply(0.0625), (new Vec3d(13.0, 17.0, 6.0)).multiply(0.0625))); - int2ObjectOpenHashMap.put(4, List.of((new Vec3d(3.0, 17.0, 5.0)).multiply(0.0625), (new Vec3d(13.0, 17.0, 5)).multiply(0.0625), - (new Vec3d(4.0, 14.0, 10.0)).multiply(0.0625), (new Vec3d(12.0, 14.0, 10.0)).multiply(0.0625))); + int2ObjectOpenHashMap.put(1, List.of((new Vec3(8.0, 17.0, 7.0)).scale(0.0625))); + int2ObjectOpenHashMap.put(2, List.of((new Vec3(3.0, 17.0, 6.0)).scale(0.0625), (new Vec3(13.0, 17.0, 6.0)).scale(0.0625))); + int2ObjectOpenHashMap.put(3, List.of((new Vec3(8.0, 14.0, 8.0)).scale(0.0625), (new Vec3(3.0, 17.0, 6.0)).scale(0.0625), (new Vec3(13.0, 17.0, 6.0)).scale(0.0625))); + int2ObjectOpenHashMap.put(4, List.of((new Vec3(3.0, 17.0, 5.0)).scale(0.0625), (new Vec3(13.0, 17.0, 5)).scale(0.0625), + (new Vec3(4.0, 14.0, 10.0)).scale(0.0625), (new Vec3(12.0, 14.0, 10.0)).scale(0.0625))); }); - SHAPE = Block.createCuboidShape(4, 0, 4, 12, 15, 12); + SHAPE = Block.box(4, 0, 4, 12, 15, 12); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/CeramicLampBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/CeramicLampBlock.java index 7b507f8a34..dd79dd0f63 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/CeramicLampBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/CeramicLampBlock.java @@ -1,124 +1,116 @@ package net.sevenstars.middleearth.block.special.candles; -import net.minecraft.block.*; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; import java.util.function.ToIntFunction; public class CeramicLampBlock extends CandleHolderBlock { private static final VoxelShape SHAPE; - private static final Vec3d PARTICLE_OFFSET = new Vec3d(8.0, 7.0, 13.5).multiply(0.0625); + private static final Vec3 PARTICLE_OFFSET = new Vec3(8.0, 7.0, 13.5).scale(0.0625); - public CeramicLampBlock(Settings settings) { + public CeramicLampBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(LIT, false).with(HORIZONTAL_FACING, Direction.NORTH)); + this.registerDefaultState(this.defaultBlockState().setValue(LIT, false).setValue(HORIZONTAL_FACING, Direction.NORTH)); } @Override - public @Nullable BlockState getPlacementState(ItemPlacementContext ctx) { - BlockState blockState = super.getPlacementState(ctx); + public @Nullable BlockState getStateForPlacement(BlockPlaceContext ctx) { + BlockState blockState = super.getStateForPlacement(ctx); if(blockState == null) return null; - return blockState.with(Properties.HORIZONTAL_FACING, blockState.get(HORIZONTAL_FACING).getOpposite()); + return blockState.setValue(BlockStateProperties.HORIZONTAL_FACING, blockState.getValue(HORIZONTAL_FACING).getOpposite()); } @Override - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - return Block.sideCoversSmallSquare(world, pos.down(), Direction.UP); + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + return Block.canSupportCenter(world, pos.below(), Direction.UP); } - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { - if (state.get(LIT)) { - int quarter = state.get(HORIZONTAL_FACING).getHorizontalQuarterTurns(); - Vec3d rotatedOffset = PARTICLE_OFFSET.add(-0.5, -0.5, -0.5).rotateY(quarter * -90 * ((float)Math.PI / 180)).add(0.5, 0.5, 0.5); + public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { + if (state.getValue(LIT)) { + int quarter = state.getValue(HORIZONTAL_FACING).get2DDataValue(); + Vec3 rotatedOffset = PARTICLE_OFFSET.add(-0.5, -0.5, -0.5).yRot(quarter * -90 * ((float)Math.PI / 180)).add(0.5, 0.5, 0.5); spawnCandleParticles(world, rotatedOffset.add(pos.getX(), pos.getY(), pos.getZ()), random); } } - protected static void setLit(WorldAccess world, BlockState state, BlockPos pos, boolean lit) { - world.setBlockState(pos, state.with(LIT, lit), 2 | 3); + protected static void setLit(LevelAccessor world, BlockState state, BlockPos pos, boolean lit) { + world.setBlock(pos, state.setValue(LIT, lit), 2 | 3); if(lit){ - world.playSound(null, pos, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.5F, 1.0F); + world.playSound(null, pos, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.5F, 1.0F); } } - protected static void extinguish(@Nullable PlayerEntity player, BlockState state, WorldAccess world, BlockPos pos) { + protected static void extinguish(@Nullable Player player, BlockState state, LevelAccessor world, BlockPos pos) { setLit(world, state, pos, false); - world.playSound(null, pos, SoundEvents.BLOCK_CANDLE_EXTINGUISH, SoundCategory.BLOCKS, 1.5F, 1.0F); - world.emitGameEvent(player, GameEvent.BLOCK_CHANGE, pos); + world.playSound(null, pos, SoundEvents.CANDLE_EXTINGUISH, SoundSource.BLOCKS, 1.5F, 1.0F); + world.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); } @Override public FluidState getFluidState(BlockState state) { - return Fluids.EMPTY.getDefaultState(); + return Fluids.EMPTY.defaultFluidState(); } - public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient && projectile.isOnFire() && !state.get(LIT)) { - world.setBlockState(hit.getBlockPos(), state.with(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); + public void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!world.isClientSide && projectile.isOnFire() && !state.getValue(LIT)) { + world.setBlock(hit.getBlockPos(), state.setValue(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); } } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(HORIZONTAL_FACING, rotation.rotate(state.get(HORIZONTAL_FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(HORIZONTAL_FACING, rotation.rotate(state.getValue(HORIZONTAL_FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(HORIZONTAL_FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(HORIZONTAL_FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); } static { - SHAPE = VoxelShapes.union(Block.createCuboidShape(5, 0, 5, 11, 2.0, 11)); + SHAPE = Shapes.or(Block.box(5, 0, 5, 11, 2.0, 11)); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/ChandelierBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/ChandelierBlock.java index 869de2dd6a..773bcf3182 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/ChandelierBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/ChandelierBlock.java @@ -1,173 +1,55 @@ package net.sevenstars.middleearth.block.special.candles; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; -import net.minecraft.world.tick.ScheduledTickView; -import org.jetbrains.annotations.Nullable; - -import java.util.function.ToIntFunction; - -public class ChandelierBlock extends Block { - private static final int MAX_VARIANT = 2; - public static final IntProperty VARIANT = IntProperty.of("variant", 1, MAX_VARIANT); - public static final BooleanProperty LIT; - - public static final ToIntFunction STATE_TO_LUMINANCE; - private static final VoxelShape SHAPE; - - public ChandelierBlock(Settings settings) { - super(settings); - this.setDefaultState(this.getDefaultState().with(LIT, false)); - } - - @Override - protected void appendProperties(StateManager.Builder builder) { - builder.add(LIT).add(VARIANT); - } - - @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - BlockState blockState = this.getDefaultState().with(VARIANT, 1); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { - return blockState; - } - return null; - } - - @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - return !state.canPlaceAt(world, pos) ? - Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); - } - - @Override - protected boolean canPathfindThrough(BlockState state, NavigationType type) { - return false; - } - - @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - Hand hand = player.getActiveHand(); - if (!world.isClient && player.getAbilities().allowModifyWorld) { - ItemStack itemStack = player.getStackInHand(hand); - if(player.isInCreativeMode() && itemStack == ItemStack.EMPTY){ - world.setBlockState(pos, state.cycle(VARIANT)); - return ActionResult.SUCCESS; - } - - if (state.get(LIT) && itemStack.isIn(ItemTags.SHOVELS)) { - extinguish(null, state, world, pos); - } else if (!state.get(LIT) && itemStack.isOf(Items.FLINT_AND_STEEL) || itemStack.isOf(Items.TORCH)) { - setLit(world, state, pos, true); - } - } - return ActionResult.SUCCESS; - } - - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { - if (state.get(LIT)) { - if(state.get(VARIANT) == 1) { - spawnCandleParticles(world, pos.toCenterPos().add(0.5, 12.5 * 0.0625, -0.375), random); - spawnCandleParticles(world, pos.toCenterPos().add(0.5, 12.5 * 0.0625, 1.375), random); - spawnCandleParticles(world, pos.toCenterPos().add(0.375, 12.5 * 0.0625, 0.5), random); - spawnCandleParticles(world, pos.toCenterPos().add(1.375, 12.5 * 0.0625, 0.5), random); - spawnCandleParticles(world, pos.toCenterPos().add(-0.125, 12.5 * 0.0625, -0.125), random); - spawnCandleParticles(world, pos.toCenterPos().add(-0.125, 12.5 * 0.0625, 1.125), random); - spawnCandleParticles(world, pos.toCenterPos().add(1.125, 12.5 * 0.0625, -0.125), random); - spawnCandleParticles(world, pos.toCenterPos().add(1.125, 12.5 * 0.0625, 1.125), random); - } else if(state.get(VARIANT) == 2) { - spawnCandleParticles(world, pos.toCenterPos().add(-0.25, 12.5 * 0.0625, -0.25), random); - spawnCandleParticles(world, pos.toCenterPos().add(-0.25, 12.5 * 0.0625, 1.25), random); - spawnCandleParticles(world, pos.toCenterPos().add(1.25, 12.5 * 0.0625, -0.25), random); - spawnCandleParticles(world, pos.toCenterPos().add(1.25, 12.5 * 0.0625, 1.25), random); - spawnCandleParticles(world, pos.toCenterPos().add(-0.25, 12.5 * 0.0625, 0.5), random); - spawnCandleParticles(world, pos.toCenterPos().add(0.5, 12.5 * 0.0625, 1.25), random); - spawnCandleParticles(world, pos.toCenterPos().add(0.5, 12.5 * 0.0625, -0.25), random); - spawnCandleParticles(world, pos.toCenterPos().add(1.25, 12.5 * 0.0625, 0.5), random); - } - } - } - - protected static void spawnCandleParticles(World world, Vec3d vec3d, Random random) { - float f = random.nextFloat(); - if (f < 0.3F) { - world.addParticleClient(ParticleTypes.SMOKE, vec3d.x - 0.5f, vec3d.y - 0.5f, vec3d.z - 0.5f, 0.0, 0.0, 0.0); - if (f < 0.17F) { - world.playSoundClient(vec3d.x, vec3d.y, vec3d.z, SoundEvents.BLOCK_CANDLE_AMBIENT, SoundCategory.BLOCKS, 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F, false); - } - } - world.addParticleClient(ParticleTypes.SMALL_FLAME, vec3d.x - 0.5f, vec3d.y - 0.5f, vec3d.z - 0.5f, 0.0, 0.0, 0.0); - } - - protected static void setLit(WorldAccess world, BlockState state, BlockPos pos, boolean lit) { - world.setBlockState(pos, state.with(LIT, lit), 2 | 3); - if(lit){ - world.playSound(null, pos, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.5F, 1.0F); - } - } - - protected static void extinguish(@Nullable PlayerEntity player, BlockState state, WorldAccess world, BlockPos pos) { - setLit(world, state, pos, false); - - world.playSound(null, pos, SoundEvents.BLOCK_CANDLE_EXTINGUISH, SoundCategory.BLOCKS, 1.5F, 1.0F); - world.emitGameEvent(player, GameEvent.BLOCK_CHANGE, pos); +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +import java.util.List; + +public class ChandelierBlock extends AbstractChandelierBlock { + public static final MapCodec CODEC = simpleCodec(ChandelierBlock::new); + private static final double CANDLE_HEIGHT = 12.5 / 16.0; + private static final List VARIANT_ONE_PARTICLES = List.of( + new Vec3(0.5, CANDLE_HEIGHT, -0.375), + new Vec3(0.5, CANDLE_HEIGHT, 1.375), + new Vec3(0.375, CANDLE_HEIGHT, 0.5), + new Vec3(1.375, CANDLE_HEIGHT, 0.5), + new Vec3(-0.125, CANDLE_HEIGHT, -0.125), + new Vec3(-0.125, CANDLE_HEIGHT, 1.125), + new Vec3(1.125, CANDLE_HEIGHT, -0.125), + new Vec3(1.125, CANDLE_HEIGHT, 1.125)); + private static final List VARIANT_TWO_PARTICLES = List.of( + new Vec3(-0.25, CANDLE_HEIGHT, -0.25), + new Vec3(-0.25, CANDLE_HEIGHT, 1.25), + new Vec3(1.25, CANDLE_HEIGHT, -0.25), + new Vec3(1.25, CANDLE_HEIGHT, 1.25), + new Vec3(-0.25, CANDLE_HEIGHT, 0.5), + new Vec3(0.5, CANDLE_HEIGHT, 1.25), + new Vec3(0.5, CANDLE_HEIGHT, -0.25), + new Vec3(1.25, CANDLE_HEIGHT, 0.5)); + private static final VoxelShape SHAPE = Block.box(0.0, 2.0, 0.0, 16.0, 16.0, 16.0); + + public ChandelierBlock(Properties properties) { + super(properties); } @Override - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - return Block.sideCoversSmallSquare(world, pos.up(), Direction.DOWN); + protected MapCodec codec() { + return CODEC; } @Override - public FluidState getFluidState(BlockState state) { - return Fluids.EMPTY.getDefaultState(); - } - - public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient && projectile.isOnFire() && !state.get(LIT)) { - world.setBlockState(hit.getBlockPos(), state.with(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); - } + protected Iterable particleOffsets(BlockState state) { + return state.getValue(VARIANT) == 1 ? VARIANT_ONE_PARTICLES : VARIANT_TWO_PARTICLES; } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return SHAPE; } - - static { - LIT = Properties.LIT; - STATE_TO_LUMINANCE = (state) -> state.get(LIT) ? 15 : 0; - SHAPE = Block.createCuboidShape(0, 2, 0, 16, 16.0, 16); - } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/SkullCandleBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/SkullCandleBlock.java index b35c02e1c7..d0c0aaf5f5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/SkullCandleBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/SkullCandleBlock.java @@ -2,72 +2,82 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import net.minecraft.block.*; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; +import net.minecraft.Util; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.ItemTags; import net.minecraft.util.*; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.function.ToIntFunction; public class SkullCandleBlock extends Block { - public static final EnumProperty HORIZONTAL_FACING = HorizontalFacingBlock.FACING; - public static final IntProperty CANDLES = IntProperty.of("candles", 1, 3); + public static final EnumProperty HORIZONTAL_FACING = HorizontalDirectionalBlock.FACING; + public static final IntegerProperty CANDLES = IntegerProperty.create("candles", 1, 3); public static final BooleanProperty LIT; private static final Int2ObjectMap CANDLES_TO_PARTICLE_OFFSETS; public static final ToIntFunction STATE_TO_LUMINANCE; private static final VoxelShape SHAPE; - public SkullCandleBlock(Settings settings) { + public SkullCandleBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(LIT, false).with(CANDLES, 1) - .with(HORIZONTAL_FACING, Direction.NORTH)); + this.registerDefaultState(this.defaultBlockState().setValue(LIT, false).setValue(CANDLES, 1) + .setValue(HORIZONTAL_FACING, Direction.NORTH)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(LIT, CANDLES, HORIZONTAL_FACING); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; if (direction.getAxis() == Direction.Axis.Y) { - BlockState blockState = this.getDefaultState().with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { + BlockState blockState = this.defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()); + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { return blockState; } } @@ -76,131 +86,131 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - return !state.canPlaceAt(world, pos) ? - Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + return !state.canSurvive(world, pos) ? + Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override - protected boolean canPathfindThrough(BlockState state, NavigationType type) { + protected boolean isPathfindable(BlockState state, PathComputationType type) { return false; } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - Hand hand = player.getActiveHand(); - if (!world.isClient && player.getAbilities().allowModifyWorld) { - if(player.isInCreativeMode()){ - world.setBlockState(pos, state.cycle(LIT)); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + InteractionHand hand = player.getUsedItemHand(); + if (!world.isClientSide && player.getAbilities().mayBuild) { + if(player.hasInfiniteMaterials()){ + world.setBlockAndUpdate(pos, state.cycle(LIT)); } else { - ItemStack itemStack = player.getStackInHand(hand); - if (state.get(LIT) && itemStack.isIn(ItemTags.SHOVELS)) { + ItemStack itemStack = player.getItemInHand(hand); + if (state.getValue(LIT) && itemStack.is(ItemTags.SHOVELS)) { extinguish(null, state, world, pos); - } else if (!state.get(LIT) && itemStack.isOf(Items.FLINT_AND_STEEL) || itemStack.isOf(Items.TORCH)) { + } else if (!state.getValue(LIT) && itemStack.is(Items.FLINT_AND_STEEL) || itemStack.is(Items.TORCH)) { setLit(world, state, pos, true); } } } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } @Override - protected ActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - ItemStack itemStack = player.getStackInHand(hand); - if(itemStack.isIn(ItemTags.CANDLES) && state.get(CANDLES) < 3) { - stack.decrementUnlessCreative(1, player); - world.setBlockState(pos, state.cycle(CANDLES)); - return ActionResult.CONSUME; + protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + ItemStack itemStack = player.getItemInHand(hand); + if(itemStack.is(ItemTags.CANDLES) && state.getValue(CANDLES) < 3) { + stack.consume(1, player); + world.setBlockAndUpdate(pos, state.cycle(CANDLES)); + return ItemInteractionResult.CONSUME; } - return super.onUseWithItem(stack, state, world, pos, player, hand, hit); + return super.useItemOn(stack, state, world, pos, player, hand, hit); } - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { - if (state.get(LIT)) { + public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { + if (state.getValue(LIT)) { this.getParticleOffsets(state).forEach((offset) -> { - int quarter = state.get(HORIZONTAL_FACING).getHorizontalQuarterTurns(); - Vec3d rotatedOffset = offset.add(-0.5, -0.5, -0.5).rotateY(quarter * -90 * ((float)Math.PI / 180)).add(0.5, 0.5, 0.5); + int quarter = state.getValue(HORIZONTAL_FACING).get2DDataValue(); + Vec3 rotatedOffset = offset.add(-0.5, -0.5, -0.5).yRot(quarter * -90 * ((float)Math.PI / 180)).add(0.5, 0.5, 0.5); spawnCandleParticles(world, rotatedOffset.add(pos.getX(), pos.getY(), pos.getZ()), random); }); } } - private static void spawnCandleParticles(World world, Vec3d vec3d, Random random) { + private static void spawnCandleParticles(Level world, Vec3 vec3d, RandomSource random) { float f = random.nextFloat(); if (f < 0.3F) { - world.addParticleClient(ParticleTypes.SMOKE, vec3d.x, vec3d.y, vec3d.z, 0.0, 0.0, 0.0); + world.addParticle(ParticleTypes.SMOKE, vec3d.x, vec3d.y, vec3d.z, 0.0, 0.0, 0.0); if (f < 0.17F) { - world.playSoundClient(vec3d.x + 0.5, vec3d.y + 0.5, vec3d.z + 0.5, SoundEvents.BLOCK_CANDLE_AMBIENT, SoundCategory.BLOCKS, 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F, false); + world.playLocalSound(vec3d.x + 0.5, vec3d.y + 0.5, vec3d.z + 0.5, SoundEvents.CANDLE_AMBIENT, SoundSource.BLOCKS, 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F, false); } } - world.addParticleClient(ParticleTypes.SMALL_FLAME, vec3d.x, vec3d.y, vec3d.z, 0.0, 0.0, 0.0); + world.addParticle(ParticleTypes.SMALL_FLAME, vec3d.x, vec3d.y, vec3d.z, 0.0, 0.0, 0.0); } - protected static void setLit(WorldAccess world, BlockState state, BlockPos pos, boolean lit) { - world.setBlockState(pos, state.with(LIT, lit), 2 | 3); + protected static void setLit(LevelAccessor world, BlockState state, BlockPos pos, boolean lit) { + world.setBlock(pos, state.setValue(LIT, lit), 2 | 3); if(lit){ - world.playSound(null, pos, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.5F, 1.0F); + world.playSound(null, pos, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.5F, 1.0F); } } - protected static void extinguish(@Nullable PlayerEntity player, BlockState state, WorldAccess world, BlockPos pos) { + protected static void extinguish(@Nullable Player player, BlockState state, LevelAccessor world, BlockPos pos) { setLit(world, state, pos, false); - world.playSound(null, pos, SoundEvents.BLOCK_CANDLE_EXTINGUISH, SoundCategory.BLOCKS, 1.5F, 1.0F); - world.emitGameEvent(player, GameEvent.BLOCK_CHANGE, pos); + world.playSound(null, pos, SoundEvents.CANDLE_EXTINGUISH, SoundSource.BLOCKS, 1.5F, 1.0F); + world.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); } @Override public FluidState getFluidState(BlockState state) { - return Fluids.EMPTY.getDefaultState(); + return Fluids.EMPTY.defaultFluidState(); } - public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient && projectile.isOnFire() && !state.get(LIT)) { - world.setBlockState(hit.getBlockPos(), state.with(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); + public void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!world.isClientSide && projectile.isOnFire() && !state.getValue(LIT)) { + world.setBlock(hit.getBlockPos(), state.setValue(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); } } - protected Iterable getParticleOffsets(BlockState state) { - return (Iterable)CANDLES_TO_PARTICLE_OFFSETS.get(state.get(CANDLES)); + protected Iterable getParticleOffsets(BlockState state) { + return (Iterable)CANDLES_TO_PARTICLE_OFFSETS.get(state.getValue(CANDLES)); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(HORIZONTAL_FACING, rotation.rotate(state.get(HORIZONTAL_FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(HORIZONTAL_FACING, rotation.rotate(state.getValue(HORIZONTAL_FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(HORIZONTAL_FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(HORIZONTAL_FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); } static { - LIT = Properties.LIT; - STATE_TO_LUMINANCE = (state) -> state.get(LIT) ? (int)(state.get(CANDLES) * 3.5f) : 0; + LIT = BlockStateProperties.LIT; + STATE_TO_LUMINANCE = (state) -> state.getValue(LIT) ? (int)(state.getValue(CANDLES) * 3.5f) : 0; CANDLES_TO_PARTICLE_OFFSETS = Util.make(new Int2ObjectOpenHashMap(4), (int2ObjectOpenHashMap) -> { - int2ObjectOpenHashMap.put(1, List.of((new Vec3d(8.0, 16.0, 8.0)).multiply(0.0625))); - int2ObjectOpenHashMap.put(2, List.of((new Vec3d(7.0, 16.0, 8.0)).multiply(0.0625), (new Vec3d(10, 14.0, 9)).multiply(0.0625))); - int2ObjectOpenHashMap.put(3, List.of((new Vec3d(7.0, 16.0, 9.0)).multiply(0.0625), (new Vec3d(8.0, 15.0, 6.0)).multiply(0.0625), - (new Vec3d(10, 14.0, 10.0)).multiply(0.0625), (new Vec3d(2.0, 8.0, 4.0)).multiply(0.0625), (new Vec3d(13.0, 6.0, 13.0)).multiply(0.0625))); + int2ObjectOpenHashMap.put(1, List.of((new Vec3(8.0, 16.0, 8.0)).scale(0.0625))); + int2ObjectOpenHashMap.put(2, List.of((new Vec3(7.0, 16.0, 8.0)).scale(0.0625), (new Vec3(10, 14.0, 9)).scale(0.0625))); + int2ObjectOpenHashMap.put(3, List.of((new Vec3(7.0, 16.0, 9.0)).scale(0.0625), (new Vec3(8.0, 15.0, 6.0)).scale(0.0625), + (new Vec3(10, 14.0, 10.0)).scale(0.0625), (new Vec3(2.0, 8.0, 4.0)).scale(0.0625), (new Vec3(13.0, 6.0, 13.0)).scale(0.0625))); }); - SHAPE = Block.createCuboidShape(4, 0, 4, 12, 8, 12); + SHAPE = Block.box(4, 0, 4, 12, 8, 12); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/SmallChandelierBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/SmallChandelierBlock.java index 0f2f85f87d..15c6b60f3c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/SmallChandelierBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/candles/SmallChandelierBlock.java @@ -1,162 +1,47 @@ package net.sevenstars.middleearth.block.special.candles; -import net.minecraft.block.*; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; -import net.minecraft.world.tick.ScheduledTickView; -import org.jetbrains.annotations.Nullable; - -import java.util.function.ToIntFunction; - -public class SmallChandelierBlock extends Block { - private static final int MAX_VARIANT = 2; - public static final IntProperty VARIANT = IntProperty.of("variant", 1, MAX_VARIANT); - public static final BooleanProperty LIT; - - public static final ToIntFunction STATE_TO_LUMINANCE; - private static final VoxelShape SHAPE; - - public SmallChandelierBlock(Settings settings) { - super(settings); - this.setDefaultState(this.getDefaultState().with(LIT, false)); - } - - @Override - protected void appendProperties(StateManager.Builder builder) { - builder.add(LIT).add(VARIANT); - } - - @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - BlockState blockState = this.getDefaultState().with(VARIANT, 1); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { - return blockState; - } - return null; - } - - @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - return !state.canPlaceAt(world, pos) ? - Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); - } - - @Override - protected boolean canPathfindThrough(BlockState state, NavigationType type) { - return false; - } - - @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - Hand hand = player.getActiveHand(); - if (!world.isClient && player.getAbilities().allowModifyWorld) { - ItemStack itemStack = player.getStackInHand(hand); - if(player.isInCreativeMode() && itemStack == ItemStack.EMPTY){ - world.setBlockState(pos, state.cycle(VARIANT)); - return ActionResult.SUCCESS; - } - - if (state.get(LIT) && itemStack.isIn(ItemTags.SHOVELS)) { - extinguish(null, state, world, pos); - } else if (!state.get(LIT) && itemStack.isOf(Items.FLINT_AND_STEEL) || itemStack.isOf(Items.TORCH)) { - setLit(world, state, pos, true); - } - } - return ActionResult.SUCCESS; - } - - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { - if (state.get(LIT)) { - if(state.get(VARIANT) == 1) { - spawnCandleParticles(world, pos.toCenterPos().add(0.0625, 12.5 * 0.0625, 0.0625), random); - spawnCandleParticles(world, pos.toCenterPos().add(0.0625, 12.5 * 0.0625, 0.9375), random); - spawnCandleParticles(world, pos.toCenterPos().add(0.9375, 12.5 * 0.0625, 0.0625), random); - spawnCandleParticles(world, pos.toCenterPos().add(0.9375, 12.5 * 0.0625, 0.9375), random); - } else if(state.get(VARIANT) == 2) { - spawnCandleParticles(world, pos.toCenterPos().add(0.125, 12.5 * 0.0625, 0.5), random); - spawnCandleParticles(world, pos.toCenterPos().add(0.5, 12.5 * 0.0625, 0.875), random); - spawnCandleParticles(world, pos.toCenterPos().add(0.5, 12.5 * 0.0625, 0.125), random); - spawnCandleParticles(world, pos.toCenterPos().add(0.875, 12.5 * 0.0625, 0.5), random); - } - } - } - - protected static void spawnCandleParticles(World world, Vec3d vec3d, Random random) { - float f = random.nextFloat(); - if (f < 0.3F) { - world.addParticleClient(ParticleTypes.SMOKE, vec3d.x - 0.5f, vec3d.y - 0.5f, vec3d.z - 0.5f, 0.0, 0.0, 0.0); - if (f < 0.17F) { - world.playSoundClient(vec3d.x, vec3d.y, vec3d.z, SoundEvents.BLOCK_CANDLE_AMBIENT, SoundCategory.BLOCKS, 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F, false); - } - } - world.addParticleClient(ParticleTypes.SMALL_FLAME, vec3d.x - 0.5f, vec3d.y - 0.5f, vec3d.z - 0.5f, 0.0, 0.0, 0.0); - } - - protected static void setLit(WorldAccess world, BlockState state, BlockPos pos, boolean lit) { - world.setBlockState(pos, state.with(LIT, lit), 2 | 3); - if(lit){ - world.playSound(null, pos, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.5F, 1.0F); - } - } - - protected static void extinguish(@Nullable PlayerEntity player, BlockState state, WorldAccess world, BlockPos pos) { - setLit(world, state, pos, false); - - world.playSound(null, pos, SoundEvents.BLOCK_CANDLE_EXTINGUISH, SoundCategory.BLOCKS, 1.5F, 1.0F); - world.emitGameEvent(player, GameEvent.BLOCK_CHANGE, pos); +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +import java.util.List; + +public class SmallChandelierBlock extends AbstractChandelierBlock { + public static final MapCodec CODEC = simpleCodec(SmallChandelierBlock::new); + private static final double CANDLE_HEIGHT = 12.5 / 16.0; + private static final List VARIANT_ONE_PARTICLES = List.of( + new Vec3(0.0625, CANDLE_HEIGHT, 0.0625), + new Vec3(0.0625, CANDLE_HEIGHT, 0.9375), + new Vec3(0.9375, CANDLE_HEIGHT, 0.0625), + new Vec3(0.9375, CANDLE_HEIGHT, 0.9375)); + private static final List VARIANT_TWO_PARTICLES = List.of( + new Vec3(0.125, CANDLE_HEIGHT, 0.5), + new Vec3(0.5, CANDLE_HEIGHT, 0.875), + new Vec3(0.5, CANDLE_HEIGHT, 0.125), + new Vec3(0.875, CANDLE_HEIGHT, 0.5)); + private static final VoxelShape SHAPE = Block.box(0.0, 2.0, 0.0, 16.0, 16.0, 16.0); + + public SmallChandelierBlock(Properties properties) { + super(properties); } @Override - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - return Block.sideCoversSmallSquare(world, pos.up(), Direction.DOWN); + protected MapCodec codec() { + return CODEC; } @Override - public FluidState getFluidState(BlockState state) { - return Fluids.EMPTY.getDefaultState(); - } - - public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient && projectile.isOnFire() && !state.get(LIT)) { - world.setBlockState(hit.getBlockPos(), state.with(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); - } + protected Iterable particleOffsets(BlockState state) { + return state.getValue(VARIANT) == 1 ? VARIANT_ONE_PARTICLES : VARIANT_TWO_PARTICLES; } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return SHAPE; } - - static { - LIT = Properties.LIT; - STATE_TO_LUMINANCE = (state) -> state.get(LIT) ? 15 : 0; - SHAPE = Block.createCuboidShape(0, 2, 0, 16, 16.0, 16); - } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/BeechCofferBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/BeechCofferBlock.java index 9d4b457182..09a0c7547d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/BeechCofferBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/BeechCofferBlock.java @@ -1,47 +1,47 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ChestBlock; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; public class BeechCofferBlock extends ChestBlock { - public BeechCofferBlock(Settings settings) { - super(() -> ModBlockEntities.BEECH_COFFER, settings); + public BeechCofferBlock(Properties settings) { + super(settings, () -> ModBlockEntities.BEECH_COFFER); } @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new BeechCofferBlockEntity(pos, state); } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction direction = ctx.getHorizontalPlayerFacing(); - FluidState fluidstate = ctx.getWorld().getFluidState(ctx.getBlockPos()); - return this.getDefaultState().with(FACING, direction).with(WATERLOGGED, fluidstate.getFluid() == Fluids.WATER); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction direction = ctx.getHorizontalDirection(); + FluidState fluidstate = ctx.getLevel().getFluidState(ctx.getClickedPos()); + return this.defaultBlockState().setValue(FACING, direction).setValue(WATERLOGGED, fluidstate.getType() == Fluids.WATER); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if(state.get(FACING) == Direction.NORTH) { - return Block.createCuboidShape(2.0, 0.0, 2.0, 14.0, 8.0, 10.0); - } else if(state.get(FACING) == Direction.SOUTH) { - return Block.createCuboidShape(2.0, 0.0, 6.0, 14.0, 8.0, 14.0); - } else if(state.get(FACING) == Direction.EAST) { - return Block.createCuboidShape(6.0, 0.0, 2.0, 14.0, 8.0, 14.0); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + if(state.getValue(FACING) == Direction.NORTH) { + return Block.box(2.0, 0.0, 2.0, 14.0, 8.0, 10.0); + } else if(state.getValue(FACING) == Direction.SOUTH) { + return Block.box(2.0, 0.0, 6.0, 14.0, 8.0, 14.0); + } else if(state.getValue(FACING) == Direction.EAST) { + return Block.box(6.0, 0.0, 2.0, 14.0, 8.0, 14.0); } else { - return Block.createCuboidShape(2.0, 0.0, 2.0, 10.0, 8.0, 14.0); + return Block.box(2.0, 0.0, 2.0, 10.0, 8.0, 14.0); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/BeechCofferBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/BeechCofferBlockEntity.java index a094160316..e1d61b0adc 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/BeechCofferBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/BeechCofferBlockEntity.java @@ -1,11 +1,11 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.ChestBlockEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModBlockEntities; @@ -13,11 +13,11 @@ public class BeechCofferBlockEntity extends ChestBlockEntity { public BeechCofferBlockEntity(BlockPos pos, BlockState state) { super(ModBlockEntities.BEECH_COFFER, pos, state); - this.setHeldStacks(DefaultedList.ofSize(this.size(), ItemStack.EMPTY)); + this.setItems(NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY)); } @Override - public Text getDisplayName() { - return Text.translatable(MiddleEarth.of("beech_coffer").toTranslationKey("screen")); + public Component getDisplayName() { + return Component.translatable(MiddleEarth.of("beech_coffer").toLanguageKey("screen")); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/BeechCofferEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/BeechCofferEntityRenderer.java index 7832da6177..0fb6aae073 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/BeechCofferEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/BeechCofferEntityRenderer.java @@ -1,87 +1,100 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.*; -import net.minecraft.block.entity.ChestBlockEntity; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Axis; +import net.minecraft.world.level.block.*; import net.minecraft.client.model.*; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.TexturedRenderLayers; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.render.block.entity.ChestBlockEntityRenderer; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.Sheets; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.blockentity.ChestRenderer; +import net.minecraft.client.resources.model.Material; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.DoubleBlockCombiner; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.reinforcedChest.ReinforcedChestBlock; import net.sevenstars.middleearth.entity.EntityModelLayersME; -public class BeechCofferEntityRenderer extends ChestBlockEntityRenderer { +public class BeechCofferEntityRenderer extends ChestRenderer { private static final String BODY = "body"; private static final String LID = "lid"; + private static final Material MATERIAL = + new Material(Sheets.CHEST_SHEET, MiddleEarth.ofPath("model", "beech_coffer")); private final ModelPart lid; private final ModelPart body; - public BeechCofferEntityRenderer(BlockEntityRendererFactory.Context ctx) { + public BeechCofferEntityRenderer(BlockEntityRendererProvider.Context ctx) { super(ctx); - ModelPart modelPart = ctx.getLayerModelPart(EntityModelLayersME.BEECH_COFFER); + ModelPart modelPart = ctx.bakeLayer(EntityModelLayersME.BEECH_COFFER); this.body = modelPart.getChild(BODY); this.lid = modelPart.getChild(LID); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData body = modelPartData.addChild(BODY, ModelPartBuilder.create() - .uv(8, 50).cuboid(-12.0F, -1.0F, -3.0F, 12.0F, 6.0F, 8.0F, new Dilation(0.0F)), - ModelTransform.origin(6.0F, 19.0F, 1.0F)); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition body = modelPartData.addOrReplaceChild(BODY, CubeListBuilder.create() + .texOffs(8, 50).addBox(-12.0F, -1.0F, -3.0F, 12.0F, 6.0F, 8.0F, new CubeDeformation(0.0F)), + PartPose.offset(6.0F, 19.0F, 1.0F)); - body.addChild("cube_r1", ModelPartBuilder.create() - .uv(43, 48).cuboid(0.0F, 0.0F, -1.0F, 0.0F, 2.0F, 4.0F, new Dilation(0.0F)), - ModelTransform.of(-12.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.3491F)); + body.addOrReplaceChild("cube_r1", CubeListBuilder.create() + .texOffs(43, 48).addBox(0.0F, 0.0F, -1.0F, 0.0F, 2.0F, 4.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-12.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.3491F)); - body.addChild("cube_r2", ModelPartBuilder.create() - .uv(43, 48).mirrored().cuboid(0.0F, 0.0F, -1.0F, 0.0F, 2.0F, 4.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -0.3491F)); + body.addOrReplaceChild("cube_r2", CubeListBuilder.create() + .texOffs(43, 48).mirror().addBox(0.0F, 0.0F, -1.0F, 0.0F, 2.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -0.3491F)); - modelPartData.addChild(LID, ModelPartBuilder.create() - .uv(12, 35).cuboid(-6.0F, -2.0F, -6.0F, 12.0F, 2.0F, 6.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 18.0F, 5.0F)); + modelPartData.addOrReplaceChild(LID, CubeListBuilder.create() + .texOffs(12, 35).addBox(-6.0F, -2.0F, -6.0F, 12.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 18.0F, 5.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } @Override - public void render(T entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { - SpriteIdentifier spriteIdentifier = new SpriteIdentifier(TexturedRenderLayers.CHEST_ATLAS_TEXTURE, MiddleEarth.ofPath( "model", "beech_coffer")); - VertexConsumer vertexConsumer = spriteIdentifier.getVertexConsumer(vertexConsumers, RenderLayer::getEntityCutout); + public void render(T entity, float tickProgress, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { + VertexConsumer vertexConsumer = MATERIAL.buffer(vertexConsumers, RenderType::entityCutout); - World world = entity.getWorld(); - BlockState blockState = world != null ? entity.getCachedState() : Blocks.CHEST.getDefaultState().with(ChestBlock.FACING, Direction.SOUTH); + Level world = entity.getLevel(); + BlockState blockState = world != null ? entity.getBlockState() : Blocks.CHEST.defaultBlockState().setValue(ChestBlock.FACING, Direction.SOUTH); Block block = blockState.getBlock(); BeechCofferBlock chest = (BeechCofferBlock)block; - DoubleBlockProperties.PropertySource properties; - properties = chest.getBlockEntitySource(blockState, world, entity.getPos(), true); - float g = properties.apply(ReinforcedChestBlock.getAnimationProgressRetriever(entity)).get(tickProgress); + DoubleBlockCombiner.NeighborCombineResult properties; + properties = chest.combine(blockState, world, entity.getBlockPos(), true); + float g = properties.apply(ReinforcedChestBlock.opennessCombiner(entity)).get(tickProgress); g = 1.0F - g; g = 1.0F - g * g * g; - matrices.push(); - float rotation = blockState.get(ChestBlock.FACING).getPositiveHorizontalDegrees(); + matrices.pushPose(); + float rotation = blockState.getValue(ChestBlock.FACING).toYRot(); matrices.translate(0.5D, 1.5D, 0.5D); - matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(180)); - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotation - 180)); + matrices.mulPose(Axis.XP.rotationDegrees(180)); + matrices.mulPose(Axis.YP.rotationDegrees(rotation - 180)); - lid.pitch = g * -1.5707964f; + lid.xRot = g * -1.5707964f; lid.render(matrices, vertexConsumer, light, overlay); body.render(matrices, vertexConsumer, light, overlay); - matrices.pop(); + matrices.popPose(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/ChestnutCofferBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/ChestnutCofferBlock.java index ac86fdca41..b3711b9d1c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/ChestnutCofferBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/ChestnutCofferBlock.java @@ -1,47 +1,47 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ChestBlock; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; public class ChestnutCofferBlock extends ChestBlock { - public ChestnutCofferBlock(Settings settings) { - super(() -> ModBlockEntities.CHESTNUT_COFFER, settings); + public ChestnutCofferBlock(Properties settings) { + super(settings, () -> ModBlockEntities.CHESTNUT_COFFER); } @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new ChestnutCofferBlockEntity(pos, state); } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction direction = ctx.getHorizontalPlayerFacing(); - FluidState fluidstate = ctx.getWorld().getFluidState(ctx.getBlockPos()); - return this.getDefaultState().with(FACING, direction).with(WATERLOGGED, fluidstate.getFluid() == Fluids.WATER); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction direction = ctx.getHorizontalDirection(); + FluidState fluidstate = ctx.getLevel().getFluidState(ctx.getClickedPos()); + return this.defaultBlockState().setValue(FACING, direction).setValue(WATERLOGGED, fluidstate.getType() == Fluids.WATER); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if(state.get(FACING) == Direction.NORTH) { - return Block.createCuboidShape(0.0, 0.0, 2.0, 16.0, 12.0, 13.0); - } else if(state.get(FACING) == Direction.SOUTH) { - return Block.createCuboidShape(0.0, 0.0, 3.0, 16.0, 12.0, 14.0); - } else if(state.get(FACING) == Direction.EAST) { - return Block.createCuboidShape(3.0, 0.0, 0.0, 14.0, 12.0, 16.0); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + if(state.getValue(FACING) == Direction.NORTH) { + return Block.box(0.0, 0.0, 2.0, 16.0, 12.0, 13.0); + } else if(state.getValue(FACING) == Direction.SOUTH) { + return Block.box(0.0, 0.0, 3.0, 16.0, 12.0, 14.0); + } else if(state.getValue(FACING) == Direction.EAST) { + return Block.box(3.0, 0.0, 0.0, 14.0, 12.0, 16.0); } else { - return Block.createCuboidShape(2.0, 0.0, 0.0, 13.0, 12.0, 16.0); + return Block.box(2.0, 0.0, 0.0, 13.0, 12.0, 16.0); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/ChestnutCofferBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/ChestnutCofferBlockEntity.java index e22ee4d746..a7d83c3be8 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/ChestnutCofferBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/ChestnutCofferBlockEntity.java @@ -1,11 +1,11 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.ChestBlockEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModBlockEntities; @@ -13,11 +13,11 @@ public class ChestnutCofferBlockEntity extends ChestBlockEntity { public ChestnutCofferBlockEntity(BlockPos pos, BlockState state) { super(ModBlockEntities.CHESTNUT_COFFER, pos, state); - this.setHeldStacks(DefaultedList.ofSize(this.size(), ItemStack.EMPTY)); + this.setItems(NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY)); } @Override - public Text getDisplayName() { - return Text.translatable(MiddleEarth.of("chestnut_coffer").toTranslationKey("screen")); + public Component getDisplayName() { + return Component.translatable(MiddleEarth.of("chestnut_coffer").toLanguageKey("screen")); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/ChestnutCofferEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/ChestnutCofferEntityRenderer.java index 3415dbc152..17a3d9518b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/ChestnutCofferEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/ChestnutCofferEntityRenderer.java @@ -1,100 +1,101 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ChestBlock; -import net.minecraft.block.DoubleBlockProperties; -import net.minecraft.block.entity.ChestBlockEntity; -import net.minecraft.client.model.Dilation; -import net.minecraft.client.model.ModelData; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.model.ModelPartBuilder; -import net.minecraft.client.model.ModelPartData; -import net.minecraft.client.model.ModelTransform; -import net.minecraft.client.model.TexturedModelData; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.TexturedRenderLayers; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.render.block.entity.ChestBlockEntityRenderer; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Axis; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.Sheets; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.blockentity.ChestRenderer; +import net.minecraft.client.resources.model.Material; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.DoubleBlockCombiner; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.reinforcedChest.ReinforcedChestBlock; import net.sevenstars.middleearth.entity.EntityModelLayersME; -public class ChestnutCofferEntityRenderer extends ChestBlockEntityRenderer { +public class ChestnutCofferEntityRenderer extends ChestRenderer { private static final String BODY = "body"; private static final String LID = "lid"; + private static final Material MATERIAL = + new Material(Sheets.CHEST_SHEET, MiddleEarth.ofPath("model", "chestnut_coffer")); private final ModelPart body; private final ModelPart lid; - public ChestnutCofferEntityRenderer(BlockEntityRendererFactory.Context ctx) { + public ChestnutCofferEntityRenderer(BlockEntityRendererProvider.Context ctx) { super(ctx); - ModelPart modelPart = ctx.getLayerModelPart(EntityModelLayersME.CHESTNUT_COFFER); + ModelPart modelPart = ctx.bakeLayer(EntityModelLayersME.CHESTNUT_COFFER); this.body = modelPart.getChild(BODY); this.lid = modelPart.getChild(LID); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData body = modelPartData.addChild(BODY, ModelPartBuilder.create() - .uv(2, 34).cuboid(-16.0F, 6.1F, -5.0F, 4.0F, 2.0F, 1.0F, new Dilation(0.0F)) - .uv(19, 34).cuboid(-4.0F, 6.1F, -5.0F, 4.0F, 2.0F, 1.0F, new Dilation(0.0F)) - .uv(35, 34).cuboid(-4.0F, 6.1F, 5.0F, 4.0F, 2.0F, 1.0F, new Dilation(0.0F)) - .uv(2, 39).cuboid(-16.0F, 6.1F, 5.0F, 4.0F, 2.0F, 1.0F, new Dilation(0.0F)) - .uv(0, 13).cuboid(-16.0F, -1.9F, -5.0F, 16.0F, 8.0F, 11.0F, new Dilation(0.0F)), - ModelTransform.origin(8.0F, 15.9F, 0.0F)); - - body.addChild("cube_r1", ModelPartBuilder.create() - .uv(1, -1).cuboid(0.0F, 0.0F, -2.0F, 0.0F, 4.0F, 5.0F, new Dilation(0.0F)), - ModelTransform.of(-16.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.3491F)); - - body.addChild("cube_r2", ModelPartBuilder.create() - .uv(1, -1).mirrored().cuboid(0.0F, 0.0F, -2.0F, 0.0F, 4.0F, 5.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -0.3491F)); - - modelPartData.addChild(LID, ModelPartBuilder.create() - .uv(0, 49).cuboid(-8.0F, -2.0F, -12.0F, 16.0F, 2.0F, 13.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 14.0F, 6.0F)); - - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition body = modelPartData.addOrReplaceChild(BODY, CubeListBuilder.create() + .texOffs(2, 34).addBox(-16.0F, 6.1F, -5.0F, 4.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(19, 34).addBox(-4.0F, 6.1F, -5.0F, 4.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(35, 34).addBox(-4.0F, 6.1F, 5.0F, 4.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(2, 39).addBox(-16.0F, 6.1F, 5.0F, 4.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(0, 13).addBox(-16.0F, -1.9F, -5.0F, 16.0F, 8.0F, 11.0F, new CubeDeformation(0.0F)), + PartPose.offset(8.0F, 15.9F, 0.0F)); + + body.addOrReplaceChild("cube_r1", CubeListBuilder.create() + .texOffs(1, -1).addBox(0.0F, 0.0F, -2.0F, 0.0F, 4.0F, 5.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-16.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.3491F)); + + body.addOrReplaceChild("cube_r2", CubeListBuilder.create() + .texOffs(1, -1).mirror().addBox(0.0F, 0.0F, -2.0F, 0.0F, 4.0F, 5.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -0.3491F)); + + modelPartData.addOrReplaceChild(LID, CubeListBuilder.create() + .texOffs(0, 49).addBox(-8.0F, -2.0F, -12.0F, 16.0F, 2.0F, 13.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 14.0F, 6.0F)); + + return LayerDefinition.create(modelData, 64, 64); } @Override - public void render(T entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { - SpriteIdentifier spriteIdentifier = new SpriteIdentifier(TexturedRenderLayers.CHEST_ATLAS_TEXTURE, MiddleEarth.ofPath( "model", "chestnut_coffer")); - VertexConsumer vertexConsumer = spriteIdentifier.getVertexConsumer(vertexConsumers, RenderLayer::getEntityCutout); + public void render(T entity, float tickProgress, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { + VertexConsumer vertexConsumer = MATERIAL.buffer(vertexConsumers, RenderType::entityCutout); - World world = entity.getWorld(); - BlockState blockState = world != null ? entity.getCachedState() : Blocks.CHEST.getDefaultState().with(ChestBlock.FACING, Direction.SOUTH); + Level world = entity.getLevel(); + BlockState blockState = world != null ? entity.getBlockState() : Blocks.CHEST.defaultBlockState().setValue(ChestBlock.FACING, Direction.SOUTH); Block block = blockState.getBlock(); ChestnutCofferBlock chest = (ChestnutCofferBlock)block; - DoubleBlockProperties.PropertySource properties = chest.getBlockEntitySource(blockState, world, entity.getPos(), true); - float g = properties.apply(ReinforcedChestBlock.getAnimationProgressRetriever(entity)).get(tickProgress); + DoubleBlockCombiner.NeighborCombineResult properties = chest.combine(blockState, world, entity.getBlockPos(), true); + float g = properties.apply(ReinforcedChestBlock.opennessCombiner(entity)).get(tickProgress); g = 1.0F - g; g = 1.0F - g * g * g; - matrices.push(); - float rotation = blockState.get(ChestBlock.FACING).getPositiveHorizontalDegrees(); + matrices.pushPose(); + float rotation = blockState.getValue(ChestBlock.FACING).toYRot(); matrices.translate(0.5D, 1.5D, 0.5D); - matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(180)); - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotation - 180)); + matrices.mulPose(Axis.XP.rotationDegrees(180)); + matrices.mulPose(Axis.YP.rotationDegrees(rotation - 180)); - lid.pitch = g * -1.5707964f; + lid.xRot = g * -1.5707964f; lid.render(matrices, vertexConsumer, light, overlay); body.render(matrices, vertexConsumer, light, overlay); - matrices.pop(); + matrices.popPose(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/FirCofferBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/FirCofferBlock.java index 3d8aad43a1..17da8ef39c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/FirCofferBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/FirCofferBlock.java @@ -1,43 +1,43 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ChestBlock; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; public class FirCofferBlock extends ChestBlock { - public FirCofferBlock(Settings settings) { - super(() -> ModBlockEntities.FIR_COFFER, settings); + public FirCofferBlock(Properties settings) { + super(settings, () -> ModBlockEntities.FIR_COFFER); } @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new FirCofferBlockEntity(pos, state); } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction direction = ctx.getHorizontalPlayerFacing(); - FluidState fluidstate = ctx.getWorld().getFluidState(ctx.getBlockPos()); - return this.getDefaultState().with(FACING, direction).with(WATERLOGGED, fluidstate.getFluid() == Fluids.WATER); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction direction = ctx.getHorizontalDirection(); + FluidState fluidstate = ctx.getLevel().getFluidState(ctx.getClickedPos()); + return this.defaultBlockState().setValue(FACING, direction).setValue(WATERLOGGED, fluidstate.getType() == Fluids.WATER); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if(state.get(FACING) == Direction.NORTH || state.get(FACING) == Direction.SOUTH) { - return Block.createCuboidShape(3.0, 0.0, 4.0, 13.0, 8.0, 12.0); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + if(state.getValue(FACING) == Direction.NORTH || state.getValue(FACING) == Direction.SOUTH) { + return Block.box(3.0, 0.0, 4.0, 13.0, 8.0, 12.0); } else { - return Block.createCuboidShape(4.0, 0.0, 3.0, 12.0, 8.0, 13.0); + return Block.box(4.0, 0.0, 3.0, 12.0, 8.0, 13.0); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/FirCofferBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/FirCofferBlockEntity.java index 926cfa66c8..4699c775a6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/FirCofferBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/FirCofferBlockEntity.java @@ -1,11 +1,11 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.ChestBlockEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModBlockEntities; @@ -13,11 +13,11 @@ public class FirCofferBlockEntity extends ChestBlockEntity { public FirCofferBlockEntity(BlockPos pos, BlockState state) { super(ModBlockEntities.FIR_COFFER, pos, state); - this.setHeldStacks(DefaultedList.ofSize(this.size(), ItemStack.EMPTY)); + this.setItems(NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY)); } @Override - public Text getDisplayName() { - return Text.translatable(MiddleEarth.of("fir_coffer").toTranslationKey("screen")); + public Component getDisplayName() { + return Component.translatable(MiddleEarth.of("fir_coffer").toLanguageKey("screen")); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/FirCofferEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/FirCofferEntityRenderer.java index 39b35a0e14..4e01663b85 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/FirCofferEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/FirCofferEntityRenderer.java @@ -1,83 +1,96 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.*; -import net.minecraft.block.entity.ChestBlockEntity; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Axis; +import net.minecraft.world.level.block.*; import net.minecraft.client.model.*; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.TexturedRenderLayers; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.render.block.entity.ChestBlockEntityRenderer; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.Sheets; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.blockentity.ChestRenderer; +import net.minecraft.client.resources.model.Material; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.DoubleBlockCombiner; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.reinforcedChest.ReinforcedChestBlock; import net.sevenstars.middleearth.entity.EntityModelLayersME; -public class FirCofferEntityRenderer extends ChestBlockEntityRenderer { +public class FirCofferEntityRenderer extends ChestRenderer { private static final String BASE = "bottom"; private static final String LID = "lid"; + private static final Material MATERIAL = + new Material(Sheets.CHEST_SHEET, MiddleEarth.ofPath("model", "fir_coffer")); private final ModelPart lid; private final ModelPart bottom; - public FirCofferEntityRenderer(BlockEntityRendererFactory.Context ctx) { + public FirCofferEntityRenderer(BlockEntityRendererProvider.Context ctx) { super(ctx); - ModelPart modelPart = ctx.getLayerModelPart(EntityModelLayersME.FIR_COFFER); + ModelPart modelPart = ctx.bakeLayer(EntityModelLayersME.FIR_COFFER); this.bottom = modelPart.getChild(BASE); this.lid = modelPart.getChild(LID); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - modelPartData.addChild(LID, ModelPartBuilder.create() - .uv(0, 24).cuboid(-5.0F, -2.0F, -8.0F, 10.0F, 2.0F, 8.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 18.0F, 4.0F)); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + modelPartData.addOrReplaceChild(LID, CubeListBuilder.create() + .texOffs(0, 24).addBox(-5.0F, -2.0F, -8.0F, 10.0F, 2.0F, 8.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 18.0F, 4.0F)); - modelPartData.addChild(BASE, ModelPartBuilder.create() - .uv(0, 36).cuboid(-1.0F, -4.0F, -7.0F, 10.0F, 4.0F, 8.0F, new Dilation(0.0F)) - .uv(40, 34).cuboid(-1.0F, 0.0F, -7.0F, 2.0F, 2.0F, 2.0F, new Dilation(0.0F)) - .uv(40, 29).cuboid(-1.0F, 0.0F, -1.0F, 2.0F, 2.0F, 2.0F, new Dilation(0.0F)) - .uv(40, 44).cuboid(7.0F, 0.0F, -7.0F, 2.0F, 2.0F, 2.0F, new Dilation(0.0F)) - .uv(40, 39).cuboid(7.0F, 0.0F, -1.0F, 2.0F, 2.0F, 2.0F, new Dilation(0.0F)), - ModelTransform.origin(-4.0F, 22.0F, 3.0F)); + modelPartData.addOrReplaceChild(BASE, CubeListBuilder.create() + .texOffs(0, 36).addBox(-1.0F, -4.0F, -7.0F, 10.0F, 4.0F, 8.0F, new CubeDeformation(0.0F)) + .texOffs(40, 34).addBox(-1.0F, 0.0F, -7.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(40, 29).addBox(-1.0F, 0.0F, -1.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(40, 44).addBox(7.0F, 0.0F, -7.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(40, 39).addBox(7.0F, 0.0F, -1.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), + PartPose.offset(-4.0F, 22.0F, 3.0F)); - return TexturedModelData.of(modelData, 48, 48); + return LayerDefinition.create(modelData, 48, 48); } @Override - public void render(T entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { - SpriteIdentifier spriteIdentifier = new SpriteIdentifier(TexturedRenderLayers.CHEST_ATLAS_TEXTURE, MiddleEarth.ofPath( "model", "fir_coffer")); - VertexConsumer vertexConsumer = spriteIdentifier.getVertexConsumer(vertexConsumers, RenderLayer::getEntityCutout); + public void render(T entity, float tickProgress, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { + VertexConsumer vertexConsumer = MATERIAL.buffer(vertexConsumers, RenderType::entityCutout); - World world = entity.getWorld(); - BlockState blockState = world != null ? entity.getCachedState() : Blocks.CHEST.getDefaultState().with(ChestBlock.FACING, Direction.SOUTH); + Level world = entity.getLevel(); + BlockState blockState = world != null ? entity.getBlockState() : Blocks.CHEST.defaultBlockState().setValue(ChestBlock.FACING, Direction.SOUTH); Block block = blockState.getBlock(); FirCofferBlock chest = (FirCofferBlock)block; - DoubleBlockProperties.PropertySource properties; - properties = chest.getBlockEntitySource(blockState, world, entity.getPos(), true); - float g = properties.apply(ReinforcedChestBlock.getAnimationProgressRetriever(entity)).get(tickProgress); + DoubleBlockCombiner.NeighborCombineResult properties; + properties = chest.combine(blockState, world, entity.getBlockPos(), true); + float g = properties.apply(ReinforcedChestBlock.opennessCombiner(entity)).get(tickProgress); g = 1.0F - g; g = 1.0F - g * g * g; - matrices.push(); - float rotation = blockState.get(ChestBlock.FACING).getPositiveHorizontalDegrees(); + matrices.pushPose(); + float rotation = blockState.getValue(ChestBlock.FACING).toYRot(); matrices.translate(0.5D, 1.5D, 0.5D); - matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(180)); - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotation - 180)); + matrices.mulPose(Axis.XP.rotationDegrees(180)); + matrices.mulPose(Axis.YP.rotationDegrees(rotation - 180)); - lid.pitch = g * -1.5707964f; + lid.xRot = g * -1.5707964f; lid.render(matrices, vertexConsumer, light, overlay); bottom.render(matrices, vertexConsumer, light, overlay); - matrices.pop(); + matrices.popPose(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/LarchCofferBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/LarchCofferBlock.java index 7767af5d6f..715ca4248f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/LarchCofferBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/LarchCofferBlock.java @@ -1,43 +1,43 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ChestBlock; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; public class LarchCofferBlock extends ChestBlock { - public LarchCofferBlock(Settings settings) { - super(() -> ModBlockEntities.LARCH_COFFER, settings); + public LarchCofferBlock(Properties settings) { + super(settings, () -> ModBlockEntities.LARCH_COFFER); } @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new LarchCofferBlockEntity(pos, state); } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction direction = ctx.getHorizontalPlayerFacing(); - FluidState fluidstate = ctx.getWorld().getFluidState(ctx.getBlockPos()); - return this.getDefaultState().with(FACING, direction).with(WATERLOGGED, fluidstate.getFluid() == Fluids.WATER); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction direction = ctx.getHorizontalDirection(); + FluidState fluidstate = ctx.getLevel().getFluidState(ctx.getClickedPos()); + return this.defaultBlockState().setValue(FACING, direction).setValue(WATERLOGGED, fluidstate.getType() == Fluids.WATER); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if(state.get(FACING) == Direction.NORTH || state.get(FACING) == Direction.SOUTH) { - return Block.createCuboidShape(1.0, 0.0, 3.0, 15.0, 12.0, 13.0); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + if(state.getValue(FACING) == Direction.NORTH || state.getValue(FACING) == Direction.SOUTH) { + return Block.box(1.0, 0.0, 3.0, 15.0, 12.0, 13.0); } else { - return Block.createCuboidShape(3.0, 0.0, 1.0, 13.0, 12.0, 15.0); + return Block.box(3.0, 0.0, 1.0, 13.0, 12.0, 15.0); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/LarchCofferBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/LarchCofferBlockEntity.java index c06a1629bf..8d7ea1cc32 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/LarchCofferBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/LarchCofferBlockEntity.java @@ -1,11 +1,11 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.ChestBlockEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModBlockEntities; @@ -13,11 +13,11 @@ public class LarchCofferBlockEntity extends ChestBlockEntity { public LarchCofferBlockEntity(BlockPos pos, BlockState state) { super(ModBlockEntities.LARCH_COFFER, pos, state); - this.setHeldStacks(DefaultedList.ofSize(this.size(), ItemStack.EMPTY)); + this.setItems(NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY)); } @Override - public Text getDisplayName() { - return Text.translatable(MiddleEarth.of("larch_coffer").toTranslationKey("screen")); + public Component getDisplayName() { + return Component.translatable(MiddleEarth.of("larch_coffer").toLanguageKey("screen")); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/LarchCofferEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/LarchCofferEntityRenderer.java index 46e76ad548..ba1827092a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/LarchCofferEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/LarchCofferEntityRenderer.java @@ -1,89 +1,102 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.*; -import net.minecraft.block.entity.ChestBlockEntity; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Axis; +import net.minecraft.world.level.block.*; import net.minecraft.client.model.*; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.TexturedRenderLayers; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.render.block.entity.ChestBlockEntityRenderer; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.Sheets; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.blockentity.ChestRenderer; +import net.minecraft.client.resources.model.Material; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.DoubleBlockCombiner; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.reinforcedChest.ReinforcedChestBlock; import net.sevenstars.middleearth.entity.EntityModelLayersME; -public class LarchCofferEntityRenderer extends ChestBlockEntityRenderer { +public class LarchCofferEntityRenderer extends ChestRenderer { private static final String BASE = "bottom"; private static final String LID = "lid"; + private static final Material MATERIAL = + new Material(Sheets.CHEST_SHEET, MiddleEarth.ofPath("model", "larch_coffer")); private final ModelPart lid; private final ModelPart bottom; - public LarchCofferEntityRenderer(BlockEntityRendererFactory.Context ctx) { + public LarchCofferEntityRenderer(BlockEntityRendererProvider.Context ctx) { super(ctx); - ModelPart modelPart = ctx.getLayerModelPart(EntityModelLayersME.LARCH_COFFER); + ModelPart modelPart = ctx.bakeLayer(EntityModelLayersME.LARCH_COFFER); this.bottom = modelPart.getChild(BASE); this.lid = modelPart.getChild(LID); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData lid = modelPartData.addChild(LID, ModelPartBuilder.create().uv(0, 21).cuboid(-8.0F, -2.0F, -10.0F, 16.0F, 2.0F, 10.0F, new Dilation(0.0F)) - .uv(49, 57).cuboid(-1.0F, -2.0F, -11.0F, 2.0F, 3.0F, 1.0F, - new Dilation(0.0F)), ModelTransform.origin(0.0F, 14.0F, 5.0F)); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition lid = modelPartData.addOrReplaceChild(LID, CubeListBuilder.create().texOffs(0, 21).addBox(-8.0F, -2.0F, -10.0F, 16.0F, 2.0F, 10.0F, new CubeDeformation(0.0F)) + .texOffs(49, 57).addBox(-1.0F, -2.0F, -11.0F, 2.0F, 3.0F, 1.0F, + new CubeDeformation(0.0F)), PartPose.offset(0.0F, 14.0F, 5.0F)); - ModelPartData bottom = modelPartData.addChild(BASE, ModelPartBuilder.create().uv(0, 58).cuboid(-7.0F, -2.0F, -5.0F, 3.0F, 2.0F, 2.0F, new Dilation(0.0F)) - .uv(12, 58).cuboid(-7.0F, -2.0F, 3.0F, 3.0F, 2.0F, 2.0F, new Dilation(0.0F)) - .uv(24, 58).cuboid(4.0F, -2.0F, 3.0F, 3.0F, 2.0F, 2.0F, new Dilation(0.0F)) - .uv(36, 58).cuboid(4.0F, -2.0F, -5.0F, 3.0F, 2.0F, 2.0F, new Dilation(0.0F)) - .uv(0, 0).cuboid(-7.0F, -10.0F, -5.0F, 14.0F, 8.0F, 10.0F, - new Dilation(0.0F)), ModelTransform.origin(0.0F, 24.0F, 0.0F)); + PartDefinition bottom = modelPartData.addOrReplaceChild(BASE, CubeListBuilder.create().texOffs(0, 58).addBox(-7.0F, -2.0F, -5.0F, 3.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(12, 58).addBox(-7.0F, -2.0F, 3.0F, 3.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(24, 58).addBox(4.0F, -2.0F, 3.0F, 3.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(36, 58).addBox(4.0F, -2.0F, -5.0F, 3.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(0, 0).addBox(-7.0F, -10.0F, -5.0F, 14.0F, 8.0F, 10.0F, + new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); - ModelPartData handle_r1 = bottom.addChild("handle_r1", ModelPartBuilder.create().uv(0, 0) - .mirrored().cuboid(0.0F, 0.0F, -2.0F, 0.0F, 3.0F, 4.0F, new Dilation(0.0F)) - .mirrored(false), ModelTransform.of(7.0F, -6.1F, 0.0F, 0.0F, 0.0F, -0.3927F)); + PartDefinition handle_r1 = bottom.addOrReplaceChild("handle_r1", CubeListBuilder.create().texOffs(0, 0) + .mirror().addBox(0.0F, 0.0F, -2.0F, 0.0F, 3.0F, 4.0F, new CubeDeformation(0.0F)) + .mirror(false), PartPose.offsetAndRotation(7.0F, -6.1F, 0.0F, 0.0F, 0.0F, -0.3927F)); - ModelPartData handle_r2 = bottom.addChild("handle_r2", ModelPartBuilder.create().uv(0, 0) - .cuboid(0.0F, 0.0F, -2.0F, 0.0F, 3.0F, 4.0F, new Dilation(0.0F)), - ModelTransform.of(-7.0F, -6.1F, 0.0F, 0.0F, 0.0F, 0.3927F)); - return TexturedModelData.of(modelData, 64, 64); + PartDefinition handle_r2 = bottom.addOrReplaceChild("handle_r2", CubeListBuilder.create().texOffs(0, 0) + .addBox(0.0F, 0.0F, -2.0F, 0.0F, 3.0F, 4.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-7.0F, -6.1F, 0.0F, 0.0F, 0.0F, 0.3927F)); + return LayerDefinition.create(modelData, 64, 64); } @Override - public void render(T entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { - SpriteIdentifier spriteIdentifier = new SpriteIdentifier(TexturedRenderLayers.CHEST_ATLAS_TEXTURE, MiddleEarth.ofPath( "model", "larch_coffer")); - VertexConsumer vertexConsumer = spriteIdentifier.getVertexConsumer(vertexConsumers, RenderLayer::getEntityCutout); + public void render(T entity, float tickProgress, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { + VertexConsumer vertexConsumer = MATERIAL.buffer(vertexConsumers, RenderType::entityCutout); - World world = entity.getWorld(); - BlockState blockState = world != null ? entity.getCachedState() : Blocks.CHEST.getDefaultState().with(ChestBlock.FACING, Direction.SOUTH); + Level world = entity.getLevel(); + BlockState blockState = world != null ? entity.getBlockState() : Blocks.CHEST.defaultBlockState().setValue(ChestBlock.FACING, Direction.SOUTH); Block block = blockState.getBlock(); LarchCofferBlock chest = (LarchCofferBlock)block; - DoubleBlockProperties.PropertySource properties; - properties = chest.getBlockEntitySource(blockState, world, entity.getPos(), true); - float g = properties.apply(ReinforcedChestBlock.getAnimationProgressRetriever(entity)).get(tickProgress); + DoubleBlockCombiner.NeighborCombineResult properties; + properties = chest.combine(blockState, world, entity.getBlockPos(), true); + float g = properties.apply(ReinforcedChestBlock.opennessCombiner(entity)).get(tickProgress); g = 1.0F - g; g = 1.0F - g * g * g; - matrices.push(); - float rotation = blockState.get(ChestBlock.FACING).getPositiveHorizontalDegrees(); + matrices.pushPose(); + float rotation = blockState.getValue(ChestBlock.FACING).toYRot(); matrices.translate(0.5D, 1.5D, 0.5D); - matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(180)); - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotation - 180)); + matrices.mulPose(Axis.XP.rotationDegrees(180)); + matrices.mulPose(Axis.YP.rotationDegrees(rotation - 180)); - lid.pitch = g * -1.5707964f; + lid.xRot = g * -1.5707964f; lid.render(matrices, vertexConsumer, light, overlay); bottom.render(matrices, vertexConsumer, light, overlay); - matrices.pop(); + matrices.popPose(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/OakCofferBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/OakCofferBlock.java index f4789479b1..d0f6d548ba 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/OakCofferBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/OakCofferBlock.java @@ -1,43 +1,43 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ChestBlock; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; public class OakCofferBlock extends ChestBlock { - public OakCofferBlock(Settings settings) { - super(() -> ModBlockEntities.OAK_COFFER, settings); + public OakCofferBlock(Properties settings) { + super(settings, () -> ModBlockEntities.OAK_COFFER); } @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new OakCofferBlockEntity(pos, state); } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction direction = ctx.getHorizontalPlayerFacing(); - FluidState fluidstate = ctx.getWorld().getFluidState(ctx.getBlockPos()); - return this.getDefaultState().with(FACING, direction).with(WATERLOGGED, fluidstate.getFluid() == Fluids.WATER); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction direction = ctx.getHorizontalDirection(); + FluidState fluidstate = ctx.getLevel().getFluidState(ctx.getClickedPos()); + return this.defaultBlockState().setValue(FACING, direction).setValue(WATERLOGGED, fluidstate.getType() == Fluids.WATER); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if(state.get(FACING) == Direction.NORTH || state.get(FACING) == Direction.SOUTH) { - return Block.createCuboidShape(0.0, 0.0, 2.0, 16.0, 14.0, 14.0); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + if(state.getValue(FACING) == Direction.NORTH || state.getValue(FACING) == Direction.SOUTH) { + return Block.box(0.0, 0.0, 2.0, 16.0, 14.0, 14.0); } else { - return Block.createCuboidShape(2.0, 0.0, 0.0, 14.0, 14.0, 16.0); + return Block.box(2.0, 0.0, 0.0, 14.0, 14.0, 16.0); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/OakCofferBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/OakCofferBlockEntity.java index 1d335dacf0..78434d10e5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/OakCofferBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/OakCofferBlockEntity.java @@ -1,11 +1,11 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.ChestBlockEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModBlockEntities; @@ -13,11 +13,11 @@ public class OakCofferBlockEntity extends ChestBlockEntity { public OakCofferBlockEntity(BlockPos pos, BlockState state) { super(ModBlockEntities.OAK_COFFER, pos, state); - this.setHeldStacks(DefaultedList.ofSize(this.size(), ItemStack.EMPTY)); + this.setItems(NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY)); } @Override - public Text getDisplayName() { - return Text.translatable(MiddleEarth.of("oak_coffer").toTranslationKey("screen")); + public Component getDisplayName() { + return Component.translatable(MiddleEarth.of("oak_coffer").toLanguageKey("screen")); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/OakCofferEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/OakCofferEntityRenderer.java index 4907421436..d37dcf0bcf 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/OakCofferEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/OakCofferEntityRenderer.java @@ -1,103 +1,104 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ChestBlock; -import net.minecraft.block.DoubleBlockProperties; -import net.minecraft.block.entity.ChestBlockEntity; -import net.minecraft.client.model.Dilation; -import net.minecraft.client.model.ModelData; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.model.ModelPartBuilder; -import net.minecraft.client.model.ModelPartData; -import net.minecraft.client.model.ModelTransform; -import net.minecraft.client.model.TexturedModelData; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.TexturedRenderLayers; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.render.block.entity.ChestBlockEntityRenderer; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Axis; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.Sheets; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.blockentity.ChestRenderer; +import net.minecraft.client.resources.model.Material; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.DoubleBlockCombiner; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.reinforcedChest.ReinforcedChestBlock; import net.sevenstars.middleearth.entity.EntityModelLayersME; -public class OakCofferEntityRenderer extends ChestBlockEntityRenderer { +public class OakCofferEntityRenderer extends ChestRenderer { private static final String BODY = "body"; private static final String LID = "lid"; + private static final Material MATERIAL = + new Material(Sheets.CHEST_SHEET, MiddleEarth.ofPath("model", "oak_coffer")); private final ModelPart lid; private final ModelPart body; - public OakCofferEntityRenderer(BlockEntityRendererFactory.Context ctx) { + public OakCofferEntityRenderer(BlockEntityRendererProvider.Context ctx) { super(ctx); - ModelPart modelPart = ctx.getLayerModelPart(EntityModelLayersME.OAK_COFFER); + ModelPart modelPart = ctx.bakeLayer(EntityModelLayersME.OAK_COFFER); this.lid = modelPart.getChild(LID); this.body = modelPart.getChild(BODY); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData lid = modelPartData.addChild(LID, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 13.0F, 6.0F)); - - lid.addChild("lid_r1", ModelPartBuilder.create() - .uv(0, 9).cuboid(-12.0F, -3.0F, -16.0F, 12.0F, 3.0F, 16.0F, new Dilation(0.0F)), - ModelTransform.of(-8.0F, 0.0F, 0.0F, 0.0F, -1.5708F, 0.0F)); - - ModelPartData body = modelPartData.addChild(BODY, ModelPartBuilder.create() - .uv(0, 56).cuboid(-11.0F, 0.0F, -14.0F, 3.0F, 4.0F, 3.0F, new Dilation(0.0F)) - .uv(26, 56).cuboid(-11.0F, 0.0F, -3.0F, 3.0F, 4.0F, 3.0F, new Dilation(0.0F)) - .uv(39, 56).cuboid(-2.0F, 0.0F, -3.0F, 3.0F, 4.0F, 3.0F, new Dilation(0.0F)) - .uv(13, 56).cuboid(-2.0F, 0.0F, -14.0F, 3.0F, 4.0F, 3.0F, new Dilation(0.0F)) - .uv(0, 32).cuboid(-11.0F, -7.0F, -14.0F, 12.0F, 7.0F, 14.0F, new Dilation(0.0F)), - ModelTransform.of(-7.0F, 20.0F, 5.0F, 0.0F, -1.5708F, 0.0F)); - - body.addChild("cube_r1", ModelPartBuilder.create() - .uv(0, -2).cuboid(0.0F, 0.0F, -2.0F, 0.0F, 3.0F, 4.0F, new Dilation(0.0F)), - ModelTransform.of(-5.0F, -5.0F, -14.0F, -1.5708F, 1.2654F, -1.5708F)); - - body.addChild("cube_r2", ModelPartBuilder.create() - .uv(0, -2).mirrored().cuboid(0.0F, 0.0F, -2.0F, 0.0F, 3.0F, 4.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(-5.0F, -5.0F, 0.0F, 1.5708F, 1.2654F, 1.5708F)); - - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition lid = modelPartData.addOrReplaceChild(LID, CubeListBuilder.create(), + PartPose.offset(0.0F, 13.0F, 6.0F)); + + lid.addOrReplaceChild("lid_r1", CubeListBuilder.create() + .texOffs(0, 9).addBox(-12.0F, -3.0F, -16.0F, 12.0F, 3.0F, 16.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-8.0F, 0.0F, 0.0F, 0.0F, -1.5708F, 0.0F)); + + PartDefinition body = modelPartData.addOrReplaceChild(BODY, CubeListBuilder.create() + .texOffs(0, 56).addBox(-11.0F, 0.0F, -14.0F, 3.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(26, 56).addBox(-11.0F, 0.0F, -3.0F, 3.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(39, 56).addBox(-2.0F, 0.0F, -3.0F, 3.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(13, 56).addBox(-2.0F, 0.0F, -14.0F, 3.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(0, 32).addBox(-11.0F, -7.0F, -14.0F, 12.0F, 7.0F, 14.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-7.0F, 20.0F, 5.0F, 0.0F, -1.5708F, 0.0F)); + + body.addOrReplaceChild("cube_r1", CubeListBuilder.create() + .texOffs(0, -2).addBox(0.0F, 0.0F, -2.0F, 0.0F, 3.0F, 4.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-5.0F, -5.0F, -14.0F, -1.5708F, 1.2654F, -1.5708F)); + + body.addOrReplaceChild("cube_r2", CubeListBuilder.create() + .texOffs(0, -2).mirror().addBox(0.0F, 0.0F, -2.0F, 0.0F, 3.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(-5.0F, -5.0F, 0.0F, 1.5708F, 1.2654F, 1.5708F)); + + return LayerDefinition.create(modelData, 64, 64); } @Override - public void render(T entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { - SpriteIdentifier spriteIdentifier = new SpriteIdentifier(TexturedRenderLayers.CHEST_ATLAS_TEXTURE, MiddleEarth.ofPath( "model", "oak_coffer")); - VertexConsumer vertexConsumer = spriteIdentifier.getVertexConsumer(vertexConsumers, RenderLayer::getEntityCutout); + public void render(T entity, float tickProgress, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { + VertexConsumer vertexConsumer = MATERIAL.buffer(vertexConsumers, RenderType::entityCutout); - World world = entity.getWorld(); - BlockState blockState = world != null ? entity.getCachedState() : Blocks.CHEST.getDefaultState().with(ChestBlock.FACING, Direction.SOUTH); + Level world = entity.getLevel(); + BlockState blockState = world != null ? entity.getBlockState() : Blocks.CHEST.defaultBlockState().setValue(ChestBlock.FACING, Direction.SOUTH); Block block = blockState.getBlock(); OakCofferBlock chest = (OakCofferBlock)block; - DoubleBlockProperties.PropertySource properties = chest.getBlockEntitySource(blockState, world, entity.getPos(), true); - float g = properties.apply(ReinforcedChestBlock.getAnimationProgressRetriever(entity)).get(tickProgress); + DoubleBlockCombiner.NeighborCombineResult properties = chest.combine(blockState, world, entity.getBlockPos(), true); + float g = properties.apply(ReinforcedChestBlock.opennessCombiner(entity)).get(tickProgress); g = 1.0F - g; g = 1.0F - g * g * g; - matrices.push(); - float rotation = blockState.get(ChestBlock.FACING).getPositiveHorizontalDegrees(); + matrices.pushPose(); + float rotation = blockState.getValue(ChestBlock.FACING).toYRot(); matrices.translate(0.5D, 1.5D, 0.5D); - matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(180)); - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotation - 180)); + matrices.mulPose(Axis.XP.rotationDegrees(180)); + matrices.mulPose(Axis.YP.rotationDegrees(rotation - 180)); - lid.pitch = g * -1.5707964f; + lid.xRot = g * -1.5707964f; lid.render(matrices, vertexConsumer, light, overlay); body.render(matrices, vertexConsumer, light, overlay); - matrices.pop(); + matrices.popPose(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/PineCofferBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/PineCofferBlock.java index 524fa5a191..63b7dd32e0 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/PineCofferBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/PineCofferBlock.java @@ -1,47 +1,47 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ChestBlock; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; public class PineCofferBlock extends ChestBlock { - public PineCofferBlock(Settings settings) { - super(() -> ModBlockEntities.PINE_COFFER, settings); + public PineCofferBlock(Properties settings) { + super(settings, () -> ModBlockEntities.PINE_COFFER); } @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new PineCofferBlockEntity(pos, state); } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction direction = ctx.getHorizontalPlayerFacing(); - FluidState fluidstate = ctx.getWorld().getFluidState(ctx.getBlockPos()); - return this.getDefaultState().with(FACING, direction).with(WATERLOGGED, fluidstate.getFluid() == Fluids.WATER); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction direction = ctx.getHorizontalDirection(); + FluidState fluidstate = ctx.getLevel().getFluidState(ctx.getClickedPos()); + return this.defaultBlockState().setValue(FACING, direction).setValue(WATERLOGGED, fluidstate.getType() == Fluids.WATER); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if(state.get(FACING) == Direction.NORTH) { - return Block.createCuboidShape(0.0, 0.0, 1.0, 16.0, 16.0, 14.0); - } else if(state.get(FACING) == Direction.SOUTH) { - return Block.createCuboidShape(0.0, 0.0, 2.0, 16.0, 16.0, 15.0); - } else if(state.get(FACING) == Direction.EAST) { - return Block.createCuboidShape(2.0, 0.0, 0.0, 15.0, 16.0, 16.0); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + if(state.getValue(FACING) == Direction.NORTH) { + return Block.box(0.0, 0.0, 1.0, 16.0, 16.0, 14.0); + } else if(state.getValue(FACING) == Direction.SOUTH) { + return Block.box(0.0, 0.0, 2.0, 16.0, 16.0, 15.0); + } else if(state.getValue(FACING) == Direction.EAST) { + return Block.box(2.0, 0.0, 0.0, 15.0, 16.0, 16.0); } else { - return Block.createCuboidShape(1.0, 0.0, 0.0, 14.0, 16.0, 16.0); + return Block.box(1.0, 0.0, 0.0, 14.0, 16.0, 16.0); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/PineCofferBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/PineCofferBlockEntity.java index b88ebf2158..9e0df00fc1 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/PineCofferBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/PineCofferBlockEntity.java @@ -1,11 +1,11 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.ChestBlockEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModBlockEntities; @@ -13,11 +13,11 @@ public class PineCofferBlockEntity extends ChestBlockEntity { public PineCofferBlockEntity(BlockPos pos, BlockState state) { super(ModBlockEntities.PINE_COFFER, pos, state); - this.setHeldStacks(DefaultedList.ofSize(this.size(), ItemStack.EMPTY)); + this.setItems(NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY)); } @Override - public Text getDisplayName() { - return Text.translatable(MiddleEarth.of("pine_coffer").toTranslationKey("screen")); + public Component getDisplayName() { + return Component.translatable(MiddleEarth.of("pine_coffer").toLanguageKey("screen")); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/PineCofferEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/PineCofferEntityRenderer.java index 119b155670..575dfb3d33 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/PineCofferEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/PineCofferEntityRenderer.java @@ -1,93 +1,106 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.*; -import net.minecraft.block.entity.ChestBlockEntity; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Axis; +import net.minecraft.world.level.block.*; import net.minecraft.client.model.*; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.TexturedRenderLayers; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.render.block.entity.ChestBlockEntityRenderer; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.Sheets; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.blockentity.ChestRenderer; +import net.minecraft.client.resources.model.Material; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.DoubleBlockCombiner; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.reinforcedChest.ReinforcedChestBlock; import net.sevenstars.middleearth.entity.EntityModelLayersME; -public class PineCofferEntityRenderer extends ChestBlockEntityRenderer { +public class PineCofferEntityRenderer extends ChestRenderer { private static final String BASE = "bottom"; private static final String LID = "lid"; + private static final Material MATERIAL = + new Material(Sheets.CHEST_SHEET, MiddleEarth.ofPath("model", "pine_coffer")); private final ModelPart lid; private final ModelPart bottom; - public PineCofferEntityRenderer(BlockEntityRendererFactory.Context ctx) { + public PineCofferEntityRenderer(BlockEntityRendererProvider.Context ctx) { super(ctx); - ModelPart modelPart = ctx.getLayerModelPart(EntityModelLayersME.PINE_COFFER); + ModelPart modelPart = ctx.bakeLayer(EntityModelLayersME.PINE_COFFER); this.bottom = modelPart.getChild(BASE); this.lid = modelPart.getChild(LID); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData lid = modelPartData.addChild("lid", ModelPartBuilder.create().uv(0, 23) - .cuboid(-8.0F, -2.0F, -14.0F, 16.0F, 2.0F, 15.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 10.0F, 7.0F)); - - ModelPartData bottom = modelPartData.addChild("bottom", ModelPartBuilder.create().uv(48, 29). - cuboid(7.0F, -4.0F, -6.0F, 1.0F, 4.0F, 3.0F, new Dilation(0.0F)) - .uv(3, 29).cuboid(7.0F, -4.0F, 4.0F, 1.0F, 4.0F, 3.0F, new Dilation(0.0F)) - .uv(3, 45).cuboid(-8.0F, -4.0F, 4.0F, 1.0F, 4.0F, 3.0F, new Dilation(0.0F)) - .uv(47, 45).cuboid(-8.0F, -4.0F, -6.0F, 1.0F, 4.0F, 3.0F, new Dilation(0.0F)) - .uv(0, 41).cuboid(-8.0F, -14.0F, -6.0F, 16.0F, 10.0F, 13.0F, new Dilation(0.0F)) - .uv(14, 5).cuboid(8.0F, -4.0F, -3.0F, 0.0F, 4.0F, 7.0F, new Dilation(0.0F)) - .uv(30, 5).cuboid(-8.0F, -4.0F, -3.0F, 0.0F, 4.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 24.0F, 0.0F)); - - ModelPartData cube_r1 = bottom.addChild("cube_r1", ModelPartBuilder.create().uv(14, 0) - .mirrored().cuboid(0.0F, 0.0F, -4.0F, 0.0F, 4.0F, 7.0F, new Dilation(0.0F)) - .mirrored(false), ModelTransform.of(-8.0F, -12.0F, 1.0F, 0.0F, 0.0F, 0.3491F)); - - ModelPartData cube_r2 = bottom.addChild("cube_r2", ModelPartBuilder.create().uv(14, 0) - .cuboid(0.0F, 0.0F, -4.0F, 0.0F, 4.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.of(8.0F, -12.0F, 1.0F, 0.0F, 0.0F, -0.3491F)); - - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition lid = modelPartData.addOrReplaceChild("lid", CubeListBuilder.create().texOffs(0, 23) + .addBox(-8.0F, -2.0F, -14.0F, 16.0F, 2.0F, 15.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 10.0F, 7.0F)); + + PartDefinition bottom = modelPartData.addOrReplaceChild("bottom", CubeListBuilder.create().texOffs(48, 29). + addBox(7.0F, -4.0F, -6.0F, 1.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(3, 29).addBox(7.0F, -4.0F, 4.0F, 1.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(3, 45).addBox(-8.0F, -4.0F, 4.0F, 1.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(47, 45).addBox(-8.0F, -4.0F, -6.0F, 1.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(0, 41).addBox(-8.0F, -14.0F, -6.0F, 16.0F, 10.0F, 13.0F, new CubeDeformation(0.0F)) + .texOffs(14, 5).addBox(8.0F, -4.0F, -3.0F, 0.0F, 4.0F, 7.0F, new CubeDeformation(0.0F)) + .texOffs(30, 5).addBox(-8.0F, -4.0F, -3.0F, 0.0F, 4.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 24.0F, 0.0F)); + + PartDefinition cube_r1 = bottom.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(14, 0) + .mirror().addBox(0.0F, 0.0F, -4.0F, 0.0F, 4.0F, 7.0F, new CubeDeformation(0.0F)) + .mirror(false), PartPose.offsetAndRotation(-8.0F, -12.0F, 1.0F, 0.0F, 0.0F, 0.3491F)); + + PartDefinition cube_r2 = bottom.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(14, 0) + .addBox(0.0F, 0.0F, -4.0F, 0.0F, 4.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(8.0F, -12.0F, 1.0F, 0.0F, 0.0F, -0.3491F)); + + return LayerDefinition.create(modelData, 64, 64); } @Override - public void render(T entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { - SpriteIdentifier spriteIdentifier = new SpriteIdentifier(TexturedRenderLayers.CHEST_ATLAS_TEXTURE, MiddleEarth.ofPath( "model", "pine_coffer")); - VertexConsumer vertexConsumer = spriteIdentifier.getVertexConsumer(vertexConsumers, RenderLayer::getEntityCutout); + public void render(T entity, float tickProgress, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { + VertexConsumer vertexConsumer = MATERIAL.buffer(vertexConsumers, RenderType::entityCutout); - World world = entity.getWorld(); - BlockState blockState = world != null ? entity.getCachedState() : Blocks.CHEST.getDefaultState().with(ChestBlock.FACING, Direction.SOUTH); + Level world = entity.getLevel(); + BlockState blockState = world != null ? entity.getBlockState() : Blocks.CHEST.defaultBlockState().setValue(ChestBlock.FACING, Direction.SOUTH); Block block = blockState.getBlock(); PineCofferBlock chest = (PineCofferBlock)block; - DoubleBlockProperties.PropertySource properties; - properties = chest.getBlockEntitySource(blockState, world, entity.getPos(), true); - float g = properties.apply(ReinforcedChestBlock.getAnimationProgressRetriever(entity)).get(tickProgress); + DoubleBlockCombiner.NeighborCombineResult properties; + properties = chest.combine(blockState, world, entity.getBlockPos(), true); + float g = properties.apply(ReinforcedChestBlock.opennessCombiner(entity)).get(tickProgress); g = 1.0F - g; g = 1.0F - g * g * g; - matrices.push(); - float rotation = blockState.get(ChestBlock.FACING).getPositiveHorizontalDegrees(); + matrices.pushPose(); + float rotation = blockState.getValue(ChestBlock.FACING).toYRot(); matrices.translate(0.5D, 1.5D, 0.5D); - matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(180)); - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotation - 180)); + matrices.mulPose(Axis.XP.rotationDegrees(180)); + matrices.mulPose(Axis.YP.rotationDegrees(rotation - 180)); - lid.pitch = g * -1.5707964f; + lid.xRot = g * -1.5707964f; lid.render(matrices, vertexConsumer, light, overlay); bottom.render(matrices, vertexConsumer, light, overlay); - matrices.pop(); + matrices.popPose(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/SpruceCofferBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/SpruceCofferBlock.java index 1220c6558f..fcec517748 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/SpruceCofferBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/SpruceCofferBlock.java @@ -1,39 +1,39 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ChestBlock; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; public class SpruceCofferBlock extends ChestBlock { - public SpruceCofferBlock(Settings settings) { - super(() -> ModBlockEntities.SPRUCE_COFFER, settings); + public SpruceCofferBlock(Properties settings) { + super(settings, () -> ModBlockEntities.SPRUCE_COFFER); } @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new SpruceCofferBlockEntity(pos, state); } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction direction = ctx.getHorizontalPlayerFacing(); - FluidState fluidstate = ctx.getWorld().getFluidState(ctx.getBlockPos()); - return this.getDefaultState().with(FACING, direction).with(WATERLOGGED, fluidstate.getFluid() == Fluids.WATER); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction direction = ctx.getHorizontalDirection(); + FluidState fluidstate = ctx.getLevel().getFluidState(ctx.getClickedPos()); + return this.defaultBlockState().setValue(FACING, direction).setValue(WATERLOGGED, fluidstate.getType() == Fluids.WATER); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 11.0, 16.0); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(0.0, 0.0, 0.0, 16.0, 11.0, 16.0); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/SpruceCofferBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/SpruceCofferBlockEntity.java index 6dbd30cf35..db392e9b9b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/SpruceCofferBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/SpruceCofferBlockEntity.java @@ -1,11 +1,11 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.ChestBlockEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModBlockEntities; @@ -13,11 +13,11 @@ public class SpruceCofferBlockEntity extends ChestBlockEntity { public SpruceCofferBlockEntity(BlockPos pos, BlockState state) { super(ModBlockEntities.SPRUCE_COFFER, pos, state); - this.setHeldStacks(DefaultedList.ofSize(this.size(), ItemStack.EMPTY)); + this.setItems(NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY)); } @Override - public Text getDisplayName() { - return Text.translatable(MiddleEarth.of("spruce_coffer").toTranslationKey("screen")); + public Component getDisplayName() { + return Component.translatable(MiddleEarth.of("spruce_coffer").toLanguageKey("screen")); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/SpruceCofferEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/SpruceCofferEntityRenderer.java index 03f9885671..f759eff9b1 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/SpruceCofferEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/SpruceCofferEntityRenderer.java @@ -1,96 +1,109 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.*; -import net.minecraft.block.entity.ChestBlockEntity; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Axis; +import net.minecraft.world.level.block.*; import net.minecraft.client.model.*; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.TexturedRenderLayers; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.render.block.entity.ChestBlockEntityRenderer; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.Sheets; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.blockentity.ChestRenderer; +import net.minecraft.client.resources.model.Material; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.DoubleBlockCombiner; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.reinforcedChest.ReinforcedChestBlock; import net.sevenstars.middleearth.entity.EntityModelLayersME; -public class SpruceCofferEntityRenderer extends ChestBlockEntityRenderer { +public class SpruceCofferEntityRenderer extends ChestRenderer { private static final String BASE = "bottom"; private static final String LID = "lid"; + private static final Material MATERIAL = + new Material(Sheets.CHEST_SHEET, MiddleEarth.ofPath("model", "spruce_coffer")); private final ModelPart lid; private final ModelPart bottom; - public SpruceCofferEntityRenderer(BlockEntityRendererFactory.Context ctx) { + public SpruceCofferEntityRenderer(BlockEntityRendererProvider.Context ctx) { super(ctx); - ModelPart modelPart = ctx.getLayerModelPart(EntityModelLayersME.SPRUCE_COFFER); + ModelPart modelPart = ctx.bakeLayer(EntityModelLayersME.SPRUCE_COFFER); this.bottom = modelPart.getChild(BASE); this.lid = modelPart.getChild(LID); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData lid = modelPartData.addChild("lid", ModelPartBuilder.create().uv(0, 45) - .cuboid(0.0F, -3.0F, -8.0F, 16.0F, 3.0F, 16.0F, - new Dilation(0.0F)), ModelTransform.origin(-8.0F, 16.0F, 0.0F)); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition lid = modelPartData.addOrReplaceChild("lid", CubeListBuilder.create().texOffs(0, 45) + .addBox(0.0F, -3.0F, -8.0F, 16.0F, 3.0F, 16.0F, + new CubeDeformation(0.0F)), PartPose.offset(-8.0F, 16.0F, 0.0F)); - ModelPartData lock_r1 = lid.addChild("lock_r1", ModelPartBuilder.create().uv(0, 1) - .cuboid(-2.0F, -4.0F, -1.0F, 4.0F, 4.0F, 1.0F, new Dilation(0.0F)), - ModelTransform.of(16.0F, 1.0F, 0.0F, 0.0F, -1.5708F, 0.0F)); + PartDefinition lock_r1 = lid.addOrReplaceChild("lock_r1", CubeListBuilder.create().texOffs(0, 1) + .addBox(-2.0F, -4.0F, -1.0F, 4.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(16.0F, 1.0F, 0.0F, 0.0F, -1.5708F, 0.0F)); - ModelPartData body = modelPartData.addChild("bottom", ModelPartBuilder.create().uv(0, 38) - .cuboid(5.0F, -3.0F, -8.0F, 3.0F, 3.0F, 3.0F, new Dilation(0.0F)) - .uv(12, 38).cuboid(-8.0F, -3.0F, -8.0F, 3.0F, 3.0F, 3.0F, new Dilation(0.0F)) - .uv(24, 38).cuboid(-8.0F, -3.0F, 5.0F, 3.0F, 3.0F, 3.0F, new Dilation(0.0F)) - .uv(36, 38).cuboid(5.0F, -3.0F, 5.0F, 3.0F, 3.0F, 3.0F, new Dilation(0.0F)) - .uv(0, 36).cuboid(-5.0F, -3.0F, -8.0F, 10.0F, 2.0F, 0.0F, new Dilation(0.0F)) - .uv(20, 36).cuboid(-5.0F, -3.0F, 8.0F, 10.0F, 2.0F, 0.0F, new Dilation(0.0F)) - .uv(0, 24).cuboid(8.0F, -3.0F, -5.0F, 0.0F, 2.0F, 10.0F, new Dilation(0.0F)) - .uv(20, 24).cuboid(-8.0F, -3.0F, -5.0F, 0.0F, 2.0F, 10.0F, new Dilation(0.0F)) - .uv(0, 3).cuboid(-8.0F, -8.0F, -8.0F, 16.0F, 5.0F, 16.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, 24.0F, 0.0F, 0.0F, 1.5708F, 0.0F)); + PartDefinition body = modelPartData.addOrReplaceChild("bottom", CubeListBuilder.create().texOffs(0, 38) + .addBox(5.0F, -3.0F, -8.0F, 3.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(12, 38).addBox(-8.0F, -3.0F, -8.0F, 3.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(24, 38).addBox(-8.0F, -3.0F, 5.0F, 3.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(36, 38).addBox(5.0F, -3.0F, 5.0F, 3.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(0, 36).addBox(-5.0F, -3.0F, -8.0F, 10.0F, 2.0F, 0.0F, new CubeDeformation(0.0F)) + .texOffs(20, 36).addBox(-5.0F, -3.0F, 8.0F, 10.0F, 2.0F, 0.0F, new CubeDeformation(0.0F)) + .texOffs(0, 24).addBox(8.0F, -3.0F, -5.0F, 0.0F, 2.0F, 10.0F, new CubeDeformation(0.0F)) + .texOffs(20, 24).addBox(-8.0F, -3.0F, -5.0F, 0.0F, 2.0F, 10.0F, new CubeDeformation(0.0F)) + .texOffs(0, 3).addBox(-8.0F, -8.0F, -8.0F, 16.0F, 5.0F, 16.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 24.0F, 0.0F, 0.0F, 1.5708F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } @Override - public void render(T entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { - SpriteIdentifier spriteIdentifier = new SpriteIdentifier(TexturedRenderLayers.CHEST_ATLAS_TEXTURE, MiddleEarth.ofPath( "model", "spruce_coffer")); - VertexConsumer vertexConsumer = spriteIdentifier.getVertexConsumer(vertexConsumers, RenderLayer::getEntityCutout); + public void render(T entity, float tickProgress, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { + VertexConsumer vertexConsumer = MATERIAL.buffer(vertexConsumers, RenderType::entityCutout); - World world = entity.getWorld(); - BlockState blockState = world != null ? entity.getCachedState() : Blocks.CHEST.getDefaultState().with(ChestBlock.FACING, Direction.SOUTH); + Level world = entity.getLevel(); + BlockState blockState = world != null ? entity.getBlockState() : Blocks.CHEST.defaultBlockState().setValue(ChestBlock.FACING, Direction.SOUTH); Block block = blockState.getBlock(); SpruceCofferBlock chest = (SpruceCofferBlock)block; - DoubleBlockProperties.PropertySource properties; - properties = chest.getBlockEntitySource(blockState, world, entity.getPos(), true); - float g = properties.apply(ReinforcedChestBlock.getAnimationProgressRetriever(entity)).get(tickProgress); + DoubleBlockCombiner.NeighborCombineResult properties; + properties = chest.combine(blockState, world, entity.getBlockPos(), true); + float g = properties.apply(ReinforcedChestBlock.opennessCombiner(entity)).get(tickProgress); g = 1.0F - g; g = 1.0F - g * g * g; - matrices.push(); - Direction facing = blockState.get(ChestBlock.FACING); - float rotation = facing.getPositiveHorizontalDegrees(); + matrices.pushPose(); + Direction facing = blockState.getValue(ChestBlock.FACING); + float rotation = facing.toYRot(); matrices.translate(0.5D, 1.5D, 0.5D); - matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(180)); + matrices.mulPose(Axis.XP.rotationDegrees(180)); if(facing == Direction.NORTH || facing == Direction.SOUTH) { - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-rotation - 90)); + matrices.mulPose(Axis.YP.rotationDegrees(-rotation - 90)); } else { - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-rotation + 90)); + matrices.mulPose(Axis.YP.rotationDegrees(-rotation + 90)); } - lid.roll = g * -1.5707964f; + lid.zRot = g * -1.5707964f; lid.render(matrices, vertexConsumer, light, overlay); bottom.render(matrices, vertexConsumer, light, overlay); - matrices.pop(); + matrices.popPose(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/WillowCofferBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/WillowCofferBlock.java index fffb9b35fe..c6c2cb5a61 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/WillowCofferBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/WillowCofferBlock.java @@ -1,43 +1,43 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ChestBlock; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; public class WillowCofferBlock extends ChestBlock { - public WillowCofferBlock(Settings settings) { - super(() -> ModBlockEntities.WILLOW_COFFER, settings); + public WillowCofferBlock(Properties settings) { + super(settings, () -> ModBlockEntities.WILLOW_COFFER); } @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new WillowCofferBlockEntity(pos, state); } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction direction = ctx.getHorizontalPlayerFacing(); - FluidState fluidstate = ctx.getWorld().getFluidState(ctx.getBlockPos()); - return this.getDefaultState().with(FACING, direction).with(WATERLOGGED, fluidstate.getFluid() == Fluids.WATER); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction direction = ctx.getHorizontalDirection(); + FluidState fluidstate = ctx.getLevel().getFluidState(ctx.getClickedPos()); + return this.defaultBlockState().setValue(FACING, direction).setValue(WATERLOGGED, fluidstate.getType() == Fluids.WATER); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if(state.get(FACING) == Direction.NORTH || state.get(FACING) == Direction.SOUTH) { - return Block.createCuboidShape(0.0, 0.0, 2.0, 16.0, 16.0, 14.0); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + if(state.getValue(FACING) == Direction.NORTH || state.getValue(FACING) == Direction.SOUTH) { + return Block.box(0.0, 0.0, 2.0, 16.0, 16.0, 14.0); } else { - return Block.createCuboidShape(2.0, 0.0, 0.0, 14.0, 16.0, 16.0); + return Block.box(2.0, 0.0, 0.0, 14.0, 16.0, 16.0); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/WillowCofferBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/WillowCofferBlockEntity.java index 16ddf7541e..f2196c7649 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/WillowCofferBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/WillowCofferBlockEntity.java @@ -1,11 +1,11 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.ChestBlockEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModBlockEntities; @@ -13,11 +13,11 @@ public class WillowCofferBlockEntity extends ChestBlockEntity { public WillowCofferBlockEntity(BlockPos pos, BlockState state) { super(ModBlockEntities.WILLOW_COFFER, pos, state); - this.setHeldStacks(DefaultedList.ofSize(this.size(), ItemStack.EMPTY)); + this.setItems(NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY)); } @Override - public Text getDisplayName() { - return Text.translatable(MiddleEarth.of("willow_coffer").toTranslationKey("screen")); + public Component getDisplayName() { + return Component.translatable(MiddleEarth.of("willow_coffer").toLanguageKey("screen")); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/WillowCofferEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/WillowCofferEntityRenderer.java index e40e4b96f8..c4409e2caf 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/WillowCofferEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/coffers/WillowCofferEntityRenderer.java @@ -1,92 +1,93 @@ package net.sevenstars.middleearth.block.special.coffers; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ChestBlock; -import net.minecraft.block.DoubleBlockProperties; -import net.minecraft.block.entity.ChestBlockEntity; -import net.minecraft.client.model.Dilation; -import net.minecraft.client.model.ModelData; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.model.ModelPartBuilder; -import net.minecraft.client.model.ModelPartData; -import net.minecraft.client.model.ModelTransform; -import net.minecraft.client.model.TexturedModelData; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.TexturedRenderLayers; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.render.block.entity.ChestBlockEntityRenderer; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Axis; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.Sheets; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.blockentity.ChestRenderer; +import net.minecraft.client.resources.model.Material; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.DoubleBlockCombiner; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.reinforcedChest.ReinforcedChestBlock; import net.sevenstars.middleearth.entity.EntityModelLayersME; -public class WillowCofferEntityRenderer extends ChestBlockEntityRenderer { +public class WillowCofferEntityRenderer extends ChestRenderer { private static final String BODY = "body"; private static final String LID = "lid"; + private static final Material MATERIAL = + new Material(Sheets.CHEST_SHEET, MiddleEarth.ofPath("model", "willow_coffer")); private final ModelPart body; private final ModelPart lid; - public WillowCofferEntityRenderer(BlockEntityRendererFactory.Context ctx) { + public WillowCofferEntityRenderer(BlockEntityRendererProvider.Context ctx) { super(ctx); - ModelPart modelPart = ctx.getLayerModelPart(EntityModelLayersME.WILLOW_COFFER); + ModelPart modelPart = ctx.bakeLayer(EntityModelLayersME.WILLOW_COFFER); this.body = modelPart.getChild(BODY); this.lid = modelPart.getChild(LID); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - modelPartData.addChild(BODY, ModelPartBuilder.create() - .uv(0, 36).cuboid(-1.0F, -4.0F, -1.0F, 4.0F, 4.0F, 4.0F, new Dilation(0.0F)) - .uv(16, 36).cuboid(-1.0F, -4.0F, 7.0F, 4.0F, 4.0F, 4.0F, new Dilation(0.0F)) - .uv(32, 36).cuboid(11.0F, -4.0F, 7.0F, 4.0F, 4.0F, 4.0F, new Dilation(0.0F)) - .uv(0, 44).cuboid(11.0F, -4.0F, -1.0F, 4.0F, 4.0F, 4.0F, new Dilation(0.0F)) - .uv(1, 0).cuboid(-1.0F, -13.0F, -1.0F, 16.0F, 9.0F, 12.0F, new Dilation(0.0F)), - ModelTransform.origin(-7.0F, 24.0F, -5.0F)); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + modelPartData.addOrReplaceChild(BODY, CubeListBuilder.create() + .texOffs(0, 36).addBox(-1.0F, -4.0F, -1.0F, 4.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)) + .texOffs(16, 36).addBox(-1.0F, -4.0F, 7.0F, 4.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)) + .texOffs(32, 36).addBox(11.0F, -4.0F, 7.0F, 4.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)) + .texOffs(0, 44).addBox(11.0F, -4.0F, -1.0F, 4.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)) + .texOffs(1, 0).addBox(-1.0F, -13.0F, -1.0F, 16.0F, 9.0F, 12.0F, new CubeDeformation(0.0F)), + PartPose.offset(-7.0F, 24.0F, -5.0F)); - modelPartData.addChild(LID, ModelPartBuilder.create() - .uv(1, 21).cuboid(-8.0F, -3.0F, -12.0F, 16.0F, 3.0F, 12.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 11.0F, 6.0F)); + modelPartData.addOrReplaceChild(LID, CubeListBuilder.create() + .texOffs(1, 21).addBox(-8.0F, -3.0F, -12.0F, 16.0F, 3.0F, 12.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 11.0F, 6.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } @Override - public void render(T entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { - SpriteIdentifier spriteIdentifier = new SpriteIdentifier(TexturedRenderLayers.CHEST_ATLAS_TEXTURE, MiddleEarth.ofPath( "model", "willow_coffer")); - VertexConsumer vertexConsumer = spriteIdentifier.getVertexConsumer(vertexConsumers, RenderLayer::getEntityCutout); + public void render(T entity, float tickProgress, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { + VertexConsumer vertexConsumer = MATERIAL.buffer(vertexConsumers, RenderType::entityCutout); - World world = entity.getWorld(); - BlockState blockState = world != null ? entity.getCachedState() : Blocks.CHEST.getDefaultState().with(ChestBlock.FACING, Direction.SOUTH); + Level world = entity.getLevel(); + BlockState blockState = world != null ? entity.getBlockState() : Blocks.CHEST.defaultBlockState().setValue(ChestBlock.FACING, Direction.SOUTH); Block block = blockState.getBlock(); WillowCofferBlock chest = (WillowCofferBlock)block; - DoubleBlockProperties.PropertySource properties = chest.getBlockEntitySource(blockState, world, entity.getPos(), true); - float g = properties.apply(ReinforcedChestBlock.getAnimationProgressRetriever(entity)).get(tickProgress); + DoubleBlockCombiner.NeighborCombineResult properties = chest.combine(blockState, world, entity.getBlockPos(), true); + float g = properties.apply(ReinforcedChestBlock.opennessCombiner(entity)).get(tickProgress); g = 1.0F - g; g = 1.0F - g * g * g; - matrices.push(); - float rotation = blockState.get(ChestBlock.FACING).getPositiveHorizontalDegrees(); + matrices.pushPose(); + float rotation = blockState.getValue(ChestBlock.FACING).toYRot(); matrices.translate(0.5D, 1.5D, 0.5D); - matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(180)); - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotation - 180)); + matrices.mulPose(Axis.XP.rotationDegrees(180)); + matrices.mulPose(Axis.YP.rotationDegrees(rotation - 180)); - lid.pitch = g * -1.5707964f; + lid.xRot = g * -1.5707964f; lid.render(matrices, vertexConsumer, light, overlay); body.render(matrices, vertexConsumer, light, overlay); - matrices.pop(); + matrices.popPose(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CeramicCrockpotBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CeramicCrockpotBlock.java index cd660adc54..b336afa598 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CeramicCrockpotBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CeramicCrockpotBlock.java @@ -1,32 +1,32 @@ package net.sevenstars.middleearth.block.special.crockpot; import com.mojang.serialization.MapCodec; -import net.minecraft.block.BlockState; -import net.minecraft.block.BlockWithEntity; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; import org.jetbrains.annotations.Nullable; public class CeramicCrockpotBlock extends CrockpotBlock { - public static final EnumProperty FACING = Properties.HORIZONTAL_FACING; - public static final BooleanProperty HANGING = BooleanProperty.of("hanging"); + public static final EnumProperty FACING = BlockStateProperties.HORIZONTAL_FACING; + public static final BooleanProperty HANGING = BooleanProperty.create("hanging"); - public CeramicCrockpotBlock(Settings settings) { + public CeramicCrockpotBlock(Properties settings) { super(settings); } @Override - protected MapCodec getCodec() { - return CeramicCrockpotBlock.createCodec(CeramicCrockpotBlock::new); + protected MapCodec codec() { + return CeramicCrockpotBlock.simpleCodec(CeramicCrockpotBlock::new); } @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new CrockpotBlockEntity(pos, state, 0.8125f); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotBlock.java index 205c44fd19..150f244a76 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotBlock.java @@ -1,143 +1,168 @@ package net.sevenstars.middleearth.block.special.crockpot; import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.BlockWithEntity; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemUsage; -import net.minecraft.registry.tag.BlockTags; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.stat.Stats; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.event.GameEvent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.stats.Stats; +import net.minecraft.tags.BlockTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.Containers; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ItemUtils; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import net.sevenstars.middleearth.block.special.bellows.BellowsBlock; import org.jetbrains.annotations.Nullable; -public class CrockpotBlock extends BlockWithEntity { - public static final EnumProperty FACING = Properties.HORIZONTAL_FACING; - public static final BooleanProperty HANGING = BooleanProperty.of("hanging"); +public class CrockpotBlock extends BaseEntityBlock { + public static final EnumProperty FACING = BlockStateProperties.HORIZONTAL_FACING; + public static final BooleanProperty HANGING = BooleanProperty.create("hanging"); - public CrockpotBlock(Settings settings) { + public CrockpotBlock(Properties settings) { super(settings); - setDefaultState(getDefaultState().with(FACING, Direction.NORTH).with(HANGING, false)); + registerDefaultState(defaultBlockState().setValue(FACING, Direction.NORTH).setValue(HANGING, false)); } @Override - protected MapCodec getCodec() { - return CrockpotBlock.createCodec(CrockpotBlock::new); + protected MapCodec codec() { + return CrockpotBlock.simpleCodec(CrockpotBlock::new); } @Override - protected ActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - BlockEntity blockEntity = player.getWorld().getBlockEntity(pos); + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; + } + + @Override + protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + BlockEntity blockEntity = player.level().getBlockEntity(pos); if(blockEntity instanceof CrockpotBlockEntity crockpotBlockEntity) { boolean filled = crockpotBlockEntity.fill(stack); if(filled) { - ItemStack remainder = stack.getRecipeRemainder(); - player.setStackInHand(hand, ItemUsage.exchangeStack(stack, player, remainder).copy()); - player.incrementStat(Stats.USED.getOrCreateStat(stack.getItem())); - world.playSound(null, pos, SoundEvents.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.1F); - world.emitGameEvent(null, GameEvent.FLUID_PLACE, pos); - return ActionResult.SUCCESS; + ItemStack remainder = stack.getCraftingRemainingItem(); + player.setItemInHand(hand, ItemUtils.createFilledResult(stack, player, remainder).copy()); + player.awardStat(Stats.ITEM_USED.get(stack.getItem())); + world.playSound(null, pos, SoundEvents.BUCKET_EMPTY, SoundSource.BLOCKS, 1.0F, 1.1F); + world.gameEvent(null, GameEvent.FLUID_PLACE, pos); + return ItemInteractionResult.SUCCESS; } else { if(stack.isEmpty()) { - NamedScreenHandlerFactory screenHandlerFactory = state.createScreenHandlerFactory(world, pos); + MenuProvider screenHandlerFactory = state.getMenuProvider(world, pos); if(screenHandlerFactory != null) { - player.openHandledScreen(screenHandlerFactory); + if (screenHandlerFactory instanceof net.sevenstars.middleearth.block.utils.ExtendedMenuProviderME extendedProvider) { + net.sevenstars.middleearth.block.utils.ExtendedMenuProviderME.open(player, extendedProvider); + } else { + player.openMenu(screenHandlerFactory); } - return ActionResult.CONSUME; + } + return ItemInteractionResult.CONSUME; } else { ItemStack stackResult = crockpotBlockEntity.fillBowl(stack.getItem()); if(!stackResult.isEmpty()) { - stack.decrement(1); - world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 0.9F); + stack.shrink(1); + world.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BOTTLE_FILL, SoundSource.BLOCKS, 1.0F, 0.9F); - if(world.isClient) { + if(world.isClientSide) { if (stack.isEmpty()) { - player.setStackInHand(hand, stackResult); - } else if (!player.getInventory().insertStack(stackResult)) { - player.dropItem(stackResult, false); + player.setItemInHand(hand, stackResult); + } else if (!player.getInventory().add(stackResult)) { + player.drop(stackResult, false); } } - world.emitGameEvent(player, GameEvent.FLUID_PICKUP, pos); - return ActionResult.SUCCESS; + world.gameEvent(player, GameEvent.FLUID_PICKUP, pos); + return ItemInteractionResult.SUCCESS; } } } } - return super.onUseWithItem(stack, state, world, pos, player, hand, hit); + return super.useItemOn(stack, state, world, pos, player, hand, hit); + } + + @Override + protected void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) { + if (!state.is(newState.getBlock())) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity instanceof CrockpotBlockEntity crockpot) { + for (int slot = 0; slot < CrockpotBlockEntity.OUTPUT_SLOT; slot++) { + Containers.dropItemStack(world, pos.getX(), pos.getY(), pos.getZ(), crockpot.getItem(slot)); + } + } + } + super.onRemove(state, world, pos, newState, moved); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(4.0, 0.0, 4.0, 12, 7.0, 12.0); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(4.0, 0.0, 4.0, 12, 7.0, 12.0); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING, HANGING); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - BlockView blockView = ctx.getWorld(); - BlockPos blockPos = ctx.getBlockPos(); - BlockPos bottomBlockPos = blockPos.down(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + BlockGetter blockView = ctx.getLevel(); + BlockPos blockPos = ctx.getClickedPos(); + BlockPos bottomBlockPos = blockPos.below(); BlockState blockState = blockView.getBlockState(bottomBlockPos); - if(blockState.isIn(BlockTags.CAMPFIRES) || blockState.isOf(ModDecorativeBlocks.BONFIRE)) { - return this.getDefaultState().with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()).with(HANGING, true); + if(blockState.is(BlockTags.CAMPFIRES) || blockState.is(ModDecorativeBlocks.BONFIRE)) { + return this.defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()).setValue(HANGING, true); } - return this.getDefaultState().with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); + return this.defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()); } @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new CrockpotBlockEntity(pos, state, 0.375f); } @Nullable @Override - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { + public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { return null; //validateTicker(world, type, ModBlockEntities.CROCKPOT); } @Nullable - protected static BlockEntityTicker validateTicker(World world, BlockEntityType givenType, BlockEntityType expectedType) { - return world.isClient - ? BellowsBlock.validateTicker(givenType, expectedType, CrockpotBlockEntity::clientTick) - : BellowsBlock.validateTicker(givenType, expectedType, CrockpotBlockEntity::serverTick); + protected static BlockEntityTicker validateTicker(Level world, BlockEntityType givenType, BlockEntityType expectedType) { + return world.isClientSide + ? BellowsBlock.createTickerHelper(givenType, expectedType, CrockpotBlockEntity::clientTick) + : BellowsBlock.createTickerHelper(givenType, expectedType, CrockpotBlockEntity::serverTick); } @Override - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { - super.randomDisplayTick(state, world, pos, random); + public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { + super.animateTick(state, world, pos, random); BlockEntity blockEntity = world.getBlockEntity(pos); if(blockEntity instanceof CrockpotBlockEntity crockpotBlockEntity) { if(crockpotBlockEntity.isCooking()) { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotBlockEntity.java index e553ac0a50..b2c80f2650 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotBlockEntity.java @@ -1,37 +1,39 @@ package net.sevenstars.middleearth.block.special.crockpot; -import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.UseRemainderComponent; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.Inventories; -import net.minecraft.inventory.Inventory; -import net.minecraft.inventory.SidedInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.recipe.RecipeEntry; -import net.minecraft.recipe.ServerRecipeManager; -import net.minecraft.registry.DynamicRegistryManager; -import net.minecraft.screen.PropertyDelegate; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.text.Text; -import net.minecraft.util.ItemScatterer; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.sevenstars.middleearth.block.utils.ExtendedMenuProviderME; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.NonNullList; +import net.minecraft.core.RegistryAccess; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.Container; +import net.minecraft.world.ContainerHelper; +import net.minecraft.world.WorldlyContainer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.forge.MultipleStackRecipeInput; import net.sevenstars.middleearth.recipe.CrockpotRecipe; @@ -41,17 +43,22 @@ import java.util.ArrayList; import java.util.List; -public class CrockpotBlockEntity extends BlockEntity implements ExtendedScreenHandlerFactory, SidedInventory { +public class CrockpotBlockEntity extends BlockEntity implements ExtendedMenuProviderME, WorldlyContainer { private static final String ID = "crockpot"; public static final int OUTPUT_SLOT = 4; public static final int COOK_TIME = 60; - private final DefaultedList inventory = - DefaultedList.ofSize(5, ItemStack.EMPTY); - protected final PropertyDelegate propertyDelegate; - private final ServerRecipeManager.MatchGetter matchGetter; + private final NonNullList inventory = + NonNullList.withSize(5, ItemStack.EMPTY); + protected final ContainerData propertyDelegate; + private final RecipeManager.CachedCheck matchGetter; private int progress = 0; - private Random random; private float liquidTopLevel; + private MultipleStackRecipeInput cachedRecipeInput = new MultipleStackRecipeInput(List.of()); + @Nullable + private RecipeHolder cachedRecipe; + private int cachedIngredientCount; + private boolean recipeCacheDirty = true; + private boolean clientSyncPending; public CrockpotBlockEntity(BlockPos pos, BlockState state) { this(pos, state, 0.5f); @@ -59,7 +66,7 @@ public CrockpotBlockEntity(BlockPos pos, BlockState state) { public CrockpotBlockEntity(BlockPos pos, BlockState state, float liquidTopLevel) { super(null, pos, state); - this.propertyDelegate = new PropertyDelegate() { + this.propertyDelegate = new ContainerData() { @Override public int get(int index) { return switch (index) { @@ -76,86 +83,82 @@ public void set(int index, int value) { } @Override - public int size() { + public int getCount() { return 1; } }; - this.matchGetter = ServerRecipeManager.createCachedMatchGetter(RecipesME.CROCKPOT); + this.matchGetter = RecipeManager.createCheck(RecipesME.CROCKPOT); this.liquidTopLevel = liquidTopLevel; - random = Random.create(); } - public static void serverTick(World world, BlockPos pos, BlockState state, CrockpotBlockEntity blockEntity) { - ArrayList ingredients = new ArrayList<>(); - for(int i = 0; i < blockEntity.inventory.size(); i++) { - ItemStack ingredient = blockEntity.inventory.get(i); - if(!ingredient.isEmpty()) { - ingredients.add(ingredient); - } + public static void serverTick(Level world, BlockPos pos, BlockState state, CrockpotBlockEntity blockEntity) { + if (world.isClientSide || !(world instanceof ServerLevel serverWorld)) { + return; } - boolean markDirty = false; - if (blockEntity.isBoiling() && !world.isClient) { - blockEntity.randomBubbles(); - ServerWorld serverWorld = (ServerWorld) world; - MultipleStackRecipeInput recipeInput = new MultipleStackRecipeInput(ingredients); - RecipeEntry recipeEntry; - if (ingredients.size() >= 2) { - recipeEntry = blockEntity.matchGetter.getFirstMatch(recipeInput, serverWorld).orElse(null); - } else { - recipeEntry = null; - blockEntity.progress = Math.max(blockEntity.progress - 1, 0); - } - markDirty = true; - ++blockEntity.progress; - if (blockEntity.progress >= COOK_TIME) { + + if (!blockEntity.isBoiling()) { + if (blockEntity.progress != 0) { blockEntity.progress = 0; - craftRecipe(world.getRegistryManager(), recipeEntry, recipeInput, blockEntity.inventory); - blockEntity.recipeCraftedSound(); + blockEntity.markPersistedChanged(); + blockEntity.clientSyncPending = true; } + blockEntity.flushClientSync(serverWorld); + return; } - if (markDirty) { - markDirty(world, pos, state); - } - - } + blockEntity.refreshRecipeCache(serverWorld); - public static void clientTick(World world, BlockPos pos, BlockState state, CrockpotBlockEntity blockEntity) { - if(blockEntity.isCooking()) - { - double x = (double)pos.getX() + 0.5; - double y = (double)pos.getY() + 0.5; - double z = (double)pos.getZ() + 0.5; - if (blockEntity.random.nextDouble() < 0.12) { - world.playSound(null, pos, SoundEvents.BLOCK_BUBBLE_COLUMN_BUBBLE_POP, SoundCategory.BLOCKS, 1.0F, 1.0F); + int previousProgress = blockEntity.progress; + boolean inventoryChanged = false; + if (blockEntity.cachedIngredientCount < 2) { + blockEntity.progress = Math.max(blockEntity.progress - 1, 0); + } + ++blockEntity.progress; + if (blockEntity.progress >= COOK_TIME) { + blockEntity.progress = 0; + inventoryChanged = craftRecipe( + world.registryAccess(), + blockEntity.cachedRecipe, + blockEntity.cachedRecipeInput, + blockEntity.inventory + ); + if (inventoryChanged) { + blockEntity.recipeCacheDirty = true; + blockEntity.clientSyncPending = true; } + blockEntity.recipeCraftedSound(); + } - double i = blockEntity.random.nextDouble() * 0.4 - 0.2; - double j = blockEntity.random.nextDouble() * 0.4 - 0.2; - world.addParticleClient(ParticleTypes.BUBBLE, x + i, y, z + j, 0.0, 0.1, 0.0); + if (blockEntity.progress != previousProgress || inventoryChanged) { + blockEntity.markPersistedChanged(); } + if ((previousProgress > 0) != (blockEntity.progress > 0)) { + blockEntity.clientSyncPending = true; + } + blockEntity.flushClientSync(serverWorld); } - public void randomBubbles() { - if(isCooking()) + public static void clientTick(Level world, BlockPos pos, BlockState state, CrockpotBlockEntity blockEntity) { + if(blockEntity.isCooking()) { double x = (double)pos.getX() + 0.5; double y = (double)pos.getY() + 0.5; double z = (double)pos.getZ() + 0.5; - if (random.nextDouble() < 0.12) { - world.playSound(null, pos, SoundEvents.BLOCK_BUBBLE_COLUMN_BUBBLE_POP, SoundCategory.BLOCKS, 1.0F, 1.0F); + if (world.random.nextDouble() < 0.12) { + world.playSound(null, pos, SoundEvents.BUBBLE_COLUMN_BUBBLE_POP, SoundSource.BLOCKS, 1.0F, 1.0F); } - double i = random.nextDouble() * 0.4 - 0.2; - double j = random.nextDouble() * 0.4 - 0.2; - world.addParticleClient(ParticleTypes.BUBBLE, x + i, y, z + j, 0.0, 0.1, 0.0); + double i = world.random.nextDouble() * 0.4 - 0.2; + double j = world.random.nextDouble() * 0.4 - 0.2; + world.addParticle(ParticleTypes.BUBBLE, x + i, y, z + j, 0.0, 0.1, 0.0); } } - private static boolean craftRecipe(DynamicRegistryManager dynamicRegistryManager, @Nullable RecipeEntry recipe, - MultipleStackRecipeInput input, DefaultedList inventory) { + private static boolean craftRecipe(RegistryAccess dynamicRegistryManager, + @Nullable RecipeHolder recipe, + MultipleStackRecipeInput input, NonNullList inventory) { if (recipe != null) { - ItemStack craftedStack = recipe.value().craft(input, dynamicRegistryManager); + ItemStack craftedStack = recipe.value().assemble(input, dynamicRegistryManager); inventory.set(OUTPUT_SLOT, craftedStack.copy()); for(int i = 0; i < OUTPUT_SLOT; i++) { inventory.set(i, ItemStack.EMPTY); @@ -166,16 +169,60 @@ private static boolean craftRecipe(DynamicRegistryManager dynamicRegistryManager } } + private void refreshRecipeCache(ServerLevel world) { + if (!this.recipeCacheDirty) { + return; + } + + ArrayList ingredients = new ArrayList<>(); + for (ItemStack ingredient : this.inventory) { + if (!ingredient.isEmpty()) { + ingredients.add(ingredient); + } + } + this.cachedIngredientCount = ingredients.size(); + this.cachedRecipeInput = new MultipleStackRecipeInput(ingredients); + this.cachedRecipe = this.cachedIngredientCount >= 2 + ? this.matchGetter.getRecipeFor(this.cachedRecipeInput, world).orElse(null) + : null; + this.recipeCacheDirty = false; + } + + private void markPersistedChanged() { + super.setChanged(); + } + + private void markInventoryChanged() { + this.recipeCacheDirty = true; + this.markPersistedChanged(); + this.clientSyncPending = true; + } + + @Override + public void setChanged() { + this.recipeCacheDirty = true; + this.markPersistedChanged(); + this.clientSyncPending = true; + } + + private void flushClientSync(ServerLevel world) { + if (this.clientSyncPending) { + BlockState state = this.getBlockState(); + world.sendBlockUpdated(this.worldPosition, state, state, Block.UPDATE_CLIENTS); + this.clientSyncPending = false; + } + } + public void recipeCraftedSound() { - double x = (double)pos.getX() + 0.5; - double y = (double)pos.getY() + 0.5; - double z = (double)pos.getZ() + 0.5; - world.playSound(null, pos, SoundEvents.BLOCK_BREWING_STAND_BREW, SoundCategory.BLOCKS, 1.1F, 0.8F); + double x = (double)worldPosition.getX() + 0.5; + double y = (double)worldPosition.getY() + 0.5; + double z = (double)worldPosition.getZ() + 0.5; + level.playSound(null, worldPosition, SoundEvents.BREWING_STAND_BREW, SoundSource.BLOCKS, 1.1F, 0.8F); } @Nullable @Override - public ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) { + public AbstractContainerMenu createMenu(int syncId, Inventory playerInventory, Player player) { return new CrockpotScreenHandler(syncId, playerInventory, this, this.propertyDelegate); } @@ -184,10 +231,10 @@ public boolean isCooking() { } public boolean isHanging() { - if(world != null) { - BlockState blockState = world.getBlockState(getPos()); + if(level != null) { + BlockState blockState = level.getBlockState(getBlockPos()); if(blockState == null || blockState.isAir()) return false; - return blockState.get(CrockpotBlock.HANGING); + return blockState.getValue(CrockpotBlock.HANGING); } return false; } @@ -197,7 +244,7 @@ public boolean isBoiling() { } public boolean hasOutput() { - return !getStack(OUTPUT_SLOT).isEmpty(); + return !getItem(OUTPUT_SLOT).isEmpty(); } public float getLiquidTopLevel() { @@ -205,9 +252,9 @@ public float getLiquidTopLevel() { } public boolean fill(ItemStack itemStack) { - if(getStack(OUTPUT_SLOT).isEmpty()) { + if(getItem(OUTPUT_SLOT).isEmpty()) { if(itemStack.getItem() == Items.WATER_BUCKET) { - setStack(OUTPUT_SLOT, itemStack); + setItem(OUTPUT_SLOT, itemStack); return true; } } @@ -216,19 +263,18 @@ public boolean fill(ItemStack itemStack) { public ItemStack fillBowl(Item remainder) { if(hasOutput()) { - ItemStack outputStack = getStack(OUTPUT_SLOT); - UseRemainderComponent remainderComponent = outputStack.get(DataComponentTypes.USE_REMAINDER); - if(remainderComponent != null) { - ItemStack recipeRemainder = remainderComponent.convertInto(); + ItemStack outputStack = getItem(OUTPUT_SLOT); + var foodProperties = outputStack.get(DataComponents.FOOD); + if (foodProperties != null) { + ItemStack recipeRemainder = foodProperties.usingConvertsTo().orElse(ItemStack.EMPTY); if (recipeRemainder.getItem() == remainder) { ItemStack result = outputStack.copy(); result.setCount(1); - outputStack.decrement(1); + outputStack.shrink(1); if(outputStack.getCount() == 0) { - outputStack = ItemStack.EMPTY; + this.inventory.set(OUTPUT_SLOT, ItemStack.EMPTY); } - setStack(OUTPUT_SLOT, outputStack); - System.out.println(getStack(OUTPUT_SLOT)); + this.markInventoryChanged(); return result; } } @@ -237,18 +283,7 @@ public ItemStack fillBowl(Item remainder) { } @Override - public void onBlockReplaced(BlockPos pos, BlockState oldState) { - if (this.world != null) { - List items = new ArrayList<>(getList()); - items.removeLast(); - for (ItemStack item : items) { - ItemScatterer.spawn(this.world, pos.getX(), pos.getY(), pos.getZ(), item); - } - } - } - - @Override - public int[] getAvailableSlots(Direction side) { + public int[] getSlotsForFace(Direction side) { int[] slots = new int[inventory.size()]; for (int i = 0; i < slots.length; i++) { slots[i] = i; @@ -257,17 +292,17 @@ public int[] getAvailableSlots(Direction side) { } @Override - public boolean canInsert(int slot, ItemStack stack, @Nullable Direction dir) { - return this.isValid(slot, stack); + public boolean canPlaceItemThroughFace(int slot, ItemStack stack, @Nullable Direction dir) { + return this.canPlaceItem(slot, stack); } @Override - public boolean canExtract(int slot, ItemStack stack, Direction dir) { + public boolean canTakeItemThroughFace(int slot, ItemStack stack, Direction dir) { return false; // Do not extract liquid output into hopper. } @Override - public int size() { + public int getContainerSize() { return this.inventory.size(); } @@ -277,7 +312,7 @@ public boolean isEmpty() { } @Override - public ItemStack getStack(int slot) { + public ItemStack getItem(int slot) { return this.inventory.get(slot); } @@ -286,55 +321,84 @@ public List getList() { } @Override - public ItemStack removeStack(int slot, int amount) { - return Inventories.splitStack(this.inventory, slot, amount); + public ItemStack removeItem(int slot, int amount) { + ItemStack removed = ContainerHelper.removeItem(this.inventory, slot, amount); + if (!removed.isEmpty()) { + this.markInventoryChanged(); + } + return removed; } @Override - public ItemStack removeStack(int slot) { - return Inventories.removeStack(inventory, slot); + public ItemStack removeItemNoUpdate(int slot) { + return ContainerHelper.takeItem(inventory, slot); } @Override - public void setStack(int slot, ItemStack stack) { - this.inventory.set(slot, stack); - if (stack.getCount() > getMaxCountPerStack()) { - stack.setCount(getMaxCountPerStack()); + public void setItem(int slot, ItemStack stack) { + if (stack.getCount() > getMaxStackSize()) { + stack.setCount(getMaxStackSize()); + } + if (!ItemStack.matches(this.inventory.get(slot), stack)) { + this.inventory.set(slot, stack); + this.markInventoryChanged(); } } @Override - public boolean canPlayerUse(PlayerEntity player) { - return Inventory.canPlayerUse(this, player); + public boolean stillValid(Player player) { + return Container.stillValidBlockEntity(this, player); } @Override - public void clear() { - this.inventory.clear(); + public void clearContent() { + boolean hasItems = false; + for (ItemStack stack : this.inventory) { + if (!stack.isEmpty()) { + hasItems = true; + break; + } + } + if (hasItems) { + this.inventory.clear(); + this.markInventoryChanged(); + } } @Override - public Object getScreenOpeningData(ServerPlayerEntity serverPlayerEntity) { - return pos; + public void writeOpeningData(RegistryFriendlyByteBuf buffer) { + BlockPos.STREAM_CODEC.encode(buffer, worldPosition); } @Override - public Text getDisplayName() { - return Text.translatable("screen." + MiddleEarth.MOD_ID + "." + ID); + public Component getDisplayName() { + return Component.translatable("screen." + MiddleEarth.MOD_ID + "." + ID); } @Override - protected void writeData(WriteView view) { - super.writeData(view); - Inventories.writeData(view, this.inventory); - view.putInt(ID + ".progress", this.progress); + protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.saveAdditional(tag, registries); + ContainerHelper.saveAllItems(tag, this.inventory, registries); + tag.putInt(ID + ".progress", this.progress); } @Override - protected void readData(ReadView view) { - super.readData(view); + protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.loadAdditional(tag, registries); this.inventory.clear(); - Inventories.readData(view, this.inventory); - this.progress = view.getInt(ID + ".progress", 0); + ContainerHelper.loadAllItems(tag, this.inventory, registries); + this.progress = tag.getInt(ID + ".progress"); + this.recipeCacheDirty = true; + } + + @Nullable + @Override + public Packet getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); + } + + @Override + public CompoundTag getUpdateTag(HolderLookup.Provider registryLookup) { + return this.saveWithoutMetadata(registryLookup); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotEntityRenderer.java index 231d0cf384..638720dea3 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotEntityRenderer.java @@ -1,67 +1,63 @@ package net.sevenstars.middleearth.block.special.crockpot; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BlockEntityRenderer; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.Vec3d; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.model.Material; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.world.phys.Vec3; -@Environment(value= EnvType.CLIENT) public class CrockpotEntityRenderer implements BlockEntityRenderer { private static final float SIZE_FACTOR = 0.25f; - private static SpriteIdentifier waterSpriteId = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, Identifier.ofVanilla("block/water_still")); + private static Material waterSpriteId = new Material(TextureAtlas.LOCATION_BLOCKS, ResourceLocation.withDefaultNamespace("block/water_still")); - public CrockpotEntityRenderer(BlockEntityRendererFactory.Context context) { + public CrockpotEntityRenderer(BlockEntityRendererProvider.Context context) { } @Override - public void render(CrockpotBlockEntity entity, float tickProgress, MatrixStack matrices, - VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { + public void render(CrockpotBlockEntity entity, float tickProgress, PoseStack matrices, + MultiBufferSource vertexConsumers, int light, int overlay) { int color = 4161734; int red = color >> 16 & 255; int green = color >> 8 & 255; int blue = color & 255; - matrices.push(); + matrices.pushPose(); if(entity.hasOutput()) { float liquidTopLevel = entity.getLiquidTopLevel(); matrices.translate(0, liquidTopLevel, 0); // 0.0625 per pixel - VertexConsumer consumer = vertexConsumers.getBuffer(RenderLayer.getTranslucentMovingBlock()); + VertexConsumer consumer = vertexConsumers.getBuffer(RenderType.translucentMovingBlock()); //matrices.peek(); - Sprite waterSprite = waterSpriteId.getSprite(); + TextureAtlasSprite waterSprite = waterSpriteId.sprite(); - MatrixStack.Entry entry = matrices.peek(); + PoseStack.Pose entry = matrices.last(); - float minU = waterSprite.getMinU(); - float minV = waterSprite.getMinV(); - float maxU = waterSprite.getMaxU(); - float maxV = waterSprite.getMaxV(); + float minU = waterSprite.getU0(); + float minV = waterSprite.getV0(); + float maxU = waterSprite.getU1(); + float maxV = waterSprite.getV1(); float tempMin = minU; - minU = MathHelper.lerp(SIZE_FACTOR, minU, maxU); - maxU = MathHelper.lerp(1 - SIZE_FACTOR, tempMin, maxU); + minU = Mth.lerp(SIZE_FACTOR, minU, maxU); + maxU = Mth.lerp(1 - SIZE_FACTOR, tempMin, maxU); tempMin = minV; - minV = MathHelper.lerp(SIZE_FACTOR, minV, maxV); - maxV = MathHelper.lerp(1 - SIZE_FACTOR, tempMin, maxV); + minV = Mth.lerp(SIZE_FACTOR, minV, maxV); + maxV = Mth.lerp(1 - SIZE_FACTOR, tempMin, maxV); - consumer.vertex(entry, SIZE_FACTOR, 0, SIZE_FACTOR) .color(50, 80, 240, 190).texture(minU, minV).light(light).overlay(overlay).normal(1, 1, 1); - consumer.vertex(entry, SIZE_FACTOR, 0, 1 - SIZE_FACTOR) .color(50, 80, 190, 190).texture(minU, maxV).light(light).overlay(overlay).normal(1, 1, 1); - consumer.vertex(entry, 1 - SIZE_FACTOR, 0, 1 - SIZE_FACTOR) .color(50, 80, 240, 190).texture(maxU, maxV).light(light).overlay(overlay).normal(1, 1, 1); - consumer.vertex(entry, 1 - SIZE_FACTOR, 0, SIZE_FACTOR) .color(50, 80, 240, 190).texture(maxU, minV).light(light).overlay(overlay).normal(1, 1, 1); + consumer.addVertex(entry, SIZE_FACTOR, 0, SIZE_FACTOR) .setColor(50, 80, 240, 190).setUv(minU, minV).setLight(light).setOverlay(overlay).setNormal(1, 1, 1); + consumer.addVertex(entry, SIZE_FACTOR, 0, 1 - SIZE_FACTOR) .setColor(50, 80, 190, 190).setUv(minU, maxV).setLight(light).setOverlay(overlay).setNormal(1, 1, 1); + consumer.addVertex(entry, 1 - SIZE_FACTOR, 0, 1 - SIZE_FACTOR) .setColor(50, 80, 240, 190).setUv(maxU, maxV).setLight(light).setOverlay(overlay).setNormal(1, 1, 1); + consumer.addVertex(entry, 1 - SIZE_FACTOR, 0, SIZE_FACTOR) .setColor(50, 80, 240, 190).setUv(maxU, minV).setLight(light).setOverlay(overlay).setNormal(1, 1, 1); } - matrices.pop(); + matrices.popPose(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotScreen.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotScreen.java index fdbfd7cd8f..31ddd67b5c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotScreen.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotScreen.java @@ -1,35 +1,36 @@ package net.sevenstars.middleearth.block.special.crockpot; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.sevenstars.middleearth.MiddleEarth; -public class CrockpotScreen extends HandledScreen { - private static final Identifier WATER_TEXTURE = Identifier.ofVanilla("textures/block/water_still.png"); - private static final Identifier TEXTURE = MiddleEarth.ofPath( "textures", "gui", "crockpot.png"); - private static final Identifier BUBBLES_TEXTURE = Identifier.ofVanilla("container/brewing_stand/bubbles"); +public class CrockpotScreen extends AbstractContainerScreen { + private static final ResourceLocation WATER_TEXTURE = ResourceLocation.withDefaultNamespace("textures/block/water_still.png"); + private static final ResourceLocation TEXTURE = MiddleEarth.ofPath( "textures", "gui", "crockpot.png"); + private static final ResourceLocation BUBBLES_TEXTURE = ResourceLocation.withDefaultNamespace("container/brewing_stand/bubbles"); private static final int[] BUBBLE_PROGRESS = new int[]{29, 24, 20, 16, 11, 6, 0}; private static final int LIQUID_SIZE = 24; private static final int PROGRESS_ARROW_SIZE = 24; - public CrockpotScreen(CrockpotScreenHandler handler, PlayerInventory inventory, Text title) { + public CrockpotScreen(CrockpotScreenHandler handler, Inventory inventory, Component title) { super(handler, inventory, title); } @Override protected void init() { - titleX = (backgroundWidth - textRenderer.getWidth(title)) / 2; + titleLabelX = (imageWidth - font.width(title)) / 2; super.init(); } @Override - protected void drawBackground(DrawContext context, float deltaTicks, int mouseX, int mouseY) { - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, this.x, this.y, 0, 0, this.backgroundWidth, this.backgroundHeight, 256, 256); - context.drawTexture(RenderPipelines.GUI_TEXTURED, WATER_TEXTURE, this.x + 120, this.y + 31, 0, 0, 24, 24, 16, 16, 0xFF66AAEE); + protected void renderBg(GuiGraphics context, float deltaTicks, int mouseX, int mouseY) { + context.blit(TEXTURE, this.leftPos, this.topPos, 0, 0, this.imageWidth, this.imageHeight, 256, 256); + context.setColor(0.4F, 2.0F / 3.0F, 14.0F / 15.0F, 1.0F); + context.blit(WATER_TEXTURE, this.leftPos + 120, this.topPos + 31, 0, 0, 24, 24, 16, 16); + context.setColor(1.0F, 1.0F, 1.0F, 1.0F); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotScreenHandler.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotScreenHandler.java index b693fcef85..4a6e30d3b8 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotScreenHandler.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crockpot/CrockpotScreenHandler.java @@ -1,35 +1,35 @@ package net.sevenstars.middleearth.block.special.crockpot; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.Inventory; -import net.minecraft.inventory.SimpleInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.ArrayPropertyDelegate; -import net.minecraft.screen.PropertyDelegate; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.slot.Slot; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.world.Container; +import net.minecraft.world.SimpleContainer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.inventory.SimpleContainerData; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import net.sevenstars.middleearth.gui.ModScreenHandlers; -public class CrockpotScreenHandler extends ScreenHandler { - final Inventory inventory; - private final PropertyDelegate propertyDelegate; +public class CrockpotScreenHandler extends AbstractContainerMenu { + final Container inventory; + private final ContainerData propertyDelegate; protected BlockPos pos; - public CrockpotScreenHandler(int syncId, PlayerInventory playerInventory, BlockPos blockPos) { - this(syncId, playerInventory, new SimpleInventory(5), new ArrayPropertyDelegate(1)); + public CrockpotScreenHandler(int syncId, Inventory playerInventory, BlockPos blockPos) { + this(syncId, playerInventory, new SimpleContainer(5), new SimpleContainerData(1)); this.pos = blockPos; } - public CrockpotScreenHandler(int syncId, PlayerInventory playerInventory, - Inventory inventory, PropertyDelegate propertyDelegate) { + public CrockpotScreenHandler(int syncId, Inventory playerInventory, + Container inventory, ContainerData propertyDelegate) { super(ModScreenHandlers.CROCKPOT_SCREEN_HANDLER, syncId); this.inventory = inventory; this.propertyDelegate = propertyDelegate; - this.pos = BlockPos.ORIGIN; + this.pos = BlockPos.ZERO; - checkSize(inventory, 5); + checkContainerSize(inventory, 5); this.addSlot(new Slot(inventory, 0, 48, 44)); this.addSlot(new Slot(inventory, 1, 66, 44)); @@ -38,8 +38,8 @@ public CrockpotScreenHandler(int syncId, PlayerInventory playerInventory, addPlayerInventory(playerInventory); addPlayerHotbar(playerInventory); - inventory.onOpen(playerInventory.player); - addProperties(propertyDelegate); + inventory.startOpen(playerInventory.player); + addDataSlots(propertyDelegate); } public BlockPos getPos() { @@ -51,41 +51,41 @@ public boolean isCrafting() { } @Override - public ItemStack quickMove(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { ItemStack itemStack = ItemStack.EMPTY; Slot slot2 = this.slots.get(slot); - if (slot2.hasStack()) { - ItemStack itemStack2 = slot2.getStack(); + if (slot2.hasItem()) { + ItemStack itemStack2 = slot2.getItem(); itemStack = itemStack2.copy(); if (slot == CrockpotBlockEntity.OUTPUT_SLOT) { - if (!this.insertItem(itemStack2, 3, 39, true)) { + if (!this.moveItemStackTo(itemStack2, 3, 39, true)) { return ItemStack.EMPTY; } - slot2.onQuickTransfer(itemStack2, itemStack); + slot2.onQuickCraft(itemStack2, itemStack); } if (itemStack2.isEmpty()) { - slot2.setStack(ItemStack.EMPTY); + slot2.setByPlayer(ItemStack.EMPTY); } else { - slot2.markDirty(); + slot2.setChanged(); } if (itemStack2.getCount() == itemStack.getCount()) { return ItemStack.EMPTY; } - slot2.onTakeItem(player, itemStack2); + slot2.onTake(player, itemStack2); } return itemStack; } @Override - public boolean canUse(PlayerEntity player) { - return this.inventory.canPlayerUse(player); + public boolean stillValid(Player player) { + return this.inventory.stillValid(player); } - private void addPlayerInventory(PlayerInventory playerInventory) { + private void addPlayerInventory(Inventory playerInventory) { for (int i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); @@ -93,7 +93,7 @@ private void addPlayerInventory(PlayerInventory playerInventory) { } } - private void addPlayerHotbar(PlayerInventory playerInventory) { + private void addPlayerHotbar(Inventory playerInventory) { for (int i = 0; i < 9; ++i) { this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142)); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/BellpepperCropBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/BellpepperCropBlock.java index 46678af58f..8c6c053008 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/BellpepperCropBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/BellpepperCropBlock.java @@ -1,27 +1,27 @@ package net.sevenstars.middleearth.block.special.crop; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.CropBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.sevenstars.middleearth.item.ResourceItemsME; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.CropBlock; -import net.minecraft.item.ItemConvertible; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; public class BellpepperCropBlock extends CropBlock { public static final int MAX_AGE = 4; - public static final IntProperty AGE = Properties.AGE_4; - public BellpepperCropBlock(Settings settings) { + public static final IntegerProperty AGE = BlockStateProperties.AGE_4; + public BellpepperCropBlock(Properties settings) { super(settings); } @Override - protected ItemConvertible getSeedsItem() { + protected ItemLike getBaseSeedId() { return ResourceItemsME.BELL_PEPPER_SEEDS; } @Override - public IntProperty getAgeProperty() { + public IntegerProperty getAgeProperty() { return AGE; } @@ -31,7 +31,7 @@ public int getMaxAge() { } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(AGE); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/CucumberCropBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/CucumberCropBlock.java index 4aa3f40457..bfc785dc3f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/CucumberCropBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/CucumberCropBlock.java @@ -1,27 +1,27 @@ package net.sevenstars.middleearth.block.special.crop; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.CropBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.sevenstars.middleearth.item.ResourceItemsME; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.CropBlock; -import net.minecraft.item.ItemConvertible; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; public class CucumberCropBlock extends CropBlock { public static final int MAX_AGE = 3; - public static final IntProperty AGE = Properties.AGE_3; - public CucumberCropBlock(Settings settings) { + public static final IntegerProperty AGE = BlockStateProperties.AGE_3; + public CucumberCropBlock(Properties settings) { super(settings); } @Override - protected ItemConvertible getSeedsItem() { + protected ItemLike getBaseSeedId() { return ResourceItemsME.CUCUMBER_SEEDS; } @Override - public IntProperty getAgeProperty() { + public IntegerProperty getAgeProperty() { return AGE; } @@ -31,7 +31,7 @@ public int getMaxAge() { } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(AGE); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/FlaxCropBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/FlaxCropBlock.java index 9cbe95cbe6..13da9bab9f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/FlaxCropBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/FlaxCropBlock.java @@ -1,27 +1,27 @@ package net.sevenstars.middleearth.block.special.crop; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.CropBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.sevenstars.middleearth.item.ResourceItemsME; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.CropBlock; -import net.minecraft.item.ItemConvertible; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; public class FlaxCropBlock extends CropBlock { public static final int MAX_AGE = 3; - public static final IntProperty AGE = Properties.AGE_3; - public FlaxCropBlock(Settings settings) { + public static final IntegerProperty AGE = BlockStateProperties.AGE_3; + public FlaxCropBlock(Properties settings) { super(settings); } @Override - protected ItemConvertible getSeedsItem() { + protected ItemLike getBaseSeedId() { return ResourceItemsME.FLAX_SEEDS; } @Override - public IntProperty getAgeProperty() { + public IntegerProperty getAgeProperty() { return AGE; } @@ -31,7 +31,7 @@ public int getMaxAge() { } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(AGE); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/GarlicCropBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/GarlicCropBlock.java index 7c8c91355c..1eeb28f08e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/GarlicCropBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/GarlicCropBlock.java @@ -1,27 +1,27 @@ package net.sevenstars.middleearth.block.special.crop; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.CropBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.sevenstars.middleearth.item.FoodItemsME; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.CropBlock; -import net.minecraft.item.ItemConvertible; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; public class GarlicCropBlock extends CropBlock { public static final int MAX_AGE = 3; - public static final IntProperty AGE = Properties.AGE_3; - public GarlicCropBlock(Settings settings) { + public static final IntegerProperty AGE = BlockStateProperties.AGE_3; + public GarlicCropBlock(Properties settings) { super(settings); } @Override - protected ItemConvertible getSeedsItem() { + protected ItemLike getBaseSeedId() { return FoodItemsME.GARLIC; } @Override - public IntProperty getAgeProperty() { + public IntegerProperty getAgeProperty() { return AGE; } @@ -31,7 +31,7 @@ public int getMaxAge() { } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(AGE); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/LeekCropBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/LeekCropBlock.java index 03943923f3..259def7be6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/LeekCropBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/LeekCropBlock.java @@ -1,27 +1,27 @@ package net.sevenstars.middleearth.block.special.crop; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.CropBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.sevenstars.middleearth.item.FoodItemsME; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.CropBlock; -import net.minecraft.item.ItemConvertible; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; public class LeekCropBlock extends CropBlock { public static final int MAX_AGE = 3; - public static final IntProperty AGE = Properties.AGE_3; - public LeekCropBlock(Settings settings) { + public static final IntegerProperty AGE = BlockStateProperties.AGE_3; + public LeekCropBlock(Properties settings) { super(settings); } @Override - protected ItemConvertible getSeedsItem() { + protected ItemLike getBaseSeedId() { return FoodItemsME.LEEK; } @Override - public IntProperty getAgeProperty() { + public IntegerProperty getAgeProperty() { return AGE; } @@ -31,7 +31,7 @@ public int getMaxAge() { } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(AGE); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/LettuceCropBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/LettuceCropBlock.java index f0bc85ef54..a7f1924946 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/LettuceCropBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/LettuceCropBlock.java @@ -1,27 +1,27 @@ package net.sevenstars.middleearth.block.special.crop; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.CropBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.sevenstars.middleearth.item.ResourceItemsME; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.CropBlock; -import net.minecraft.item.ItemConvertible; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; public class LettuceCropBlock extends CropBlock { public static final int MAX_AGE = 3; - public static final IntProperty AGE = Properties.AGE_3; - public LettuceCropBlock(Settings settings) { + public static final IntegerProperty AGE = BlockStateProperties.AGE_3; + public LettuceCropBlock(Properties settings) { super(settings); } @Override - protected ItemConvertible getSeedsItem() { + protected ItemLike getBaseSeedId() { return ResourceItemsME.LETTUCE_SEEDS; } @Override - public IntProperty getAgeProperty() { + public IntegerProperty getAgeProperty() { return AGE; } @@ -31,7 +31,7 @@ public int getMaxAge() { } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(AGE); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/OnionCropBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/OnionCropBlock.java index 0a7567dc41..da96ddc743 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/OnionCropBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/OnionCropBlock.java @@ -1,27 +1,27 @@ package net.sevenstars.middleearth.block.special.crop; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.CropBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.sevenstars.middleearth.item.FoodItemsME; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.CropBlock; -import net.minecraft.item.ItemConvertible; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; public class OnionCropBlock extends CropBlock { public static final int MAX_AGE = 3; - public static final IntProperty AGE = Properties.AGE_3; - public OnionCropBlock(Settings settings) { + public static final IntegerProperty AGE = BlockStateProperties.AGE_3; + public OnionCropBlock(Properties settings) { super(settings); } @Override - protected ItemConvertible getSeedsItem() { + protected ItemLike getBaseSeedId() { return FoodItemsME.ONION; } @Override - public IntProperty getAgeProperty() { + public IntegerProperty getAgeProperty() { return AGE; } @@ -31,7 +31,7 @@ public int getMaxAge() { } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(AGE); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/PipeweedCropBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/PipeweedCropBlock.java index 9cc09fc448..9ef4abf6e9 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/PipeweedCropBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/PipeweedCropBlock.java @@ -1,42 +1,42 @@ package net.sevenstars.middleearth.block.special.crop; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.CropBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.item.ResourceItemsME; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.CropBlock; -import net.minecraft.block.ShapeContext; -import net.minecraft.item.ItemConvertible; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; public class PipeweedCropBlock extends CropBlock { public static final int MAX_AGE = 3; - public static final IntProperty AGE = Properties.AGE_3; + public static final IntegerProperty AGE = BlockStateProperties.AGE_3; //protected static final VoxelShape SHAPE = Block.createCuboidShape(2.0, 0.0, 2.0, 14.0, 30.0, 14.0); private static final VoxelShape[] AGE_TO_SHAPE = new VoxelShape[]{ - Block.createCuboidShape(2.0, 0.0, 2.0, 14.0, 6.0, 14.0), // Shape for age 0 - Block.createCuboidShape(2.0, 0.0, 2.0, 14.0, 12.0, 14.0), // Shape for age 1 - Block.createCuboidShape(2.0, 0.0, 2.0, 14.0, 22.0, 14.0), // Shape for age 2 - Block.createCuboidShape(2.0, 0.0, 2.0, 14.0, 30.0, 14.0) // Shape for age 3 + Block.box(2.0, 0.0, 2.0, 14.0, 6.0, 14.0), // Shape for age 0 + Block.box(2.0, 0.0, 2.0, 14.0, 12.0, 14.0), // Shape for age 1 + Block.box(2.0, 0.0, 2.0, 14.0, 22.0, 14.0), // Shape for age 2 + Block.box(2.0, 0.0, 2.0, 14.0, 30.0, 14.0) // Shape for age 3 }; - public PipeweedCropBlock(Settings settings) { + public PipeweedCropBlock(Properties settings) { super(settings); } @Override - protected ItemConvertible getSeedsItem() { + protected ItemLike getBaseSeedId() { return ResourceItemsME.PIPEWEED_SEEDS; } @Override - public IntProperty getAgeProperty() { + public IntegerProperty getAgeProperty() { return AGE; } @@ -46,28 +46,28 @@ public int getMaxAge() { } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(AGE); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return AGE_TO_SHAPE[this.getAge(state)]; } @Override - public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { + public boolean isBonemealSuccess(Level world, RandomSource random, BlockPos pos, BlockState state) { //actually poorly named method, this is called when the crop is bonemealed- only used for bonemealing item if u take a look :) - return super.canGrow(world, random, pos, state); + return super.isBonemealSuccess(world, random, pos, state); } @Override - protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { //MiddleEarth.LOGGER.logDebugMsg("PipeweedCropBlock randomTick"); int currentAge = this.getAge(state); - if (world.getBlockState(pos.up()).isAir()) { + if (world.getBlockState(pos.above()).isAir()) { super.randomTick(state, world, pos, random); } else { if (currentAge < 1) { - world.setBlockState(pos, this.withAge(currentAge + 1), 2); + world.setBlock(pos, this.getStateForAge(currentAge + 1), 2); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/TomatoCropBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/TomatoCropBlock.java index 70b8a69b21..9d3d0d0f5c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/TomatoCropBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/crop/TomatoCropBlock.java @@ -1,36 +1,36 @@ package net.sevenstars.middleearth.block.special.crop; +import net.minecraft.core.BlockPos; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.CropBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.item.ResourceItemsME; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.CropBlock; -import net.minecraft.block.ShapeContext; -import net.minecraft.item.ItemConvertible; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; public class TomatoCropBlock extends CropBlock { public static final int MAX_AGE = 3; - public static final IntProperty AGE = Properties.AGE_3; - protected static final VoxelShape SHAPE = Block.createCuboidShape(2.0, 0.0, 2.0, 14.0, 30.0, 14.0); + public static final IntegerProperty AGE = BlockStateProperties.AGE_3; + protected static final VoxelShape SHAPE = Block.box(2.0, 0.0, 2.0, 14.0, 30.0, 14.0); - public TomatoCropBlock(Settings settings) { + public TomatoCropBlock(Properties settings) { super(settings); } @Override - protected ItemConvertible getSeedsItem() { + protected ItemLike getBaseSeedId() { return ResourceItemsME.TOMATO_SEEDS; } @Override - public IntProperty getAgeProperty() { + public IntegerProperty getAgeProperty() { return AGE; } @@ -40,23 +40,23 @@ public int getMaxAge() { } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(AGE); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { if(super.getAge(state) > 1){ return SHAPE; } - return super.getOutlineShape(state, world, pos, context); + return super.getShape(state, world, pos, context); } @Override - public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { + public boolean isBonemealSuccess(Level world, RandomSource random, BlockPos pos, BlockState state) { if(super.getAge(state) > 1) { - return world.getBlockState(pos).canPlaceAt(world, pos.add(0,1,0)); + return world.getBlockState(pos).canSurvive(world, pos.offset(0,1,0)); // todo : make it so whenever the tomato wants to grow, it checks the origin above to see if you can place anything } - return super.canGrow(world, random, pos, state); + return super.isBonemealSuccess(world, random, pos, state); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/curtains/CurtainsBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/curtains/CurtainsBlock.java index 799b29b330..33c96fbde3 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/curtains/CurtainsBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/curtains/CurtainsBlock.java @@ -1,118 +1,127 @@ package net.sevenstars.middleearth.block.special.curtains; import com.mojang.serialization.MapCodec; -import net.minecraft.block.*; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.state.property.Property; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.MultifaceBlock; +import net.minecraft.world.level.block.MultifaceSpreader; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.utils.BlockTagsME; import org.jetbrains.annotations.Nullable; import java.util.Arrays; +import java.util.EnumMap; import java.util.Map; import java.util.Objects; -import java.util.function.Function; -public class CurtainsBlock extends MultifaceBlock { - public static final MapCodec CODEC = createCodec(CurtainsBlock::new); - public static final BooleanProperty TIP; +public class CurtainsBlock extends MultifaceBlock implements SimpleWaterloggedBlock { + public static final MapCodec CODEC = simpleCodec(CurtainsBlock::new); + public static final BooleanProperty TIP = BooleanProperty.create("tip"); + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - private final Function shapeFunction; + private final Map shapes; + private final MultifaceSpreader spreader = new MultifaceSpreader(this); - public CurtainsBlock(Settings settings) { + public CurtainsBlock(Properties settings) { super(settings); - shapeFunction = createShapeFunction(); + this.registerDefaultState(this.defaultBlockState().setValue(TIP, false).setValue(WATERLOGGED, false)); + this.shapes = makeShapes(); } @Override - public MapCodec getCodec() { + public MapCodec codec() { return CODEC; } @Override @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - World world = ctx.getWorld(); - BlockPos blockPos = ctx.getBlockPos(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Level world = ctx.getLevel(); + BlockPos blockPos = ctx.getClickedPos(); BlockState blockState = world.getBlockState(blockPos); - BlockState returnState = (BlockState) Arrays.stream(ctx.getPlacementDirections()).map((direction) -> { - return this.withDirection(blockState, world, blockPos, direction); + BlockState returnState = (BlockState) Arrays.stream(ctx.getNearestLookingDirections()).map((direction) -> { + return this.getStateForPlacement(blockState, world, blockPos, direction); }).filter(Objects::nonNull).findFirst().orElse((BlockState) null); - if(returnState != null) returnState = returnState.with(TIP, - !world.getBlockState(blockPos.down()).isIn(BlockTagsME.CURTAINS)); + if(returnState != null) returnState = returnState.setValue(TIP, + !world.getBlockState(blockPos.below()).is(BlockTagsME.CURTAINS)); return returnState; } @Override - protected boolean canHaveDirection(Direction direction) { + protected boolean isFaceSupported(Direction direction) { return direction != Direction.UP && direction != Direction.DOWN; } @Override - public boolean canGrowWithDirection(BlockView world, BlockState state, BlockPos pos, Direction direction) { - return canHaveDirection(direction); + public boolean isValidStateForPlacement(BlockGetter world, BlockState state, BlockPos pos, Direction direction) { + return isFaceSupported(direction); } @Override - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { return true; } @Override - protected boolean canReplace(BlockState state, ItemPlacementContext context) { + protected boolean canBeReplaced(BlockState state, BlockPlaceContext context) { boolean sneaking = false; - if(context.getPlayer() != null) sneaking = context.getPlayer().isSneaking(); + if(context.getPlayer() != null) sneaking = context.getPlayer().isShiftKeyDown(); boolean placeVertically = false; - if(context.getSide() == Direction.UP) { - if(!context.getStack().isOf(this.asItem())) { + if(context.getClickedFace() == Direction.UP) { + if(!context.getItemInHand().is(this.asItem())) { placeVertically = true; } else { - BlockState neighbor = context.getWorld().getBlockState(context.getBlockPos().up()); - if(context.getStack().isOf(neighbor.getBlock().asItem()) || neighbor.isAir()) { + BlockState neighbor = context.getLevel().getBlockState(context.getClickedPos().above()); + if(context.getItemInHand().is(neighbor.getBlock().asItem()) || neighbor.isAir()) { placeVertically = true; } } - } else if(context.getSide() == Direction.DOWN) { - if(!context.getStack().isOf(this.asItem())) { + } else if(context.getClickedFace() == Direction.DOWN) { + if(!context.getItemInHand().is(this.asItem())) { placeVertically = true; } else { - BlockState neighbor = context.getWorld().getBlockState(context.getBlockPos().down()); - if(context.getStack().isOf(neighbor.getBlock().asItem()) || neighbor.isAir()) { + BlockState neighbor = context.getLevel().getBlockState(context.getClickedPos().below()); + if(context.getItemInHand().is(neighbor.getBlock().asItem()) || neighbor.isAir()) { placeVertically = true; } } } if(sneaking) placeVertically = !placeVertically; - return isNotFullBlock(state) && !placeVertically && context.getStack().isOf(this.asItem()); + return hasAnyVacantFace(state) && !placeVertically && context.getItemInHand().is(this.asItem()); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return state.with(TIP, !world.getBlockState(pos.down()).isIn(BlockTagsME.CURTAINS)); + return state.setValue(TIP, !world.getBlockState(pos.below()).is(BlockTagsME.CURTAINS)); } - private static boolean isNotFullBlock(BlockState state) { + private static boolean hasAnyVacantFace(BlockState state) { Direction[] var1 = DIRECTIONS; int var2 = var1.length; for(int var3 = 0; var3 < var2; ++var3) { Direction direction = var1[var3]; - if (!hasDirection(state, direction)) { + if (!hasFace(state, direction)) { return true; } } @@ -120,35 +129,45 @@ private static boolean isNotFullBlock(BlockState state) { } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return (VoxelShape)this.shapeFunction.apply(state); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return this.shapes.get(state); } - private Function createShapeFunction() { - Map map = VoxelShapes.createFacingShapeMap(Block.createCuboidZShape(16.0, 0.0, 3.0)); - return this.createShapeFunction((state) -> { - VoxelShape voxelShape = VoxelShapes.empty(); + private Map makeShapes() { + Map map = new EnumMap<>(Direction.class); + map.put(Direction.NORTH, Block.box(0, 0, 0, 16, 16, 3)); + map.put(Direction.SOUTH, Block.box(0, 0, 13, 16, 16, 16)); + map.put(Direction.WEST, Block.box(0, 0, 0, 3, 16, 16)); + map.put(Direction.EAST, Block.box(13, 0, 0, 16, 16, 16)); + return this.getShapeForEachState((state) -> { + VoxelShape voxelShape = Shapes.empty(); Direction[] var3 = DIRECTIONS; int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; - if (hasDirection(state, direction)) { - voxelShape = VoxelShapes.union(voxelShape, (VoxelShape)map.get(direction)); + if (hasFace(state, direction)) { + voxelShape = Shapes.or(voxelShape, (VoxelShape)map.get(direction)); } } - return voxelShape.isEmpty() ? VoxelShapes.fullCube() : voxelShape; - }, new Property[]{WATERLOGGED}); + return voxelShape.isEmpty() ? Shapes.block() : voxelShape; + }); } @Override - protected void appendProperties(StateManager.Builder builder) { - builder.add(new Property[]{TIP}); - super.appendProperties(builder); + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(TIP, WATERLOGGED); + super.createBlockStateDefinition(builder); } - static { - TIP = Properties.TIP; + @Override + protected FluidState getFluidState(BlockState state) { + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + + @Override + public MultifaceSpreader getSpreader() { + return this.spreader; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/curtains/SmallCurtainsBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/curtains/SmallCurtainsBlock.java index d33bed6cec..56acefec20 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/curtains/SmallCurtainsBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/curtains/SmallCurtainsBlock.java @@ -1,67 +1,67 @@ package net.sevenstars.middleearth.block.special.curtains; import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.HorizontalFacingBlock; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.state.property.Property; -import net.minecraft.util.ActionResult; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; -public class SmallCurtainsBlock extends HorizontalFacingBlock { +public class SmallCurtainsBlock extends HorizontalDirectionalBlock { public static final BooleanProperty OPEN; - public static final MapCodec CODEC = createCodec(SmallCurtainsBlock::new); + public static final MapCodec CODEC = simpleCodec(SmallCurtainsBlock::new); - public SmallCurtainsBlock(Settings settings) { + public SmallCurtainsBlock(Properties settings) { super(settings); } @Override - protected MapCodec getCodec() { + protected MapCodec codec() { return CODEC; } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if (!world.isClient && player.getAbilities().allowModifyWorld) { - world.setBlockState(pos, state.cycle(OPEN)); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (!world.isClientSide && player.getAbilities().mayBuild) { + world.setBlockAndUpdate(pos, state.cycle(OPEN)); } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return switch (state.get(Properties.HORIZONTAL_FACING)) { - case WEST -> Block.createCuboidShape(14, 2, 0, 16, 16, 16); - case EAST -> Block.createCuboidShape(0, 2, 0, 2, 16, 16); - case SOUTH -> Block.createCuboidShape(0, 2, 0, 16, 16, 2); - case NORTH -> Block.createCuboidShape(0, 2, 14, 16, 16, 16); - default -> VoxelShapes.cuboid(0, 2, 0, 16, 16, 16); + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return switch (state.getValue(BlockStateProperties.HORIZONTAL_FACING)) { + case WEST -> Block.box(14, 2, 0, 16, 16, 16); + case EAST -> Block.box(0, 2, 0, 2, 16, 16); + case SOUTH -> Block.box(0, 2, 0, 16, 16, 2); + case NORTH -> Block.box(0, 2, 14, 16, 16, 16); + default -> Shapes.box(0, 2, 0, 16, 16, 16); }; } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(new Property[]{OPEN, FACING}); } static { - OPEN = Properties.OPEN; + OPEN = BlockStateProperties.OPEN; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/dirts/CustomFarmlandBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/dirts/CustomFarmlandBlock.java index ab5faa6530..0ac6f2dfd9 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/dirts/CustomFarmlandBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/dirts/CustomFarmlandBlock.java @@ -1,82 +1,83 @@ package net.sevenstars.middleearth.block.special.dirts; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.FarmlandBlock; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.registry.tag.BlockTags; -import net.minecraft.registry.tag.FluidTags; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.BlockView; -import net.minecraft.world.GameRules; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; import org.jetbrains.annotations.Nullable; import java.util.Iterator; - -public class CustomFarmlandBlock extends FarmlandBlock { +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.FluidTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.GameRules; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.FarmBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.gameevent.GameEvent; + +public class CustomFarmlandBlock extends FarmBlock { private final Block target; - public CustomFarmlandBlock(Settings settings, Block target) { + public CustomFarmlandBlock(Properties settings, Block target) { super(settings); this.target = target; } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - return !this.getDefaultState().canPlaceAt(ctx.getWorld(), ctx.getBlockPos()) ? target.getDefaultState() : super.getPlacementState(ctx); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return !this.defaultBlockState().canSurvive(ctx.getLevel(), ctx.getClickedPos()) ? target.defaultBlockState() : super.getStateForPlacement(ctx); } - public static void setToDirt(@Nullable Entity entity, BlockState state, World world, BlockPos pos, Block target) { - BlockState blockState = pushEntitiesUpBeforeBlockChange(state, target.getDefaultState(), world, pos); - world.setBlockState(pos, blockState); - world.emitGameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Emitter.of(entity, blockState)); + public static void setToDirt(@Nullable Entity entity, BlockState state, Level world, BlockPos pos, Block target) { + BlockState blockState = pushEntitiesUp(state, target.defaultBlockState(), world, pos); + world.setBlockAndUpdate(pos, blockState); + world.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(entity, blockState)); } - protected void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - if (!state.canPlaceAt(world, pos)) { + protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + if (!state.canSurvive(world, pos)) { setToDirt((Entity)null, state, world, pos, target); } } - protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - int i = (Integer)state.get(MOISTURE); - if (!isWaterNearby(world, pos) && !world.hasRain(pos.up())) { + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + int i = (Integer)state.getValue(MOISTURE); + if (!isNearWater(world, pos) && !world.isRainingAt(pos.above())) { if (i > 0) { - world.setBlockState(pos, (BlockState)state.with(MOISTURE, i - 1), 2); - } else if (!hasCrop(world, pos)) { + world.setBlock(pos, (BlockState)state.setValue(MOISTURE, i - 1), 2); + } else if (!shouldMaintainFarmland(world, pos)) { setToDirt((Entity)null, state, world, pos, target); } } else if (i < 7) { - world.setBlockState(pos, (BlockState)state.with(MOISTURE, 7), 2); + world.setBlock(pos, (BlockState)state.setValue(MOISTURE, 7), 2); } } - public void onLandedUpon(World world, BlockState state, BlockPos pos, Entity entity, double fallDistance) { - if (world instanceof ServerWorld serverWorld) { - if ((double)world.random.nextFloat() < fallDistance - 0.5 && entity instanceof LivingEntity && (entity instanceof PlayerEntity || serverWorld.getGameRules().getBoolean(GameRules.DO_MOB_GRIEFING)) && entity.getWidth() * entity.getWidth() * entity.getHeight() > 0.512F) { + @Override + public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) { + if (world instanceof ServerLevel serverWorld) { + if ((double)world.random.nextFloat() < fallDistance - 0.5 && entity instanceof LivingEntity && (entity instanceof Player || serverWorld.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) { setToDirt((Entity)null, state, world, pos, target); } } - entity.handleFallDamage(fallDistance, 1.0F, entity.getDamageSources().fall()); + entity.causeFallDamage(fallDistance, 1.0F, entity.damageSources().fall()); } - private static boolean hasCrop(BlockView world, BlockPos pos) { - return world.getBlockState(pos.up()).isIn(BlockTags.MAINTAINS_FARMLAND); + private static boolean shouldMaintainFarmland(BlockGetter world, BlockPos pos) { + return world.getBlockState(pos.above()).is(BlockTags.MAINTAINS_FARMLAND); } - private static boolean isWaterNearby(WorldView world, BlockPos pos) { - Iterator var2 = BlockPos.iterate(pos.add(-4, 0, -4), pos.add(4, 1, 4)).iterator(); + private static boolean isNearWater(LevelReader world, BlockPos pos) { + Iterator var2 = BlockPos.betweenClosed(pos.offset(-4, 0, -4), pos.offset(4, 1, 4)).iterator(); BlockPos blockPos; do { @@ -85,7 +86,7 @@ private static boolean isWaterNearby(WorldView world, BlockPos pos) { } blockPos = (BlockPos)var2.next(); - } while(!world.getFluidState(blockPos).isIn(FluidTags.WATER)); + } while(!world.getFluidState(blockPos).is(FluidTags.WATER)); return true; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/dirts/CustomGrassBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/dirts/CustomGrassBlock.java index 3bdf6c3ff2..000190ce64 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/dirts/CustomGrassBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/dirts/CustomGrassBlock.java @@ -1,35 +1,41 @@ package net.sevenstars.middleearth.block.special.dirts; -import net.minecraft.block.*; -import net.minecraft.registry.tag.FluidTags; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.WorldView; -import net.minecraft.world.chunk.light.ChunkLightProvider; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.FluidTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.GrassBlock; +import net.minecraft.world.level.block.SnowLayerBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.lighting.LightEngine; public class CustomGrassBlock extends GrassBlock { private final Block target; - public CustomGrassBlock(Settings settings, Block target) { + public CustomGrassBlock(Properties settings, Block target) { super(settings); this.target = target; } @Override - protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - if (!canSurvive(state, world, pos)) { - world.setBlockState(pos, this.target.getDefaultState()); + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + if (!canBeGrass(state, world, pos)) { + world.setBlockAndUpdate(pos, this.target.defaultBlockState()); } else { - if (world.getLightLevel(pos.up()) >= 9) { - BlockState blockState = this.getDefaultState(); + if (world.getMaxLocalRawBrightness(pos.above()) >= 9) { + BlockState blockState = this.defaultBlockState(); for(int i = 0; i < 4; ++i) { - BlockPos blockPos = pos.add(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); - if (world.getBlockState(blockPos).isOf(this.target) && canSpread(blockState, world, blockPos)) { - world.setBlockState(blockPos, (BlockState)blockState.with(SNOWY, isSnow(world.getBlockState(blockPos.up())))); + BlockPos blockPos = pos.offset(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); + if (world.getBlockState(blockPos).is(this.target) && canPropagate(blockState, world, blockPos)) { + world.setBlockAndUpdate(blockPos, blockState.setValue(SNOWY, world.getBlockState(blockPos.above()).is(BlockTags.SNOW))); } } } @@ -37,20 +43,22 @@ protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Ran } } - private static boolean canSpread(BlockState state, WorldView world, BlockPos pos) { - BlockPos blockPos = pos.up(); - return canSurvive(state, world, pos) && !world.getFluidState(blockPos).isIn(FluidTags.WATER); + private static boolean canPropagate(BlockState state, LevelReader world, BlockPos pos) { + BlockPos blockPos = pos.above(); + return canBeGrass(state, world, pos) && !world.getFluidState(blockPos).is(FluidTags.WATER); } - private static boolean canSurvive(BlockState state, WorldView world, BlockPos pos) { - BlockPos blockPos = pos.up(); + private static boolean canBeGrass(BlockState state, LevelReader world, BlockPos pos) { + BlockPos blockPos = pos.above(); BlockState blockState = world.getBlockState(blockPos); - if (blockState.isOf(Blocks.SNOW) && (Integer)blockState.get(SnowBlock.LAYERS) == 1) { + if (blockState.is(Blocks.SNOW) && (Integer)blockState.getValue(SnowLayerBlock.LAYERS) == 1) { return true; - } else if (blockState.getFluidState().getLevel() == 8) { + } else if (blockState.getFluidState().getAmount() == 8) { return false; } else { - int i = ChunkLightProvider.getRealisticOpacity(state, blockState, Direction.UP, blockState.getOpacity()); + int i = LightEngine.getLightBlockInto( + world, state, pos, blockState, blockPos, Direction.UP, blockState.getLightBlock(world, blockPos) + ); return i < 15; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/dirts/CustomPathBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/dirts/CustomPathBlock.java index ef30a2f7e8..2d2014c294 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/dirts/CustomPathBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/dirts/CustomPathBlock.java @@ -1,26 +1,29 @@ package net.sevenstars.middleearth.block.special.dirts; -import net.minecraft.block.*; -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.DirtPathBlock; +import net.minecraft.world.level.block.state.BlockState; public class CustomPathBlock extends DirtPathBlock { private final Block target; - public CustomPathBlock(Settings settings, Block target) { + public CustomPathBlock(Properties settings, Block target) { super(settings); this.target = target; } - public BlockState getPlacementState(ItemPlacementContext ctx) { - return !this.getDefaultState().canPlaceAt(ctx.getWorld(), ctx.getBlockPos()) ? Block.pushEntitiesUpBeforeBlockChange(this.getDefaultState(), target.getDefaultState(), ctx.getWorld(), ctx.getBlockPos()) : super.getPlacementState(ctx); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return !this.defaultBlockState().canSurvive(ctx.getLevel(), ctx.getClickedPos()) ? Block.pushEntitiesUp(this.defaultBlockState(), target.defaultBlockState(), ctx.getLevel(), ctx.getClickedPos()) : super.getStateForPlacement(ctx); } - protected void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { CustomFarmlandBlock.setToDirt((Entity)null, state, world, pos, target); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor10x4.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor10x4.java index f0fe8d5e91..fd57986d9f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor10x4.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor10x4.java @@ -1,19 +1,19 @@ package net.sevenstars.middleearth.block.special.doors; +import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.sevenstars.middleearth.block.special.LargeDoorBlock; -import net.minecraft.state.property.IntProperty; public class LargeDoor10x4 extends LargeDoorBlock { - public static final IntProperty PART = IntProperty.of("part", 0, 39); + public static final IntegerProperty PART = IntegerProperty.create("part", 0, 39); - public LargeDoor10x4(Settings settings) { + public LargeDoor10x4(Properties settings) { super(settings); this.doorHeight = 10; this.doorWidth = 4; } @Override - public IntProperty getPart() { + public IntegerProperty getPart() { return PART; } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor10x5.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor10x5.java index f7e6c889b6..c73a2f79b0 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor10x5.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor10x5.java @@ -1,19 +1,19 @@ package net.sevenstars.middleearth.block.special.doors; +import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.sevenstars.middleearth.block.special.LargeDoorBlock; -import net.minecraft.state.property.IntProperty; public class LargeDoor10x5 extends LargeDoorBlock { - public static final IntProperty PART = IntProperty.of("part", 0, 49); + public static final IntegerProperty PART = IntegerProperty.create("part", 0, 49); - public LargeDoor10x5(Settings settings) { + public LargeDoor10x5(Properties settings) { super(settings); this.doorHeight = 10; this.doorWidth = 5; } @Override - public IntProperty getPart() { + public IntegerProperty getPart() { return PART; } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor1x2.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor1x2.java index 58a6ea11f0..6432c87d5f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor1x2.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor1x2.java @@ -1,19 +1,19 @@ package net.sevenstars.middleearth.block.special.doors; -import net.minecraft.state.property.IntProperty; +import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.sevenstars.middleearth.block.special.LargeDoorBlock; public class LargeDoor1x2 extends LargeDoorBlock { - public static final IntProperty PART = IntProperty.of("part", 0, 1); + public static final IntegerProperty PART = IntegerProperty.create("part", 0, 1); - public LargeDoor1x2(Settings settings) { + public LargeDoor1x2(Properties settings) { super(settings); this.doorHeight = 1; this.doorWidth = 2; } @Override - public IntProperty getPart() { + public IntegerProperty getPart() { return PART; } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor2x2.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor2x2.java index e3e5163e75..5ca6dd8845 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor2x2.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor2x2.java @@ -1,19 +1,19 @@ package net.sevenstars.middleearth.block.special.doors; +import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.sevenstars.middleearth.block.special.LargeDoorBlock; -import net.minecraft.state.property.IntProperty; public class LargeDoor2x2 extends LargeDoorBlock { - public static final IntProperty PART = IntProperty.of("part", 0, 3); + public static final IntegerProperty PART = IntegerProperty.create("part", 0, 3); - public LargeDoor2x2(Settings settings) { + public LargeDoor2x2(Properties settings) { super(settings); this.doorHeight = 2; this.doorWidth = 2; } @Override - public IntProperty getPart() { + public IntegerProperty getPart() { return PART; } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor3x1.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor3x1.java index 9f090a4e44..25444626d0 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor3x1.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor3x1.java @@ -1,19 +1,19 @@ package net.sevenstars.middleearth.block.special.doors; +import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.sevenstars.middleearth.block.special.LargeDoorBlock; -import net.minecraft.state.property.IntProperty; public class LargeDoor3x1 extends LargeDoorBlock { - public static final IntProperty PART = IntProperty.of("part", 0, 2); + public static final IntegerProperty PART = IntegerProperty.create("part", 0, 2); - public LargeDoor3x1(Settings settings) { + public LargeDoor3x1(Properties settings) { super(settings); this.doorHeight = 3; this.doorWidth = 1; } @Override - public IntProperty getPart() { + public IntegerProperty getPart() { return PART; } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor4x2.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor4x2.java index 857c9f4834..a0c41bacc0 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor4x2.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor4x2.java @@ -1,19 +1,19 @@ package net.sevenstars.middleearth.block.special.doors; +import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.sevenstars.middleearth.block.special.LargeDoorBlock; -import net.minecraft.state.property.IntProperty; public class LargeDoor4x2 extends LargeDoorBlock { - public static final IntProperty PART = IntProperty.of("part", 0, 7); + public static final IntegerProperty PART = IntegerProperty.create("part", 0, 7); - public LargeDoor4x2(Settings settings) { + public LargeDoor4x2(Properties settings) { super(settings); this.doorHeight = 4; this.doorWidth = 2; } @Override - public IntProperty getPart() { + public IntegerProperty getPart() { return PART; } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor5x2.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor5x2.java index 834d1b68bd..e9b6ead8c0 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor5x2.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor5x2.java @@ -1,19 +1,19 @@ package net.sevenstars.middleearth.block.special.doors; +import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.sevenstars.middleearth.block.special.LargeDoorBlock; -import net.minecraft.state.property.IntProperty; public class LargeDoor5x2 extends LargeDoorBlock { - public static final IntProperty PART = IntProperty.of("part", 0, 9); + public static final IntegerProperty PART = IntegerProperty.create("part", 0, 9); - public LargeDoor5x2(Settings settings) { + public LargeDoor5x2(Properties settings) { super(settings); this.doorHeight = 5; this.doorWidth = 2; } @Override - public IntProperty getPart() { + public IntegerProperty getPart() { return PART; } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor5x3.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor5x3.java index 2d4e7c3c84..c5a11a4345 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor5x3.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor5x3.java @@ -1,19 +1,19 @@ package net.sevenstars.middleearth.block.special.doors; +import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.sevenstars.middleearth.block.special.LargeDoorBlock; -import net.minecraft.state.property.IntProperty; public class LargeDoor5x3 extends LargeDoorBlock { - public static final IntProperty PART = IntProperty.of("part", 0, 14); + public static final IntegerProperty PART = IntegerProperty.create("part", 0, 14); - public LargeDoor5x3(Settings settings) { + public LargeDoor5x3(Properties settings) { super(settings); this.doorHeight = 5; this.doorWidth = 3; } @Override - public IntProperty getPart() { + public IntegerProperty getPart() { return PART; } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor6x2.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor6x2.java index d66ee61f45..266069bcd3 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor6x2.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeDoor6x2.java @@ -1,19 +1,19 @@ package net.sevenstars.middleearth.block.special.doors; +import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.sevenstars.middleearth.block.special.LargeDoorBlock; -import net.minecraft.state.property.IntProperty; public class LargeDoor6x2 extends LargeDoorBlock { - public static final IntProperty PART = IntProperty.of("part", 0, 11); + public static final IntegerProperty PART = IntegerProperty.create("part", 0, 11); - public LargeDoor6x2(Settings settings) { + public LargeDoor6x2(Properties settings) { super(settings); this.doorHeight = 6; this.doorWidth = 2; } @Override - public IntProperty getPart() { + public IntegerProperty getPart() { return PART; } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeThickDoor3x2.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeThickDoor3x2.java index fb0e4e774c..d89d8fbc56 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeThickDoor3x2.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/doors/LargeThickDoor3x2.java @@ -1,56 +1,56 @@ package net.sevenstars.middleearth.block.special.doors; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.DoorHingeSide; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.special.LargeDoorBlock; import net.sevenstars.middleearth.item.ResourceItemsME; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.enums.DoorHinge; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.state.property.IntProperty; -import net.minecraft.util.ActionResult; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; public class LargeThickDoor3x2 extends LargeDoorBlock { - public static final IntProperty PART = IntProperty.of("part", 0, 5); + public static final IntegerProperty PART = IntegerProperty.create("part", 0, 5); - protected static final VoxelShape NORTH_SHAPE = Block.createCuboidShape(0, 0, 0, 16, 16, 8); - protected static final VoxelShape SOUTH_SHAPE = Block.createCuboidShape(0, 0, 8, 16, 16, 16); - protected static final VoxelShape EAST_SHAPE = Block.createCuboidShape(8, 0, 0, 16, 16, 16); - protected static final VoxelShape WEST_SHAPE = Block.createCuboidShape(0, 0, 0, 8, 16, 16); + protected static final VoxelShape NORTH_SHAPE = Block.box(0, 0, 0, 16, 16, 8); + protected static final VoxelShape SOUTH_SHAPE = Block.box(0, 0, 8, 16, 16, 16); + protected static final VoxelShape EAST_SHAPE = Block.box(8, 0, 0, 16, 16, 16); + protected static final VoxelShape WEST_SHAPE = Block.box(0, 0, 0, 8, 16, 16); - public LargeThickDoor3x2(Settings settings) { + public LargeThickDoor3x2(Properties settings) { super(settings); this.doorHeight = 3; this.doorWidth = 2; } @Override - public IntProperty getPart() { + public IntegerProperty getPart() { return PART; } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if(state.get(PART) == 4 && player.getMainHandStack().getItem() == ResourceItemsME.DWARVEN_KEY){ - return super.onUse(state, world, pos, player, hit); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if(state.getValue(PART) == 4 && player.getMainHandItem().getItem() == ResourceItemsME.DWARVEN_KEY){ + return super.useWithoutItem(state, world, pos, player, hit); } else { - return ActionResult.PASS; + return InteractionResult.PASS; } } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - Direction direction = (Direction) state.get(HORIZONTAL_FACING); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + Direction direction = (Direction) state.getValue(HORIZONTAL_FACING); VoxelShape var10000 = null; - if (state.get(HINGE) == DoorHinge.LEFT) { - if (!state.get(OPEN)) { + if (state.getValue(HINGE) == DoorHingeSide.LEFT) { + if (!state.getValue(OPEN)) { return switch (direction) { case WEST -> EAST_SHAPE; case EAST -> WEST_SHAPE; @@ -66,7 +66,7 @@ protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos }; } } else { - if (!state.get(OPEN)) { + if (!state.getValue(OPEN)) { return switch (direction) { case WEST -> EAST_SHAPE; case EAST -> WEST_SHAPE; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/AbstractToggleableFireBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/AbstractToggleableFireBlock.java index 8c28290e8d..31b349a5ff 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/AbstractToggleableFireBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/AbstractToggleableFireBlock.java @@ -1,137 +1,135 @@ package net.sevenstars.middleearth.block.special.fireBlocks; import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockRenderType; -import net.minecraft.block.BlockState; -import net.minecraft.block.BlockWithEntity; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.CampfireBlockEntity; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCollisionHandler; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.particle.SimpleParticleType; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.state.property.Property; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.event.GameEvent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.particles.SimpleParticleType; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.ItemTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.Nullable; -public abstract class AbstractToggleableFireBlock extends BlockWithEntity { +public abstract class AbstractToggleableFireBlock extends BaseEntityBlock { - public static final BooleanProperty LIT = Properties.LIT; + public static final BooleanProperty LIT = BlockStateProperties.LIT; - public AbstractToggleableFireBlock(Settings settings) { + public AbstractToggleableFireBlock(Properties settings) { super(settings); - this.setDefaultState(this.stateManager.getDefaultState().with(LIT, true)); + this.registerDefaultState(this.stateDefinition.any().setValue(LIT, true)); } - protected abstract MapCodec getCodec(); + protected abstract MapCodec codec(); @Override - protected boolean canPathfindThrough(BlockState state, NavigationType type) { + protected boolean isPathfindable(BlockState state, PathComputationType type) { return false; } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - Hand hand = player.getActiveHand(); - if (!world.isClient && player.getAbilities().allowModifyWorld) { - if(player.isInCreativeMode()){ - world.setBlockState(pos, state.cycle(LIT)); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + InteractionHand hand = player.getUsedItemHand(); + if (!world.isClientSide && player.getAbilities().mayBuild) { + if(player.hasInfiniteMaterials()){ + world.setBlockAndUpdate(pos, state.cycle(LIT)); } else { - ItemStack itemStack = player.getStackInHand(hand); - if (state.get(LIT) && itemStack.isIn(ItemTags.SHOVELS)) { + ItemStack itemStack = player.getItemInHand(hand); + if (state.getValue(LIT) && itemStack.is(ItemTags.SHOVELS)) { extinguish((Entity)null, world, pos, state); - } else if (!state.get(LIT) && itemStack.isOf(Items.FLINT_AND_STEEL) || itemStack.isOf(Items.TORCH)) { + } else if (!state.getValue(LIT) + && (itemStack.is(Items.FLINT_AND_STEEL) || itemStack.is(Items.TORCH))) { setLit(world, state, pos, true); } } } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } - protected static void setLit(WorldAccess world, BlockState state, BlockPos pos, boolean lit) { - world.setBlockState(pos, state.with(LIT, lit), 2 | 3); + protected static void setLit(LevelAccessor world, BlockState state, BlockPos pos, boolean lit) { + world.setBlock(pos, state.setValue(LIT, lit), 2 | 3); if(lit){ - world.playSound(null, pos, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.5F, 1.0F); + world.playSound(null, pos, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.5F, 1.0F); } } - public static void extinguish(@Nullable Entity entity, WorldAccess world, BlockPos pos, BlockState state) { - if (world.isClient()) { + public static void extinguish(@Nullable Entity entity, LevelAccessor world, BlockPos pos, BlockState state) { + setLit(world, state, pos, false); + if (world.isClientSide()) { for(int i = 0; i < 20; ++i) { - spawnSmokeParticle((World)world, pos, true, true); + spawnSmokeParticle((Level)world, pos, true, true); } } - world.emitGameEvent(entity, GameEvent.BLOCK_CHANGE, pos); + world.gameEvent(entity, GameEvent.BLOCK_CHANGE, pos); } - public static void spawnSmokeParticle(World world, BlockPos pos, boolean isSignal, boolean lotsOfSmoke) { - Random random = world.getRandom(); + public static void spawnSmokeParticle(Level world, BlockPos pos, boolean isSignal, boolean lotsOfSmoke) { + RandomSource random = world.getRandom(); SimpleParticleType simpleParticleType = isSignal ? ParticleTypes.CAMPFIRE_SIGNAL_SMOKE : ParticleTypes.CAMPFIRE_COSY_SMOKE; - world.addImportantParticleClient(simpleParticleType, true, (double)pos.getX() + 0.5 + random.nextDouble() / 3.0 * (double)(random.nextBoolean() ? 1 : -1), (double)pos.getY() + random.nextDouble() + random.nextDouble(), (double)pos.getZ() + 0.5 + random.nextDouble() / 3.0 * (double)(random.nextBoolean() ? 1 : -1), 0.0, 0.07, 0.0); + world.addAlwaysVisibleParticle(simpleParticleType, true, (double)pos.getX() + 0.5 + random.nextDouble() / 3.0 * (double)(random.nextBoolean() ? 1 : -1), (double)pos.getY() + random.nextDouble() + random.nextDouble(), (double)pos.getZ() + 0.5 + random.nextDouble() / 3.0 * (double)(random.nextBoolean() ? 1 : -1), 0.0, 0.07, 0.0); if (lotsOfSmoke) { - world.addParticleClient(ParticleTypes.SMOKE, (double)pos.getX() + 0.5 + random.nextDouble() / 4.0 * (double)(random.nextBoolean() ? 1 : -1), (double)pos.getY() + 0.4, (double)pos.getZ() + 0.5 + random.nextDouble() / 4.0 * (double)(random.nextBoolean() ? 1 : -1), 0.0, 0.005, 0.0); + world.addParticle(ParticleTypes.SMOKE, (double)pos.getX() + 0.5 + random.nextDouble() / 4.0 * (double)(random.nextBoolean() ? 1 : -1), (double)pos.getY() + 0.4, (double)pos.getZ() + 0.5 + random.nextDouble() / 4.0 * (double)(random.nextBoolean() ? 1 : -1), 0.0, 0.005, 0.0); } } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(new Property[]{LIT}); } - protected BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } @Override - protected void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler) { - if (state.get(LIT) && entity instanceof LivingEntity) { - if (!world.isClient) { - ServerWorld serverWorld = (ServerWorld)world; + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (state.getValue(LIT) && entity instanceof LivingEntity) { + if (!world.isClientSide) { if (isEntityAbove(pos, entity)) { - entity.damage(serverWorld, world.getDamageSources().campfire(), (float) 1); + entity.hurt(world.damageSources().campfire(), 1.0F); } } } - super.onEntityCollision(state, world, pos, entity, handler); + super.entityInside(state, world, pos, entity); } - protected void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { + protected void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { BlockPos blockPos = hit.getBlockPos(); - if (!world.isClient && projectile.isOnFire()) { - ServerWorld serverWorld = (ServerWorld)world; - if (projectile.canModifyAt(serverWorld, blockPos) && !(Boolean)state.get(LIT)){ - world.setBlockState(blockPos, (BlockState)state.with(Properties.LIT, true), 11); + if (!world.isClientSide && projectile.isOnFire()) { + ServerLevel serverWorld = (ServerLevel)world; + if (projectile.mayInteract(serverWorld, blockPos) && !(Boolean)state.getValue(LIT)){ + world.setBlock(blockPos, (BlockState)state.setValue(BlockStateProperties.LIT, true), 11); } } } public static boolean isLitFireBlock(BlockState state) { - return state.contains(LIT) && (Boolean)state.get(LIT) && state.getBlock() instanceof AbstractToggleableFireBlock; + return state.hasProperty(LIT) && (Boolean)state.getValue(LIT) && state.getBlock() instanceof AbstractToggleableFireBlock; } private static boolean isEntityAbove(BlockPos pos, Entity entity) { - return entity.isOnGround() && entity.getPos().y > (double)((float)pos.getY() + 0.51F); + return entity.onGround() && entity.position().y > (double)((float)pos.getY() + 0.51F); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/BonfireBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/BonfireBlock.java index 0ef31b8679..45b0afbaa0 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/BonfireBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/BonfireBlock.java @@ -1,47 +1,47 @@ package net.sevenstars.middleearth.block.special.fireBlocks; import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; public class BonfireBlock extends AbstractToggleableFireBlock { - public static final MapCodec CODEC = BonfireBlock.createCodec(BonfireBlock::new); + public static final MapCodec CODEC = BonfireBlock.simpleCodec(BonfireBlock::new); - protected static final VoxelShape SHAPE = Block.createCuboidShape(2, 0, 2, 14, 12, 14); - public static final BooleanProperty LIT = Properties.LIT; + protected static final VoxelShape SHAPE = Block.box(2, 0, 2, 14, 12, 14); + public static final BooleanProperty LIT = BlockStateProperties.LIT; - public BonfireBlock(Settings settings) { + public BonfireBlock(Properties settings) { super(settings); } @Override - protected MapCodec getCodec() { - return null; + protected MapCodec codec() { + return CODEC; } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override @Nullable - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { - if (world.isClient) { - if (state.get(LIT)) { - return AbstractToggleableFireBlock.validateTicker(type, ModBlockEntities.BONFIRE, BonfireBlockEntity::clientTick); + public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { + if (world.isClientSide) { + if (state.getValue(LIT)) { + return AbstractToggleableFireBlock.createTickerHelper(type, ModBlockEntities.BONFIRE, BonfireBlockEntity::clientTick); } } return null; @@ -49,7 +49,7 @@ public BlockEntityTicker getTicker(World world, Block @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new BonfireBlockEntity(pos, state); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/BonfireBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/BonfireBlockEntity.java index fc1cab9e98..7893bdcd86 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/BonfireBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/BonfireBlockEntity.java @@ -1,8 +1,8 @@ package net.sevenstars.middleearth.block.special.fireBlocks; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; public class BonfireBlockEntity extends ToggleableFireBlockEntity { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/BrazierBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/BrazierBlock.java index c84c28c785..8c35dae378 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/BrazierBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/BrazierBlock.java @@ -1,48 +1,48 @@ package net.sevenstars.middleearth.block.special.fireBlocks; import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; public class BrazierBlock extends AbstractToggleableFireBlock { - public static final MapCodec CODEC = BrazierBlock.createCodec(BrazierBlock::new); + public static final MapCodec CODEC = BrazierBlock.simpleCodec(BrazierBlock::new); - protected static final VoxelShape SHAPE = Block.createCuboidShape(0, 0, 0, 16, 14, 16); - public static final BooleanProperty LIT = Properties.LIT; + protected static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 14, 16); + public static final BooleanProperty LIT = BlockStateProperties.LIT; - public BrazierBlock(Settings settings) { + public BrazierBlock(Properties settings) { super(settings); } @Override - protected MapCodec getCodec() { + protected MapCodec codec() { return CODEC; } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override @Nullable - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { - if (world.isClient) { - if (state.get(LIT)) { - return AbstractToggleableFireBlock.validateTicker(type, ModBlockEntities.BIG_BRAZIER, BrazierBlockEntity::clientTick); + public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { + if (world.isClientSide) { + if (state.getValue(LIT)) { + return AbstractToggleableFireBlock.createTickerHelper(type, ModBlockEntities.BIG_BRAZIER, BrazierBlockEntity::clientTick); } } return null; @@ -50,7 +50,7 @@ public BlockEntityTicker getTicker(World world, Block @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new BrazierBlockEntity(pos, state); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/BrazierBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/BrazierBlockEntity.java index 1fa3b034b5..758d40c3aa 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/BrazierBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/BrazierBlockEntity.java @@ -1,8 +1,8 @@ package net.sevenstars.middleearth.block.special.fireBlocks; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; public class BrazierBlockEntity extends ToggleableFireBlockEntity { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/ChimneyBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/ChimneyBlock.java index be7851d578..a8538c884b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/ChimneyBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/ChimneyBlock.java @@ -1,49 +1,49 @@ package net.sevenstars.middleearth.block.special.fireBlocks; import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; public class ChimneyBlock extends AbstractToggleableFireBlock { - public static final MapCodec CODEC = ChimneyBlock.createCodec(ChimneyBlock::new); + public static final MapCodec CODEC = ChimneyBlock.simpleCodec(ChimneyBlock::new); - protected static final VoxelShape SHAPE = VoxelShapes.combineAndSimplify(Block.createCuboidShape(0, 0, 0, 16, 4, 16), Block.createCuboidShape(3, 4, 3, 13, 16, 13), BooleanBiFunction.OR); - public static final BooleanProperty LIT = Properties.LIT; + protected static final VoxelShape SHAPE = Shapes.join(Block.box(0, 0, 0, 16, 4, 16), Block.box(3, 4, 3, 13, 16, 13), BooleanOp.OR); + public static final BooleanProperty LIT = BlockStateProperties.LIT; - public ChimneyBlock(Settings settings) { + public ChimneyBlock(Properties settings) { super(settings); } @Override - protected MapCodec getCodec() { + protected MapCodec codec() { return CODEC; } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override @Nullable - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { - if (world.isClient) { - if (state.get(LIT)) { - return AbstractToggleableFireBlock.validateTicker(type, ModBlockEntities.CHIMNEY, ChimneyBlockEntity::clientTick); + public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { + if (world.isClientSide) { + if (state.getValue(LIT)) { + return AbstractToggleableFireBlock.createTickerHelper(type, ModBlockEntities.CHIMNEY, ChimneyBlockEntity::clientTick); } } return null; @@ -51,7 +51,7 @@ public BlockEntityTicker getTicker(World world, Block @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new ChimneyBlockEntity(pos, state); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/ChimneyBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/ChimneyBlockEntity.java index fdfef1f583..aa07da5098 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/ChimneyBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/ChimneyBlockEntity.java @@ -1,8 +1,8 @@ package net.sevenstars.middleearth.block.special.fireBlocks; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; public class ChimneyBlockEntity extends ToggleableFireBlockEntity { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/FireBowlBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/FireBowlBlock.java index 1f789f8d51..a5ca7cb853 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/FireBowlBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/FireBowlBlock.java @@ -1,47 +1,47 @@ package net.sevenstars.middleearth.block.special.fireBlocks; import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; public class FireBowlBlock extends AbstractToggleableFireBlock { - public static final MapCodec CODEC = FireBowlBlock.createCodec(FireBowlBlock::new); + public static final MapCodec CODEC = FireBowlBlock.simpleCodec(FireBowlBlock::new); - protected static final VoxelShape SHAPE = Block.createCuboidShape(1, 0, 1, 15, 10, 15); - public static final BooleanProperty LIT = Properties.LIT; + protected static final VoxelShape SHAPE = Block.box(1, 0, 1, 15, 10, 15); + public static final BooleanProperty LIT = BlockStateProperties.LIT; - public FireBowlBlock(Settings settings) { + public FireBowlBlock(Properties settings) { super(settings); } @Override - protected MapCodec getCodec() { + protected MapCodec codec() { return CODEC; } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override @Nullable - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { - if (world.isClient) { - if (state.get(LIT)) { - return AbstractToggleableFireBlock.validateTicker(type, ModBlockEntities.FIRE_BOWL, FireBowlBlockEntity::clientTick); + public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { + if (world.isClientSide) { + if (state.getValue(LIT)) { + return AbstractToggleableFireBlock.createTickerHelper(type, ModBlockEntities.FIRE_BOWL, FireBowlBlockEntity::clientTick); } } return null; @@ -49,7 +49,7 @@ public BlockEntityTicker getTicker(World world, Block @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new FireBowlBlockEntity(pos, state); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/FireBowlBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/FireBowlBlockEntity.java index c2608deeda..d36abfbe7f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/FireBowlBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/FireBowlBlockEntity.java @@ -1,8 +1,8 @@ package net.sevenstars.middleearth.block.special.fireBlocks; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; public class FireBowlBlockEntity extends ToggleableFireBlockEntity { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/GildedBrazierBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/GildedBrazierBlock.java index 83b1d7838c..2bd43d688c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/GildedBrazierBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/GildedBrazierBlock.java @@ -1,48 +1,48 @@ package net.sevenstars.middleearth.block.special.fireBlocks; import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; public class GildedBrazierBlock extends AbstractToggleableFireBlock { - public static final MapCodec CODEC = GildedBrazierBlock.createCodec(GildedBrazierBlock::new); + public static final MapCodec CODEC = GildedBrazierBlock.simpleCodec(GildedBrazierBlock::new); - protected static final VoxelShape SHAPE = Block.createCuboidShape(0, 0, 0, 16, 14, 16); - public static final BooleanProperty LIT = Properties.LIT; + protected static final VoxelShape SHAPE = Block.box(0, 0, 0, 16, 14, 16); + public static final BooleanProperty LIT = BlockStateProperties.LIT; - public GildedBrazierBlock(Settings settings) { + public GildedBrazierBlock(Properties settings) { super(settings); } @Override - protected MapCodec getCodec() { + protected MapCodec codec() { return CODEC; } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override @Nullable - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { - if (world.isClient) { - if (state.get(LIT)) { - return AbstractToggleableFireBlock.validateTicker(type, ModBlockEntities.GILDED_BIG_BRAZIER, GildedBrazierBlockEntity::clientTick); + public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { + if (world.isClientSide) { + if (state.getValue(LIT)) { + return AbstractToggleableFireBlock.createTickerHelper(type, ModBlockEntities.GILDED_BIG_BRAZIER, GildedBrazierBlockEntity::clientTick); } } return null; @@ -50,7 +50,7 @@ public BlockEntityTicker getTicker(World world, Block @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new GildedBrazierBlockEntity(pos, state); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/GildedBrazierBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/GildedBrazierBlockEntity.java index 58d3317e57..077ba6564d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/GildedBrazierBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/GildedBrazierBlockEntity.java @@ -1,8 +1,8 @@ package net.sevenstars.middleearth.block.special.fireBlocks; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; public class GildedBrazierBlockEntity extends ToggleableFireBlockEntity { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/GildedSmallBrazierBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/GildedSmallBrazierBlock.java index 22ecd0b93e..ffc7d8f697 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/GildedSmallBrazierBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/GildedSmallBrazierBlock.java @@ -1,47 +1,47 @@ package net.sevenstars.middleearth.block.special.fireBlocks; import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; public class GildedSmallBrazierBlock extends AbstractToggleableFireBlock { - public static final MapCodec CODEC = GildedSmallBrazierBlock.createCodec(GildedSmallBrazierBlock::new); + public static final MapCodec CODEC = GildedSmallBrazierBlock.simpleCodec(GildedSmallBrazierBlock::new); - protected static final VoxelShape SHAPE = Block.createCuboidShape(3, 0, 3, 13, 15, 13); - public static final BooleanProperty LIT = Properties.LIT; + protected static final VoxelShape SHAPE = Block.box(3, 0, 3, 13, 15, 13); + public static final BooleanProperty LIT = BlockStateProperties.LIT; - public GildedSmallBrazierBlock(Settings settings) { + public GildedSmallBrazierBlock(Properties settings) { super(settings); } @Override - protected MapCodec getCodec() { + protected MapCodec codec() { return CODEC; } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override @Nullable - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { - if (world.isClient) { - if (state.get(LIT)) { - return AbstractToggleableFireBlock.validateTicker(type, ModBlockEntities.GILDED_SMALL_BRAZIER, GildedSmallBrazierBlockEntity::clientTick); + public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { + if (world.isClientSide) { + if (state.getValue(LIT)) { + return AbstractToggleableFireBlock.createTickerHelper(type, ModBlockEntities.GILDED_SMALL_BRAZIER, GildedSmallBrazierBlockEntity::clientTick); } } return null; @@ -49,7 +49,7 @@ public BlockEntityTicker getTicker(World world, Block @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new GildedSmallBrazierBlockEntity(pos, state); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/GildedSmallBrazierBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/GildedSmallBrazierBlockEntity.java index f9050c53e4..53d5c8d9f4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/GildedSmallBrazierBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/GildedSmallBrazierBlockEntity.java @@ -1,8 +1,8 @@ package net.sevenstars.middleearth.block.special.fireBlocks; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; public class GildedSmallBrazierBlockEntity extends ToggleableFireBlockEntity { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/SmallBrazierBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/SmallBrazierBlock.java index 7b7ea12a68..911c1b35ec 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/SmallBrazierBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/SmallBrazierBlock.java @@ -1,47 +1,47 @@ package net.sevenstars.middleearth.block.special.fireBlocks; import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; public class SmallBrazierBlock extends AbstractToggleableFireBlock { - public static final MapCodec CODEC = SmallBrazierBlock.createCodec(SmallBrazierBlock::new); + public static final MapCodec CODEC = SmallBrazierBlock.simpleCodec(SmallBrazierBlock::new); - protected static final VoxelShape SHAPE = Block.createCuboidShape(3, 0, 3, 13, 15, 13); - public static final BooleanProperty LIT = Properties.LIT; + protected static final VoxelShape SHAPE = Block.box(3, 0, 3, 13, 15, 13); + public static final BooleanProperty LIT = BlockStateProperties.LIT; - public SmallBrazierBlock(Settings settings) { + public SmallBrazierBlock(Properties settings) { super(settings); } @Override - protected MapCodec getCodec() { + protected MapCodec codec() { return CODEC; } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override @Nullable - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { - if (world.isClient) { - if (state.get(LIT)) { - return AbstractToggleableFireBlock.validateTicker(type, ModBlockEntities.SMALL_BRAZIER, SmallBrazierBlockEntity::clientTick); + public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { + if (world.isClientSide) { + if (state.getValue(LIT)) { + return AbstractToggleableFireBlock.createTickerHelper(type, ModBlockEntities.SMALL_BRAZIER, SmallBrazierBlockEntity::clientTick); } } return null; @@ -49,7 +49,7 @@ public BlockEntityTicker getTicker(World world, Block @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new SmallBrazierBlockEntity(pos, state); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/SmallBrazierBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/SmallBrazierBlockEntity.java index 7799420c2d..250d787de6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/SmallBrazierBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/SmallBrazierBlockEntity.java @@ -1,8 +1,8 @@ package net.sevenstars.middleearth.block.special.fireBlocks; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.BlockState; -import net.minecraft.util.math.BlockPos; public class SmallBrazierBlockEntity extends ToggleableFireBlockEntity { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/ToggleableFireBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/ToggleableFireBlockEntity.java index 6d854a8c0d..548a97ed9d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/ToggleableFireBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fireBlocks/ToggleableFireBlockEntity.java @@ -1,12 +1,12 @@ package net.sevenstars.middleearth.block.special.fireBlocks; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; public class ToggleableFireBlockEntity extends BlockEntity { @@ -14,9 +14,9 @@ public ToggleableFireBlockEntity(BlockEntityType type, BlockPos pos, BlockSta super(type, pos, state); } - public static void clientTick(World world, BlockPos pos, BlockState state, ToggleableFireBlockEntity campfire) { + public static void clientTick(Level world, BlockPos pos, BlockState state, ToggleableFireBlockEntity campfire) { int i; - Random random = world.random; + RandomSource random = world.random; if (random.nextFloat() < 0.11f) { for (i = 0; i < random.nextInt(2) + 2; ++i) { spawnSmokeParticle(world, pos, false); @@ -24,11 +24,11 @@ public static void clientTick(World world, BlockPos pos, BlockState state, Toggl } } - public static void spawnSmokeParticle(World world, BlockPos pos, boolean lotsOfSmoke) { - Random random = world.getRandom(); - world.addImportantParticleClient(ParticleTypes.CAMPFIRE_SIGNAL_SMOKE, true, (double)pos.getX() + 0.5 + random.nextDouble() / 3.0 * (double)(random.nextBoolean() ? 1 : -1), (double)pos.getY() + 0.5 + random.nextDouble() + random.nextDouble(), (double)pos.getZ() + 0.5 + random.nextDouble() / 3.0 * (double)(random.nextBoolean() ? 1 : -1), 0.0, 0.07, 0.0); + public static void spawnSmokeParticle(Level world, BlockPos pos, boolean lotsOfSmoke) { + RandomSource random = world.getRandom(); + world.addAlwaysVisibleParticle(ParticleTypes.CAMPFIRE_SIGNAL_SMOKE, true, (double)pos.getX() + 0.5 + random.nextDouble() / 3.0 * (double)(random.nextBoolean() ? 1 : -1), (double)pos.getY() + 0.5 + random.nextDouble() + random.nextDouble(), (double)pos.getZ() + 0.5 + random.nextDouble() / 3.0 * (double)(random.nextBoolean() ? 1 : -1), 0.0, 0.07, 0.0); if (lotsOfSmoke) { - world.addParticleClient(ParticleTypes.SMOKE, (double)pos.getX() + 0.5 + random.nextDouble() / 4.0 * (double)(random.nextBoolean() ? 1 : -1), (double)pos.getY() + 1.0, (double)pos.getZ() + 0.5 + random.nextDouble() / 4.0 * (double)(random.nextBoolean() ? 1 : -1), 0.0, 0.005, 0.0); + world.addParticle(ParticleTypes.SMOKE, (double)pos.getX() + 0.5 + random.nextDouble() / 4.0 * (double)(random.nextBoolean() ? 1 : -1), (double)pos.getY() + 1.0, (double)pos.getZ() + 0.5 + random.nextDouble() / 4.0 * (double)(random.nextBoolean() ? 1 : -1), 0.0, 0.005, 0.0); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fire_of_orthanc/FireOfOrthancBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fire_of_orthanc/FireOfOrthancBlock.java index f15f634353..1f791380bb 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fire_of_orthanc/FireOfOrthancBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fire_of_orthanc/FireOfOrthancBlock.java @@ -1,82 +1,83 @@ package net.sevenstars.middleearth.block.special.fire_of_orthanc; import com.mojang.serialization.MapCodec; -import net.minecraft.util.ActionResult; +import net.minecraft.core.BlockPos; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.stats.Stats; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Explosion; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.item.DecorativeItemsME; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.stat.Stats; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.event.GameEvent; -import net.minecraft.world.explosion.Explosion; import org.jetbrains.annotations.Nullable; public class FireOfOrthancBlock extends Block { - public static final MapCodec CODEC = createCodec(FireOfOrthancBlock::new); - public static final VoxelShape OUTLINE_SHAPE = Block.createCuboidShape(2, 0, 2, 14, 12, 14); + public static final MapCodec CODEC = simpleCodec(FireOfOrthancBlock::new); + public static final VoxelShape OUTLINE_SHAPE = Block.box(2, 0, 2, 14, 12, 14); - public FireOfOrthancBlock(Settings settings) { + public FireOfOrthancBlock(Properties settings) { super(settings); } - protected ActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - if (!stack.isOf(DecorativeItemsME.TORCH_OF_ORTHANC)) { - return super.onUseWithItem(stack, state, world, pos, player, hand, hit); + protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + if (!stack.is(DecorativeItemsME.TORCH_OF_ORTHANC)) { + return super.useItemOn(stack, state, world, pos, player, hand, hit); } else { explode(world, pos, player); - world.setBlockState(pos, Blocks.AIR.getDefaultState(), 11); + world.setBlock(pos, Blocks.AIR.defaultBlockState(), 11); Item item = stack.getItem(); - if (!player.isInCreativeMode()) { - if (stack.isOf(Items.FLINT_AND_STEEL)) { - stack.damage(1, player, LivingEntity.getSlotForHand(hand)); + if (!player.hasInfiniteMaterials()) { + if (stack.is(Items.FLINT_AND_STEEL)) { + stack.hurtAndBreak(1, player, LivingEntity.getSlotForHand(hand)); } else { - stack.decrement(1); + stack.shrink(1); } } - player.incrementStat(Stats.USED.getOrCreateStat(item)); - return ActionResult.SUCCESS; + player.awardStat(Stats.ITEM_USED.get(item)); + return ItemInteractionResult.SUCCESS; } } - public void explode(World world, BlockPos pos, @Nullable LivingEntity igniter) { - if (!world.isClient) { + public void explode(Level world, BlockPos pos, @Nullable LivingEntity igniter) { + if (!world.isClientSide) { FireOfOrthancEntity fireOfOrthancEntity = new FireOfOrthancEntity(world, (double) pos.getX() + 0.5, pos.getY(), (double) pos.getZ() + 0.5, igniter, true); - world.spawnEntity(fireOfOrthancEntity); - world.emitGameEvent(igniter, GameEvent.PRIME_FUSE, pos); + world.addFreshEntity(fireOfOrthancEntity); + world.gameEvent(igniter, GameEvent.PRIME_FUSE, pos); } else { - world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.25F, 0.8F); + world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.25F, 0.8F); } } - public void onDestroyedByExplosion(World world, BlockPos pos, Explosion explosion) { - if (!world.isClient) { - FireOfOrthancEntity fireOfOrthancEntity = new FireOfOrthancEntity(world, (double)pos.getX() + 0.5, pos.getY(), (double)pos.getZ() + 0.5, explosion.getCausingEntity(), false); + public void onDestroyedByExplosion(Level world, BlockPos pos, Explosion explosion) { + if (!world.isClientSide) { + FireOfOrthancEntity fireOfOrthancEntity = new FireOfOrthancEntity(world, (double)pos.getX() + 0.5, pos.getY(), (double)pos.getZ() + 0.5, explosion.getIndirectSourceEntity(), false); int i = fireOfOrthancEntity.getFuse(); fireOfOrthancEntity.setFuse((short)(world.random.nextInt(i / 2) + i / 2)); - world.spawnEntity(fireOfOrthancEntity); + world.addFreshEntity(fireOfOrthancEntity); } } - public boolean shouldDropItemsOnExplosion(Explosion explosion) { + public boolean dropFromExplosion(Explosion explosion) { return false; } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return OUTLINE_SHAPE; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fire_of_orthanc/FireOfOrthancEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fire_of_orthanc/FireOfOrthancEntity.java index 905e1c9710..da1a17a09c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fire_of_orthanc/FireOfOrthancEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fire_of_orthanc/FireOfOrthancEntity.java @@ -1,40 +1,46 @@ package net.sevenstars.middleearth.block.special.fire_of_orthanc; -import net.minecraft.block.BlockState; -import net.minecraft.entity.*; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.data.TrackedData; -import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.world.World; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.Registries; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtUtils; +import net.minecraft.world.entity.*; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.MoverType; +import net.minecraft.world.entity.TraceableEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import net.sevenstars.middleearth.entity.EntitiesME; import org.jetbrains.annotations.Nullable; -public class FireOfOrthancEntity extends Entity implements Ownable { - private static final TrackedData FUSE; - private static final TrackedData BLOCK_STATE; +public class FireOfOrthancEntity extends Entity implements TraceableEntity { + private static final EntityDataAccessor FUSE; + private static final EntityDataAccessor BLOCK_STATE; private static final int DEFAULT_FUSE = 16; public static final float EXPLOSION_FORCE = 12.31f; - public static final BlockState DEFAULT_BLOCK_STATE = ModDecorativeBlocks.FIRE_OF_ORTHANC.getDefaultState(); + public static final BlockState DEFAULT_BLOCK_STATE = ModDecorativeBlocks.FIRE_OF_ORTHANC.defaultBlockState(); protected boolean chainReaction = false; @Nullable private LivingEntity causingEntity; - public FireOfOrthancEntity(EntityType type, World world) { + public FireOfOrthancEntity(EntityType type, Level world) { super(type, world); } - public FireOfOrthancEntity(World world, double x, double y, double z, @Nullable LivingEntity igniter, boolean instant) { + public FireOfOrthancEntity(Level world, double x, double y, double z, @Nullable LivingEntity igniter, boolean instant) { this(EntitiesME.FIRE_OF_ORTHANC, world); - this.setPosition(x, y, z); + this.setPos(x, y, z); double d = world.random.nextDouble() * 6.2831854820251465; - this.setVelocity(-Math.sin(d) * 0.02, 0.20000000298023224, -Math.cos(d) * 0.02); + this.setDeltaMovement(-Math.sin(d) * 0.02, 0.20000000298023224, -Math.cos(d) * 0.02); if(instant) { this.setFuse(6); @@ -42,80 +48,83 @@ public FireOfOrthancEntity(World world, double x, double y, double z, @Nullable } else this.setFuse(DEFAULT_FUSE); - this.lastX = x; - this.lastY = y; - this.lastZ = z; + this.xo = x; + this.yo = y; + this.zo = z; this.causingEntity = igniter; } @Override - protected void initDataTracker(DataTracker.Builder builder) { - builder.add(FUSE, DEFAULT_FUSE); - builder.add(BLOCK_STATE, ModDecorativeBlocks.FIRE_OF_ORTHANC.getDefaultState()); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + builder.define(FUSE, DEFAULT_FUSE); + builder.define(BLOCK_STATE, ModDecorativeBlocks.FIRE_OF_ORTHANC.defaultBlockState()); } public void explode() { - this.getWorld().createExplosion(this, this.getX(), this.getBodyY(0.0625), this.getZ(), EXPLOSION_FORCE, World.ExplosionSourceType.TNT); + this.level().explode(this, this.getX(), this.getY(0.0625), this.getZ(), EXPLOSION_FORCE, Level.ExplosionInteraction.TNT); tryKillOwner(); } private void tryKillOwner() { Entity owner = this.getOwner(); - World world = this.getWorld(); - if(owner instanceof LivingEntity ownerEntity && world instanceof ServerWorld serverWorld) { - if(ownerEntity instanceof PlayerEntity playerEntity){ + Level world = this.level(); + if(owner instanceof LivingEntity ownerEntity && world instanceof ServerLevel) { + if(ownerEntity instanceof Player playerEntity){ if(!playerEntity.isCreative()){ - playerEntity.kill(serverWorld); + playerEntity.kill(); } } else { - ownerEntity.kill(serverWorld); + ownerEntity.kill(); } } } @Override - protected void readCustomData(ReadView view) { - this.setFuse(view.getShort("fuse", (short) 0)); - this.setBlockState((BlockState)view.read("block_state", BlockState.CODEC).orElse(DEFAULT_BLOCK_STATE)); - + protected void readAdditionalSaveData(CompoundTag tag) { + this.setFuse(tag.getShort("fuse")); + if (tag.contains("block_state", CompoundTag.TAG_COMPOUND)) { + this.setBlockState(NbtUtils.readBlockState( + this.level().holderLookup(Registries.BLOCK), tag.getCompound("block_state"))); + } } @Override - protected void writeCustomData(WriteView view) { - view.putShort("fuse", (short)this.getFuse()); - view.put("block_state", BlockState.CODEC, this.getBlockState()); + protected void addAdditionalSaveData(CompoundTag tag) { + tag.putShort("fuse", (short)this.getFuse()); + tag.put("block_state", NbtUtils.writeBlockState(this.getBlockState())); } - protected double getGravity() { + protected double getDefaultGravity() { return 0.04f; } @Override - public boolean damage(ServerWorld world, DamageSource source, float amount) { + public boolean hurt(DamageSource source, float amount) { return false; } public void tick() { this.applyGravity(); - this.move(MovementType.SELF, this.getVelocity()); - this.setVelocity(this.getVelocity().multiply(0.98)); - if (this.isOnGround()) { - this.setVelocity(this.getVelocity().multiply(0.7, -0.5, 0.7)); + this.move(MoverType.SELF, this.getDeltaMovement()); + this.setDeltaMovement(this.getDeltaMovement().scale(0.98)); + if (this.onGround()) { + this.setDeltaMovement(this.getDeltaMovement().multiply(0.7, -0.5, 0.7)); } int i = this.getFuse() - 1; this.setFuse(i); if (i <= 0) { this.discard(); - if (!this.getWorld().isClient) { + if (!this.level().isClientSide) { this.explode(); } } else { - this.updateWaterState(); - if (this.getWorld().isClient && !chainReaction) { + this.updateInWaterStateAndDoFluidPushing(); + if (this.level().isClientSide && !chainReaction) { for(int j = 0; j < 4; j++) { - this.getWorld().addParticleClient(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.8f, this.getZ(), - (Math.random() - 0.5f) * 0.3f, 0.4f, (Math.random() - 0.5f) * 0.5f); + this.level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.8f, this.getZ(), + (this.level().getRandom().nextDouble() - 0.5f) * 0.3f, 0.4f, + (this.level().getRandom().nextDouble() - 0.5f) * 0.5f); } } } @@ -128,23 +137,23 @@ public Entity getOwner() { } public void setFuse(int fuse) { - this.dataTracker.set(FUSE, fuse); + this.entityData.set(FUSE, fuse); } public int getFuse() { - return this.dataTracker.get(FUSE); + return this.entityData.get(FUSE); } public void setBlockState(BlockState state) { - this.dataTracker.set(BLOCK_STATE, state); + this.entityData.set(BLOCK_STATE, state); } public BlockState getBlockState() { - return this.dataTracker.get(BLOCK_STATE); + return this.entityData.get(BLOCK_STATE); } static { - FUSE = DataTracker.registerData(FireOfOrthancEntity.class, TrackedDataHandlerRegistry.INTEGER); - BLOCK_STATE = DataTracker.registerData(FireOfOrthancEntity.class, TrackedDataHandlerRegistry.BLOCK_STATE); + FUSE = SynchedEntityData.defineId(FireOfOrthancEntity.class, EntityDataSerializers.INT); + BLOCK_STATE = SynchedEntityData.defineId(FireOfOrthancEntity.class, EntityDataSerializers.BLOCK_STATE); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fire_of_orthanc/FireOfOrthancEntityRenderState.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fire_of_orthanc/FireOfOrthancEntityRenderState.java deleted file mode 100644 index e8e203742f..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fire_of_orthanc/FireOfOrthancEntityRenderState.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.sevenstars.middleearth.block.special.fire_of_orthanc; - -import net.minecraft.client.render.entity.state.EntityRenderState; - -public class FireOfOrthancEntityRenderState extends EntityRenderState { - -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fire_of_orthanc/FireOfOrthancEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fire_of_orthanc/FireOfOrthancEntityRenderer.java index fd6454e87e..82fd2aad28 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fire_of_orthanc/FireOfOrthancEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/fire_of_orthanc/FireOfOrthancEntityRenderer.java @@ -1,59 +1,54 @@ package net.sevenstars.middleearth.block.special.fire_of_orthanc; -import net.minecraft.block.BlockRenderType; -import net.minecraft.block.BlockState; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.BlockRenderManager; -import net.minecraft.client.render.entity.EntityRenderer; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.world.World; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Axis; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; -public class FireOfOrthancEntityRenderer extends EntityRenderer { - private final BlockRenderManager blockRenderManager; +public class FireOfOrthancEntityRenderer extends EntityRenderer { + private final BlockRenderDispatcher blockRenderManager; - public FireOfOrthancEntityRenderer(EntityRendererFactory.Context ctx) { + public FireOfOrthancEntityRenderer(EntityRendererProvider.Context ctx) { super(ctx); this.shadowRadius = 0.5F; - this.blockRenderManager = ctx.getBlockRenderManager(); + this.blockRenderManager = ctx.getBlockRenderDispatcher(); } @Override - public FireOfOrthancEntityRenderState createRenderState() { - return new FireOfOrthancEntityRenderState(); - } - - - public void render(FireOfOrthancEntity fireOfOrthancEntity, float yaw, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light) { - BlockState blockState = ModDecorativeBlocks.FIRE_OF_ORTHANC.getDefaultState(); - if (blockState.getRenderType() != BlockRenderType.MODEL) { + public void render(FireOfOrthancEntity fireOfOrthancEntity, float yaw, float tickDelta, PoseStack matrixStack, MultiBufferSource vertexConsumerProvider, int light) { + BlockState blockState = ModDecorativeBlocks.FIRE_OF_ORTHANC.defaultBlockState(); + if (blockState.getRenderShape() != RenderShape.MODEL) { return; } - World world = fireOfOrthancEntity.getWorld(); - if (blockState == world.getBlockState(fireOfOrthancEntity.getBlockPos()) || blockState.getRenderType() == BlockRenderType.INVISIBLE) { + Level world = fireOfOrthancEntity.level(); + if (blockState == world.getBlockState(fireOfOrthancEntity.blockPosition()) || blockState.getRenderShape() == RenderShape.INVISIBLE) { return; } - matrixStack.push(); - matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-90.0F)); + matrixStack.pushPose(); + matrixStack.mulPose(Axis.YP.rotationDegrees(-90.0F)); - float scale = ((float) fireOfOrthancEntity.age / 36) + 1.0f; + float scale = ((float) fireOfOrthancEntity.tickCount / 36) + 1.0f; scale = Math.min(1.2f, scale); matrixStack.scale(scale, scale, scale); - BlockPos blockPos = BlockPos.ofFloored(fireOfOrthancEntity.getX(), fireOfOrthancEntity.getBoundingBox().maxY, fireOfOrthancEntity.getZ()); matrixStack.translate(-0.5, 0.0, -0.5); - //TODO to test if this worky - this.blockRenderManager.renderBlockAsEntity(blockState, matrixStack, vertexConsumerProvider, light, OverlayTexture.DEFAULT_UV); + this.blockRenderManager.renderSingleBlock(blockState, matrixStack, vertexConsumerProvider, light, OverlayTexture.NO_OVERLAY); + matrixStack.popPose(); + super.render(fireOfOrthancEntity, yaw, tickDelta, matrixStack, vertexConsumerProvider, light); + } - /*this.blockRenderManager.getModelRenderer().render(world, this.blockRenderManager.getModel(blockState), blockState, - blockPos, matrixStack, vertexConsumerProvider.getBuffer(RenderLayers.getMovingBlockLayer(blockState)), false, - Random.create(), 0, OverlayTexture.DEFAULT_UV);*/ - matrixStack.pop(); - super.render(new FireOfOrthancEntityRenderState(), matrixStack, vertexConsumerProvider, light); + @Override + public ResourceLocation getTextureLocation(FireOfOrthancEntity entity) { + return TextureAtlas.LOCATION_BLOCKS; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/ForgeBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/ForgeBlock.java index 5fbfde58b8..f338a8a52f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/ForgeBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/ForgeBlock.java @@ -1,169 +1,182 @@ package net.sevenstars.middleearth.block.special.forge; import com.mojang.serialization.MapCodec; -import net.minecraft.server.world.ServerWorld; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import net.sevenstars.middleearth.item.DataComponentTypesME; import net.sevenstars.middleearth.item.dataComponents.TemperatureDataComponent; -import net.minecraft.block.*; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.particle.SimpleParticleType; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.ItemScatterer; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.particles.SimpleParticleType; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.RandomSource; +import net.minecraft.world.Containers; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.Nullable; -public class ForgeBlock extends BlockWithEntity implements BlockEntityProvider { - public static final EnumProperty PART = EnumProperty.of("part", ForgePart.class); - public static final EnumProperty FACING = Properties.HORIZONTAL_FACING; - public static final BooleanProperty LIT = Properties.LIT; +public class ForgeBlock extends BaseEntityBlock implements EntityBlock { + public static final EnumProperty PART = EnumProperty.create("part", ForgePart.class); + public static final EnumProperty FACING = BlockStateProperties.HORIZONTAL_FACING; + public static final BooleanProperty LIT = BlockStateProperties.LIT; - public ForgeBlock(Settings settings) { + public ForgeBlock(Properties settings) { super(settings); - this.setDefaultState(((this.stateManager.getDefaultState()).with(FACING, Direction.NORTH)).with(LIT, false).with(PART, ForgePart.BOTTOM)); + this.registerDefaultState(((this.stateDefinition.any()).setValue(FACING, Direction.NORTH)).setValue(LIT, false).setValue(PART, ForgePart.BOTTOM)); } @Override - protected MapCodec getCodec() { - return createCodec(ForgeBlock::new); + protected MapCodec codec() { + return simpleCodec(ForgeBlock::new); } @Override - public BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + public RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } @Override - protected void onStateReplaced(BlockState state, ServerWorld world, BlockPos pos, boolean moved) { - BlockEntity blockEntity = world.getBlockEntity(pos); - if(blockEntity instanceof ForgeBlockEntity forgeBlockEntity) { - if (state.get(PART) == ForgePart.BOTTOM){ - MetalTypes metal = forgeBlockEntity.getCurrentMetal(); - int storage = forgeBlockEntity.getStorage(); - - if (metal != MetalTypes.EMPTY){ - ItemStack ingotStack = new ItemStack(metal.getIngot(), storage / 144); - ingotStack.set(DataComponentTypesME.TEMPERATURE_DATA, new TemperatureDataComponent(1000)); - ItemStack nuggetStack = new ItemStack(metal.getNugget(), storage % 144 / 16); - nuggetStack.set(DataComponentTypesME.TEMPERATURE_DATA, new TemperatureDataComponent(1000)); - - ItemScatterer.spawn(world, pos.getX(), pos.getY(), pos.getZ(), ingotStack); - ItemScatterer.spawn(world, pos.getX(), pos.getY(), pos.getZ(), nuggetStack); + protected void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) { + if (!state.is(newState.getBlock())) { + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity instanceof ForgeBlockEntity forgeBlockEntity) { + if (state.getValue(PART) == ForgePart.BOTTOM) { + MetalTypes metal = forgeBlockEntity.getCurrentMetal(); + int storage = forgeBlockEntity.getStorage(); + + if (metal != MetalTypes.EMPTY) { + ItemStack ingotStack = new ItemStack(metal.getIngot(), storage / 144); + ingotStack.set(DataComponentTypesME.TEMPERATURE_DATA, new TemperatureDataComponent(1000)); + ItemStack nuggetStack = new ItemStack(metal.getNugget(), storage % 144 / 16); + nuggetStack.set(DataComponentTypesME.TEMPERATURE_DATA, new TemperatureDataComponent(1000)); + + Containers.dropItemStack(world, pos.getX(), pos.getY(), pos.getZ(), ingotStack); + Containers.dropItemStack(world, pos.getX(), pos.getY(), pos.getZ(), nuggetStack); + } + Containers.dropContents(world, pos, forgeBlockEntity); } - ItemScatterer.spawn(world, pos, forgeBlockEntity); } + super.onRemove(state, world, pos, newState, moved); + world.updateNeighbourForOutputSignal(pos, this); } - ItemScatterer.onStateReplaced(state, world, pos); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - BlockPos pos = ctx.getBlockPos().add(0,1,0); - World world = ctx.getWorld(); - Direction direction = ctx.getHorizontalPlayerFacing().getOpposite(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + BlockPos pos = ctx.getClickedPos().offset(0,1,0); + Level world = ctx.getLevel(); + Direction direction = ctx.getHorizontalDirection().getOpposite(); - return world.getBlockState(pos).canReplace(ctx) && world.getWorldBorder().contains(pos) ? (BlockState)this.getDefaultState().with(FACING, direction).with(PART, ForgePart.BOTTOM) : null; + return world.getBlockState(pos).canBeReplaced(ctx) && world.getWorldBorder().isWithinBounds(pos) ? (BlockState)this.defaultBlockState().setValue(FACING, direction).setValue(PART, ForgePart.BOTTOM) : null; } - public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { - super.onPlaced(world, pos, state, placer, itemStack); - if (!world.isClient) { - BlockPos blockPos = pos.add(0,1,0); - world.setBlockState(blockPos, (BlockState)state.with(PART, ForgePart.TOP), 3); - world.updateNeighbors(pos, Blocks.AIR); - state.updateNeighbors(world, pos, 3); + public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { + super.setPlacedBy(world, pos, state, placer, itemStack); + if (!world.isClientSide) { + BlockPos blockPos = pos.offset(0,1,0); + world.setBlock(blockPos, (BlockState)state.setValue(PART, ForgePart.TOP), 3); + world.updateNeighborsAt(pos, Blocks.AIR); + state.updateNeighbourShapes(world, pos, 3); } } @Override - public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { - if (!world.isClient) { - ForgePart forgePart = (ForgePart)state.get(PART); - ForgePart forgePartOpposite = (ForgePart)state.get(PART).getOpposite(state.get(PART)); + public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { + if (!world.isClientSide) { + ForgePart forgePart = (ForgePart)state.getValue(PART); + ForgePart forgePartOpposite = (ForgePart)state.getValue(PART).getOpposite(state.getValue(PART)); BlockPos blockPos; if(forgePart == ForgePart.BOTTOM){ - blockPos = pos.add(0,1,0); + blockPos = pos.offset(0,1,0); } else { - blockPos = pos.add(0,-1,0); + blockPos = pos.offset(0,-1,0); } BlockState blockState = world.getBlockState(blockPos); - if (blockState.isOf(this) && blockState.get(PART) == forgePartOpposite) { - world.setBlockState(blockPos, Blocks.AIR.getDefaultState(), 35); - world.syncWorldEvent(player, 2001, blockPos, Block.getRawIdFromState(blockState)); + if (blockState.is(this) && blockState.getValue(PART) == forgePartOpposite) { + world.setBlock(blockPos, Blocks.AIR.defaultBlockState(), 35); + world.levelEvent(player, 2001, blockPos, Block.getId(blockState)); } } - return super.onBreak(world, pos, state, player); + return super.playerWillDestroy(world, pos, state, player); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - return state.rotate(mirror.getRotation(state.get(FACING))); + public BlockState mirror(BlockState state, Mirror mirror) { + return state.rotate(mirror.getRotation(state.getValue(FACING))); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); builder.add(LIT); builder.add(PART); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if (world.isClient) { - return ActionResult.SUCCESS; + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (world.isClientSide) { + return InteractionResult.SUCCESS; } else { - if(state.get(PART) == ForgePart.BOTTOM){ - NamedScreenHandlerFactory screenHandlerFactory = state.createScreenHandlerFactory(world, pos); + if(state.getValue(PART) == ForgePart.BOTTOM){ + MenuProvider screenHandlerFactory = state.getMenuProvider(world, pos); if(screenHandlerFactory != null) { - player.openHandledScreen(screenHandlerFactory); + if (screenHandlerFactory instanceof net.sevenstars.middleearth.block.utils.ExtendedMenuProviderME extendedProvider) { + net.sevenstars.middleearth.block.utils.ExtendedMenuProviderME.open(player, extendedProvider); + } else { + player.openMenu(screenHandlerFactory); + } } } - return ActionResult.CONSUME; + return InteractionResult.CONSUME; } } @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new ForgeBlockEntity(pos, state); } @Nullable @Override - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { + public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { return validateTicker(world, type, ModBlockEntities.FORGE); } @Nullable - protected static BlockEntityTicker validateTicker(World world, BlockEntityType givenType, BlockEntityType expectedType) { + protected static BlockEntityTicker validateTicker(Level world, BlockEntityType givenType, BlockEntityType expectedType) { BlockEntityTicker ticker; - if (world instanceof ServerWorld serverWorld) { - ticker = validateTicker(givenType, expectedType, (worldx, pos, state, blockEntity) -> { + if (world instanceof ServerLevel serverWorld) { + ticker = createTickerHelper(givenType, expectedType, (worldx, pos, state, blockEntity) -> { ForgeBlockEntity.tick(serverWorld, pos, state, blockEntity); }); } else { @@ -174,29 +187,29 @@ protected static BlockEntityTicker validateTicker(Wor } @Override - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { - if (!state.get(LIT).booleanValue()) { + public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { + if (!state.getValue(LIT).booleanValue()) { return; } - if (state.get(PART) == ForgePart.BOTTOM){ + if (state.getValue(PART) == ForgePart.BOTTOM){ double d = (double)pos.getX() + 0.5; double e = pos.getY(); double f = (double)pos.getZ() + 0.5; if (random.nextDouble() < 0.1) { - world.playSoundClient(d, e, f, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0f, 1.0f, false); + world.playLocalSound(d, e, f, SoundEvents.FURNACE_FIRE_CRACKLE, SoundSource.BLOCKS, 1.0f, 1.0f, false); } - Direction direction = state.get(FACING); + Direction direction = state.getValue(FACING); Direction.Axis axis = direction.getAxis(); double g = 0.52; double h = random.nextDouble() * 0.6 - 0.3; - double i = axis == Direction.Axis.X ? (double)direction.getOffsetX() * 0.52 : h; + double i = axis == Direction.Axis.X ? (double)direction.getStepX() * 0.52 : h; double j = random.nextDouble() * 6.0 / 16.0; - double k = axis == Direction.Axis.Z ? (double)direction.getOffsetZ() * 0.52 : h; - world.addParticleClient(ParticleTypes.SMOKE, d + i, e + j, f + k, 0.0, 0.0, 0.0); - world.addParticleClient(ParticleTypes.FLAME, d + i, e + j, f + k, 0.0, 0.0, 0.0); + double k = axis == Direction.Axis.Z ? (double)direction.getStepZ() * 0.52 : h; + world.addParticle(ParticleTypes.SMOKE, d + i, e + j, f + k, 0.0, 0.0, 0.0); + world.addParticle(ParticleTypes.FLAME, d + i, e + j, f + k, 0.0, 0.0, 0.0); } else { SimpleParticleType simpleParticleType = ParticleTypes.CAMPFIRE_COSY_SMOKE; - world.addImportantParticleClient(simpleParticleType, true, (double)pos.getX() + 0.5 + random.nextDouble() / 3.0 * (double)(random.nextBoolean() ? 1 : -1), (double)pos.getY() + random.nextDouble() + random.nextDouble(), (double)pos.getZ() + 0.5 + random.nextDouble() / 3.0 * (double)(random.nextBoolean() ? 1 : -1), 0.0, 0.07, 0.0); + world.addAlwaysVisibleParticle(simpleParticleType, true, (double)pos.getX() + 0.5 + random.nextDouble() / 3.0 * (double)(random.nextBoolean() ? 1 : -1), (double)pos.getY() + random.nextDouble() + random.nextDouble(), (double)pos.getZ() + 0.5 + random.nextDouble() / 3.0 * (double)(random.nextBoolean() ? 1 : -1), 0.0, 0.07, 0.0); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/ForgeBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/ForgeBlockEntity.java index f938981551..68863208ce 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/ForgeBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/ForgeBlockEntity.java @@ -1,17 +1,50 @@ package net.sevenstars.middleearth.block.special.forge; -import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; -import net.minecraft.component.type.ConsumableComponents; -import net.minecraft.component.type.FoodComponent; -import net.minecraft.entity.ExperienceOrbEntity; -import net.minecraft.item.equipment.trim.ArmorTrim; -import net.minecraft.item.equipment.trim.ArmorTrimMaterial; -import net.minecraft.item.equipment.trim.ArmorTrimPattern; -import net.minecraft.recipe.ServerRecipeManager; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.math.MathHelper; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.sevenstars.middleearth.block.utils.ExtendedMenuProviderME; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.NonNullList; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.Registries; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.Container; +import net.minecraft.world.ContainerHelper; +import net.minecraft.world.WorldlyContainer; +import net.minecraft.world.entity.ExperienceOrb; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.item.armortrim.ArmorTrim; +import net.minecraft.world.item.armortrim.TrimMaterial; +import net.minecraft.world.item.armortrim.TrimPattern; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.AbstractFurnaceBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; @@ -22,57 +55,21 @@ import net.sevenstars.middleearth.item.ResourceItemsME; import net.sevenstars.middleearth.item.dataComponents.TemperatureDataComponent; import net.sevenstars.middleearth.recipe.AlloyingRecipe; -import net.minecraft.block.AbstractFurnaceBlock; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.entity.ItemEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.Inventories; -import net.minecraft.inventory.Inventory; -import net.minecraft.inventory.SidedInventory; -import net.minecraft.inventory.SimpleInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.network.listener.ClientPlayPacketListener; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; -import net.minecraft.recipe.RecipeEntry; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.screen.PropertyDelegate; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.property.Properties; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; import net.sevenstars.middleearth.recipe.RecipesME; import org.jetbrains.annotations.Nullable; import java.util.*; -public class ForgeBlockEntity extends BlockEntity implements ExtendedScreenHandlerFactory, SidedInventory { +public class ForgeBlockEntity extends BlockEntity implements ExtendedMenuProviderME, WorldlyContainer { private static final String ID = "forge"; public static final int MAX_PROGRESS = 1200; public static final int MAX_STORAGE = 2304; public static final int MAX_BOOST_TIME = 10; public static final int FUEL_SLOT = 0; public static final int OUTPUT_SLOT = 5; - private final DefaultedList inventory = - DefaultedList.ofSize(6, ItemStack.EMPTY); - protected final PropertyDelegate propertyDelegate; + private final NonNullList inventory = + NonNullList.withSize(6, ItemStack.EMPTY); + protected final ContainerData propertyDelegate; private int progress = 0; private int boostTime = 0; private int fuelTime = 0; @@ -80,9 +77,14 @@ public class ForgeBlockEntity extends BlockEntity implements ExtendedScreenHandl private int mode = 0; private int storage = 0; - private final ServerRecipeManager.MatchGetter matchGetter; + private final RecipeManager.CachedCheck matchGetter; private MetalTypes currentMetal = MetalTypes.EMPTY; + @Nullable + private RecipeHolder cachedAlloyingRecipe; + private boolean cachedHasHeatingRecipe; + private boolean processingInputsDirty = true; + private boolean clientSyncPending; //TODO melting smithing parts //TODO convert metals to registry, enum constant datagen if no registry @@ -90,7 +92,7 @@ public class ForgeBlockEntity extends BlockEntity implements ExtendedScreenHandl public ForgeBlockEntity(BlockPos pos, BlockState state) { super(ModBlockEntities.FORGE, pos, state); - this.propertyDelegate = new PropertyDelegate() { + this.propertyDelegate = new ContainerData() { @Override public int get(int index) { return switch (index) { @@ -116,25 +118,25 @@ public void set(int index, int value) { } @Override - public int size() { + public int getCount() { return 6; } }; - this.matchGetter = ServerRecipeManager.createCachedMatchGetter(RecipesME.FORGE); + this.matchGetter = RecipeManager.createCheck(RecipesME.FORGE); } public ItemStack getRenderStack(ForgeBlockEntity entity) { if (this.currentMetal != MetalTypes.EMPTY){ - return entity.currentMetal.getIngot().getDefaultStack(); + return entity.currentMetal.getIngot().getDefaultInstance(); } else { return ItemStack.EMPTY; } } @Override - public Text getDisplayName() { - return Text.translatable("screen." + MiddleEarth.MOD_ID + "." + ID); + public Component getDisplayName() { + return Component.translatable("screen." + MiddleEarth.MOD_ID + "." + ID); } public int getStorage() { @@ -147,20 +149,20 @@ public MetalTypes getCurrentMetal() { @Nullable @Override - public ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) { + public AbstractContainerMenu createMenu(int syncId, Inventory playerInventory, Player player) { return new ForgeAlloyingScreenHandler(syncId, playerInventory, this, this.propertyDelegate); } - public int hasBellows(World world, BlockPos pos, BlockState state){ - Direction direction = state.get(Properties.HORIZONTAL_FACING); - BlockPos pos1 = pos.offset(direction.rotateYClockwise()); - BlockPos pos2 = pos.offset(direction.rotateYClockwise().getOpposite()); + public int hasBellows(Level world, BlockPos pos, BlockState state){ + Direction direction = state.getValue(BlockStateProperties.HORIZONTAL_FACING); + BlockPos pos1 = pos.relative(direction.getClockWise()); + BlockPos pos2 = pos.relative(direction.getClockWise().getOpposite()); - Direction directionForge = state.get(ForgeBlock.FACING); + Direction directionForge = state.getValue(ForgeBlock.FACING); - if(world.getBlockState(pos1).isOf(ModDecorativeBlocks.BELLOWS) && world.getBlockState(pos2).isOf(ModDecorativeBlocks.BELLOWS)){ - Direction direction1 = world.getBlockState(pos1).get(BellowsBlock.FACING); - Direction direction2 = world.getBlockState(pos2).get(BellowsBlock.FACING); + if(world.getBlockState(pos1).is(ModDecorativeBlocks.BELLOWS) && world.getBlockState(pos2).is(ModDecorativeBlocks.BELLOWS)){ + Direction direction1 = world.getBlockState(pos1).getValue(BellowsBlock.FACING); + Direction direction2 = world.getBlockState(pos2).getValue(BellowsBlock.FACING); switch (directionForge){ case NORTH -> { if (direction1 == Direction.WEST && direction2 == Direction.EAST){ @@ -190,59 +192,95 @@ public int hasBellows(World world, BlockPos pos, BlockState state){ @Nullable @Override - public Packet toUpdatePacket() { - return BlockEntityUpdateS2CPacket.create(this); + public Packet getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); } @Override - protected void writeData(WriteView view) { - super.writeData(view); - Inventories.writeData(view, this.inventory, true); - view.putInt(ID + ".progress", this.progress); - view.putInt(ID + ".boost-time", this.boostTime); - view.putInt(ID + ".fuel-time", this.fuelTime); - view.putInt(ID + ".max-fuel-time", this.maxFuelTime); - view.putInt(ID + ".mode", this.mode); - view.putInt(ID + ".storage", this.storage); - view.putString(ID + ".current-metal", this.currentMetal.getName()); + protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.saveAdditional(tag, registries); + ContainerHelper.saveAllItems(tag, this.inventory, true, registries); + tag.putInt(ID + ".progress", this.progress); + tag.putInt(ID + ".boost-time", this.boostTime); + tag.putInt(ID + ".fuel-time", this.fuelTime); + tag.putInt(ID + ".max-fuel-time", this.maxFuelTime); + tag.putInt(ID + ".mode", this.mode); + tag.putInt(ID + ".storage", this.storage); + tag.putString(ID + ".current-metal", this.currentMetal.getName()); } @Override - protected void readData(ReadView view) { - super.readData(view); + protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.loadAdditional(tag, registries); this.inventory.clear(); - Inventories.readData(view, this.inventory); - this.progress = view.getInt(ID + ".progress", 0); - this.boostTime = view.getInt(ID + ".boost-time", 0); - this.fuelTime = view.getInt(ID + ".fuel-time", 0); - this.maxFuelTime = view.getInt(ID + ".max-fuel-time", 0); - this.mode = view.getInt(ID + ".mode", 0); - this.storage = view.getInt(ID + ".storage", 0); - this.currentMetal = MetalTypes.fromValue(view.getString(ID + ".current-metal", "bronze").toLowerCase()); + ContainerHelper.loadAllItems(tag, this.inventory, registries); + this.progress = tag.getInt(ID + ".progress"); + this.boostTime = tag.getInt(ID + ".boost-time"); + this.fuelTime = tag.getInt(ID + ".fuel-time"); + this.maxFuelTime = tag.getInt(ID + ".max-fuel-time"); + this.mode = tag.getInt(ID + ".mode"); + this.storage = tag.getInt(ID + ".storage"); + String metalName = tag.contains(ID + ".current-metal") ? tag.getString(ID + ".current-metal") : "bronze"; + this.currentMetal = MetalTypes.fromValue(metalName.toLowerCase()); + this.processingInputsDirty = true; + } + + private void markPersistedChanged() { + super.setChanged(); + } + + private void markClientVisibleChanged() { + this.markPersistedChanged(); + this.clientSyncPending = true; + } + + private void markInventoryChanged(int slot) { + if (slot >= 1 && slot <= 4) { + this.processingInputsDirty = true; + } + this.markClientVisibleChanged(); } - public void update() { - markDirty(); - world.updateListeners(pos, getCachedState(), getCachedState(), Block.NOTIFY_ALL); + @Override + public void setChanged() { + this.processingInputsDirty = true; + this.markClientVisibleChanged(); + } + + private void flushClientSync(ServerLevel world) { + if (this.clientSyncPending) { + BlockState state = this.getBlockState(); + world.sendBlockUpdated(this.worldPosition, state, state, Block.UPDATE_CLIENTS); + this.clientSyncPending = false; + } } @Override - public NbtCompound toInitialChunkDataNbt(RegistryWrapper.WrapperLookup registryLookup) { - return createNbt(registryLookup); + public CompoundTag getUpdateTag(HolderLookup.Provider registryLookup) { + return saveWithoutMetadata(registryLookup); } - public void setInventory(DefaultedList inventory) { - for (int i = 0; i < inventory.size(); i++) { - this.inventory.set(i, inventory.get(i)); + public void setInventory(NonNullList inventory) { + boolean changed = false; + for (int i = 0; i < Math.min(inventory.size(), this.inventory.size()); i++) { + ItemStack stack = inventory.get(i); + if (!ItemStack.matches(this.inventory.get(i), stack)) { + this.inventory.set(i, stack); + changed = true; + } + } + if (changed) { + this.processingInputsDirty = true; + this.markClientVisibleChanged(); } } protected boolean isFuel(ItemStack stack) { - return this.world.getFuelRegistry().isFuel(stack); + return stack.getBurnTime(RecipeType.SMELTING) > 0; } @Override - public int[] getAvailableSlots(Direction side) { + public int[] getSlotsForFace(Direction side) { int[] slots = new int[inventory.size()]; for (int i = 0; i < slots.length; i++) { slots[i] = i; @@ -251,8 +289,8 @@ public int[] getAvailableSlots(Direction side) { } @Override - public boolean canInsert(int slot, ItemStack stack, @Nullable Direction dir) { - if (this.world.getBlockState(this.pos).get(ForgeBlock.PART) == ForgePart.TOP) return false; + public boolean canPlaceItemThroughFace(int slot, ItemStack stack, @Nullable Direction dir) { + if (this.level.getBlockState(this.worldPosition).getValue(ForgeBlock.PART) == ForgePart.TOP) return false; if (mode == 0 && dir != null) return false; @@ -263,8 +301,8 @@ public boolean canInsert(int slot, ItemStack stack, @Nullable Direction dir) { } @Override - public boolean canExtract(int slot, ItemStack stack, Direction dir) { - if (this.world.getBlockState(this.pos).get(ForgeBlock.PART) == ForgePart.TOP) return false; + public boolean canTakeItemThroughFace(int slot, ItemStack stack, Direction dir) { + if (this.level.getBlockState(this.worldPosition).getValue(ForgeBlock.PART) == ForgePart.TOP) return false; if (dir == Direction.DOWN && slot < 5) return false; @@ -272,14 +310,14 @@ public boolean canExtract(int slot, ItemStack stack, Direction dir) { } @Override - public int size() { + public int getContainerSize() { return inventory.size(); } @Override public boolean isEmpty() { - for (int i = 0; i < size(); i++) { - ItemStack itemStack = getStack(i); + for (int i = 0; i < getContainerSize(); i++) { + ItemStack itemStack = getItem(i); if (!itemStack.isEmpty()) { return false; } @@ -288,46 +326,59 @@ public boolean isEmpty() { } @Override - public ItemStack getStack(int slot) { + public ItemStack getItem(int slot) { return inventory.get(slot); } @Override - public ItemStack removeStack(int slot, int amount) { - return Inventories.splitStack(this.inventory, slot, amount); + public ItemStack removeItem(int slot, int amount) { + ItemStack removed = ContainerHelper.removeItem(this.inventory, slot, amount); + if (!removed.isEmpty()) { + this.markInventoryChanged(slot); + } + return removed; } @Override - public ItemStack removeStack(int slot) { - return Inventories.removeStack(inventory, slot); + public ItemStack removeItemNoUpdate(int slot) { + return ContainerHelper.takeItem(inventory, slot); } @Override - public void setStack(int slot, ItemStack stack) { - this.inventory.set(slot, stack); - if (stack.getCount() > getMaxCountPerStack()) { - stack.setCount(getMaxCountPerStack()); + public void setItem(int slot, ItemStack stack) { + if (stack.getCount() > getMaxStackSize()) { + stack.setCount(getMaxStackSize()); + } + if (!ItemStack.matches(this.inventory.get(slot), stack)) { + this.inventory.set(slot, stack); + this.markInventoryChanged(slot); } } @Override - public boolean canPlayerUse(PlayerEntity player) { - return Inventory.canPlayerUse(this, player); + public boolean stillValid(Player player) { + return Container.stillValidBlockEntity(this, player); } @Override - public void clear() { - this.inventory.clear(); + public void clearContent() { + if (!this.isEmpty()) { + this.inventory.clear(); + this.processingInputsDirty = true; + this.markClientVisibleChanged(); + } } public void bellowsBoost() { - this.boostTime = MAX_BOOST_TIME; - update(); + if (this.boostTime != MAX_BOOST_TIME) { + this.boostTime = MAX_BOOST_TIME; + this.markPersistedChanged(); + } } - public static void switchMode(Vec3d coords, ServerPlayerEntity player){ - BlockPos pos = new BlockPos((int) coords.getX(), (int) coords.getY(), (int) coords.getZ()); - Optional forgeBlockEntity = player.getWorld().getBlockEntity(pos, ModBlockEntities.FORGE); + public static void switchMode(Vec3 coords, ServerPlayer player){ + BlockPos pos = new BlockPos((int) coords.x(), (int) coords.y(), (int) coords.z()); + Optional forgeBlockEntity = player.level().getBlockEntity(pos, ModBlockEntities.FORGE); if(forgeBlockEntity.isPresent()){ ForgeBlockEntity entity = forgeBlockEntity.get(); @@ -336,30 +387,32 @@ public static void switchMode(Vec3d coords, ServerPlayerEntity player){ } else if (entity.mode == 0) { entity.mode = 1; } + entity.processingInputsDirty = true; + entity.markClientVisibleChanged(); } } - public static void outputItemStack(int amount, Vec3d coords, ServerPlayerEntity player, int mode){ - BlockPos pos = new BlockPos((int) coords.getX(), (int) coords.getY(), (int) coords.getZ()); + public static void outputItemStack(int amount, Vec3 coords, ServerPlayer player, int mode){ + BlockPos pos = new BlockPos((int) coords.x(), (int) coords.y(), (int) coords.z()); - Optional forgeBlockEntity = player.getWorld().getBlockEntity(pos, ModBlockEntities.FORGE); + Optional forgeBlockEntity = player.level().getBlockEntity(pos, ModBlockEntities.FORGE); ItemStack itemstack = ItemStack.EMPTY; if(forgeBlockEntity.isPresent()){ ForgeBlockEntity entity = forgeBlockEntity.get(); - if (entity.getStack(OUTPUT_SLOT).getMaxCount() <= entity.getStack(OUTPUT_SLOT).getCount()) return; + if (entity.getItem(OUTPUT_SLOT).getMaxStackSize() <= entity.getItem(OUTPUT_SLOT).getCount()) return; - RegistryWrapper.Impl armorTrimMaterialRegistry = entity.getWorld().getRegistryManager().getOrThrow(RegistryKeys.TRIM_MATERIAL); - RegistryWrapper.Impl armorTrimPatternRegistry = entity.getWorld().getRegistryManager().getOrThrow(RegistryKeys.TRIM_PATTERN); + HolderLookup.RegistryLookup armorTrimMaterialRegistry = entity.getLevel().registryAccess().lookupOrThrow(Registries.TRIM_MATERIAL); + HolderLookup.RegistryLookup armorTrimPatternRegistry = entity.getLevel().registryAccess().lookupOrThrow(Registries.TRIM_PATTERN); switch (amount){ case 16 -> { if(entity.currentMetal.getIngot().equals(ResourceItemsME.THERAPOD_NUGGET)) { itemstack = new ItemStack(ResourceItemsME.PTEROSAUR_NUGGET); - FoodComponent foodComponent = new FoodComponent(1, 0.5f, false); - itemstack.set(DataComponentTypes.FOOD, foodComponent); - itemstack.set(DataComponentTypes.CONSUMABLE, ConsumableComponents.FOOD); + FoodProperties foodComponent = new FoodProperties.Builder() + .nutrition(1).saturationModifier(0.5F).build(); + itemstack.set(DataComponents.FOOD, foodComponent); itemstack.set(DataComponentTypesME.TEMPERATURE_DATA, new TemperatureDataComponent(100)); } else if (entity.currentMetal.getNugget() != null){ itemstack = new ItemStack(entity.currentMetal.getNugget()); @@ -369,9 +422,9 @@ public static void outputItemStack(int amount, Vec3d coords, ServerPlayerEntity case 144 -> { if(entity.currentMetal.getIngot().equals(ResourceItemsME.THERAPOD_NUGGET)) { itemstack = new ItemStack(ResourceItemsME.THERAPOD_NUGGET); - FoodComponent foodComponent = new FoodComponent(7, 0.8f, false); - itemstack.set(DataComponentTypes.FOOD, foodComponent); - itemstack.set(DataComponentTypes.CONSUMABLE, ConsumableComponents.FOOD); + FoodProperties foodComponent = new FoodProperties.Builder() + .nutrition(7).saturationModifier(0.8F).build(); + itemstack.set(DataComponents.FOOD, foodComponent); } else { itemstack = new ItemStack(entity.currentMetal.getIngot()); } @@ -384,18 +437,18 @@ public static void outputItemStack(int amount, Vec3d coords, ServerPlayerEntity if(entity.currentMetal.getIngot().equals(ResourceItemsME.THERAPOD_NUGGET)) { if(mode == 4) itemstack = new ItemStack(ResourceItemsME.THYREOPHORAN_NUGGET); else itemstack = new ItemStack(ResourceItemsME.CERATOPSIAN_NUGGET); - FoodComponent foodComponent = new FoodComponent(10, 0.8f, false); - itemstack.set(DataComponentTypes.FOOD, foodComponent); - itemstack.set(DataComponentTypes.CONSUMABLE, ConsumableComponents.FOOD); + FoodProperties foodComponent = new FoodProperties.Builder() + .nutrition(10).saturationModifier(0.8F).build(); + itemstack.set(DataComponents.FOOD, foodComponent); } else if(entity.currentMetal.isVanilla()) { - itemstack.set(DataComponentTypes.TRIM, new ArmorTrim( - armorTrimMaterialRegistry.getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, Identifier.of(entity.currentMetal.getName()))), - armorTrimPatternRegistry.getOrThrow(RegistryKey.of(RegistryKeys.TRIM_PATTERN, Identifier.of(MiddleEarth.MOD_ID, "smithing_part"))))); + itemstack.set(DataComponents.TRIM, new ArmorTrim( + armorTrimMaterialRegistry.getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, ResourceLocation.parse(entity.currentMetal.getName()))), + armorTrimPatternRegistry.getOrThrow(ResourceKey.create(Registries.TRIM_PATTERN, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "smithing_part"))))); } else { - itemstack.set(DataComponentTypes.TRIM, new ArmorTrim( - armorTrimMaterialRegistry.getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, Identifier.of(MiddleEarth.MOD_ID, entity.currentMetal.getName()))), - armorTrimPatternRegistry.getOrThrow(RegistryKey.of(RegistryKeys.TRIM_PATTERN, Identifier.of(MiddleEarth.MOD_ID, "smithing_part"))))); + itemstack.set(DataComponents.TRIM, new ArmorTrim( + armorTrimMaterialRegistry.getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, entity.currentMetal.getName()))), + armorTrimPatternRegistry.getOrThrow(ResourceKey.create(Registries.TRIM_PATTERN, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "smithing_part"))))); }itemstack.set(DataComponentTypesME.TEMPERATURE_DATA, new TemperatureDataComponent(100)); } @@ -403,177 +456,199 @@ else if(entity.currentMetal.isVanilla()) { itemstack = new ItemStack(ResourceItemsME.LARGE_ROD); if(entity.currentMetal.getIngot().equals(ResourceItemsME.THERAPOD_NUGGET)) { itemstack = new ItemStack(ResourceItemsME.SAUROPOD_NUGGET); - FoodComponent foodComponent = new FoodComponent(14, 0.85f, false); - itemstack.set(DataComponentTypes.FOOD, foodComponent); - itemstack.set(DataComponentTypes.CONSUMABLE, ConsumableComponents.FOOD); + FoodProperties foodComponent = new FoodProperties.Builder() + .nutrition(14).saturationModifier(0.85F).build(); + itemstack.set(DataComponents.FOOD, foodComponent); } else if (entity.currentMetal.isVanilla()){ - itemstack.set(DataComponentTypes.TRIM, new ArmorTrim( - armorTrimMaterialRegistry.getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, Identifier.of(entity.currentMetal.getName()))), - armorTrimPatternRegistry.getOrThrow(RegistryKey.of(RegistryKeys.TRIM_PATTERN, Identifier.of(MiddleEarth.MOD_ID, "smithing_part"))))); + itemstack.set(DataComponents.TRIM, new ArmorTrim( + armorTrimMaterialRegistry.getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, ResourceLocation.parse(entity.currentMetal.getName()))), + armorTrimPatternRegistry.getOrThrow(ResourceKey.create(Registries.TRIM_PATTERN, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "smithing_part"))))); } else { - itemstack.set(DataComponentTypes.TRIM, new ArmorTrim( - armorTrimMaterialRegistry.getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, Identifier.of(MiddleEarth.MOD_ID, entity.currentMetal.getName()))), - armorTrimPatternRegistry.getOrThrow(RegistryKey.of(RegistryKeys.TRIM_PATTERN, Identifier.of(MiddleEarth.MOD_ID, "smithing_part"))))); + itemstack.set(DataComponents.TRIM, new ArmorTrim( + armorTrimMaterialRegistry.getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, entity.currentMetal.getName()))), + armorTrimPatternRegistry.getOrThrow(ResourceKey.create(Registries.TRIM_PATTERN, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "smithing_part"))))); } itemstack.set(DataComponentTypesME.TEMPERATURE_DATA, new TemperatureDataComponent(100)); } } - if (entity.getStack(OUTPUT_SLOT).isOf(itemstack.getItem()) && !itemstack.isEmpty()){ - if (Objects.equals(entity.getStack(OUTPUT_SLOT).get(DataComponentTypes.TRIM), itemstack.get(DataComponentTypes.TRIM))) { + if (entity.getItem(OUTPUT_SLOT).is(itemstack.getItem()) && !itemstack.isEmpty()){ + if (Objects.equals(entity.getItem(OUTPUT_SLOT).get(DataComponents.TRIM), itemstack.get(DataComponents.TRIM))) { if (amount <= entity.storage && amount > 0) { - itemstack.setCount(entity.getStack(OUTPUT_SLOT).getCount() + 1); + itemstack.setCount(entity.getItem(OUTPUT_SLOT).getCount() + 1); entity.storage = entity.storage - amount; if (entity.storage == 0) { entity.currentMetal = MetalTypes.EMPTY; } - entity.setStack(OUTPUT_SLOT, itemstack); - playExtractSound(entity.getWorld(), pos); - entity.update(); + entity.setItem(OUTPUT_SLOT, itemstack); + playExtractSound(entity.getLevel(), pos); } else { - playFailedExtractSound(entity.getWorld(), pos); + playFailedExtractSound(entity.getLevel(), pos); } }else { - playFailedExtractSound(entity.getWorld(), pos); + playFailedExtractSound(entity.getLevel(), pos); } - } else if(entity.getStack(OUTPUT_SLOT).isEmpty() && !itemstack.isEmpty()){ + } else if(entity.getItem(OUTPUT_SLOT).isEmpty() && !itemstack.isEmpty()){ if (amount <= entity.storage && amount > 0) { - itemstack.setCount(entity.getStack(OUTPUT_SLOT).getCount() + 1); + itemstack.setCount(entity.getItem(OUTPUT_SLOT).getCount() + 1); entity.storage = entity.storage - amount; if (entity.storage == 0) { entity.currentMetal = MetalTypes.EMPTY; } - entity.setStack(OUTPUT_SLOT, itemstack); - playExtractSound(entity.getWorld(), pos); - entity.update(); + entity.setItem(OUTPUT_SLOT, itemstack); + playExtractSound(entity.getLevel(), pos); } else { - playFailedExtractSound(entity.getWorld(), pos); + playFailedExtractSound(entity.getLevel(), pos); } } else { - playFailedExtractSound(entity.getWorld(), pos); + playFailedExtractSound(entity.getLevel(), pos); } } } - private static void playExtractSound(World world, BlockPos pos){ - world.playSound(null, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1.0f, 1.0f); + private static void playExtractSound(Level world, BlockPos pos){ + world.playSound(null, pos, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 1.0f, 1.0f); } - private static void playFailedExtractSound(World world, BlockPos pos){ - world.playSound(null, pos, SoundEvents.BLOCK_DECORATED_POT_INSERT_FAIL, SoundCategory.BLOCKS, 1.0f, 1.0f); + private static void playFailedExtractSound(Level world, BlockPos pos){ + world.playSound(null, pos, SoundEvents.DECORATED_POT_INSERT_FAIL, SoundSource.BLOCKS, 1.0f, 1.0f); } - public static void tick(ServerWorld world, BlockPos blockPos, BlockState blockState, ForgeBlockEntity entity) { - if (blockState.get(ForgeBlock.PART) == ForgePart.TOP) return; - - entity.fuelTime = Math.max(0, entity.fuelTime - 1); - entity.boostTime = Math.max(0, entity.boostTime - 1); - - boolean progress = false; + public static void tick(ServerLevel world, BlockPos blockPos, BlockState blockState, ForgeBlockEntity entity) { + if (blockState.getValue(ForgeBlock.PART) == ForgePart.TOP) { + entity.flushClientSync(world); + return; + } - entity.update(); + boolean persistedStateChanged = false; + if (entity.fuelTime > 0) { + entity.fuelTime--; + persistedStateChanged = true; + } + if (entity.boostTime > 0) { + entity.boostTime--; + persistedStateChanged = true; + } - if(entity.mode == 1) { // Alloying mode - if(hasAlloyingRecipe(entity, world)) { - if(entity.hasFuel(entity)) { - int progressValue = 1; - if(entity.boostTime > 0) { - progressValue = 8; - } - entity.progress += progressValue; - progress = true; - entity.update(); - if(entity.progress >= MAX_PROGRESS) { - craftItem(entity, world); - entity.progress = 0; - entity.update(); - } + entity.refreshProcessingCache(world); + boolean madeProgress = false; + + if (entity.mode == 1) { + RecipeHolder recipe = entity.cachedAlloyingRecipe; + if (recipe != null + && canInsertLiquid(entity.storage, entity.currentMetal, recipe) + && entity.hasFuel()) { + entity.progress += entity.boostTime > 0 ? 8 : 1; + madeProgress = true; + persistedStateChanged = true; + if (entity.progress >= MAX_PROGRESS) { + craftItem(entity, world, recipe); + entity.progress = 0; } } - } else { // Heating mode - dropExtraItems(entity); - if(hasHeatingRecipe(entity)) { - if(entity.hasFuel(entity)) { - int progressValue = 2; - if(entity.boostTime > 0) { - progressValue = 16; - } - entity.progress += progressValue; - progress = true; - entity.update(); - if(entity.progress >= MAX_PROGRESS) { - for (int i = 1; i <= 4; i++) { - entity.getStack(i).set(DataComponentTypesME.TEMPERATURE_DATA, new TemperatureDataComponent(100)); - } - entity.progress = 0; - entity.update(); + } else if (entity.cachedHasHeatingRecipe && entity.hasFuel()) { + entity.progress += entity.boostTime > 0 ? 16 : 2; + madeProgress = true; + persistedStateChanged = true; + if (entity.progress >= MAX_PROGRESS) { + for (int i = 1; i <= 4; i++) { + ItemStack stack = entity.getItem(i); + if (!stack.isEmpty()) { + stack.set(DataComponentTypesME.TEMPERATURE_DATA, new TemperatureDataComponent(100)); } } + entity.progress = 0; + entity.processingInputsDirty = true; } } - if (!progress){ + if (!madeProgress && entity.progress > 0) { entity.progress = Math.max(entity.progress - 2, 0); - entity.update(); + persistedStateChanged = true; } - boolean isCooking = entity.fuelTime > 0; - - blockState = blockState.with(AbstractFurnaceBlock.LIT, isCooking); - BlockState blockStateUp = blockState.with(AbstractFurnaceBlock.LIT, isCooking).with(ForgeBlock.PART, ForgePart.TOP); - world.setBlockState(blockPos, blockState, Block.NOTIFY_ALL); - world.setBlockState(blockPos.up(), blockStateUp, Block.NOTIFY_ALL); - } - private static void craftItem(ForgeBlockEntity entity, ServerWorld world) { - SimpleInventory inventory1 = new SimpleInventory(entity.size()); - List inputs = new ArrayList<>(); - for (int i = 0; i < entity.size(); i++) { - inventory1.setStack(i, entity.getStack(i)); - if(i != FUEL_SLOT && i != OUTPUT_SLOT) inputs.add(entity.getStack(i)); + if (persistedStateChanged) { + entity.markPersistedChanged(); } - RecipeEntry match = entity.matchGetter.getFirstMatch( - new MultipleStackRecipeInput(inputs), world).orElse(null); + boolean isLit = entity.fuelTime > 0; + if (blockState.getValue(AbstractFurnaceBlock.LIT) != isLit) { + BlockState lowerState = blockState.setValue(AbstractFurnaceBlock.LIT, isLit); + BlockState upperState = lowerState.setValue(ForgeBlock.PART, ForgePart.TOP); + world.setBlock(blockPos, lowerState, Block.UPDATE_ALL); + world.setBlock(blockPos.above(), upperState, Block.UPDATE_ALL); + } - if(match == null) throw new RuntimeException("Somehow... you crafted an item without recipe?!"); + entity.flushClientSync(world); + } - ExperienceOrbEntity.spawn(world, entity.getPos().toCenterPos().add(0, 1, 0), match.value().getXp()); + private static void craftItem( + ForgeBlockEntity entity, + ServerLevel world, + RecipeHolder recipe + ) { + ExperienceOrb.award(world, entity.getBlockPos().getCenter().add(0, 1, 0), recipe.value().getXp()); - if(hasAlloyingRecipe(entity, world)) { - for (int i = 1; i <= 4; i++) { - entity.removeStack(i, 1); - } - entity.storage = entity.storage + match.value().amount; - entity.currentMetal = MetalTypes.fromValue(match.value().output.toLowerCase()); - entity.update(); + for (int i = 1; i <= 4; i++) { + entity.getItem(i).shrink(1); } + entity.storage += recipe.value().amount; + entity.currentMetal = MetalTypes.fromValue(recipe.value().output.toLowerCase()); + entity.processingInputsDirty = true; + entity.markClientVisibleChanged(); } - private static boolean hasAlloyingRecipe(ForgeBlockEntity entity, ServerWorld world) { - SimpleInventory inventory1 = new SimpleInventory(entity.size()); - List inputs = new ArrayList<>(); - for (int i = 0; i < entity.size(); i++) { - inventory1.setStack(i, entity.getStack(i)); - if(i != FUEL_SLOT && i != OUTPUT_SLOT) inputs.add(entity.getStack(i)); + private void refreshProcessingCache(ServerLevel world) { + if (!this.processingInputsDirty) { + return; } - if(inputs.isEmpty()) return false; - RecipeEntry match = entity.matchGetter.getFirstMatch( - new MultipleStackRecipeInput(inputs), world).orElse(null); + if (this.mode == 1) { + this.cachedHasHeatingRecipe = false; + if (this.hasAnyProcessingInput()) { + List inputs = List.of( + this.getItem(1), + this.getItem(2), + this.getItem(3), + this.getItem(4) + ); + this.cachedAlloyingRecipe = this.matchGetter + .getRecipeFor(new MultipleStackRecipeInput(inputs), world) + .orElse(null); + } else { + this.cachedAlloyingRecipe = null; + } + } else { + this.cachedAlloyingRecipe = null; + if (dropExtraItems(this)) { + this.markClientVisibleChanged(); + } + this.cachedHasHeatingRecipe = this.computeHasHeatingRecipe(); + } - if(match == null) return false; + this.processingInputsDirty = false; + } - return canInsertLiquid(entity.storage, entity.currentMetal, match); + private boolean hasAnyProcessingInput() { + for (int i = 1; i <= 4; i++) { + if (!this.getItem(i).isEmpty()) { + return true; + } + } + return false; } - private static void dropExtraItems(ForgeBlockEntity entity) { - { - if(entity.getWorld() == null) return; - for (int i = 0; i < entity.size(); i++) + private static boolean dropExtraItems(ForgeBlockEntity entity) { + if (entity.getLevel() == null) { + return false; + } + + boolean changed = false; + for (int i = 0; i < entity.getContainerSize(); i++) if (i != FUEL_SLOT) { - ItemStack itemStack = entity.getStack(i); + ItemStack itemStack = entity.getItem(i); if (!itemStack.isEmpty() && itemStack.getCount() > 1) { int difference = itemStack.getCount() - 1; if(i == OUTPUT_SLOT){ @@ -583,76 +658,70 @@ private static void dropExtraItems(ForgeBlockEntity entity) { ItemStack extraStack = itemStack.copy(); extraStack.setCount(difference); - ItemEntity itemEntity = new ItemEntity(entity.getWorld(), - entity.getPos().getX() + 0.5f, - entity.getPos().getY() + 1.5f, - entity.getPos().getZ() + 0.5f, extraStack); - itemEntity.setToDefaultPickupDelay(); - float f = (float) (Math.random() * 0.15f); - float g = (float) (Math.random() * 0.15f); - itemEntity.setVelocity(f, 0.25f, g); - entity.getWorld().spawnEntity(itemEntity); + ItemEntity itemEntity = new ItemEntity(entity.getLevel(), + entity.getBlockPos().getX() + 0.5f, + entity.getBlockPos().getY() + 1.5f, + entity.getBlockPos().getZ() + 0.5f, extraStack); + itemEntity.setDefaultPickUpDelay(); + float f = (float) (entity.getLevel().getRandom().nextDouble() * 0.15f); + float g = (float) (entity.getLevel().getRandom().nextDouble() * 0.15f); + itemEntity.setDeltaMovement(f, 0.25f, g); + entity.getLevel().addFreshEntity(itemEntity); itemStack.setCount(1); if(i == OUTPUT_SLOT){ itemStack.setCount(0); } + changed = true; } } - } + return changed; } - private static boolean hasHeatingRecipe(ForgeBlockEntity entity) { - List inputs = new ArrayList<>(); + private boolean computeHasHeatingRecipe() { boolean hasColdItem = false; - for (int i = 0; i < entity.size(); i++) { + for (int i = 0; i < this.getContainerSize(); i++) { if(i != FUEL_SLOT && i != OUTPUT_SLOT) { - Item item = entity.getStack(i).getItem(); - if (entity.getStack(i).isEmpty()){ - hasColdItem = true; - } else if(!HotMetalsModel.nuggets.contains(item) && !HotMetalsModel.ingots.contains(item) && !HotMetalsModel.items.contains(item)) { - return false; // One of the items cannot be heated - } else { - TemperatureDataComponent temperatureComponent = entity.getStack(i).get(DataComponentTypesME.TEMPERATURE_DATA); + ItemStack stack = this.getItem(i); + if (!stack.isEmpty()) { + Item item = stack.getItem(); + if (!HotMetalsModel.nuggets.contains(item) + && !HotMetalsModel.ingots.contains(item) + && !HotMetalsModel.items.contains(item)) { + return false; + } + TemperatureDataComponent temperatureComponent = stack.get(DataComponentTypesME.TEMPERATURE_DATA); if(temperatureComponent == null || temperatureComponent.temperature() < 100) { hasColdItem = true; - inputs.add(entity.getStack(i)); } } } } - if(inputs.isEmpty()) return false; - else return hasColdItem; + return hasColdItem; } - private boolean hasFuel(ForgeBlockEntity entity) { - - SimpleInventory inventory1 = new SimpleInventory(entity.size()); - for (int i = 0; i < entity.size(); i++) { - inventory1.setStack(i, entity.getStack(i)); + private boolean hasFuel() { + if (this.fuelTime > 0) { + return true; } - ItemStack fuelStack = inventory1.getStack(FUEL_SLOT); - if(this.fuelTime > 0) return true; - else { - if(isFuel(fuelStack)) { - getFuel(entity, fuelStack); - return true; - } else return false; + ItemStack fuelStack = this.getItem(FUEL_SLOT); + if (!this.isFuel(fuelStack)) { + return false; } - } - private void getFuel(ForgeBlockEntity entity, ItemStack fuelStack) { - fuelTime = Math.round((float) this.world.getFuelRegistry().getFuelTicks(fuelStack) / 16); - maxFuelTime = fuelTime; - if(fuelStack.isOf(Items.LAVA_BUCKET)) { - entity.removeStack(FUEL_SLOT); - entity.setStack(FUEL_SLOT, Items.BUCKET.getDefaultStack()); + this.fuelTime = Math.round((float) fuelStack.getBurnTime(RecipeType.SMELTING) / 16); + this.maxFuelTime = this.fuelTime; + if (fuelStack.is(Items.LAVA_BUCKET)) { + this.inventory.set(FUEL_SLOT, Items.BUCKET.getDefaultInstance()); + } else { + fuelStack.shrink(1); } - else entity.getStack(FUEL_SLOT).decrement(1); + this.markInventoryChanged(FUEL_SLOT); + return true; } - private static boolean canInsertLiquid(int storage, MetalTypes currentMetal, RecipeEntry match) { + private static boolean canInsertLiquid(int storage, MetalTypes currentMetal, RecipeHolder match) { var value = match.value().output.toLowerCase(); MetalTypes metal = MetalTypes.fromValue(value); if((storage + match.value().amount) <= MAX_STORAGE){ @@ -665,7 +734,7 @@ private static boolean canInsertLiquid(int storage, MetalTypes currentMetal, Rec } @Override - public Object getScreenOpeningData(ServerPlayerEntity player) { - return pos; + public void writeOpeningData(RegistryFriendlyByteBuf buffer) { + BlockPos.STREAM_CODEC.encode(buffer, worldPosition); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/ForgeEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/ForgeEntityRenderer.java index 1d546a5dfb..6119f1fd78 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/ForgeEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/ForgeEntityRenderer.java @@ -1,60 +1,60 @@ package net.sevenstars.middleearth.block.special.forge; -import net.minecraft.client.render.LightmapTextureManager; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BlockEntityRenderer; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemDisplayContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.LightType; -import net.minecraft.world.World; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Axis; +import net.minecraft.client.renderer.LightTexture; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LightLayer; +import net.minecraft.world.phys.Vec3; public class ForgeEntityRenderer implements BlockEntityRenderer { - private final BlockEntityRendererFactory.Context context; + private final BlockEntityRendererProvider.Context context; - public ForgeEntityRenderer(BlockEntityRendererFactory.Context context) { + public ForgeEntityRenderer(BlockEntityRendererProvider.Context context) { this.context = context; } @Override - public void render(ForgeBlockEntity entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { + public void render(ForgeBlockEntity entity, float tickProgress, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { ItemStack stack = entity.getRenderStack(entity); if(stack.isEmpty()) return; - matrices.push(); + matrices.pushPose(); matrices.translate(0.5f, 1.025f, 0.5f); matrices.scale(0.65f, 0.65f, 0.65f); - matrices.multiply(RotationAxis.POSITIVE_X.rotation((float) Math.toRadians(90))); + matrices.mulPose(Axis.XP.rotation((float) Math.toRadians(90))); - Direction direction = entity.getCachedState().get(ForgeBlock.FACING); + Direction direction = entity.getBlockState().getValue(ForgeBlock.FACING); switch (direction) { - case NORTH -> matrices.multiply(RotationAxis.POSITIVE_Z.rotation((float) Math.toRadians(225))); - case EAST -> matrices.multiply(RotationAxis.POSITIVE_Z.rotation((float) Math.toRadians(135))); - case SOUTH -> matrices.multiply(RotationAxis.POSITIVE_Z.rotation((float) Math.toRadians(45))); - case WEST -> matrices.multiply(RotationAxis.POSITIVE_Z.rotation((float) Math.toRadians(315))); + case NORTH -> matrices.mulPose(Axis.ZP.rotation((float) Math.toRadians(225))); + case EAST -> matrices.mulPose(Axis.ZP.rotation((float) Math.toRadians(135))); + case SOUTH -> matrices.mulPose(Axis.ZP.rotation((float) Math.toRadians(45))); + case WEST -> matrices.mulPose(Axis.ZP.rotation((float) Math.toRadians(315))); } - int currentLight = getLightLevel(entity.getWorld(), entity.getPos(), direction); + int currentLight = getLightLevel(entity.getLevel(), entity.getBlockPos(), direction); - this.context.getItemRenderer().renderItem(stack, ItemDisplayContext.FIXED, currentLight, OverlayTexture.DEFAULT_UV, - matrices, vertexConsumers, entity.getWorld(), 1); + this.context.getItemRenderer().renderStatic(stack, ItemDisplayContext.FIXED, currentLight, OverlayTexture.NO_OVERLAY, + matrices, vertexConsumers, entity.getLevel(), 1); - matrices.pop(); + matrices.popPose(); } - private int getLightLevel(World world, BlockPos pos, Direction direction) { - int bLight = world.getLightLevel(LightType.BLOCK, pos.offset(direction).up()); - int sLight = world.getLightLevel(LightType.SKY, pos.offset(direction).up()); - return LightmapTextureManager.pack(bLight, sLight); + private int getLightLevel(Level world, BlockPos pos, Direction direction) { + int bLight = world.getBrightness(LightLayer.BLOCK, pos.relative(direction).above()); + int sLight = world.getBrightness(LightLayer.SKY, pos.relative(direction).above()); + return LightTexture.pack(bLight, sLight); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/ForgePart.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/ForgePart.java index 338825551b..94dd180085 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/ForgePart.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/ForgePart.java @@ -1,8 +1,8 @@ package net.sevenstars.middleearth.block.special.forge; -import net.minecraft.util.StringIdentifiable; +import net.minecraft.util.StringRepresentable; -public enum ForgePart implements StringIdentifiable { +public enum ForgePart implements StringRepresentable { BOTTOM("bottom"), TOP("top"); @@ -16,7 +16,7 @@ public String toString() { return this.name; } - public String asString() { + public String getSerializedName() { return this.name; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/MetalTypes.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/MetalTypes.java index fc2a4b0213..24adfe5443 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/MetalTypes.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/MetalTypes.java @@ -1,11 +1,11 @@ package net.sevenstars.middleearth.block.special.forge; +import net.minecraft.util.StringRepresentable; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; import net.sevenstars.middleearth.item.ResourceItemsME; -import net.minecraft.item.Item; -import net.minecraft.item.Items; -import net.minecraft.util.StringIdentifiable; -public enum MetalTypes implements StringIdentifiable { +public enum MetalTypes implements StringRepresentable { EMPTY(-1, "empty", null, null, false, 0), COPPER(0, "copper", Items.COPPER_INGOT, null, true, 11823181), @@ -35,7 +35,6 @@ public static MetalTypes fromValue(String name) { for (MetalTypes metal : MetalTypes.values()) { if (metal.name.equals(name)) return metal; } - System.out.println("CRASH AT : " + name); return null; } @@ -68,7 +67,7 @@ public int getColor() { } @Override - public String asString() { + public String getSerializedName() { return name; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/MultipleStackRecipeInput.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/MultipleStackRecipeInput.java index 92c55f35d8..97d13e3f7d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/MultipleStackRecipeInput.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/forge/MultipleStackRecipeInput.java @@ -1,14 +1,13 @@ package net.sevenstars.middleearth.block.special.forge; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.input.RecipeInput; - import java.util.List; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeInput; public record MultipleStackRecipeInput(List items) implements RecipeInput { @Override - public ItemStack getStackInSlot(int slot) { + public ItemStack getItem(int slot) { if (slot >= size()) { throw new IllegalArgumentException("No item for index " + slot); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/gemstones/CustomBuddingGemBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/gemstones/CustomBuddingGemBlock.java index 2f1886fee3..198cb140a2 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/gemstones/CustomBuddingGemBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/gemstones/CustomBuddingGemBlock.java @@ -1,16 +1,15 @@ package net.sevenstars.middleearth.block.special.gemstones; -import net.minecraft.block.AmethystClusterBlock; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.BuddingAmethystBlock; -import net.minecraft.fluid.Fluids; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; - import java.util.List; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.block.AmethystClusterBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BuddingAmethystBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.Fluids; public class CustomBuddingGemBlock extends BuddingAmethystBlock { @@ -18,33 +17,33 @@ public class CustomBuddingGemBlock extends BuddingAmethystBlock { private final List clusters; - public CustomBuddingGemBlock(Settings settings, List clustersIn) { + public CustomBuddingGemBlock(Properties settings, List clustersIn) { super(settings); clusters = clustersIn; } @Override - public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { if (random.nextInt(5) == 0) { - Direction direction = DIRECTIONS[random.nextInt(DIRECTIONS.length)]; - BlockPos blockPos = pos.offset(direction); + Direction direction = UPDATE_SHAPE_ORDER[random.nextInt(UPDATE_SHAPE_ORDER.length)]; + BlockPos blockPos = pos.relative(direction); BlockState blockState = world.getBlockState(blockPos); Block block = null; - if (canGrowIn(blockState)) { + if (canClusterGrowAtState(blockState)) { block = clusters.get(0); - } else if (blockState.isOf(clusters.get(0)) && blockState.get(AmethystClusterBlock.FACING) == direction) { + } else if (blockState.is(clusters.get(0)) && blockState.getValue(AmethystClusterBlock.FACING) == direction) { block = clusters.get(1); - } else if (blockState.isOf(clusters.get(1)) && blockState.get(AmethystClusterBlock.FACING) == direction) { + } else if (blockState.is(clusters.get(1)) && blockState.getValue(AmethystClusterBlock.FACING) == direction) { block = clusters.get(2); - } else if (blockState.isOf(clusters.get(2)) && blockState.get(AmethystClusterBlock.FACING) == direction) { + } else if (blockState.is(clusters.get(2)) && blockState.getValue(AmethystClusterBlock.FACING) == direction) { block = clusters.get(3); } if (block != null) { - BlockState blockState2 = (BlockState)((BlockState)block.getDefaultState().with(AmethystClusterBlock.FACING, direction)).with(AmethystClusterBlock.WATERLOGGED, blockState.getFluidState().getFluid() == Fluids.WATER); - world.setBlockState(blockPos, blockState2); + BlockState blockState2 = (BlockState)((BlockState)block.defaultBlockState().setValue(AmethystClusterBlock.FACING, direction)).setValue(AmethystClusterBlock.WATERLOGGED, blockState.getFluidState().getType() == Fluids.WATER); + world.setBlockAndUpdate(blockPos, blockState2); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/hangingstuff/CustomHangingBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/hangingstuff/CustomHangingBlock.java index 1e034f88c5..164cd93026 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/hangingstuff/CustomHangingBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/hangingstuff/CustomHangingBlock.java @@ -1,50 +1,99 @@ package net.sevenstars.middleearth.block.special.hangingstuff; -import net.minecraft.block.BlockState; -import net.minecraft.block.HangingMossBlock; -import net.minecraft.block.MultifaceBlock; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; - -public class CustomHangingBlock extends HangingMossBlock { - - public CustomHangingBlock(Settings settings) { +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.MultifaceBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +public class CustomHangingBlock extends Block implements BonemealableBlock { + public static final MapCodec CODEC = simpleCodec(CustomHangingBlock::new); + public static final BooleanProperty TIP = BooleanProperty.create("tip"); + private static final VoxelShape BODY_SHAPE = Block.box(1.0, 0.0, 1.0, 15.0, 16.0, 15.0); + private static final VoxelShape TIP_SHAPE = Block.box(1.0, 2.0, 1.0, 15.0, 16.0, 15.0); + + public CustomHangingBlock(Properties settings) { super(settings); + registerDefaultState(defaultBlockState().setValue(TIP, true)); + } + + @Override + protected MapCodec codec() { + return CODEC; } @Override - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - return this.canPlaceAt(world, pos); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return state.getValue(TIP) ? TIP_SHAPE : BODY_SHAPE; } - private boolean canPlaceAt(BlockView world, BlockPos pos) { - BlockPos blockPos = pos.offset(Direction.UP); + @Override + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + return this.canStayAtPosition(world, pos); + } + + private boolean canStayAtPosition(BlockGetter world, BlockPos pos) { + BlockPos blockPos = pos.relative(Direction.UP); BlockState blockState = world.getBlockState(blockPos); - return MultifaceBlock.canGrowOn(world, Direction.UP, blockPos, blockState) || blockState.isOf(this); + return MultifaceBlock.canAttachTo(world, Direction.UP, blockPos, blockState) || blockState.is(this); } - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (!this.canPlaceAt(world, pos)) { - tickView.scheduleBlockTick(pos, this, 1); + @Override + protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (!this.canStayAtPosition(world, pos)) { + world.scheduleTick(pos, this, 1); } - return (BlockState)state.with(TIP, !world.getBlockState(pos.down()).isOf(this)); + return state.setValue(TIP, !world.getBlockState(pos.below()).is(this)); } - protected void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - if (!this.canPlaceAt(world, pos)) { - world.breakBlock(pos, true); + @Override + protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + if (!this.canStayAtPosition(world, pos)) { + world.destroyBlock(pos, true); } } @Override - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(TIP); + } + + @Override + public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state) { + return world.getBlockState(findTipPos(world, pos).below()).isAir(); + } + + @Override + public boolean isBonemealSuccess(Level world, RandomSource random, BlockPos pos, BlockState state) { + return true; + } + @Override + public void performBonemeal(ServerLevel world, RandomSource random, BlockPos pos, BlockState state) { + BlockPos growthPos = findTipPos(world, pos).below(); + if (world.getBlockState(growthPos).isAir()) { + world.setBlock(growthPos, state.setValue(TIP, true), Block.UPDATE_ALL); + } + } + + private BlockPos findTipPos(BlockGetter world, BlockPos pos) { + BlockPos.MutableBlockPos cursor = pos.mutable().move(Direction.DOWN); + while (world.getBlockState(cursor).is(this)) { + cursor.move(Direction.DOWN); + } + return cursor.move(Direction.UP).immutable(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/hangingstuff/HangingCobwebBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/hangingstuff/HangingCobwebBlock.java index 0a6e782b2b..2ddd173b0e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/hangingstuff/HangingCobwebBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/hangingstuff/HangingCobwebBlock.java @@ -1,60 +1,55 @@ package net.sevenstars.middleearth.block.special.hangingstuff; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.CobwebBlock; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCollisionHandler; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.block.WireOrientation; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; public class HangingCobwebBlock extends CustomHangingBlock { - public HangingCobwebBlock(Settings settings) { + public HangingCobwebBlock(Properties settings) { super(settings); } - protected void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler) { - Vec3d vec3d = new Vec3d(0.25, 0.05000000074505806, 0.25); + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + Vec3 vec3d = new Vec3(0.25, 0.05000000074505806, 0.25); if (entity instanceof LivingEntity livingEntity) { - if (livingEntity.hasStatusEffect(StatusEffects.WEAVING)) { - vec3d = new Vec3d(0.5, 0.25, 0.5); + if (livingEntity.hasEffect(MobEffects.WEAVING)) { + vec3d = new Vec3(0.5, 0.25, 0.5); } } - entity.slowMovement(state, vec3d); + entity.makeStuckInBlock(state, vec3d); } @Override - protected void neighborUpdate(BlockState state, World world, BlockPos pos, Block sourceBlock, @Nullable WireOrientation wireOrientation, boolean notify) { - if (!world.isClient) { + protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) { + if (!world.isClientSide) { for (Direction direction : Direction.values()) { - if (world.getFluidState(pos.offset(direction)).isIn(net.minecraft.registry.tag.FluidTags.WATER)) { - world.breakBlock(pos, true); + if (world.getFluidState(pos.relative(direction)).is(net.minecraft.tags.FluidTags.WATER)) { + world.destroyBlock(pos, true); return; } } } - super.neighborUpdate(state, world, pos, sourceBlock, wireOrientation, notify); + super.neighborChanged(state, world, pos, sourceBlock, sourcePos, notify); } @Override - public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state) { + public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state) { return false; } @Override - public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { + public boolean isBonemealSuccess(Level world, RandomSource random, BlockPos pos, BlockState state) { return false; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/inscriptiontable/InscriptionTableblock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/inscriptiontable/InscriptionTableblock.java index dc545672b4..a0d69eab78 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/inscriptiontable/InscriptionTableblock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/inscriptiontable/InscriptionTableblock.java @@ -1,60 +1,63 @@ package net.sevenstars.middleearth.block.special.inscriptiontable; import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockRenderType; -import net.minecraft.block.BlockState; -import net.minecraft.block.HorizontalFacingBlock; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.screen.*; -import net.minecraft.state.StateManager; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.world.inventory.*; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.SimpleMenuProvider; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.ContainerLevelAccess; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.phys.BlockHitResult; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.gui.inscriptiontable.InscriptionTableScreenHandler; import org.jetbrains.annotations.Nullable; -public class InscriptionTableblock extends HorizontalFacingBlock { +public class InscriptionTableblock extends HorizontalDirectionalBlock { - private static final Text TITLE = Text.translatable(MiddleEarth.of("inscription_table").toTranslationKey("container")); + private static final Component TITLE = Component.translatable(MiddleEarth.of("inscription_table").toLanguageKey("container")); - public InscriptionTableblock(Settings settings) { + public InscriptionTableblock(Properties settings) { super(settings); } @Override - protected MapCodec getCodec() { - return InscriptionTableblock.createCodec(InscriptionTableblock::new); + protected MapCodec codec() { + return InscriptionTableblock.simpleCodec(InscriptionTableblock::new); } - public BlockState getPlacementState(ItemPlacementContext ctx) { - return (BlockState)((BlockState)this.getDefaultState().with(FACING, ctx.getHorizontalPlayerFacing().getOpposite())); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return (BlockState)((BlockState)this.defaultBlockState().setValue(FACING, ctx.getHorizontalDirection().getOpposite())); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); } - protected BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if (!world.isClient) { - player.openHandledScreen(state.createScreenHandlerFactory(world, pos)); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (!world.isClientSide) { + player.openMenu(state.getMenuProvider(world, pos)); } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } @Nullable - protected NamedScreenHandlerFactory createScreenHandlerFactory(BlockState state, World world, BlockPos pos) { - return new SimpleNamedScreenHandlerFactory((syncId, inventory, player) -> { - return new InscriptionTableScreenHandler(syncId, inventory, ScreenHandlerContext.create(world, pos)); + protected MenuProvider getMenuProvider(BlockState state, Level world, BlockPos pos) { + return new SimpleMenuProvider((syncId, inventory, player) -> { + return new InscriptionTableScreenHandler(syncId, inventory, ContainerLevelAccess.create(world, pos)); }, TITLE); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/palemoss/PaleHangingMossBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/palemoss/PaleHangingMossBlock.java new file mode 100644 index 0000000000..0f6a50e5c3 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/palemoss/PaleHangingMossBlock.java @@ -0,0 +1,17 @@ +package net.sevenstars.middleearth.block.special.palemoss; + +import com.mojang.serialization.MapCodec; +import net.sevenstars.middleearth.block.special.hangingstuff.CustomHangingBlock; + +public final class PaleHangingMossBlock extends CustomHangingBlock { + public static final MapCodec CODEC = simpleCodec(PaleHangingMossBlock::new); + + public PaleHangingMossBlock(Properties properties) { + super(properties); + } + + @Override + protected MapCodec codec() { + return CODEC; + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/palemoss/PaleMossBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/palemoss/PaleMossBlock.java new file mode 100644 index 0000000000..043480f8df --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/palemoss/PaleMossBlock.java @@ -0,0 +1,49 @@ +package net.sevenstars.middleearth.block.special.palemoss; + +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.core.registries.Registries; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.sevenstars.middleearth.world.features.tree.ModTreeConfiguredFeatures; + +public final class PaleMossBlock extends Block implements BonemealableBlock { + public static final MapCodec CODEC = simpleCodec(PaleMossBlock::new); + + public PaleMossBlock(Properties properties) { + super(properties); + } + + @Override + protected MapCodec codec() { + return CODEC; + } + + @Override + public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { + return level.getBlockState(pos.above()).isAir(); + } + + @Override + public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) { + return true; + } + + @Override + public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) { + level.registryAccess().registry(Registries.CONFIGURED_FEATURE) + .flatMap(registry -> registry.getHolder(ModTreeConfiguredFeatures.PALE_MOSS_PATCH_BONEMEAL_KEY)) + .ifPresent(feature -> feature.value().place( + level, level.getChunkSource().getGenerator(), random, pos.above())); + } + + @Override + public Type getType() { + return Type.NEIGHBOR_SPREADER; + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/palemoss/PaleMossCarpetBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/palemoss/PaleMossCarpetBlock.java new file mode 100644 index 0000000000..06738f696f --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/palemoss/PaleMossCarpetBlock.java @@ -0,0 +1,269 @@ +package net.sevenstars.middleearth.block.special.palemoss; + +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.MultifaceBlock; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.WallSide; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.sevenstars.middleearth.block.registration.ModNatureBlocks; +import org.jetbrains.annotations.Nullable; + +import java.util.Map; +import java.util.function.BooleanSupplier; + +public final class PaleMossCarpetBlock extends Block implements BonemealableBlock { + public static final MapCodec CODEC = simpleCodec(PaleMossCarpetBlock::new); + public static final BooleanProperty BOTTOM = BlockStateProperties.BOTTOM; + public static final EnumProperty NORTH = BlockStateProperties.NORTH_WALL; + public static final EnumProperty EAST = BlockStateProperties.EAST_WALL; + public static final EnumProperty SOUTH = BlockStateProperties.SOUTH_WALL; + public static final EnumProperty WEST = BlockStateProperties.WEST_WALL; + public static final Map> WALL_PROPERTIES = Map.of( + Direction.NORTH, NORTH, + Direction.EAST, EAST, + Direction.SOUTH, SOUTH, + Direction.WEST, WEST); + + private static final VoxelShape BOTTOM_SHAPE = Block.box(0, 0, 0, 16, 1, 16); + private static final Map LOW_SHAPES = Map.of( + Direction.NORTH, Block.box(0, 0, 0, 16, 10, 1), + Direction.EAST, Block.box(15, 0, 0, 16, 10, 16), + Direction.SOUTH, Block.box(0, 0, 15, 16, 10, 16), + Direction.WEST, Block.box(0, 0, 0, 1, 10, 16)); + private static final Map TALL_SHAPES = Map.of( + Direction.NORTH, Block.box(0, 0, 0, 16, 16, 1), + Direction.EAST, Block.box(15, 0, 0, 16, 16, 16), + Direction.SOUTH, Block.box(0, 0, 15, 16, 16, 16), + Direction.WEST, Block.box(0, 0, 0, 1, 16, 16)); + + public PaleMossCarpetBlock(Properties properties) { + super(properties); + registerDefaultState(stateDefinition.any() + .setValue(BOTTOM, true) + .setValue(NORTH, WallSide.NONE) + .setValue(EAST, WallSide.NONE) + .setValue(SOUTH, WallSide.NONE) + .setValue(WEST, WallSide.NONE)); + } + + @Override + protected MapCodec codec() { + return CODEC; + } + + @Override + protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { + VoxelShape result = state.getValue(BOTTOM) ? BOTTOM_SHAPE : Shapes.empty(); + for (Direction direction : Direction.Plane.HORIZONTAL) { + WallSide wallSide = state.getValue(WALL_PROPERTIES.get(direction)); + if (wallSide == WallSide.LOW) { + result = Shapes.or(result, LOW_SHAPES.get(direction)); + } else if (wallSide == WallSide.TALL) { + result = Shapes.or(result, TALL_SHAPES.get(direction)); + } + } + return result.isEmpty() ? Shapes.block() : result; + } + + @Override + protected VoxelShape getCollisionShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { + return state.getValue(BOTTOM) ? BOTTOM_SHAPE : Shapes.empty(); + } + + @Override + protected VoxelShape getOcclusionShape(BlockState state, BlockGetter level, BlockPos pos) { + return Shapes.empty(); + } + + @Override + protected boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) { + return true; + } + + @Override + protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { + BlockState below = level.getBlockState(pos.below()); + return state.getValue(BOTTOM) ? !below.isAir() : below.is(this) && below.getValue(BOTTOM); + } + + private static boolean canGrowOnFace(BlockGetter level, BlockPos pos, Direction direction) { + if (direction == Direction.UP) { + return false; + } + BlockPos supportPos = pos.relative(direction); + return MultifaceBlock.canAttachTo(level, direction, supportPos, level.getBlockState(supportPos)); + } + + private BlockState updateState(BlockState state, BlockGetter level, BlockPos pos, boolean forceLow) { + BlockState above = null; + BlockState below = null; + forceLow |= state.getValue(BOTTOM); + + for (Direction direction : Direction.Plane.HORIZONTAL) { + EnumProperty property = WALL_PROPERTIES.get(direction); + WallSide side = canGrowOnFace(level, pos, direction) + ? (forceLow ? WallSide.LOW : state.getValue(property)) + : WallSide.NONE; + if (side == WallSide.LOW) { + if (above == null) { + above = level.getBlockState(pos.above()); + } + if (above.is(this) && above.getValue(property) != WallSide.NONE && !above.getValue(BOTTOM)) { + side = WallSide.TALL; + } + if (!state.getValue(BOTTOM)) { + if (below == null) { + below = level.getBlockState(pos.below()); + } + if (below.is(this) && below.getValue(property) == WallSide.NONE) { + side = WallSide.NONE; + } + } + } + state = state.setValue(property, side); + } + return state; + } + + @Nullable + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + return updateState(defaultBlockState(), context.getLevel(), context.getClickedPos(), true); + } + + public static void placeAt(LevelAccessor level, BlockPos pos, RandomSource random, int flags) { + PaleMossCarpetBlock carpet = (PaleMossCarpetBlock) ModNatureBlocks.PALE_MOSS_CARPET; + BlockState bottom = carpet.updateState(carpet.defaultBlockState(), level, pos, true); + level.setBlock(pos, bottom, flags); + BlockState upper = carpet.createUpperState(level, pos, random::nextBoolean); + if (!upper.isAir()) { + level.setBlock(pos.above(), upper, flags); + level.setBlock(pos, carpet.updateState(bottom, level, pos, true), flags); + } + } + + @Override + public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { + if (!level.isClientSide) { + BlockState upper = createUpperState(level, pos, level.getRandom()::nextBoolean); + if (!upper.isAir()) { + level.setBlock(pos.above(), upper, Block.UPDATE_ALL); + } + } + } + + private BlockState createUpperState(BlockGetter level, BlockPos pos, BooleanSupplier randomBoolean) { + BlockPos upperPos = pos.above(); + BlockState current = level.getBlockState(upperPos); + boolean isCarpet = current.is(this); + if ((isCarpet && current.getValue(BOTTOM)) || (!isCarpet && !current.canBeReplaced())) { + return Blocks.AIR.defaultBlockState(); + } + + BlockState upper = updateState(defaultBlockState().setValue(BOTTOM, false), level, upperPos, true); + for (Direction direction : Direction.Plane.HORIZONTAL) { + EnumProperty property = WALL_PROPERTIES.get(direction); + if (upper.getValue(property) != WallSide.NONE && !randomBoolean.getAsBoolean()) { + upper = upper.setValue(property, WallSide.NONE); + } + } + return hasAnyShape(upper) && upper != current ? upper : Blocks.AIR.defaultBlockState(); + } + + private static boolean hasAnyShape(BlockState state) { + if (state.getValue(BOTTOM)) { + return true; + } + return WALL_PROPERTIES.values().stream().anyMatch(property -> state.getValue(property) != WallSide.NONE); + } + + @Override + protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, + LevelAccessor level, BlockPos pos, BlockPos neighborPos) { + if (!state.canSurvive(level, pos)) { + return Blocks.AIR.defaultBlockState(); + } + BlockState updated = updateState(state, level, pos, false); + return hasAnyShape(updated) ? updated : Blocks.AIR.defaultBlockState(); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(BOTTOM, NORTH, EAST, SOUTH, WEST); + } + + @Override + protected BlockState rotate(BlockState state, Rotation rotation) { + return switch (rotation) { + case CLOCKWISE_180 -> state + .setValue(NORTH, state.getValue(SOUTH)) + .setValue(EAST, state.getValue(WEST)) + .setValue(SOUTH, state.getValue(NORTH)) + .setValue(WEST, state.getValue(EAST)); + case CLOCKWISE_90 -> state + .setValue(NORTH, state.getValue(WEST)) + .setValue(EAST, state.getValue(NORTH)) + .setValue(SOUTH, state.getValue(EAST)) + .setValue(WEST, state.getValue(SOUTH)); + case COUNTERCLOCKWISE_90 -> state + .setValue(NORTH, state.getValue(EAST)) + .setValue(EAST, state.getValue(SOUTH)) + .setValue(SOUTH, state.getValue(WEST)) + .setValue(WEST, state.getValue(NORTH)); + default -> state; + }; + } + + @Override + protected BlockState mirror(BlockState state, Mirror mirror) { + return switch (mirror) { + case LEFT_RIGHT -> state + .setValue(NORTH, state.getValue(SOUTH)) + .setValue(SOUTH, state.getValue(NORTH)); + case FRONT_BACK -> state + .setValue(EAST, state.getValue(WEST)) + .setValue(WEST, state.getValue(EAST)); + default -> super.mirror(state, mirror); + }; + } + + @Override + public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { + return state.getValue(BOTTOM) && !createUpperState(level, pos, () -> true).isAir(); + } + + @Override + public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) { + return true; + } + + @Override + public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) { + BlockState upper = createUpperState(level, pos, () -> true); + if (!upper.isAir()) { + level.setBlock(pos.above(), upper, Block.UPDATE_ALL); + } + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/palemoss/PaleOakLeavesBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/palemoss/PaleOakLeavesBlock.java new file mode 100644 index 0000000000..5d8478428f --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/palemoss/PaleOakLeavesBlock.java @@ -0,0 +1,17 @@ +package net.sevenstars.middleearth.block.special.palemoss; + +import com.mojang.serialization.MapCodec; +import net.minecraft.world.level.block.LeavesBlock; + +public final class PaleOakLeavesBlock extends LeavesBlock { + public static final MapCodec CODEC = simpleCodec(PaleOakLeavesBlock::new); + + public PaleOakLeavesBlock(Properties properties) { + super(properties); + } + + @Override + public MapCodec codec() { + return CODEC; + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedBushBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedBushBlock.java new file mode 100644 index 0000000000..901b9c160f --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedBushBlock.java @@ -0,0 +1,51 @@ +package net.sevenstars.middleearth.block.special.plants; + +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.BushBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +public final class BackportedBushBlock extends BushBlock implements BonemealableBlock { + public static final MapCodec CODEC = simpleCodec(BackportedBushBlock::new); + private static final VoxelShape SHAPE = Block.box(0.0, 0.0, 0.0, 16.0, 13.0, 16.0); + + public BackportedBushBlock(BlockBehaviour.Properties properties) { + super(properties); + } + + @Override + protected MapCodec codec() { + return CODEC; + } + + @Override + protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { + return SHAPE; + } + + @Override + public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { + return BackportedPlantSpread.canSpread(level, pos, state); + } + + @Override + public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) { + return true; + } + + @Override + public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) { + BackportedPlantSpread.findSpreadPosition(level, pos, state) + .ifPresent(candidate -> level.setBlock(candidate, defaultBlockState(), Block.UPDATE_ALL)); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedDryVegetationBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedDryVegetationBlock.java new file mode 100644 index 0000000000..ae93e632f1 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedDryVegetationBlock.java @@ -0,0 +1,23 @@ +package net.sevenstars.middleearth.block.special.plants; + +import net.minecraft.core.BlockPos; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.BushBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; + +public abstract class BackportedDryVegetationBlock extends BushBlock { + protected BackportedDryVegetationBlock(BlockBehaviour.Properties properties) { + super(properties); + } + + @Override + protected boolean mayPlaceOn(BlockState floor, BlockGetter level, BlockPos pos) { + return floor.is(BlockTags.SAND) + || floor.is(BlockTags.TERRACOTTA) + || floor.is(BlockTags.DIRT) + || floor.is(Blocks.FARMLAND); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedFireflyBushBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedFireflyBushBlock.java new file mode 100644 index 0000000000..eef3ce483f --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedFireflyBushBlock.java @@ -0,0 +1,63 @@ +package net.sevenstars.middleearth.block.special.plants; + +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.BushBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.Heightmap; +import net.sevenstars.middleearth.particles.ModParticleTypes; + +public final class BackportedFireflyBushBlock extends BushBlock implements BonemealableBlock { + public static final MapCodec CODEC = simpleCodec(BackportedFireflyBushBlock::new); + + public BackportedFireflyBushBlock(BlockBehaviour.Properties properties) { + super(properties); + } + + @Override + protected MapCodec codec() { + return CODEC; + } + + @Override + public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource random) { + if (random.nextInt(30) == 0 + && level.isNight() + && level.dimensionType().natural() + && level.getHeight(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, pos.getX(), pos.getZ()) <= pos.getY()) { + level.playLocalSound(pos, SoundEvents.AZALEA_LEAVES_FALL, SoundSource.AMBIENT, 1.0F, 1.0F, false); + } + + if (level.getMaxLocalRawBrightness(pos) <= 13 && random.nextDouble() <= 0.7) { + double x = pos.getX() + random.nextDouble() * 10.0 - 5.0; + double y = pos.getY() + random.nextDouble() * 5.0; + double z = pos.getZ() + random.nextDouble() * 10.0 - 5.0; + level.addParticle(ModParticleTypes.FIREFLY_PARTICLE, x, y, z, 0.0, 0.0, 0.0); + } + } + + @Override + public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { + return BackportedPlantSpread.canSpread(level, pos, state); + } + + @Override + public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) { + return true; + } + + @Override + public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) { + BackportedPlantSpread.findSpreadPosition(level, pos, state) + .ifPresent(candidate -> level.setBlock(candidate, defaultBlockState(), Block.UPDATE_ALL)); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedLeafLitterBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedLeafLitterBlock.java new file mode 100644 index 0000000000..1e24d4374e --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedLeafLitterBlock.java @@ -0,0 +1,104 @@ +package net.sevenstars.middleearth.block.special.plants; + +import com.mojang.serialization.MapCodec; +import java.util.EnumMap; +import java.util.Map; +import java.util.function.BiFunction; +import net.minecraft.Util; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BushBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.SupportType; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; + +public final class BackportedLeafLitterBlock extends BushBlock { + public static final MapCodec CODEC = simpleCodec(BackportedLeafLitterBlock::new); + public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING; + public static final IntegerProperty AMOUNT = IntegerProperty.create("segment_amount", 1, 4); + private static final Map SINGLE_SEGMENT = createSingleSegmentShapes(); + private static final BiFunction SHAPE = Util.memoize( + (facing, amount) -> { + VoxelShape result = Shapes.empty(); + Direction segmentDirection = facing; + for (int segment = 0; segment < amount; segment++) { + result = Shapes.or(result, SINGLE_SEGMENT.get(segmentDirection)); + segmentDirection = segmentDirection.getCounterClockWise(); + } + return result.optimize(); + }); + + public BackportedLeafLitterBlock(BlockBehaviour.Properties properties) { + super(properties); + registerDefaultState(stateDefinition.any().setValue(FACING, Direction.NORTH).setValue(AMOUNT, 1)); + } + + private static Map createSingleSegmentShapes() { + Map shapes = new EnumMap<>(Direction.class); + shapes.put(Direction.NORTH, Block.box(0.0, 0.0, 0.0, 8.0, 1.0, 8.0)); + shapes.put(Direction.EAST, Block.box(8.0, 0.0, 0.0, 16.0, 1.0, 8.0)); + shapes.put(Direction.SOUTH, Block.box(8.0, 0.0, 8.0, 16.0, 1.0, 16.0)); + shapes.put(Direction.WEST, Block.box(0.0, 0.0, 8.0, 8.0, 1.0, 16.0)); + return shapes; + } + + @Override + protected MapCodec codec() { + return CODEC; + } + + @Override + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); + } + + @Override + public BlockState mirror(BlockState state, Mirror mirror) { + return state.rotate(mirror.getRotation(state.getValue(FACING))); + } + + @Override + public boolean canBeReplaced(BlockState state, BlockPlaceContext context) { + return !context.isSecondaryUseActive() + && context.getItemInHand().is(asItem()) + && state.getValue(AMOUNT) < 4 + || super.canBeReplaced(state, context); + } + + @Override + protected boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { + BlockPos floorPos = pos.below(); + return level.getBlockState(floorPos).isFaceSturdy(level, floorPos, Direction.UP, SupportType.FULL); + } + + @Override + protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { + return SHAPE.apply(state.getValue(FACING), state.getValue(AMOUNT)); + } + + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + BlockState existing = context.getLevel().getBlockState(context.getClickedPos()); + return existing.is(this) + ? existing.setValue(AMOUNT, Math.min(4, existing.getValue(AMOUNT) + 1)) + : defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(FACING, AMOUNT); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedPlantSpread.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedPlantSpread.java new file mode 100644 index 0000000000..ee6bd89018 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedPlantSpread.java @@ -0,0 +1,33 @@ +package net.sevenstars.middleearth.block.special.plants; + +import java.util.Optional; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.state.BlockState; + +final class BackportedPlantSpread { + private BackportedPlantSpread() { + } + + static boolean canSpread(LevelReader level, BlockPos pos, BlockState state) { + for (Direction direction : Direction.Plane.HORIZONTAL) { + BlockPos candidate = pos.relative(direction); + if (level.isEmptyBlock(candidate) && state.canSurvive(level, candidate)) { + return true; + } + } + return false; + } + + static Optional findSpreadPosition(Level level, BlockPos pos, BlockState state) { + for (Direction direction : Direction.Plane.HORIZONTAL.shuffledCopy(level.random)) { + BlockPos candidate = pos.relative(direction); + if (level.isEmptyBlock(candidate) && state.canSurvive(level, candidate)) { + return Optional.of(candidate); + } + } + return Optional.empty(); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedResinClumpBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedResinClumpBlock.java new file mode 100644 index 0000000000..e8afdea83e --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedResinClumpBlock.java @@ -0,0 +1,75 @@ +package net.sevenstars.middleearth.block.special.plants; + +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.MultifaceBlock; +import net.minecraft.world.level.block.MultifaceSpreader; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; + +public final class BackportedResinClumpBlock extends MultifaceBlock implements SimpleWaterloggedBlock { + public static final MapCodec CODEC = simpleCodec(BackportedResinClumpBlock::new); + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; + private final MultifaceSpreader spreader = new MultifaceSpreader(this); + + public BackportedResinClumpBlock(Properties properties) { + super(properties); + registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false)); + } + + @Override + protected MapCodec codec() { + return CODEC; + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + super.createBlockStateDefinition(builder); + builder.add(WATERLOGGED); + } + + @Override + protected BlockState updateShape( + BlockState state, + Direction direction, + BlockState neighborState, + LevelAccessor level, + BlockPos pos, + BlockPos neighborPos + ) { + if (state.getValue(WATERLOGGED)) { + level.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(level)); + } + return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + } + + @Override + protected FluidState getFluidState(BlockState state) { + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + + @Override + protected boolean canBeReplaced(BlockState state, BlockPlaceContext context) { + return !context.getItemInHand().is(asItem()) || super.canBeReplaced(state, context); + } + + @Override + protected boolean propagatesSkylightDown(BlockState state, BlockGetter level, BlockPos pos) { + return state.getFluidState().isEmpty(); + } + + @Override + public MultifaceSpreader getSpreader() { + return spreader; + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedShortDryGrassBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedShortDryGrassBlock.java new file mode 100644 index 0000000000..f020ada51d --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedShortDryGrassBlock.java @@ -0,0 +1,50 @@ +package net.sevenstars.middleearth.block.special.plants; + +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.sevenstars.middleearth.block.registration.ModNatureBlocks; + +public final class BackportedShortDryGrassBlock extends BackportedDryVegetationBlock implements BonemealableBlock { + public static final MapCodec CODEC = simpleCodec(BackportedShortDryGrassBlock::new); + private static final VoxelShape SHAPE = Block.box(2.0, 0.0, 2.0, 14.0, 10.0, 14.0); + + public BackportedShortDryGrassBlock(BlockBehaviour.Properties properties) { + super(properties); + } + + @Override + protected MapCodec codec() { + return CODEC; + } + + @Override + protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { + return SHAPE; + } + + @Override + public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { + return true; + } + + @Override + public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) { + return true; + } + + @Override + public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) { + level.setBlock(pos, ModNatureBlocks.TALL_DRY_GRASS.defaultBlockState(), Block.UPDATE_ALL); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedTallDryGrassBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedTallDryGrassBlock.java new file mode 100644 index 0000000000..3b23abe3ce --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BackportedTallDryGrassBlock.java @@ -0,0 +1,52 @@ +package net.sevenstars.middleearth.block.special.plants; + +import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.sevenstars.middleearth.block.registration.ModNatureBlocks; + +public final class BackportedTallDryGrassBlock extends BackportedDryVegetationBlock implements BonemealableBlock { + public static final MapCodec CODEC = simpleCodec(BackportedTallDryGrassBlock::new); + private static final VoxelShape SHAPE = Block.box(1.0, 0.0, 1.0, 15.0, 16.0, 15.0); + + public BackportedTallDryGrassBlock(BlockBehaviour.Properties properties) { + super(properties); + } + + @Override + protected MapCodec codec() { + return CODEC; + } + + @Override + protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { + return SHAPE; + } + + @Override + public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { + return BackportedPlantSpread.canSpread(level, pos, ModNatureBlocks.SHORT_DRY_GRASS.defaultBlockState()); + } + + @Override + public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) { + return true; + } + + @Override + public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) { + BlockState shortGrass = ModNatureBlocks.SHORT_DRY_GRASS.defaultBlockState(); + BackportedPlantSpread.findSpreadPosition(level, pos, shortGrass) + .ifPresent(candidate -> level.setBlock(candidate, shortGrass, Block.UPDATE_ALL)); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BerryHollyLeavesBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BerryHollyLeavesBlock.java index 66435d9c9b..e6092d35f6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BerryHollyLeavesBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/BerryHollyLeavesBlock.java @@ -1,29 +1,32 @@ package net.sevenstars.middleearth.block.special.plants; -import net.minecraft.block.BlockState; -import net.minecraft.block.TintedParticleLeavesBlock; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; -public class BerryHollyLeavesBlock extends TintedParticleLeavesBlock { +public final class BerryHollyLeavesBlock extends ModLeavesBlock implements BonemealableBlock { + public BerryHollyLeavesBlock(float leafParticleChance, Properties properties) { + super(leafParticleChance, properties, true); + } - public BerryHollyLeavesBlock(float f, Settings settings) { - super(f, settings); + @Override + public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { + return state.getBlock() == this; + } + + @Override + public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) { + return true; } @Override - protected ActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - if (stack.isOf(Items.BONE_MEAL)) { - world.setBlockState(pos, ModNatureBlocks.BERRY_HOLLY_LEAVES.getDefaultState()); - return ActionResult.SUCCESS; - } - return super.onUseWithItem(stack, state, world, pos, player, hand, hit); + public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) { + level.setBlock(pos, copySharedProperties(state, ModNatureBlocks.BERRY_HOLLY_LEAVES.defaultBlockState()), Block.UPDATE_ALL); } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/CustomPlantBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/CustomPlantBlock.java index 47226368e1..838a54db63 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/CustomPlantBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/CustomPlantBlock.java @@ -1,41 +1,39 @@ package net.sevenstars.middleearth.block.special.plants; import com.mojang.serialization.MapCodec; -import net.minecraft.block.*; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.tag.BlockTags; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.Heightmap; -import net.minecraft.world.World; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BushBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.particles.ModParticleTypes; import net.sevenstars.middleearth.utils.BlockTagsME; -public class CustomPlantBlock extends PlantBlock { - public static final MapCodec CODEC = CustomPlantBlock.createCodec(CustomPlantBlock::new); - protected static final VoxelShape SHAPE = Block.createCuboidShape(2.0, 0.0, 2.0, 14.0, 13.0, 14.0); +public class CustomPlantBlock extends BushBlock { + public static final MapCodec CODEC = CustomPlantBlock.simpleCodec(CustomPlantBlock::new); + protected static final VoxelShape SHAPE = Block.box(2.0, 0.0, 2.0, 14.0, 13.0, 14.0); - public CustomPlantBlock(Settings settings) { + public CustomPlantBlock(Properties settings) { super(settings); } @Override - protected MapCodec getCodec() { + protected MapCodec codec() { return CODEC; } @Override - protected boolean canPlantOnTop(BlockState floor, BlockView world, BlockPos pos) { - return (floor.isIn(BlockTags.DIRT) || floor.isIn(BlockTagsME.FARMLANDS)) && floor.isSideSolidFullSquare(world, pos, Direction.UP); + protected boolean mayPlaceOn(BlockState floor, BlockGetter world, BlockPos pos) { + return (floor.is(BlockTags.DIRT) || floor.is(BlockTagsME.FARMLANDS)) && floor.isFaceSturdy(world, pos, Direction.UP); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/CustomTallPlantBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/CustomTallPlantBlock.java index 93fb480978..ae0356e694 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/CustomTallPlantBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/CustomTallPlantBlock.java @@ -1,39 +1,39 @@ package net.sevenstars.middleearth.block.special.plants; -import net.minecraft.block.BlockState; -import net.minecraft.block.Fertilizable; -import net.minecraft.block.TallPlantBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.DoublePlantBlock; +import net.minecraft.world.level.block.state.BlockState; -public class CustomTallPlantBlock extends TallPlantBlock implements Fertilizable { +public class CustomTallPlantBlock extends DoublePlantBlock implements BonemealableBlock { private final boolean randomBoneMeal; - public CustomTallPlantBlock(Settings settings, boolean random) { + public CustomTallPlantBlock(Properties settings, boolean random) { super(settings); this.randomBoneMeal = random; } @Override - public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state) { + public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state) { return true; } - public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { + public boolean isBonemealSuccess(Level world, RandomSource random, BlockPos pos, BlockState state) { return true; } - public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) { + public void performBonemeal(ServerLevel world, RandomSource random, BlockPos pos, BlockState state) { if(this.randomBoneMeal) { float val = random.nextFloat(); if(val > 0.90f){ - dropStack(world, pos, new ItemStack(this)); + popResource(world, pos, new ItemStack(this)); } } else { - dropStack(world, pos, new ItemStack(this)); + popResource(world, pos, new ItemStack(this)); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/DesertPlantBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/DesertPlantBlock.java index fffbec4f7b..78e372a642 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/DesertPlantBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/DesertPlantBlock.java @@ -1,22 +1,21 @@ package net.sevenstars.middleearth.block.special.plants; import com.mojang.serialization.MapCodec; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.registry.tag.BlockTags; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.utils.BlockTagsME; public class DesertPlantBlock extends CustomPlantBlock { - public static final MapCodec CODEC = DesertPlantBlock.createCodec(DesertPlantBlock::new); + public static final MapCodec CODEC = DesertPlantBlock.simpleCodec(DesertPlantBlock::new); - public DesertPlantBlock(Settings settings) { + public DesertPlantBlock(Properties settings) { super(settings); } @Override - protected boolean canPlantOnTop(BlockState floor, BlockView world, BlockPos pos) { - return floor.isIn(BlockTags.DIRT) || floor.isIn(BlockTags.SAND) || floor.isIn(BlockTagsME.FARMLANDS); + protected boolean mayPlaceOn(BlockState floor, BlockGetter world, BlockPos pos) { + return floor.is(BlockTags.DIRT) || floor.is(BlockTags.SAND) || floor.is(BlockTagsME.FARMLANDS); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/FallenLeavesBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/FallenLeavesBlock.java index 9dbfce1156..475fcc4b3b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/FallenLeavesBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/FallenLeavesBlock.java @@ -1,68 +1,73 @@ package net.sevenstars.middleearth.block.special.plants; import com.mojang.serialization.MapCodec; -import net.minecraft.block.*; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.BushBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; -public class FallenLeavesBlock extends PlantBlock { - public static final EnumProperty FACING = HorizontalFacingBlock.FACING; +public class FallenLeavesBlock extends BushBlock { + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; - public FallenLeavesBlock(Settings settings) { + public FallenLeavesBlock(Properties settings) { super(settings); - setDefaultState(getDefaultState().with(FACING, Direction.NORTH)); + registerDefaultState(defaultBlockState().setValue(FACING, Direction.NORTH)); } @Override - protected MapCodec getCodec() { - return FallenLeavesBlock.createCodec(FallenLeavesBlock::new); + protected MapCodec codec() { + return FallenLeavesBlock.simpleCodec(FallenLeavesBlock::new); } - protected void appendProperties(StateManager.Builder builder) { - builder.add(Properties.HORIZONTAL_FACING); + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + builder.add(BlockStateProperties.HORIZONTAL_FACING); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()); } @Override - protected boolean canPlantOnTop(BlockState floor, BlockView world, BlockPos pos) { - return floor.isOpaqueFullCube(); + protected boolean mayPlaceOn(BlockState floor, BlockGetter world, BlockPos pos) { + return floor.isSolidRender(world, pos); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(1.0, 0.0, 1.0, 15.0, 1.5, 15.0); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(1.0, 0.0, 1.0, 15.0, 1.5, 15.0); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/FlowerbedMushroomBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/FlowerbedMushroomBlock.java index c898349067..4867c71ec7 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/FlowerbedMushroomBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/FlowerbedMushroomBlock.java @@ -1,29 +1,29 @@ package net.sevenstars.middleearth.block.special.plants; -import net.minecraft.block.BlockState; -import net.minecraft.block.FlowerbedBlock; -import net.minecraft.registry.tag.BlockTags; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldView; +import net.minecraft.core.BlockPos; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.PinkPetalsBlock; +import net.minecraft.world.level.block.state.BlockState; -public class FlowerbedMushroomBlock extends FlowerbedBlock { - public FlowerbedMushroomBlock(Settings settings) { +public class FlowerbedMushroomBlock extends PinkPetalsBlock { + public FlowerbedMushroomBlock(Properties settings) { super(settings); } @Override - public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - BlockPos blockPos = pos.down(); + public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + BlockPos blockPos = pos.below(); BlockState blockState = world.getBlockState(blockPos); - if (blockState.isIn(BlockTags.MUSHROOM_GROW_BLOCK)) { + if (blockState.is(BlockTags.MUSHROOM_GROW_BLOCK)) { return true; } - return world.getBaseLightLevel(pos, 0) < 13 && this.canPlantOnTop(blockState, world, blockPos); + return world.getRawBrightness(pos, 0) < 13 && this.mayPlaceOn(blockState, world, blockPos); } @Override - protected boolean canPlantOnTop(BlockState floor, BlockView world, BlockPos pos) { - return floor.isOpaqueFullCube(); + protected boolean mayPlaceOn(BlockState floor, BlockGetter world, BlockPos pos) { + return floor.isSolidRender(world, pos); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/MistweedPlantBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/MistweedPlantBlock.java index d42edbc60d..c9b9173bc0 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/MistweedPlantBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/MistweedPlantBlock.java @@ -1,100 +1,116 @@ package net.sevenstars.middleearth.block.special.plants; import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Fertilizable; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.particle.ParticleUtil; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.ItemTags; +import net.minecraft.util.ParticleUtils; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.phys.BlockHitResult; import net.sevenstars.middleearth.particles.ModParticleTypes; import org.jetbrains.annotations.Nullable; -public class MistweedPlantBlock extends CustomPlantBlock implements Fertilizable { - public static final MapCodec CODEC = createCodec(MistweedPlantBlock::new); - public static final BooleanProperty ACTIVE = BooleanProperty.of("active"); +import java.util.Optional; - public MistweedPlantBlock(Settings settings) { +public class MistweedPlantBlock extends CustomPlantBlock implements BonemealableBlock { + public static final MapCodec CODEC = simpleCodec(MistweedPlantBlock::new); + public static final BooleanProperty ACTIVE = BooleanProperty.create("active"); + + public MistweedPlantBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(ACTIVE, true)); + this.registerDefaultState(this.defaultBlockState().setValue(ACTIVE, true)); } @Override - protected MapCodec getCodec() { + protected MapCodec codec() { return CODEC; } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(ACTIVE); } @Override - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { - if (state.get(ACTIVE) && random.nextDouble() <= 0.45) { + public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { + if (state.getValue(ACTIVE) && random.nextDouble() <= 0.45) { double d = (double)pos.getX() + random.nextDouble() * 16.0 - 8.0; double e = (double)pos.getY() + random.nextDouble() * 5.0; double f = (double)pos.getZ() + random.nextDouble() * 16.0 - 8.0; - world.addImportantParticleClient(ModParticleTypes.BIOME_FOG_PARTICLE, true, d, e, f, 0.0, 0.0, 0.0); + world.addAlwaysVisibleParticle(ModParticleTypes.BIOME_FOG_PARTICLE, true, d, e, f, 0.0, 0.0, 0.0); } - super.randomDisplayTick(state, world, pos, random); + super.animateTick(state, world, pos, random); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - Hand hand = player.getActiveHand(); - if (!world.isClient && player.getAbilities().allowModifyWorld) { - ItemStack itemStack = player.getStackInHand(hand); - if (!state.get(ACTIVE) && itemStack.isIn(ItemTags.AXES)) { + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + InteractionHand hand = player.getUsedItemHand(); + if (!world.isClientSide && player.getAbilities().mayBuild) { + ItemStack itemStack = player.getItemInHand(hand); + if (!state.getValue(ACTIVE) && itemStack.is(ItemTags.AXES)) { activateState(null, state, world, pos); - } else if (state.get(ACTIVE) && itemStack.isOf(Items.HONEYCOMB)) { + } else if (state.getValue(ACTIVE) && itemStack.is(Items.HONEYCOMB)) { deactivateState(null, state, world, pos); } } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } - protected static void activateState(@Nullable PlayerEntity player, BlockState state, World world, BlockPos pos) { - world.setBlockState(pos, state.with(ACTIVE, true), 11); - world.playSound(null, pos, SoundEvents.ITEM_AXE_WAX_OFF, SoundCategory.BLOCKS, 1.0F, 1.0F); - world.emitGameEvent(player, GameEvent.BLOCK_CHANGE, pos); - ParticleUtil.spawnParticlesAround(world, pos, 3, 3.0, 1.0, true, ParticleTypes.WAX_OFF); + protected static void activateState(@Nullable Player player, BlockState state, Level world, BlockPos pos) { + world.setBlock(pos, state.setValue(ACTIVE, true), 11); + world.playSound(null, pos, SoundEvents.AXE_WAX_OFF, SoundSource.BLOCKS, 1.0F, 1.0F); + world.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); + ParticleUtils.spawnParticles(world, pos, 3, 3.0, 1.0, true, ParticleTypes.WAX_OFF); } - protected static void deactivateState(@Nullable PlayerEntity player, BlockState state, World world, BlockPos pos) { - world.setBlockState(pos, state.with(ACTIVE, false), 11); - world.playSound(null, pos, SoundEvents.ITEM_HONEYCOMB_WAX_ON, SoundCategory.BLOCKS, 1.0F, 1.0F); - world.emitGameEvent(player, GameEvent.BLOCK_CHANGE, pos); - ParticleUtil.spawnParticlesAround(world, pos, 3, 3.0, 1.0, true, ParticleTypes.WAX_ON); + protected static void deactivateState(@Nullable Player player, BlockState state, Level world, BlockPos pos) { + world.setBlock(pos, state.setValue(ACTIVE, false), 11); + world.playSound(null, pos, SoundEvents.HONEYCOMB_WAX_ON, SoundSource.BLOCKS, 1.0F, 1.0F); + world.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); + ParticleUtils.spawnParticles(world, pos, 3, 3.0, 1.0, true, ParticleTypes.WAX_ON); } - public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state) { - return Fertilizable.canSpread(world, pos, state); + public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state) { + return Direction.Plane.HORIZONTAL.stream().anyMatch(direction -> { + BlockPos targetPos = pos.relative(direction); + return world.isEmptyBlock(targetPos) && state.canSurvive(world, targetPos); + }); } - public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { + public boolean isBonemealSuccess(Level world, RandomSource random, BlockPos pos, BlockState state) { return true; } - public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) { - Fertilizable.findPosToSpreadTo(world, pos, state).ifPresent((blockPos) -> { - world.setBlockState(blockPos, this.getDefaultState()); + public void performBonemeal(ServerLevel world, RandomSource random, BlockPos pos, BlockState state) { + findSpreadableNeighbourPos(world, pos, state).ifPresent((blockPos) -> { + world.setBlockAndUpdate(blockPos, this.defaultBlockState()); }); } + + private static Optional findSpreadableNeighbourPos(ServerLevel world, BlockPos pos, BlockState state) { + for (Direction direction : Direction.Plane.HORIZONTAL.shuffledCopy(world.random)) { + BlockPos targetPos = pos.relative(direction); + if (world.isEmptyBlock(targetPos) && state.canSurvive(world, targetPos)) { + return Optional.of(targetPos); + } + } + return Optional.empty(); + } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/ModLeavesBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/ModLeavesBlock.java index f20ca363fd..45e5a99285 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/ModLeavesBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/ModLeavesBlock.java @@ -1,94 +1,134 @@ package net.sevenstars.middleearth.block.special.plants; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.LeavesBlock; -import net.minecraft.block.TintedParticleLeavesBlock; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ColorParticleOption; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.ParticleUtils; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.LeavesBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; import net.sevenstars.middleearth.block.registration.WoodBlockSets; +import net.sevenstars.middleearth.particles.LeafParticleColorResolver; +import net.sevenstars.middleearth.particles.ModParticleTypes; -public class ModLeavesBlock extends TintedParticleLeavesBlock { +public class ModLeavesBlock extends LeavesBlock implements BonemealableBlock { + private final float leafParticleChance; final protected boolean castShadow; - public ModLeavesBlock(float f, Settings settings, boolean castShadow) { - super(f, settings); + public ModLeavesBlock(float leafParticleChance, Properties settings, boolean castShadow) { + super(settings); + this.leafParticleChance = leafParticleChance; this.castShadow = castShadow; } @Override - public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - world.setBlockState(pos, updateDistanceFromLogs(state, world, pos), Block.NOTIFY_ALL); + public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource random) { + super.animateTick(state, level, pos, random); + if (random.nextFloat() >= this.leafParticleChance) { + return; + } + + BlockPos belowPos = pos.below(); + BlockState belowState = level.getBlockState(belowPos); + if (Block.isFaceFull(belowState.getCollisionShape(level, belowPos), Direction.UP)) { + return; + } + + int color = LeafParticleColorResolver.resolve(state, level, pos); + ParticleUtils.spawnParticleBelow( + level, + pos, + random, + ColorParticleOption.create(ModParticleTypes.TINTED_LEAVES_PARTICLE, color) + ); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { + public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + world.setBlock(pos, updateDistance(state, world, pos), Block.UPDATE_ALL); + } + + @Override + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { int i; - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - if ((i = getDistanceFromLog(neighborState) + 1) != 1 || state.get(DISTANCE) != i) { - tickView.scheduleBlockTick(pos, this, 1); + if ((i = getDistanceAt(neighborState) + 1) != 1 || state.getValue(DISTANCE) != i) { + world.scheduleTick(pos, this, 1); } return state; } - private static BlockState updateDistanceFromLogs(BlockState state, WorldAccess world, BlockPos pos) { + private static BlockState updateDistance(BlockState state, LevelAccessor world, BlockPos pos) { int i = 7; - BlockPos.Mutable mutable = new BlockPos.Mutable(); + BlockPos.MutableBlockPos mutable = new BlockPos.MutableBlockPos(); for(int x = -1; x <= 1; x++) { for(int y = -1; y <= 1; y++) { for(int z = -1; z <= 1; z++) { if(x == 0 && y == 0 && z == 0) continue; - mutable.set(pos, x, y, z); - i = Math.min(i, getDistanceFromLog(world.getBlockState(mutable)) + 1); + mutable.setWithOffset(pos, x, y, z); + i = Math.min(i, getDistanceAt(world.getBlockState(mutable)) + 1); if (i == 1) break; } } } - return state.with(DISTANCE, i); + return state.setValue(DISTANCE, i); } - private static int getDistanceFromLog(BlockState state) { - return LeavesBlock.getOptionalDistanceFromLog(state).orElse(7); + private static int getDistanceAt(BlockState state) { + return LeavesBlock.getOptionalDistanceAt(state).orElse(7); } @Override - protected int getOpacity(BlockState state) { - if(castShadow) return super.getOpacity(state); + protected int getLightBlock(BlockState state, BlockGetter world, BlockPos pos) { + if(castShadow) return super.getLightBlock(state, world, pos); return 0; } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - BlockState blockState = (this.getDefaultState().with(PERSISTENT, true)).with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); - return updateDistanceFromLogs(blockState, ctx.getWorld(), ctx.getBlockPos()); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + FluidState fluidState = ctx.getLevel().getFluidState(ctx.getClickedPos()); + BlockState blockState = (this.defaultBlockState().setValue(PERSISTENT, true)).setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER); + return updateDistance(blockState, ctx.getLevel(), ctx.getClickedPos()); } @Override - protected ActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - if (stack.isOf(Items.BONE_MEAL) && state.isOf(WoodBlockSets.MALLORN_SET.leaves)) { - world.setBlockState(pos, ModNatureBlocks.FLOWERING_MALLORN_LEAVES.getDefaultState()); - return ActionResult.SUCCESS; + public boolean isValidBonemealTarget(LevelReader level, BlockPos pos, BlockState state) { + return state.is(WoodBlockSets.MALLORN_SET.leaves); + } + + @Override + public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) { + return true; + } + + @Override + public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) { + level.setBlock(pos, copySharedProperties(state, ModNatureBlocks.FLOWERING_MALLORN_LEAVES.defaultBlockState()), Block.UPDATE_ALL); + } + + static BlockState copySharedProperties(BlockState source, BlockState target) { + for (Property property : source.getProperties()) { + target = copyProperty(source, target, property); } - return super.onUseWithItem(stack, state, world, pos, player, hand, hit); + return target; + } + + private static > BlockState copyProperty(BlockState source, BlockState target, Property property) { + return target.hasProperty(property) ? target.setValue(property, source.getValue(property)) : target; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/MordorPricklyPlantBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/MordorPricklyPlantBlock.java index dbc5fca5b1..a3dd46b1b0 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/MordorPricklyPlantBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/MordorPricklyPlantBlock.java @@ -2,26 +2,23 @@ import com.mojang.serialization.MapCodec; import net.sevenstars.middleearth.block.registration.StoneBlockSets; -import net.minecraft.block.*; -import net.minecraft.registry.tag.BlockTags; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.utils.BlockTagsME; public class MordorPricklyPlantBlock extends PricklyPlantBlock { - public MordorPricklyPlantBlock(Settings settings) { + public MordorPricklyPlantBlock(Properties settings) { super(settings); } @Override - protected boolean canPlantOnTop(BlockState floor, BlockView world, BlockPos pos) { - return floor.isIn(BlockTags.DIRT) || floor.isIn(BlockTags.SAND) || floor.isOf(StoneBlockSets.ASHENSTONE_SET.baseBlocks.base()) - || floor.isOf(Blocks.BASALT) || floor.isIn(BlockTagsME.FARMLANDS); + protected boolean mayPlaceOn(BlockState floor, BlockGetter world, BlockPos pos) { + return floor.is(BlockTags.DIRT) || floor.is(BlockTags.SAND) || floor.is(StoneBlockSets.ASHENSTONE_SET.baseBlocks.base()) + || floor.is(Blocks.BASALT) || floor.is(BlockTagsME.FARMLANDS); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/PricklyPlantBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/PricklyPlantBlock.java index dfbc0dd333..b4762d783c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/PricklyPlantBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/PricklyPlantBlock.java @@ -1,31 +1,26 @@ package net.sevenstars.middleearth.block.special.plants; -import net.minecraft.block.BlockState; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCollisionHandler; -import net.minecraft.entity.LivingEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.utils.DamageablePlantsUtil; public class PricklyPlantBlock extends CustomPlantBlock { - public PricklyPlantBlock(Settings settings) { + public PricklyPlantBlock(Properties settings) { super(settings); } @Override - protected void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler) { - if (entity instanceof LivingEntity livingEntity && world instanceof ServerWorld serverWorld) { - Vec3d vec3d = entity.isControlledByPlayer() ? entity.getMovement() : entity.getLastRenderPos().subtract(entity.getPos()); - if (vec3d.horizontalLengthSquared() > 0.0) { - double d = Math.abs(vec3d.getX()); - double e = Math.abs(vec3d.getZ()); - if (d >= 0.003 || e >= 0.003) { - DamageablePlantsUtil.tryDamageEntity(livingEntity, serverWorld, serverWorld.getDamageSources().cactus()); - } + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (entity instanceof LivingEntity livingEntity && world instanceof ServerLevel serverWorld) { + double xMovement = Math.abs(entity.getX() - entity.xOld); + double zMovement = Math.abs(entity.getZ() - entity.zOld); + if (xMovement >= 0.003 || zMovement >= 0.003) { + DamageablePlantsUtil.tryDamageEntity(livingEntity, serverWorld, serverWorld.damageSources().cactus()); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/RotatableTallFlowerBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/RotatableTallFlowerBlock.java index c9ee5ab333..cbd9757f21 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/RotatableTallFlowerBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/RotatableTallFlowerBlock.java @@ -1,65 +1,65 @@ package net.sevenstars.middleearth.block.special.plants; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.TallFlowerBlock; -import net.minecraft.block.enums.DoubleBlockHalf; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.TallFlowerBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; +import net.minecraft.world.level.block.state.properties.EnumProperty; public class RotatableTallFlowerBlock extends TallFlowerBlock { - public static final EnumProperty HORIZONTAL_FACING = Properties.HORIZONTAL_FACING; + public static final EnumProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING; - public RotatableTallFlowerBlock(Settings settings) { + public RotatableTallFlowerBlock(Properties settings) { super(settings); - setDefaultState(getDefaultState().with(HORIZONTAL_FACING, Direction.NORTH)); + registerDefaultState(defaultBlockState().setValue(HORIZONTAL_FACING, Direction.NORTH)); } @Override - protected void appendProperties(StateManager.Builder builder) { - super.appendProperties(builder.add(HORIZONTAL_FACING)); + protected void createBlockStateDefinition(StateDefinition.Builder builder) { + super.createBlockStateDefinition(builder.add(HORIZONTAL_FACING)); } - public BlockState getPlacementState(ItemPlacementContext ctx) { - BlockPos blockPos = ctx.getBlockPos(); - World world = ctx.getWorld(); - if(blockPos.getY() < world.getTopYInclusive() - 1 && world.getBlockState(blockPos.up()).canReplace(ctx)){ - return this.getDefaultState().with(HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()).with(HALF, DoubleBlockHalf.LOWER); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + BlockPos blockPos = ctx.getClickedPos(); + Level world = ctx.getLevel(); + if(blockPos.getY() < world.getMaxBuildHeight() - 1 && world.getBlockState(blockPos.above()).canBeReplaced(ctx)){ + return this.defaultBlockState().setValue(HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()).setValue(HALF, DoubleBlockHalf.LOWER); } else { return null; } } @Override - public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { - world.setBlockState(pos.up(), (BlockState)state.with(HALF, DoubleBlockHalf.UPPER), 3); + public void setPlacedBy(Level world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { + world.setBlock(pos.above(), (BlockState)state.setValue(HALF, DoubleBlockHalf.UPPER), 3); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(HORIZONTAL_FACING, rotation.rotate(state.get(HORIZONTAL_FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(HORIZONTAL_FACING, rotation.rotate(state.getValue(HORIZONTAL_FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(HORIZONTAL_FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(HORIZONTAL_FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/StrawBerryBushBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/StrawBerryBushBlock.java index 71559668bc..aeef01c81b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/StrawBerryBushBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/StrawBerryBushBlock.java @@ -1,124 +1,128 @@ package net.sevenstars.middleearth.block.special.plants; import com.mojang.serialization.MapCodec; -import net.minecraft.entity.EntityCollisionHandler; import net.sevenstars.middleearth.item.FoodItemsME; -import net.minecraft.block.*; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.SweetBerryBushBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class StrawBerryBushBlock extends CustomPlantBlock - implements Fertilizable { - public static final MapCodec CODEC = StrawBerryBushBlock.createCodec(StrawBerryBushBlock::new); + implements BonemealableBlock { + public static final MapCodec CODEC = StrawBerryBushBlock.simpleCodec(StrawBerryBushBlock::new); public static final int MAX_AGE = 3; - public static final IntProperty AGE = Properties.AGE_3; - private static final VoxelShape SMALL_SHAPE = Block.createCuboidShape(3.0, 0.0, 3.0, 13.0, 8.0, 13.0); - private static final VoxelShape LARGE_SHAPE = Block.createCuboidShape(1.0, 0.0, 1.0, 15.0, 16.0, 15.0); + public static final IntegerProperty AGE = BlockStateProperties.AGE_3; + private static final VoxelShape SMALL_SHAPE = Block.box(3.0, 0.0, 3.0, 13.0, 8.0, 13.0); + private static final VoxelShape LARGE_SHAPE = Block.box(1.0, 0.0, 1.0, 15.0, 16.0, 15.0); - public StrawBerryBushBlock(Settings settings) { + public StrawBerryBushBlock(Properties settings) { super(settings); - this.setDefaultState(this.stateManager.getDefaultState().with(AGE, 0)); + this.registerDefaultState(this.stateDefinition.any().setValue(AGE, 0)); } @Override - public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData) { + public ItemStack getCloneItemStack(LevelReader world, BlockPos pos, BlockState state) { return new ItemStack(FoodItemsME.STRAWBERRIES); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if (state.get(AGE) == 0) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + if (state.getValue(AGE) == 0) { return SMALL_SHAPE; } - if (state.get(AGE) < 3) { + if (state.getValue(AGE) < 3) { return LARGE_SHAPE; } - return super.getOutlineShape(state, world, pos, context); + return super.getShape(state, world, pos, context); } @Override - public boolean hasRandomTicks(BlockState state) { - return state.get(AGE) < 3; + public boolean isRandomlyTicking(BlockState state) { + return state.getValue(AGE) < 3; } @Override - public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - int i = state.get(AGE); - if (i < 3 && random.nextInt(5) == 0 && world.getBaseLightLevel(pos.up(), 0) >= 9) { - BlockState blockState = (BlockState) state.with(AGE, i + 1); - world.setBlockState(pos, blockState, Block.NOTIFY_LISTENERS); - world.emitGameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Emitter.of(blockState)); + public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + int i = state.getValue(AGE); + if (i < 3 && random.nextInt(5) == 0 && world.getRawBrightness(pos.above(), 0) >= 9) { + BlockState blockState = (BlockState) state.setValue(AGE, i + 1); + world.setBlock(pos, blockState, Block.UPDATE_CLIENTS); + world.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(blockState)); } } @Override - protected void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { if (!(entity instanceof LivingEntity) || entity.getType() == EntityType.BEE || entity.getType() == EntityType.FOX || entity.getType() == EntityType.BAT) { return; } - entity.slowMovement(state, new Vec3d(0.8f, 0.75, 0.8f)); + entity.makeStuckInBlock(state, new Vec3(0.8f, 0.75, 0.8f)); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - Hand hand = player.getActiveHand(); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + InteractionHand hand = player.getUsedItemHand(); boolean bl; - int i = state.get(AGE); + int i = state.getValue(AGE); boolean bl2 = bl = i == MAX_AGE; - if (!bl && player.getStackInHand(hand).isOf(Items.BONE_MEAL)) { - return ActionResult.PASS; + if (!bl && player.getItemInHand(hand).is(Items.BONE_MEAL)) { + return InteractionResult.PASS; } if (i > 1) { int j = 1 + world.random.nextInt(2); - SweetBerryBushBlock.dropStack(world, pos, new ItemStack(FoodItemsME.STRAWBERRIES, j + (bl ? 1 : 0))); - world.playSound(null, pos, SoundEvents.BLOCK_SWEET_BERRY_BUSH_PICK_BERRIES, SoundCategory.BLOCKS, 1.0f, 0.8f + world.random.nextFloat() * 0.4f); - BlockState blockState = (BlockState) state.with(AGE, 1); - world.setBlockState(pos, blockState, Block.NOTIFY_LISTENERS); - world.emitGameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Emitter.of(player, blockState)); - return ActionResult.SUCCESS; + SweetBerryBushBlock.popResource(world, pos, new ItemStack(FoodItemsME.STRAWBERRIES, j + (bl ? 1 : 0))); + world.playSound(null, pos, SoundEvents.SWEET_BERRY_BUSH_PICK_BERRIES, SoundSource.BLOCKS, 1.0f, 0.8f + world.random.nextFloat() * 0.4f); + BlockState blockState = (BlockState) state.setValue(AGE, 1); + world.setBlock(pos, blockState, Block.UPDATE_CLIENTS); + world.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(player, blockState)); + return InteractionResult.SUCCESS; } - return super.onUse(state, world, pos, player, hit); + return super.useWithoutItem(state, world, pos, player, hit); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(AGE); } @Override - public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state) { - return state.get(AGE) < MAX_AGE; + public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state) { + return state.getValue(AGE) < MAX_AGE; } @Override - public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { + public boolean isBonemealSuccess(Level world, RandomSource random, BlockPos pos, BlockState state) { return true; } @Override - public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) { - int i = Math.min(MAX_AGE, state.get(AGE) + 1); - world.setBlockState(pos, (BlockState) state.with(AGE, i), Block.NOTIFY_LISTENERS); + public void performBonemeal(ServerLevel world, RandomSource random, BlockPos pos, BlockState state) { + int i = Math.min(MAX_AGE, state.getValue(AGE) + 1); + world.setBlock(pos, (BlockState) state.setValue(AGE, i), Block.UPDATE_CLIENTS); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/TallMushroomBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/TallMushroomBlock.java index c6700a72db..a8ab7c8403 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/TallMushroomBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/TallMushroomBlock.java @@ -1,29 +1,29 @@ package net.sevenstars.middleearth.block.special.plants; -import net.minecraft.block.BlockState; -import net.minecraft.block.TallPlantBlock; -import net.minecraft.block.enums.DoubleBlockHalf; -import net.minecraft.registry.tag.BlockTags; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.WorldView; +import net.minecraft.core.BlockPos; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.DoublePlantBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; -public class TallMushroomBlock extends TallPlantBlock { - public TallMushroomBlock(Settings settings) { +public class TallMushroomBlock extends DoublePlantBlock { + public TallMushroomBlock(Properties settings) { super(settings); } @Override - public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - if (state.get(HALF) == DoubleBlockHalf.UPPER) { - BlockState blockState = world.getBlockState(pos.down()); - return blockState.isOf(this) && blockState.get(HALF) == DoubleBlockHalf.LOWER; + public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + if (state.getValue(HALF) == DoubleBlockHalf.UPPER) { + BlockState blockState = world.getBlockState(pos.below()); + return blockState.is(this) && blockState.getValue(HALF) == DoubleBlockHalf.LOWER; } - if (state.isIn(BlockTags.MUSHROOM_GROW_BLOCK)) { + if (state.is(BlockTags.MUSHROOM_GROW_BLOCK)) { return true; } - BlockPos floor = pos.down(); - boolean dark = world.getBaseLightLevel(floor, 0) < 13; - boolean opaque = world.getBlockState(floor).isOpaqueFullCube(); + BlockPos floor = pos.below(); + boolean dark = world.getRawBrightness(floor, 0) < 13; + boolean opaque = world.getBlockState(floor).isSolidRender(world, floor); return dark & opaque; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/ToughBerryBushBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/ToughBerryBushBlock.java index f09e8b24f8..5aa64c2b83 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/ToughBerryBushBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/ToughBerryBushBlock.java @@ -1,101 +1,96 @@ package net.sevenstars.middleearth.block.special.plants; import com.mojang.serialization.MapCodec; -import net.minecraft.entity.EntityCollisionHandler; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.entity.EntitiesME; import net.sevenstars.middleearth.item.FoodItemsME; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Fertilizable; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; public class ToughBerryBushBlock extends CustomPlantBlock - implements Fertilizable { - public static final MapCodec CODEC = ToughBerryBushBlock.createCodec(ToughBerryBushBlock::new); + implements BonemealableBlock { + public static final MapCodec CODEC = ToughBerryBushBlock.simpleCodec(ToughBerryBushBlock::new); public static final int MAX_AGE = 3; - public static final IntProperty AGE = Properties.AGE_3; - private static final VoxelShape SMALL_SHAPE = Block.createCuboidShape(3.0, 0.0, 3.0, 13.0, 8.0, 13.0); - private static final VoxelShape LARGE_SHAPE = Block.createCuboidShape(1.0, 0.0, 1.0, 15.0, 16.0, 15.0); + public static final IntegerProperty AGE = BlockStateProperties.AGE_3; + private static final VoxelShape SMALL_SHAPE = Block.box(3.0, 0.0, 3.0, 13.0, 8.0, 13.0); + private static final VoxelShape LARGE_SHAPE = Block.box(1.0, 0.0, 1.0, 15.0, 16.0, 15.0); - public ToughBerryBushBlock(Settings settings) { + public ToughBerryBushBlock(Properties settings) { super(settings); - this.setDefaultState(this.stateManager.getDefaultState().with(AGE, 0)); + this.registerDefaultState(this.stateDefinition.any().setValue(AGE, 0)); } @Override - protected boolean canPathfindThrough(BlockState state, NavigationType type) { + protected boolean isPathfindable(BlockState state, PathComputationType type) { return false; } @Override - public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData) { + public ItemStack getCloneItemStack(LevelReader world, BlockPos pos, BlockState state) { return new ItemStack(FoodItemsME.TOUGH_BERRIES); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if (state.get(AGE) == 0) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + if (state.getValue(AGE) == 0) { return SMALL_SHAPE; } - if (state.get(AGE) < 3) { + if (state.getValue(AGE) < 3) { return LARGE_SHAPE; } - return super.getOutlineShape(state, world, pos, context); + return super.getShape(state, world, pos, context); } @Override - public boolean hasRandomTicks(BlockState state) { - return state.get(AGE) < 3; + public boolean isRandomlyTicking(BlockState state) { + return state.getValue(AGE) < 3; } @Override - public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - int i = state.get(AGE); - if (i < 3 && random.nextInt(5) == 0 && world.getBaseLightLevel(pos.up(), 0) >= 9) { - BlockState blockState = (BlockState) state.with(AGE, i + 1); - world.setBlockState(pos, blockState, Block.NOTIFY_LISTENERS); - world.emitGameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Emitter.of(blockState)); + public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + int i = state.getValue(AGE); + if (i < 3 && random.nextInt(5) == 0 && world.getRawBrightness(pos.above(), 0) >= 9) { + BlockState blockState = (BlockState) state.setValue(AGE, i + 1); + world.setBlock(pos, blockState, Block.UPDATE_CLIENTS); + world.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(blockState)); } } @Override - protected void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler) { + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { if (entity instanceof LivingEntity && entity.getType() != EntitiesME.WARG || entity.getType() == EntityType.FOX || entity.getType() == EntityType.BAT) { - entity.slowMovement(state, new Vec3d(0.800000011920929, 0.75, 0.800000011920929)); - if (world instanceof ServerWorld) { - ServerWorld serverWorld = (ServerWorld)world; - if ((Integer)state.get(AGE) != 0) { - Vec3d vec3d = entity.isControlledByPlayer() ? entity.getMovement() : entity.getLastRenderPos().subtract(entity.getPos()); - if (vec3d.horizontalLengthSquared() > 0.0) { - double d = Math.abs(vec3d.getX()); - double e = Math.abs(vec3d.getZ()); - if (d >= 0.003000000026077032 || e >= 0.003000000026077032) { - entity.damage(serverWorld, world.getDamageSources().sweetBerryBush(), 1.0F); - } + entity.makeStuckInBlock(state, new Vec3(0.800000011920929, 0.75, 0.800000011920929)); + if (world instanceof ServerLevel) { + if ((Integer)state.getValue(AGE) != 0) { + double xMovement = Math.abs(entity.getX() - entity.xOld); + double zMovement = Math.abs(entity.getZ() - entity.zOld); + if (xMovement >= 0.003000000026077032 || zMovement >= 0.003000000026077032) { + entity.hurt(world.damageSources().sweetBerryBush(), 1.0F); } } } @@ -103,44 +98,44 @@ protected void onEntityCollision(BlockState state, World world, BlockPos pos, En } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - Hand hand = player.getActiveHand(); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + InteractionHand hand = player.getUsedItemHand(); boolean bl; - int i = state.get(AGE); + int i = state.getValue(AGE); boolean bl2 = bl = i == MAX_AGE; - if (!bl && player.getStackInHand(hand).isOf(Items.BONE_MEAL)) { - return ActionResult.PASS; + if (!bl && player.getItemInHand(hand).is(Items.BONE_MEAL)) { + return InteractionResult.PASS; } if (i > 1) { int j = 1 + world.random.nextInt(2); - ToughBerryBushBlock.dropStack(world, pos, new ItemStack(FoodItemsME.TOUGH_BERRIES, j + (bl ? 1 : 0))); - world.playSound(null, pos, SoundEvents.BLOCK_SWEET_BERRY_BUSH_PICK_BERRIES, SoundCategory.BLOCKS, 1.0f, 0.8f + world.random.nextFloat() * 0.4f); - BlockState blockState = (BlockState) state.with(AGE, 1); - world.setBlockState(pos, blockState, Block.NOTIFY_LISTENERS); - world.emitGameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Emitter.of(player, blockState)); - return ActionResult.SUCCESS; + ToughBerryBushBlock.popResource(world, pos, new ItemStack(FoodItemsME.TOUGH_BERRIES, j + (bl ? 1 : 0))); + world.playSound(null, pos, SoundEvents.SWEET_BERRY_BUSH_PICK_BERRIES, SoundSource.BLOCKS, 1.0f, 0.8f + world.random.nextFloat() * 0.4f); + BlockState blockState = (BlockState) state.setValue(AGE, 1); + world.setBlock(pos, blockState, Block.UPDATE_CLIENTS); + world.gameEvent(GameEvent.BLOCK_CHANGE, pos, GameEvent.Context.of(player, blockState)); + return InteractionResult.SUCCESS; } - return super.onUse(state, world, pos, player, hit); + return super.useWithoutItem(state, world, pos, player, hit); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(AGE); } @Override - public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state) { - return state.get(AGE) < MAX_AGE; + public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state) { + return state.getValue(AGE) < MAX_AGE; } @Override - public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { + public boolean isBonemealSuccess(Level world, RandomSource random, BlockPos pos, BlockState state) { return true; } @Override - public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) { - int i = Math.min(MAX_AGE, state.get(AGE) + 1); - world.setBlockState(pos, (BlockState) state.with(AGE, i), Block.NOTIFY_LISTENERS); + public void performBonemeal(ServerLevel world, RandomSource random, BlockPos pos, BlockState state) { + int i = Math.min(MAX_AGE, state.getValue(AGE) + 1); + world.setBlock(pos, (BlockState) state.setValue(AGE, i), Block.UPDATE_CLIENTS); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/WaterloggablePlant.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/WaterloggablePlant.java index 0fec8a8e64..08f81d7e06 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/WaterloggablePlant.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/WaterloggablePlant.java @@ -1,78 +1,83 @@ package net.sevenstars.middleearth.block.special.plants; import com.mojang.serialization.MapCodec; -import net.minecraft.world.tick.ScheduledTickView; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; import net.sevenstars.middleearth.block.special.CustomWaterloggableTallPlantBlock; -import net.minecraft.block.*; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; -public class WaterloggablePlant extends CustomPlantBlock implements Fertilizable, Waterloggable { - public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; +public class WaterloggablePlant extends CustomPlantBlock implements BonemealableBlock, SimpleWaterloggedBlock { + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - public static final MapCodec CODEC = WaterloggablePlant.createCodec(WaterloggablePlant::new); + public static final MapCodec CODEC = WaterloggablePlant.simpleCodec(WaterloggablePlant::new); - public WaterloggablePlant(Settings settings) { + public WaterloggablePlant(Properties settings) { super(settings); - this.setDefaultState((BlockState)((BlockState)this.stateManager.getDefaultState()).with(WATERLOGGED, false)); + this.registerDefaultState((BlockState)((BlockState)this.stateDefinition.any()).setValue(WATERLOGGED, false)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(WATERLOGGED); } @Override public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - BlockState blockState = ctx.getWorld().getBlockState(ctx.getBlockPos()); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + BlockState blockState = ctx.getLevel().getBlockState(ctx.getClickedPos()); - if(blockState.isOf(Blocks.WATER)){ - return this.getDefaultState().with(WATERLOGGED, true); + if(blockState.is(Blocks.WATER)){ + return this.defaultBlockState().setValue(WATERLOGGED, true); } else{ - return this.getDefaultState(); + return this.defaultBlockState(); } } @Override - public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state) { + public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state) { return true; } @Override - public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { + public boolean isBonemealSuccess(Level world, RandomSource random, BlockPos pos, BlockState state) { return true; } @Override - public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) { - CustomWaterloggableTallPlantBlock tallPlantBlock = (CustomWaterloggableTallPlantBlock)(state.isOf(ModNatureBlocks.SHORT_BULRUSH) ? ModNatureBlocks.TALL_BULRUSH : ModNatureBlocks.TALL_CATTAILS); - if (tallPlantBlock.getDefaultState().canPlaceAt(world, pos) && world.isAir(pos.up())) { - tallPlantBlock.placeAt(world, pos, state.get(WATERLOGGED), 2); + public void performBonemeal(ServerLevel world, RandomSource random, BlockPos pos, BlockState state) { + CustomWaterloggableTallPlantBlock tallPlantBlock = (CustomWaterloggableTallPlantBlock)(state.is(ModNatureBlocks.SHORT_BULRUSH) ? ModNatureBlocks.TALL_BULRUSH : ModNatureBlocks.TALL_CATTAILS); + if (tallPlantBlock.defaultBlockState().canSurvive(world, pos) && world.isEmptyBlock(pos.above())) { + tallPlantBlock.placeAt(world, pos, state.getValue(WATERLOGGED), 2); } } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/WildCropBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/WildCropBlock.java index 743dbdf2da..ba11af2705 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/WildCropBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plants/WildCropBlock.java @@ -1,45 +1,45 @@ package net.sevenstars.middleearth.block.special.plants; import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Fertilizable; -import net.minecraft.block.ShapeContext; -import net.minecraft.item.ItemStack; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; -public class WildCropBlock extends CustomPlantBlock implements Fertilizable { - public static final MapCodec CODEC = WildCropBlock.createCodec(WildCropBlock::new); - protected static final VoxelShape SHAPE = Block.createCuboidShape(2.0, 0.0, 2.0, 14.0, 13.0, 14.0); +public class WildCropBlock extends CustomPlantBlock implements BonemealableBlock { + public static final MapCodec CODEC = WildCropBlock.simpleCodec(WildCropBlock::new); + protected static final VoxelShape SHAPE = Block.box(2.0, 0.0, 2.0, 14.0, 13.0, 14.0); - public WildCropBlock(Settings settings) { + public WildCropBlock(Properties settings) { super(settings); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override - public boolean isFertilizable(WorldView world, BlockPos pos, BlockState state) { + public boolean isValidBonemealTarget(LevelReader world, BlockPos pos, BlockState state) { return true; } - public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) { + public boolean isBonemealSuccess(Level world, RandomSource random, BlockPos pos, BlockState state) { return true; } - public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) { + public void performBonemeal(ServerLevel world, RandomSource random, BlockPos pos, BlockState state) { float val = random.nextFloat(); if(val > 0.90f){ - dropStack(world, pos, new ItemStack(this)); + popResource(world, pos, new ItemStack(this)); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateBlock.java index 7d2cdd6844..9d6ae2de1a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateBlock.java @@ -1,58 +1,70 @@ package net.sevenstars.middleearth.block.special.plate; import com.mojang.serialization.MapCodec; -import net.minecraft.block.*; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.*; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; +import net.minecraft.world.level.block.*; +import net.minecraft.world.item.component.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.component.DataComponents; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.*; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; -import net.minecraft.world.tick.ScheduledTickView; -import net.minecraft.world.tick.TickPriority; -import net.sevenstars.middleearth.block.registration.ModBlockEntities; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.SeededContainerLoot; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraft.world.ticks.TickPriority; import org.jetbrains.annotations.Nullable; -public class PlateBlock extends BlockWithEntity { - public static final EnumProperty FACING = Properties.HORIZONTAL_FACING; - public static final BooleanProperty UTENSILS = BooleanProperty.of("utensils"); +public class PlateBlock extends BaseEntityBlock { + public static final EnumProperty FACING = BlockStateProperties.HORIZONTAL_FACING; + public static final BooleanProperty UTENSILS = BooleanProperty.create("utensils"); - public PlateBlock(Settings settings) { + public PlateBlock(Properties settings) { super(settings); - setDefaultState(getDefaultState().with(FACING, Direction.NORTH).with(UTENSILS, false)); + registerDefaultState(defaultBlockState().setValue(FACING, Direction.NORTH).setValue(UTENSILS, false)); } @Override - protected MapCodec getCodec() { - return PlateBlock.createCodec(PlateBlock::new); + protected MapCodec codec() { + return PlateBlock.simpleCodec(PlateBlock::new); } @Override - public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { - super.onPlaced(world, pos, state, placer, itemStack); - PlateBlockEntity plateBlockEntity = (PlateBlockEntity) world.getBlockEntity(pos); - if(plateBlockEntity != null && world instanceof ServerWorld serverWorld) { - ContainerLootComponent containerLootComponent = itemStack.get(DataComponentTypes.CONTAINER_LOOT); + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; + } + + @Override + public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { + super.setPlacedBy(world, pos, state, placer, itemStack); + if (world instanceof ServerLevel + && world.getBlockEntity(pos) instanceof PlateBlockEntity plateBlockEntity) { + SeededContainerLoot containerLootComponent = itemStack.get(DataComponents.CONTAINER_LOOT); if(containerLootComponent != null) { plateBlockEntity.setLootTable(containerLootComponent.lootTable(), containerLootComponent.seed()); } @@ -60,163 +72,184 @@ public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable Livi } @Override - protected void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) { - super.onBlockAdded(state, world, pos, oldState, notify); - PlateBlockEntity plateBlockEntity = (PlateBlockEntity) world.getBlockEntity(pos); - if(plateBlockEntity != null && world instanceof ServerWorld serverWorld) { - serverWorld.scheduleBlockTick(pos, this, 1, TickPriority.NORMAL); + protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { + super.onPlace(state, world, pos, oldState, notify); + if (world instanceof ServerLevel serverWorld + && world.getBlockEntity(pos) instanceof PlateBlockEntity) { + serverWorld.scheduleTick(pos, this, 1, TickPriority.NORMAL); } } @Override - protected void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - super.scheduledTick(state, world, pos, random); - PlateBlockEntity plateBlockEntity = (PlateBlockEntity) world.getBlockEntity(pos); - if(plateBlockEntity != null && plateBlockEntity.isBlockPlaced()) { + protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + super.tick(state, world, pos, random); + if (world.getBlockEntity(pos) instanceof PlateBlockEntity plateBlockEntity + && plateBlockEntity.hasPendingLoot()) { + plateBlockEntity.setBlockPlaced(); plateBlockEntity.generateItem(world); } - plateBlockEntity.setBlockPlaced(); } @Override - protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - PlateBlockEntity plateBlockEntity = (PlateBlockEntity) world.getBlockEntity(pos); - if(plateBlockEntity != null && plateBlockEntity.isBlockPlaced()) { + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + if (world.getBlockEntity(pos) instanceof PlateBlockEntity plateBlockEntity + && plateBlockEntity.isBlockPlaced()) { plateBlockEntity.generateItem(world); } super.randomTick(state, world, pos, random); } - @Nullable @Override - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { - if (!world.isClient) { - return PlateBlock.validateTicker(world, type, ModBlockEntities.PLATE); - } - return super.getTicker(world, state, type); - } - - private static BlockEntityTicker validateTicker(World world, BlockEntityType type, BlockEntityType plate) { - return PlateBlock.validateTicker(type, plate, PlateBlockEntity::tick); + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + return Block.canSupportCenter(world, pos.below(), Direction.UP); } @Override - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - return Block.sideCoversSmallSquare(world, pos.down(), Direction.UP); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + return !state.canSurvive(world, pos) ? + Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - return !state.canPlaceAt(world, pos) ? - Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); - } + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (player.isShiftKeyDown()) { + return takeFood(world, pos, player); + } - @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - ActionResult result = onEat(world, pos, player); - if(result == ActionResult.PASS || result == ActionResult.FAIL) { - if(world instanceof ServerWorld serverWorld) { - boolean hasUtensils = state.get(UTENSILS); - serverWorld.setBlockState(pos, state.with(UTENSILS, !hasUtensils), 2); + InteractionResult result = onEat(world, pos, player); + if(result == InteractionResult.PASS || result == InteractionResult.FAIL) { + if(world instanceof ServerLevel serverWorld) { + boolean hasUtensils = state.getValue(UTENSILS); + serverWorld.setBlock(pos, state.setValue(UTENSILS, !hasUtensils), 2); } } return result; } - protected static ActionResult onEat(World world, BlockPos pos, PlayerEntity player) { - if (world.isClient) { - if (tryEat(world, pos, player).isAccepted()) { - return ActionResult.SUCCESS; - } - if (player.getStackInHand(Hand.MAIN_HAND).isEmpty()) { - return ActionResult.CONSUME; - } - } + protected static InteractionResult onEat(Level world, BlockPos pos, Player player) { return tryEat(world, pos, player); } - protected static ActionResult tryEat(World world, BlockPos pos, PlayerEntity player) { - if (!player.canConsume(false)) { - return ActionResult.PASS; + protected static InteractionResult tryEat(Level world, BlockPos pos, Player player) { + if (!(world.getBlockEntity(pos) instanceof PlateBlockEntity plateBlockEntity)) { + return InteractionResult.FAIL; } - PlateBlockEntity plateBlockEntity = (PlateBlockEntity) world.getBlockEntity(pos); - if(plateBlockEntity == null) return ActionResult.FAIL; - - ItemStack food = plateBlockEntity.getStack(); - if(food == null || food.isEmpty()) { - return ActionResult.PASS; + ItemStack food = plateBlockEntity.getTheItem(); + if(food.isEmpty()) { + return InteractionResult.PASS; } - FoodComponent foodComponent = food.get(DataComponentTypes.FOOD); - ConsumableComponent consumableComponent = food.get(DataComponentTypes.CONSUMABLE); - if(foodComponent != null && consumableComponent != null) { - if(!world.isClient) { - player.getHungerManager().add((foodComponent.nutrition() / 2), foodComponent.saturation() / 2); - } - foodComponent.onConsume(player.getWorld(), player, food, consumableComponent); - world.emitGameEvent(player, GameEvent.EAT, pos); + FoodProperties foodComponent = food.getFoodProperties(player); + if (foodComponent == null || !player.canEat(foodComponent.canAlwaysEat())) { + return InteractionResult.PASS; + } + if (world.isClientSide) { + return InteractionResult.SUCCESS; + } - ItemStack remainderItem = ItemStack.EMPTY; - UseRemainderComponent useRemainderComponent = food.get(DataComponentTypes.USE_REMAINDER); - if(useRemainderComponent != null) remainderItem = useRemainderComponent.convertInto(); - plateBlockEntity.setStack(remainderItem); + int previousFoodLevel = player.getFoodData().getFoodLevel(); + float previousSaturation = player.getFoodData().getSaturationLevel(); + ItemStack consumedResult = food.copyWithCount(1).finishUsingItem(world, player); + + // Keep the authored half-serving nutrition and saturation while invoking item-specific effects. + player.getFoodData().setFoodLevel(previousFoodLevel); + player.getFoodData().setSaturation(previousSaturation); + player.getFoodData().eat( + (foodComponent.nutrition() + 1) / 2, + foodComponent.saturation() / 2.0F + ); + + ItemStack remainder = ItemStack.EMPTY; + if (!player.hasInfiniteMaterials() && !consumedResult.isEmpty()) { + remainder = consumedResult.copy(); + } else if (foodComponent.usingConvertsTo().isPresent()) { + remainder = foodComponent.usingConvertsTo().orElseThrow().copy(); + } else if (food.hasCraftingRemainingItem()) { + remainder = food.getCraftingRemainingItem(); } + plateBlockEntity.setTheItem(remainder); + return InteractionResult.CONSUME; + } - return ActionResult.SUCCESS; + private static InteractionResult takeFood(Level world, BlockPos pos, Player player) { + if (!(world.getBlockEntity(pos) instanceof PlateBlockEntity plateBlockEntity)) { + return InteractionResult.FAIL; + } + ItemStack food = plateBlockEntity.getTheItem(); + if (food.isEmpty()) { + return InteractionResult.PASS; + } + if (!world.isClientSide) { + ItemStack removed = food.copy(); + plateBlockEntity.setTheItem(ItemStack.EMPTY); + if (!player.addItem(removed)) { + player.drop(removed, false); + } + } + return InteractionResult.sidedSuccess(world.isClientSide); } @Override - protected ActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + protected ItemInteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { if(stack.getItem() instanceof BlockItem blockItem) { if(blockItem.getBlock() instanceof PlateBlock) { - return ActionResult.PASS; + return ItemInteractionResult.SKIP_DEFAULT_BLOCK_INTERACTION; } } - if(stack.contains(DataComponentTypes.FOOD)) { - BlockEntity blockEntity = player.getWorld().getBlockEntity(pos); + if(stack.has(DataComponents.FOOD)) { + BlockEntity blockEntity = player.level().getBlockEntity(pos); if(blockEntity instanceof PlateBlockEntity plateBlockEntity) { - ItemStack plateStack = plateBlockEntity.getStack(); - if(plateStack == null || plateStack.isEmpty()) { - ItemStack insertedStack = stack.copy(); - insertedStack.setCount(1); - plateBlockEntity.setStack(insertedStack); - stack.decrementUnlessCreative(1, player); - return ActionResult.SUCCESS; - } else if (world.isClient) { - return onEat(world, pos, player); + ItemStack plateStack = plateBlockEntity.getTheItem(); + if(plateStack.isEmpty()) { + if (!world.isClientSide) { + plateBlockEntity.setTheItem(stack.copyWithCount(1)); + stack.consume(1, player); + } + return ItemInteractionResult.sidedSuccess(world.isClientSide); + } else { + InteractionResult result = onEat(world, pos, player); + if (result == InteractionResult.FAIL) { + return ItemInteractionResult.FAIL; + } + if (result == InteractionResult.CONSUME || result == InteractionResult.CONSUME_PARTIAL) { + return ItemInteractionResult.CONSUME; + } + return result.consumesAction() + ? ItemInteractionResult.sidedSuccess(world.isClientSide) + : ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION; } } else { - return ActionResult.FAIL; + return ItemInteractionResult.FAIL; } } - return super.onUseWithItem(stack, state, world, pos, player, hand, hit); + return super.useItemOn(stack, state, world, pos, player, hand, hit); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(3.0, 0.0, 3.0, 13.0, 1.0, 13.0); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(3.0, 0.0, 3.0, 13.0, 1.0, 13.0); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING, UTENSILS); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; if (direction.getAxis() == Direction.Axis.Y) { - BlockState blockState = this.getDefaultState().with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()).with(UTENSILS, false); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { + BlockState blockState = this.defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()).setValue(UTENSILS, false); + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { return blockState; } } @@ -226,17 +259,17 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new PlateBlockEntity(pos, state); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - return state.rotate(mirror.getRotation(state.get(FACING))); + public BlockState mirror(BlockState state, Mirror mirror) { + return state.rotate(mirror.getRotation(state.getValue(FACING))); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateBlockEntity.java index 5cda9e55e1..dc7de95da8 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateBlockEntity.java @@ -1,32 +1,34 @@ package net.sevenstars.middleearth.block.special.plate; -import com.mojang.serialization.Codec; import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.inventory.SingleStackInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.loot.LootTable; -import net.minecraft.loot.context.LootContextTypes; -import net.minecraft.loot.context.LootWorldContext; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.network.listener.ClientPlayPacketListener; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponentMap; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.Registries; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.SeededContainerLoot; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.storage.loot.LootParams; +import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; +import net.minecraft.world.ticks.ContainerSingleItem; +import net.minecraft.world.ticks.TickPriority; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import org.jetbrains.annotations.Nullable; -public class PlateBlockEntity extends BlockEntity implements SingleStackInventory.SingleStackBlockEntityInventory { +public class PlateBlockEntity extends BlockEntity implements ContainerSingleItem.BlockContainerSingleItem { private ItemStack food = ItemStack.EMPTY; - private RegistryKey lootTable; + private ResourceKey lootTable; private long lootTableSeed; private boolean blockPlaced = false; @@ -35,45 +37,74 @@ public PlateBlockEntity(BlockPos pos, BlockState state) { } @Override - protected void writeData(WriteView view) { - super.writeData(view); - view.put("placed", Codec.BOOL, blockPlaced); + protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.saveAdditional(tag, registries); + tag.putBoolean("placed", blockPlaced); - if (!this.writeLootTableToData(view) && !this.food.isEmpty()) { - view.put("item", ItemStack.CODEC, this.food); + if (!this.writeLootTableToData(tag) && !this.food.isEmpty()) { + tag.put("item", this.food.save(registries)); } } @Override - protected void readData(ReadView view) { - super.readData(view); - this.food.copyAndEmpty(); - this.blockPlaced = view.getBoolean("placed", false); - if (!this.readLootTableFromData(view)) { - this.food = view.read("item", ItemStack.CODEC).orElse(ItemStack.EMPTY); + protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.loadAdditional(tag, registries); + this.food = ItemStack.EMPTY; + this.blockPlaced = tag.getBoolean("placed"); + if (!this.readLootTableFromData(tag) && tag.contains("item")) { + this.food = ItemStack.parse(registries, tag.get("item")).orElse(ItemStack.EMPTY); } else { this.food = ItemStack.EMPTY; } } - public void setLootTable(RegistryKey lootTable, long seed) { + public void setLootTable(ResourceKey lootTable, long seed) { this.lootTable = lootTable; this.lootTableSeed = seed; } - private boolean readLootTableFromData(ReadView view) { - this.lootTable = (RegistryKey)view.read("LootTable", LootTable.TABLE_KEY).orElse(null); - this.lootTableSeed = view.getLong("LootTableSeed", 0L); + @Override + public void onLoad() { + super.onLoad(); + if (!(this.level instanceof ServerLevel serverLevel)) { + return; + } + + SeededContainerLoot componentLoot = this.components().get(DataComponents.CONTAINER_LOOT); + if (componentLoot != null) { + if (this.lootTable == null && this.food.isEmpty()) { + this.lootTable = componentLoot.lootTable(); + this.lootTableSeed = componentLoot.seed(); + } + DataComponentMap.Builder components = DataComponentMap.builder().addAll(this.components()); + components.set(DataComponents.CONTAINER_LOOT, null); + this.setComponents(components.build()); + this.setChanged(); + } + + if (this.hasPendingLoot()) { + serverLevel.scheduleTick(this.worldPosition, this.getBlockState().getBlock(), 1, TickPriority.NORMAL); + } + } + + public boolean hasPendingLoot() { return this.lootTable != null; } - private boolean writeLootTableToData(WriteView view) { + private boolean readLootTableFromData(CompoundTag tag) { + ResourceLocation id = tag.contains("LootTable") ? ResourceLocation.tryParse(tag.getString("LootTable")) : null; + this.lootTable = id == null ? null : ResourceKey.create(Registries.LOOT_TABLE, id); + this.lootTableSeed = tag.getLong("LootTableSeed"); + return this.lootTable != null; + } + + private boolean writeLootTableToData(CompoundTag tag) { if (this.lootTable == null) { return false; } else { - view.put("LootTable", LootTable.TABLE_KEY, this.lootTable); + tag.putString("LootTable", this.lootTable.location().toString()); if (this.lootTableSeed != 0L) { - view.putLong("LootTableSeed", this.lootTableSeed); + tag.putLong("LootTableSeed", this.lootTableSeed); } return true; @@ -88,45 +119,42 @@ public boolean isBlockPlaced() { return blockPlaced; } - public static void tick(World world, BlockPos pos, BlockState state, PlateBlockEntity blockEntity) { - if(blockEntity.blockPlaced) { - blockEntity.generateItem((ServerWorld) world); - } - } - @Nullable @Override - public Packet toUpdatePacket() { - return BlockEntityUpdateS2CPacket.create(this); + public Packet getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); } @Override - public NbtCompound toInitialChunkDataNbt(RegistryWrapper.WrapperLookup registries) { - return createNbt(registries); + public CompoundTag getUpdateTag(HolderLookup.Provider registries) { + return saveWithoutMetadata(registries); } @Override - public BlockEntity asBlockEntity() { + public BlockEntity getContainerBlockEntity() { return this; } @Override - public ItemStack getStack() { + public ItemStack getTheItem() { return food; } @Override - public void setStack(ItemStack stack) { + public void setTheItem(ItemStack stack) { + if (ItemStack.matches(this.food, stack)) { + return; + } this.food = stack; update(); } - public void generateItem(ServerWorld world) { + public void generateItem(ServerLevel world) { if (this.lootTable != null && blockPlaced) { - LootTable lootTable = world.getServer().getReloadableRegistries().getLootTable(this.lootTable); + LootTable lootTable = world.getServer().reloadableRegistries().getLootTable(this.lootTable); - LootWorldContext lootWorldContext = (new LootWorldContext.Builder(world)).build(LootContextTypes.EMPTY); - ObjectArrayList lootList = lootTable.generateLoot(lootWorldContext, this.lootTableSeed); + LootParams lootWorldContext = (new LootParams.Builder(world)).create(LootContextParamSets.EMPTY); + ObjectArrayList lootList = lootTable.getRandomItems(lootWorldContext, this.lootTableSeed); ItemStack itemLoot = ItemStack.EMPTY; if(!lootList.isEmpty()) itemLoot = lootList.get(world.getRandom().nextInt(lootList.size())); @@ -138,7 +166,14 @@ public void generateItem(ServerWorld world) { } public void update() { - markDirty(); - world.updateListeners(pos, getCachedState(), getCachedState(), Block.NOTIFY_ALL); + setChanged(); + if (level != null) { + level.sendBlockUpdated( + worldPosition, + getBlockState(), + getBlockState(), + Block.UPDATE_CLIENTS + ); + } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateEntityRenderer.java index d127d49dbd..e89647c187 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateEntityRenderer.java @@ -1,53 +1,48 @@ package net.sevenstars.middleearth.block.special.plate; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.model.loading.v1.ExtraModelKey; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.LightmapTextureManager; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BlockEntityRenderer; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.render.item.model.ItemModel; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.item.Item; -import net.minecraft.item.ItemDisplayContext; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.*; -import net.minecraft.world.LightType; -import net.minecraft.world.World; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Axis; +import net.minecraft.client.renderer.LightTexture; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LightLayer; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.block.special.forge.ForgeBlock; -@Environment(value= EnvType.CLIENT) public class PlateEntityRenderer implements BlockEntityRenderer { private final ItemRenderer itemRenderer; - public PlateEntityRenderer(BlockEntityRendererFactory.Context context) { + public PlateEntityRenderer(BlockEntityRendererProvider.Context context) { this.itemRenderer = context.getItemRenderer(); } @Override - public void render(PlateBlockEntity entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { - ItemStack stack = entity.getStack(); + public void render(PlateBlockEntity entity, float tickProgress, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { + ItemStack stack = entity.getTheItem(); if(stack.isEmpty()) return; - Identifier oldId = stack.get(DataComponentTypes.ITEM_MODEL); - Identifier modelId = PlateFoodModels.getPlateIdentifier(oldId); - ItemStack copyStack = stack.copy(); - copyStack.set(DataComponentTypes.ITEM_MODEL, modelId); + ResourceLocation itemId = BuiltInRegistries.ITEM.getKey(stack.getItem()); + ResourceLocation modelId = PlateFoodModels.getPlateIdentifier(itemId); + boolean is3D = !itemId.equals(modelId); - boolean is3D = oldId != modelId; + matrices.pushPose(); + Direction direction = entity.getBlockState().getValue(ForgeBlock.FACING); - matrices.push(); - Direction direction = entity.getCachedState().get(ForgeBlock.FACING); - - long seed = MathHelper.hashCode(entity.getPos().getX(), 0, entity.getPos().getZ()); + long seed = Mth.getSeed(entity.getBlockPos().getX(), 0, entity.getBlockPos().getZ()); double xOffset = ((seed & 15L) / 15.0 - 0.5) * 0.15; double zOffset = (((seed >> 4 & 15L) / 15.0) - 0.5) * 0.15; double rotOffset = (((seed >> 5 & 15L) / 15.0) - 0.5) * 35; @@ -55,37 +50,48 @@ public void render(PlateBlockEntity entity, float tickProgress, MatrixStack matr if(!is3D) { matrices.translate(0.5f + xOffset, 0.085f, 0.5f + zOffset); matrices.scale(0.65f, 0.65f, 0.65f); - matrices.multiply(RotationAxis.POSITIVE_X.rotation((float) Math.toRadians(90))); + matrices.mulPose(Axis.XP.rotation((float) Math.toRadians(90))); switch (direction) { - case NORTH -> matrices.multiply(RotationAxis.POSITIVE_Z.rotation((float) Math.toRadians(0))); - case EAST -> matrices.multiply(RotationAxis.POSITIVE_Z.rotation((float) Math.toRadians(90))); - case SOUTH -> matrices.multiply(RotationAxis.POSITIVE_Z.rotation((float) Math.toRadians(180))); - case WEST -> matrices.multiply(RotationAxis.POSITIVE_Z.rotation((float) Math.toRadians(270))); + case NORTH -> matrices.mulPose(Axis.ZP.rotation((float) Math.toRadians(0))); + case EAST -> matrices.mulPose(Axis.ZP.rotation((float) Math.toRadians(90))); + case SOUTH -> matrices.mulPose(Axis.ZP.rotation((float) Math.toRadians(180))); + case WEST -> matrices.mulPose(Axis.ZP.rotation((float) Math.toRadians(270))); } - matrices.multiply(RotationAxis.POSITIVE_Z.rotation((float) Math.toRadians(rotOffset))); + matrices.mulPose(Axis.ZP.rotation((float) Math.toRadians(rotOffset))); } else { matrices.translate(0.5f + xOffset, 0.56f, 0.5f + zOffset); matrices.scale(1f, 1f, 1f); switch (direction) { - case NORTH -> matrices.multiply(RotationAxis.POSITIVE_Y.rotation((float) Math.toRadians(0))); - case EAST -> matrices.multiply(RotationAxis.POSITIVE_Y.rotation((float) Math.toRadians(90))); - case SOUTH -> matrices.multiply(RotationAxis.POSITIVE_Y.rotation((float) Math.toRadians(180))); - case WEST -> matrices.multiply(RotationAxis.POSITIVE_Y.rotation((float) Math.toRadians(270))); + case NORTH -> matrices.mulPose(Axis.YP.rotation((float) Math.toRadians(0))); + case EAST -> matrices.mulPose(Axis.YP.rotation((float) Math.toRadians(90))); + case SOUTH -> matrices.mulPose(Axis.YP.rotation((float) Math.toRadians(180))); + case WEST -> matrices.mulPose(Axis.YP.rotation((float) Math.toRadians(270))); } - matrices.multiply(RotationAxis.POSITIVE_Y.rotation((float) Math.toRadians(rotOffset))); + matrices.mulPose(Axis.YP.rotation((float) Math.toRadians(rotOffset))); } - int currentLight = getLightLevel(entity.getWorld(), entity.getPos(), direction); + int currentLight = getLightLevel(entity.getLevel(), entity.getBlockPos(), direction); - this.itemRenderer.renderItem(copyStack, ItemDisplayContext.FIXED, currentLight, OverlayTexture.DEFAULT_UV, - matrices, vertexConsumers, entity.getWorld(), 1); + if (is3D) { + BakedModel model = PlateModelClientEvents.getBakedModel(modelId); + if (model != null) { + this.itemRenderer.render(stack, ItemDisplayContext.FIXED, false, matrices, vertexConsumers, + currentLight, OverlayTexture.NO_OVERLAY, model); + } else { + this.itemRenderer.renderStatic(stack, ItemDisplayContext.FIXED, currentLight, + OverlayTexture.NO_OVERLAY, matrices, vertexConsumers, entity.getLevel(), 1); + } + } else { + this.itemRenderer.renderStatic(stack, ItemDisplayContext.FIXED, currentLight, + OverlayTexture.NO_OVERLAY, matrices, vertexConsumers, entity.getLevel(), 1); + } - matrices.pop(); + matrices.popPose(); } - private int getLightLevel(World world, BlockPos pos, Direction direction) { - int bLight = world.getLightLevel(LightType.BLOCK, pos.offset(direction).up()); - int sLight = world.getLightLevel(LightType.SKY, pos.offset(direction).up()); - return LightmapTextureManager.pack(bLight, sLight); + private int getLightLevel(Level world, BlockPos pos, Direction direction) { + int bLight = world.getBrightness(LightLayer.BLOCK, pos.relative(direction).above()); + int sLight = world.getBrightness(LightLayer.SKY, pos.relative(direction).above()); + return LightTexture.pack(bLight, sLight); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateFoodModels.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateFoodModels.java index 44de98a541..c9ccf4e4a1 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateFoodModels.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateFoodModels.java @@ -1,14 +1,14 @@ package net.sevenstars.middleearth.block.special.plate; -import net.minecraft.util.Identifier; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; import java.util.HashMap; public class PlateFoodModels { - public static HashMap plateModels; + public static HashMap plateModels; - public static Identifier getPlateIdentifier(Identifier itemIdentifier) { + public static ResourceLocation getPlateIdentifier(ResourceLocation itemIdentifier) { if(plateModels.containsKey(itemIdentifier)) { return plateModels.get(itemIdentifier); } @@ -16,7 +16,7 @@ public static Identifier getPlateIdentifier(Identifier itemIdentifier) { } public static void addVanillaModel(String name) { - plateModels.put(Identifier.ofVanilla(name), Identifier.of(MiddleEarth.MOD_ID, "plate_" + name)); + plateModels.put(ResourceLocation.withDefaultNamespace(name), ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "plate_" + name)); } public static void addModel(String name) { plateModels.put(MiddleEarth.of(name), MiddleEarth.of('_', "plate", name)); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateModelClientEvents.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateModelClientEvents.java new file mode 100644 index 0000000000..07e14956d7 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/plate/PlateModelClientEvents.java @@ -0,0 +1,50 @@ +package net.sevenstars.middleearth.block.special.plate; + +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.client.event.ModelEvent; +import net.sevenstars.middleearth.MiddleEarth; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +@EventBusSubscriber(modid = MiddleEarth.NEOFORGE_MOD_ID, value = Dist.CLIENT) +public final class PlateModelClientEvents { + private static volatile Map BAKED_MODELS = Map.of(); + + private PlateModelClientEvents() { + } + + @SubscribeEvent + private static void registerAdditionalModels(ModelEvent.RegisterAdditional event) { + Set modelIds = new HashSet<>(PlateFoodModels.plateModels.values()); + for (ResourceLocation modelId : modelIds) { + event.register(ModelResourceLocation.standalone(modelId.withPrefix("item/"))); + } + } + + @SubscribeEvent + private static void cacheBakedModels(ModelEvent.BakingCompleted event) { + BakedModel missingModel = event.getModelManager().getMissingModel(); + Map models = new HashMap<>(); + for (ResourceLocation modelId : PlateFoodModels.plateModels.values()) { + BakedModel model = event.getModels().get( + ModelResourceLocation.standalone(modelId.withPrefix("item/")) + ); + if (model != null && model != missingModel) { + models.put(modelId, model); + } + } + BAKED_MODELS = Map.copyOf(models); + } + + static BakedModel getBakedModel(ResourceLocation modelId) { + return BAKED_MODELS.get(modelId); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pointedBlocks/PointedDolomiteBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pointedBlocks/PointedDolomiteBlock.java index 52f142da67..95222c4627 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pointedBlocks/PointedDolomiteBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pointedBlocks/PointedDolomiteBlock.java @@ -2,50 +2,62 @@ import com.google.common.annotations.VisibleForTesting; import com.mojang.serialization.MapCodec; -import net.minecraft.world.tick.ScheduledTickView; import net.sevenstars.middleearth.block.registration.ModBlocks; import net.sevenstars.middleearth.block.registration.StoneBlockSets; -import net.minecraft.block.*; -import net.minecraft.block.enums.Thickness; -import net.minecraft.entity.Entity; -import net.minecraft.entity.FallingBlockEntity; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.entity.projectile.TridentEntity; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.particle.ParticleEffect; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.tag.FluidTags; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.*; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.block.state.properties.*; +import net.minecraft.tags.FluidTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.item.FallingBlockEntity; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.entity.projectile.ThrownTrident; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.AbstractCauldronBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Fallable; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.DripstoneThickness; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; import java.util.Optional; import java.util.function.BiPredicate; import java.util.function.Predicate; -public class PointedDolomiteBlock extends Block implements Falling, Waterloggable { - public static final MapCodec CODEC = createCodec(PointedDolomiteBlock::new); +public class PointedDolomiteBlock extends Block implements Fallable, SimpleWaterloggedBlock { + public static final MapCodec CODEC = simpleCodec(PointedDolomiteBlock::new); public static final EnumProperty VERTICAL_DIRECTION; - public static final EnumProperty THICKNESS; + public static final EnumProperty THICKNESS; public static final BooleanProperty WATERLOGGED; private static final VoxelShape TIP_MERGE_SHAPE; private static final VoxelShape UP_TIP_SHAPE; @@ -57,73 +69,73 @@ public class PointedDolomiteBlock extends Block implements Falling, Waterloggabl private static final float MAX_HORIZONTAL_MODEL_OFFSET; private static final VoxelShape DRIP_COLLISION_SHAPE; - public MapCodec getCodec() { + public MapCodec codec() { return CODEC; } - public PointedDolomiteBlock(AbstractBlock.Settings settings) { + public PointedDolomiteBlock(BlockBehaviour.Properties settings) { super(settings); - this.setDefaultState((BlockState)((BlockState)((BlockState)((BlockState)this.stateManager.getDefaultState()).with(VERTICAL_DIRECTION, Direction.UP)).with(THICKNESS, Thickness.TIP)).with(WATERLOGGED, false)); + this.registerDefaultState((BlockState)((BlockState)((BlockState)((BlockState)this.stateDefinition.any()).setValue(VERTICAL_DIRECTION, Direction.UP)).setValue(THICKNESS, DripstoneThickness.TIP)).setValue(WATERLOGGED, false)); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(new Property[]{VERTICAL_DIRECTION, THICKNESS, WATERLOGGED}); } - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - return canPlaceAtWithDirection(world, pos, (Direction)state.get(VERTICAL_DIRECTION)); + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + return canPlaceAtWithDirection(world, pos, (Direction)state.getValue(VERTICAL_DIRECTION)); } - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if ((Boolean)state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if ((Boolean)state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } if (direction != Direction.UP && direction != Direction.DOWN) { return state; } else { - Direction direction2 = (Direction)state.get(VERTICAL_DIRECTION); - if (direction2 == Direction.DOWN && tickView.getBlockTickScheduler().isQueued(pos, this)) { + Direction direction2 = (Direction)state.getValue(VERTICAL_DIRECTION); + if (direction2 == Direction.DOWN && world.getBlockTicks().hasScheduledTick(pos, this)) { return state; - } else if (direction == direction2.getOpposite() && !this.canPlaceAt(state, world, pos)) { + } else if (direction == direction2.getOpposite() && !this.canSurvive(state, world, pos)) { if (direction2 == Direction.DOWN) { - tickView.scheduleBlockTick(pos, this, 2); + world.scheduleTick(pos, this, 2); } else { - tickView.scheduleBlockTick(pos, this, 1); + world.scheduleTick(pos, this, 1); } return state; } else { - boolean bl = state.get(THICKNESS) == Thickness.TIP_MERGE; - Thickness thickness = getThickness(world, pos, direction2, bl); - return (BlockState)state.with(THICKNESS, thickness); + boolean bl = state.getValue(THICKNESS) == DripstoneThickness.TIP_MERGE; + DripstoneThickness thickness = getThickness(world, pos, direction2, bl); + return (BlockState)state.setValue(THICKNESS, thickness); } } } - protected void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient) { + protected void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!world.isClientSide) { BlockPos blockPos = hit.getBlockPos(); - if (world instanceof ServerWorld) { - ServerWorld serverWorld = (ServerWorld)world; - if (projectile.canModifyAt(serverWorld, blockPos) && projectile.canBreakBlocks(serverWorld) && projectile instanceof TridentEntity && projectile.getVelocity().length() > 0.6) { - world.breakBlock(blockPos, true); + if (world instanceof ServerLevel) { + ServerLevel serverWorld = (ServerLevel)world; + if (projectile.mayInteract(serverWorld, blockPos) && projectile.mayBreak(serverWorld) && projectile instanceof ThrownTrident && projectile.getDeltaMovement().length() > 0.6) { + world.destroyBlock(blockPos, true); } } } } - public void onLandedUpon(World world, BlockState state, BlockPos pos, Entity entity, double fallDistance) { - if (state.get(VERTICAL_DIRECTION) == Direction.UP && state.get(THICKNESS) == Thickness.TIP) { - entity.handleFallDamage(fallDistance + 2.5, 2.0F, world.getDamageSources().stalagmite()); + public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) { + if (state.getValue(VERTICAL_DIRECTION) == Direction.UP && state.getValue(THICKNESS) == DripstoneThickness.TIP) { + entity.causeFallDamage(fallDistance + 2.5F, 2.0F, world.damageSources().stalagmite()); } else { - super.onLandedUpon(world, state, pos, entity, fallDistance); + super.fallOn(world, state, pos, entity, fallDistance); } } - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { + public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { if (canDrip(state)) { float f = random.nextFloat(); if (!(f > 0.12F)) { @@ -136,16 +148,16 @@ public void randomDisplayTick(BlockState state, World world, BlockPos pos, Rando } } - protected void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - if (isPointingUp(state) && !this.canPlaceAt(state, world, pos)) { - world.breakBlock(pos, true); + protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + if (isPointingUp(state) && !this.canSurvive(state, world, pos)) { + world.destroyBlock(pos, true); } else { spawnFallingBlock(state, world, pos); } } - protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { dripTick(state, world, pos, random.nextFloat()); if (random.nextFloat() < 0.011377778F && isHeldByPointedDripstone(state, world, pos)) { tryGrow(state, world, pos, random); @@ -154,7 +166,7 @@ protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Ran } @VisibleForTesting - public static void dripTick(BlockState state, ServerWorld world, BlockPos pos, float dripChance) { + public static void dripTick(BlockState state, ServerLevel world, BlockPos pos, float dripChance) { if (!(dripChance > 0.17578125F) || !(dripChance > 0.05859375F)) { if (isHeldByPointedDripstone(state, world, pos)) { Optional optional = getFluid(world, pos, state); @@ -174,20 +186,20 @@ public static void dripTick(BlockState state, ServerWorld world, BlockPos pos, f if (!(dripChance >= f)) { BlockPos blockPos = getTipPos(state, world, pos, 11, false); if (blockPos != null) { - if (((PointedDolomiteBlock.DrippingFluid)optional.get()).sourceState.isOf(Blocks.MUD) && fluid == Fluids.WATER) { - BlockState blockState = Blocks.CLAY.getDefaultState(); - world.setBlockState(((PointedDolomiteBlock.DrippingFluid)optional.get()).pos, blockState); - Block.pushEntitiesUpBeforeBlockChange(((PointedDolomiteBlock.DrippingFluid)optional.get()).sourceState, blockState, world, ((PointedDolomiteBlock.DrippingFluid)optional.get()).pos); - world.emitGameEvent(GameEvent.BLOCK_CHANGE, ((PointedDolomiteBlock.DrippingFluid)optional.get()).pos, GameEvent.Emitter.of(blockState)); - world.syncWorldEvent(1504, blockPos, 0); + if (((PointedDolomiteBlock.DrippingFluid)optional.get()).sourceState.is(Blocks.MUD) && fluid == Fluids.WATER) { + BlockState blockState = Blocks.CLAY.defaultBlockState(); + world.setBlockAndUpdate(((PointedDolomiteBlock.DrippingFluid)optional.get()).pos, blockState); + Block.pushEntitiesUp(((PointedDolomiteBlock.DrippingFluid)optional.get()).sourceState, blockState, world, ((PointedDolomiteBlock.DrippingFluid)optional.get()).pos); + world.gameEvent(GameEvent.BLOCK_CHANGE, ((PointedDolomiteBlock.DrippingFluid)optional.get()).pos, GameEvent.Context.of(blockState)); + world.levelEvent(1504, blockPos, 0); } else { BlockPos blockPos2 = getCauldronPos(world, blockPos, fluid); if (blockPos2 != null) { - world.syncWorldEvent(1504, blockPos, 0); + world.levelEvent(1504, blockPos, 0); int i = blockPos.getY() - blockPos2.getY(); int j = 50 + i; BlockState blockState2 = world.getBlockState(blockPos2); - world.scheduleBlockTick(blockPos2, blockState2.getBlock(), j); + world.scheduleTick(blockPos2, blockState2.getBlock(), j); } } } @@ -198,33 +210,34 @@ public static void dripTick(BlockState state, ServerWorld world, BlockPos pos, f } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - WorldAccess worldAccess = ctx.getWorld(); - BlockPos blockPos = ctx.getBlockPos(); - Direction direction = ctx.getVerticalPlayerLookDirection().getOpposite(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + LevelAccessor worldAccess = ctx.getLevel(); + BlockPos blockPos = ctx.getClickedPos(); + Direction direction = ctx.getNearestLookingVerticalDirection().getOpposite(); Direction direction2 = getDirectionToPlaceAt(worldAccess, blockPos, direction); if (direction2 == null) { return null; } else { - boolean bl = !ctx.shouldCancelInteraction(); - Thickness thickness = getThickness(worldAccess, blockPos, direction2, bl); - return thickness == null ? null : (BlockState)((BlockState)((BlockState)this.getDefaultState().with(VERTICAL_DIRECTION, direction2)).with(THICKNESS, thickness)).with(WATERLOGGED, worldAccess.getFluidState(blockPos).getFluid() == Fluids.WATER); + boolean bl = !ctx.isSecondaryUseActive(); + DripstoneThickness thickness = getThickness(worldAccess, blockPos, direction2, bl); + return thickness == null ? null : (BlockState)((BlockState)((BlockState)this.defaultBlockState().setValue(VERTICAL_DIRECTION, direction2)).setValue(THICKNESS, thickness)).setValue(WATERLOGGED, worldAccess.getFluidState(blockPos).getType() == Fluids.WATER); } } protected FluidState getFluidState(BlockState state) { - return (Boolean)state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return (Boolean)state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } - protected VoxelShape getCullingShape(BlockState state) { - return VoxelShapes.empty(); + @Override + protected VoxelShape getOcclusionShape(BlockState state, BlockGetter world, BlockPos pos) { + return Shapes.empty(); } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { VoxelShape var10000; - switch ((Thickness)state.get(THICKNESS)) { + switch ((DripstoneThickness)state.getValue(THICKNESS)) { case TIP_MERGE -> var10000 = TIP_MERGE_SHAPE; - case TIP -> var10000 = state.get(VERTICAL_DIRECTION) == Direction.DOWN ? DOWN_TIP_SHAPE : UP_TIP_SHAPE; + case TIP -> var10000 = state.getValue(VERTICAL_DIRECTION) == Direction.DOWN ? DOWN_TIP_SHAPE : UP_TIP_SHAPE; case FRUSTUM -> var10000 = BASE_SHAPE; case MIDDLE -> var10000 = FRUSTUM_SHAPE; case BASE -> var10000 = MIDDLE_SHAPE; @@ -232,37 +245,38 @@ protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos } VoxelShape voxelShape = var10000; - return voxelShape.offset(state.getModelOffset(pos)); + Vec3 offset = state.getOffset(world, pos); + return voxelShape.move(offset.x, 0.0, offset.z); } - protected boolean isShapeFullCube(BlockState state, BlockView world, BlockPos pos) { + protected boolean isCollisionShapeFullBlock(BlockState state, BlockGetter world, BlockPos pos) { return false; } - protected float getMaxHorizontalModelOffset() { + protected float getMaxHorizontalOffset() { return MAX_HORIZONTAL_MODEL_OFFSET; } - public void onDestroyedOnLanding(World world, BlockPos pos, FallingBlockEntity fallingBlockEntity) { + public void onBrokenAfterFall(Level world, BlockPos pos, FallingBlockEntity fallingBlockEntity) { if (!fallingBlockEntity.isSilent()) { - world.syncWorldEvent(1045, pos, 0); + world.levelEvent(1045, pos, 0); } } - public DamageSource getDamageSource(Entity attacker) { - return attacker.getDamageSources().fallingStalactite(attacker); + public DamageSource getFallDamageSource(Entity attacker) { + return attacker.damageSources().fallingStalactite(attacker); } - private static void spawnFallingBlock(BlockState state, ServerWorld world, BlockPos pos) { - BlockPos.Mutable mutable = pos.mutableCopy(); + private static void spawnFallingBlock(BlockState state, ServerLevel world, BlockPos pos) { + BlockPos.MutableBlockPos mutable = pos.mutable(); for(BlockState blockState = state; isPointingDown(blockState); blockState = world.getBlockState(mutable)) { - FallingBlockEntity fallingBlockEntity = FallingBlockEntity.spawnFromBlock(world, mutable, blockState); + FallingBlockEntity fallingBlockEntity = FallingBlockEntity.fall(world, mutable, blockState); if (isTip(blockState, true)) { int i = Math.max(1 + pos.getY() - mutable.getY(), 6); float f = 1.0F * (float)i; - fallingBlockEntity.setHurtEntities(f, 40); + fallingBlockEntity.setHurtsEntities(f, 40); break; } @@ -272,9 +286,9 @@ private static void spawnFallingBlock(BlockState state, ServerWorld world, Block } @VisibleForTesting - public static void tryGrow(BlockState state, ServerWorld world, BlockPos pos, Random random) { - BlockState blockState = world.getBlockState(pos.up(1)); - BlockState blockState2 = world.getBlockState(pos.up(2)); + public static void tryGrow(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + BlockState blockState = world.getBlockState(pos.above(1)); + BlockState blockState2 = world.getBlockState(pos.above(2)); if (canGrow(blockState, blockState2)) { BlockPos blockPos = getTipPos(state, world, pos, 7, false); if (blockPos != null) { @@ -291,8 +305,8 @@ public static void tryGrow(BlockState state, ServerWorld world, BlockPos pos, Ra } } - private static void tryGrowStalagmite(ServerWorld world, BlockPos pos) { - BlockPos.Mutable mutable = pos.mutableCopy(); + private static void tryGrowStalagmite(ServerLevel world, BlockPos pos) { + BlockPos.MutableBlockPos mutable = pos.mutable(); for(int i = 0; i < 10; ++i) { mutable.move(Direction.DOWN); @@ -306,8 +320,8 @@ private static void tryGrowStalagmite(ServerWorld world, BlockPos pos) { return; } - if (canPlaceAtWithDirection(world, mutable, Direction.UP) && !world.isWater(mutable.down())) { - tryGrow(world, mutable.down(), Direction.UP); + if (canPlaceAtWithDirection(world, mutable, Direction.UP) && !world.isWaterAt(mutable.below())) { + tryGrow(world, mutable.below(), Direction.UP); return; } @@ -318,71 +332,71 @@ private static void tryGrowStalagmite(ServerWorld world, BlockPos pos) { } - private static void tryGrow(ServerWorld world, BlockPos pos, Direction direction) { - BlockPos blockPos = pos.offset(direction); + private static void tryGrow(ServerLevel world, BlockPos pos, Direction direction) { + BlockPos blockPos = pos.relative(direction); BlockState blockState = world.getBlockState(blockPos); if (isTip(blockState, direction.getOpposite())) { growMerged(blockState, world, blockPos); - } else if (blockState.isAir() || blockState.isOf(Blocks.WATER)) { - place(world, blockPos, direction, Thickness.TIP); + } else if (blockState.isAir() || blockState.is(Blocks.WATER)) { + place(world, blockPos, direction, DripstoneThickness.TIP); } } - private static void place(WorldAccess world, BlockPos pos, Direction direction, Thickness thickness) { - BlockState blockState = (BlockState)((BlockState)((BlockState)ModBlocks.POINTED_DOLOMITE.getDefaultState().with(VERTICAL_DIRECTION, direction)).with(THICKNESS, thickness)).with(WATERLOGGED, world.getFluidState(pos).getFluid() == Fluids.WATER); - world.setBlockState(pos, blockState, 3); + private static void place(LevelAccessor world, BlockPos pos, Direction direction, DripstoneThickness thickness) { + BlockState blockState = (BlockState)((BlockState)((BlockState)ModBlocks.POINTED_DOLOMITE.defaultBlockState().setValue(VERTICAL_DIRECTION, direction)).setValue(THICKNESS, thickness)).setValue(WATERLOGGED, world.getFluidState(pos).getType() == Fluids.WATER); + world.setBlock(pos, blockState, 3); } - private static void growMerged(BlockState state, WorldAccess world, BlockPos pos) { + private static void growMerged(BlockState state, LevelAccessor world, BlockPos pos) { BlockPos blockPos2; BlockPos blockPos; - if (state.get(VERTICAL_DIRECTION) == Direction.UP) { + if (state.getValue(VERTICAL_DIRECTION) == Direction.UP) { blockPos = pos; - blockPos2 = pos.up(); + blockPos2 = pos.above(); } else { blockPos2 = pos; - blockPos = pos.down(); + blockPos = pos.below(); } - place(world, blockPos2, Direction.DOWN, Thickness.TIP_MERGE); - place(world, blockPos, Direction.UP, Thickness.TIP_MERGE); + place(world, blockPos2, Direction.DOWN, DripstoneThickness.TIP_MERGE); + place(world, blockPos, Direction.UP, DripstoneThickness.TIP_MERGE); } - public static void createParticle(World world, BlockPos pos, BlockState state) { + public static void createParticle(Level world, BlockPos pos, BlockState state) { getFluid(world, pos, state).ifPresent((fluid) -> { createParticle(world, pos, state, fluid.fluid); }); } - private static void createParticle(World world, BlockPos pos, BlockState state, Fluid fluid) { - Vec3d vec3d = state.getModelOffset(pos); + private static void createParticle(Level world, BlockPos pos, BlockState state, Fluid fluid) { + Vec3 vec3d = state.getOffset(world, pos); double d = 0.0625; double e = (double)pos.getX() + 0.5 + vec3d.x; double f = (double)pos.getY() + DOWN_TIP_Y - 0.0625; double g = (double)pos.getZ() + 0.5 + vec3d.z; Fluid fluid2 = getDripFluid(world, fluid); - ParticleEffect particleEffect = fluid2.isIn(FluidTags.LAVA) ? ParticleTypes.DRIPPING_DRIPSTONE_LAVA : ParticleTypes.DRIPPING_DRIPSTONE_WATER; - world.addParticleClient(particleEffect, e, f, g, 0.0, 0.0, 0.0); + ParticleOptions particleEffect = fluid2.is(FluidTags.LAVA) ? ParticleTypes.DRIPPING_DRIPSTONE_LAVA : ParticleTypes.DRIPPING_DRIPSTONE_WATER; + world.addParticle(particleEffect, e, f, g, 0.0, 0.0, 0.0); } @Nullable - private static BlockPos getTipPos(BlockState state, WorldAccess world, BlockPos pos, int range, boolean allowMerged) { + private static BlockPos getTipPos(BlockState state, LevelAccessor world, BlockPos pos, int range, boolean allowMerged) { if (isTip(state, allowMerged)) { return pos; } else { - Direction direction = (Direction)state.get(VERTICAL_DIRECTION); + Direction direction = (Direction)state.getValue(VERTICAL_DIRECTION); BiPredicate biPredicate = (posx, statex) -> { - return statex.isOf(ModBlocks.POINTED_DOLOMITE) && statex.get(VERTICAL_DIRECTION) == direction; + return statex.is(ModBlocks.POINTED_DOLOMITE) && statex.getValue(VERTICAL_DIRECTION) == direction; }; - return (BlockPos)searchInDirection(world, pos, direction.getDirection(), biPredicate, (statex) -> { + return (BlockPos)searchInDirection(world, pos, direction.getAxisDirection(), biPredicate, (statex) -> { return isTip(statex, allowMerged); }, range).orElse(null); } } @Nullable - private static Direction getDirectionToPlaceAt(WorldView world, BlockPos pos, Direction direction) { + private static Direction getDirectionToPlaceAt(LevelReader world, BlockPos pos, Direction direction) { Direction direction2; if (canPlaceAtWithDirection(world, pos, direction)) { direction2 = direction; @@ -397,31 +411,31 @@ private static Direction getDirectionToPlaceAt(WorldView world, BlockPos pos, Di return direction2; } - private static Thickness getThickness(WorldView world, BlockPos pos, Direction direction, boolean tryMerge) { + private static DripstoneThickness getThickness(LevelReader world, BlockPos pos, Direction direction, boolean tryMerge) { Direction direction2 = direction.getOpposite(); - BlockState blockState = world.getBlockState(pos.offset(direction)); + BlockState blockState = world.getBlockState(pos.relative(direction)); if (isPointedDripstoneFacingDirection(blockState, direction2)) { - return !tryMerge && blockState.get(THICKNESS) != Thickness.TIP_MERGE ? Thickness.TIP : Thickness.TIP_MERGE; + return !tryMerge && blockState.getValue(THICKNESS) != DripstoneThickness.TIP_MERGE ? DripstoneThickness.TIP : DripstoneThickness.TIP_MERGE; } else if (!isPointedDripstoneFacingDirection(blockState, direction)) { - return Thickness.TIP; + return DripstoneThickness.TIP; } else { - Thickness thickness = (Thickness)blockState.get(THICKNESS); - if (thickness != Thickness.TIP && thickness != Thickness.TIP_MERGE) { - BlockState blockState2 = world.getBlockState(pos.offset(direction2)); - return !isPointedDripstoneFacingDirection(blockState2, direction) ? Thickness.BASE : Thickness.MIDDLE; + DripstoneThickness thickness = (DripstoneThickness)blockState.getValue(THICKNESS); + if (thickness != DripstoneThickness.TIP && thickness != DripstoneThickness.TIP_MERGE) { + BlockState blockState2 = world.getBlockState(pos.relative(direction2)); + return !isPointedDripstoneFacingDirection(blockState2, direction) ? DripstoneThickness.BASE : DripstoneThickness.MIDDLE; } else { - return Thickness.FRUSTUM; + return DripstoneThickness.FRUSTUM; } } } public static boolean canDrip(BlockState state) { - return isPointingDown(state) && state.get(THICKNESS) == Thickness.TIP && !(Boolean)state.get(WATERLOGGED); + return isPointingDown(state) && state.getValue(THICKNESS) == DripstoneThickness.TIP && !(Boolean)state.getValue(WATERLOGGED); } - private static boolean canGrow(BlockState state, ServerWorld world, BlockPos pos) { - Direction direction = (Direction)state.get(VERTICAL_DIRECTION); - BlockPos blockPos = pos.offset(direction); + private static boolean canGrow(BlockState state, ServerLevel world, BlockPos pos) { + Direction direction = (Direction)state.getValue(VERTICAL_DIRECTION); + BlockPos blockPos = pos.relative(direction); BlockState blockState = world.getBlockState(blockPos); if (!blockState.getFluidState().isEmpty()) { return false; @@ -430,33 +444,33 @@ private static boolean canGrow(BlockState state, ServerWorld world, BlockPos pos } } - private static Optional getSupportingPos(World world, BlockPos pos, BlockState state, int range) { - Direction direction = (Direction)state.get(VERTICAL_DIRECTION); + private static Optional getSupportingPos(Level world, BlockPos pos, BlockState state, int range) { + Direction direction = (Direction)state.getValue(VERTICAL_DIRECTION); BiPredicate biPredicate = (posx, statex) -> { - return statex.isOf(ModBlocks.POINTED_DOLOMITE) && statex.get(VERTICAL_DIRECTION) == direction; + return statex.is(ModBlocks.POINTED_DOLOMITE) && statex.getValue(VERTICAL_DIRECTION) == direction; }; - return searchInDirection(world, pos, direction.getOpposite().getDirection(), biPredicate, (statex) -> { - return !statex.isOf(ModBlocks.POINTED_DOLOMITE); + return searchInDirection(world, pos, direction.getOpposite().getAxisDirection(), biPredicate, (statex) -> { + return !statex.is(ModBlocks.POINTED_DOLOMITE); }, range); } - private static boolean canPlaceAtWithDirection(WorldView world, BlockPos pos, Direction direction) { - BlockPos blockPos = pos.offset(direction.getOpposite()); + private static boolean canPlaceAtWithDirection(LevelReader world, BlockPos pos, Direction direction) { + BlockPos blockPos = pos.relative(direction.getOpposite()); BlockState blockState = world.getBlockState(blockPos); - return blockState.isSideSolidFullSquare(world, blockPos, direction) || isPointedDripstoneFacingDirection(blockState, direction); + return blockState.isFaceSturdy(world, blockPos, direction) || isPointedDripstoneFacingDirection(blockState, direction); } private static boolean isTip(BlockState state, boolean allowMerged) { - if (!state.isOf(ModBlocks.POINTED_DOLOMITE)) { + if (!state.is(ModBlocks.POINTED_DOLOMITE)) { return false; } else { - Thickness thickness = (Thickness)state.get(THICKNESS); - return thickness == Thickness.TIP || allowMerged && thickness == Thickness.TIP_MERGE; + DripstoneThickness thickness = (DripstoneThickness)state.getValue(THICKNESS); + return thickness == DripstoneThickness.TIP || allowMerged && thickness == DripstoneThickness.TIP_MERGE; } } private static boolean isTip(BlockState state, Direction direction) { - return isTip(state, false) && state.get(VERTICAL_DIRECTION) == direction; + return isTip(state, false) && state.getValue(VERTICAL_DIRECTION) == direction; } private static boolean isPointingDown(BlockState state) { @@ -467,52 +481,52 @@ private static boolean isPointingUp(BlockState state) { return isPointedDripstoneFacingDirection(state, Direction.UP); } - private static boolean isHeldByPointedDripstone(BlockState state, WorldView world, BlockPos pos) { - return isPointingDown(state) && !world.getBlockState(pos.up()).isOf(ModBlocks.POINTED_DOLOMITE); + private static boolean isHeldByPointedDripstone(BlockState state, LevelReader world, BlockPos pos) { + return isPointingDown(state) && !world.getBlockState(pos.above()).is(ModBlocks.POINTED_DOLOMITE); } - protected boolean canPathfindThrough(BlockState state, NavigationType type) { + protected boolean isPathfindable(BlockState state, PathComputationType type) { return false; } private static boolean isPointedDripstoneFacingDirection(BlockState state, Direction direction) { - return state.isOf(ModBlocks.POINTED_DOLOMITE) && state.get(VERTICAL_DIRECTION) == direction; + return state.is(ModBlocks.POINTED_DOLOMITE) && state.getValue(VERTICAL_DIRECTION) == direction; } @Nullable - private static BlockPos getCauldronPos(World world, BlockPos pos, Fluid fluid) { + private static BlockPos getCauldronPos(Level world, BlockPos pos, Fluid fluid) { Predicate predicate = (state) -> { - return state.getBlock() instanceof AbstractCauldronBlock && ((AbstractCauldronBlock)state.getBlock()).canBeFilledByDripstone(fluid); + return state.getBlock() instanceof AbstractCauldronBlock && ((AbstractCauldronBlock)state.getBlock()).canReceiveStalactiteDrip(fluid); }; BiPredicate biPredicate = (posx, state) -> { return canDripThrough(world, posx, state); }; - return (BlockPos)searchInDirection(world, pos, Direction.DOWN.getDirection(), biPredicate, predicate, 11).orElse(null); + return (BlockPos)searchInDirection(world, pos, Direction.DOWN.getAxisDirection(), biPredicate, predicate, 11).orElse(null); } @Nullable - public static BlockPos getDripPos(World world, BlockPos pos) { + public static BlockPos getDripPos(Level world, BlockPos pos) { BiPredicate biPredicate = (posx, state) -> { return canDripThrough(world, posx, state); }; - return (BlockPos)searchInDirection(world, pos, Direction.UP.getDirection(), biPredicate, PointedDolomiteBlock::canDrip, 11).orElse(null); + return (BlockPos)searchInDirection(world, pos, Direction.UP.getAxisDirection(), biPredicate, PointedDolomiteBlock::canDrip, 11).orElse(null); } - public static Fluid getDripFluid(ServerWorld world, BlockPos pos) { + public static Fluid getDripFluid(ServerLevel world, BlockPos pos) { return (Fluid)getFluid(world, pos, world.getBlockState(pos)).map((fluid) -> { return fluid.fluid; }).filter(PointedDolomiteBlock::isFluidLiquid).orElse(Fluids.EMPTY); } - private static Optional getFluid(World world, BlockPos pos, BlockState state) { + private static Optional getFluid(Level world, BlockPos pos, BlockState state) { return !isPointingDown(state) ? Optional.empty() : getSupportingPos(world, pos, state, 11).map((posx) -> { - BlockPos blockPos = posx.up(); + BlockPos blockPos = posx.above(); BlockState blockState = world.getBlockState(blockPos); Object fluid; - if (blockState.isOf(Blocks.MUD) && !world.getDimension().ultrawarm()) { + if (blockState.is(Blocks.MUD) && !world.dimensionType().ultraWarm()) { fluid = Fluids.WATER; } else { - fluid = world.getFluidState(blockPos).getFluid(); + fluid = world.getFluidState(blockPos).getType(); } return new PointedDolomiteBlock.DrippingFluid(blockPos, (Fluid)fluid, blockState); @@ -524,29 +538,29 @@ private static boolean isFluidLiquid(Fluid fluid) { } private static boolean canGrow(BlockState dripstoneBlockState, BlockState waterState) { - return dripstoneBlockState.isOf(StoneBlockSets.DOLOMITE_SET.baseBlocks.base()) && waterState.isOf(Blocks.WATER) && waterState.getFluidState().isStill(); + return dripstoneBlockState.is(StoneBlockSets.DOLOMITE_SET.baseBlocks.base()) && waterState.is(Blocks.WATER) && waterState.getFluidState().isSource(); } - private static Fluid getDripFluid(World world, Fluid fluid) { - if (fluid.matchesType(Fluids.EMPTY)) { - return world.getDimension().ultrawarm() ? Fluids.LAVA : Fluids.WATER; + private static Fluid getDripFluid(Level world, Fluid fluid) { + if (fluid.isSame(Fluids.EMPTY)) { + return world.dimensionType().ultraWarm() ? Fluids.LAVA : Fluids.WATER; } else { return fluid; } } - private static Optional searchInDirection(WorldAccess world, BlockPos pos, Direction.AxisDirection direction, BiPredicate continuePredicate, Predicate stopPredicate, int range) { + private static Optional searchInDirection(LevelAccessor world, BlockPos pos, Direction.AxisDirection direction, BiPredicate continuePredicate, Predicate stopPredicate, int range) { Direction direction2 = Direction.get(direction, Direction.Axis.Y); - BlockPos.Mutable mutable = pos.mutableCopy(); + BlockPos.MutableBlockPos mutable = pos.mutable(); for(int i = 1; i < range; ++i) { mutable.move(direction2); BlockState blockState = world.getBlockState(mutable); if (stopPredicate.test(blockState)) { - return Optional.of(mutable.toImmutable()); + return Optional.of(mutable.immutable()); } - if (world.isOutOfHeightLimit(mutable.getY()) || !continuePredicate.test(mutable, blockState)) { + if (world.isOutsideBuildHeight(mutable.getY()) || !continuePredicate.test(mutable, blockState)) { return Optional.empty(); } } @@ -554,32 +568,32 @@ private static Optional searchInDirection(WorldAccess world, BlockPos return Optional.empty(); } - private static boolean canDripThrough(BlockView world, BlockPos pos, BlockState state) { + private static boolean canDripThrough(BlockGetter world, BlockPos pos, BlockState state) { if (state.isAir()) { return true; - } else if (state.isOpaqueFullCube()) { + } else if (state.isSolidRender(world, pos)) { return false; } else if (!state.getFluidState().isEmpty()) { return false; } else { VoxelShape voxelShape = state.getCollisionShape(world, pos); - return !VoxelShapes.matchesAnywhere(DRIP_COLLISION_SHAPE, voxelShape, BooleanBiFunction.AND); + return !Shapes.joinIsNotEmpty(DRIP_COLLISION_SHAPE, voxelShape, BooleanOp.AND); } } static { - VERTICAL_DIRECTION = Properties.VERTICAL_DIRECTION; - THICKNESS = Properties.THICKNESS; - WATERLOGGED = Properties.WATERLOGGED; - TIP_MERGE_SHAPE = Block.createColumnShape(6.0, 0.0, 16.0); - UP_TIP_SHAPE = Block.createColumnShape(6.0, 0.0, 11.0); - DOWN_TIP_SHAPE = Block.createColumnShape(6.0, 5.0, 16.0); - BASE_SHAPE = Block.createColumnShape(8.0, 0.0, 16.0); - FRUSTUM_SHAPE = Block.createColumnShape(10.0, 0.0, 16.0); - MIDDLE_SHAPE = Block.createColumnShape(12.0, 0.0, 16.0); - DOWN_TIP_Y = DOWN_TIP_SHAPE.getMin(Direction.Axis.Y); - MAX_HORIZONTAL_MODEL_OFFSET = (float)MIDDLE_SHAPE.getMin(Direction.Axis.X); - DRIP_COLLISION_SHAPE = Block.createColumnShape(4.0, 0.0, 16.0); + VERTICAL_DIRECTION = BlockStateProperties.VERTICAL_DIRECTION; + THICKNESS = BlockStateProperties.DRIPSTONE_THICKNESS; + WATERLOGGED = BlockStateProperties.WATERLOGGED; + TIP_MERGE_SHAPE = Block.box(5.0, 0.0, 5.0, 11.0, 16.0, 11.0); + UP_TIP_SHAPE = Block.box(5.0, 0.0, 5.0, 11.0, 11.0, 11.0); + DOWN_TIP_SHAPE = Block.box(5.0, 5.0, 5.0, 11.0, 16.0, 11.0); + BASE_SHAPE = Block.box(4.0, 0.0, 4.0, 12.0, 16.0, 12.0); + FRUSTUM_SHAPE = Block.box(3.0, 0.0, 3.0, 13.0, 16.0, 13.0); + MIDDLE_SHAPE = Block.box(2.0, 0.0, 2.0, 14.0, 16.0, 14.0); + DOWN_TIP_Y = DOWN_TIP_SHAPE.min(Direction.Axis.Y); + MAX_HORIZONTAL_MODEL_OFFSET = (float)MIDDLE_SHAPE.min(Direction.Axis.X); + DRIP_COLLISION_SHAPE = Block.box(6.0, 0.0, 6.0, 10.0, 16.0, 10.0); } static record DrippingFluid(BlockPos pos, Fluid fluid, BlockState sourceState) { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pointedBlocks/PointedGalonnBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pointedBlocks/PointedGalonnBlock.java index 9a238c6324..9e5a1bd102 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pointedBlocks/PointedGalonnBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pointedBlocks/PointedGalonnBlock.java @@ -2,50 +2,62 @@ import com.google.common.annotations.VisibleForTesting; import com.mojang.serialization.MapCodec; -import net.minecraft.world.tick.ScheduledTickView; import net.sevenstars.middleearth.block.registration.ModBlocks; import net.sevenstars.middleearth.block.registration.StoneBlockSets; -import net.minecraft.block.*; -import net.minecraft.block.enums.Thickness; -import net.minecraft.entity.Entity; -import net.minecraft.entity.FallingBlockEntity; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.entity.projectile.TridentEntity; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.particle.ParticleEffect; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.tag.FluidTags; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.*; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.block.state.properties.*; +import net.minecraft.tags.FluidTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.item.FallingBlockEntity; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.entity.projectile.ThrownTrident; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.AbstractCauldronBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Fallable; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.DripstoneThickness; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; import java.util.Optional; import java.util.function.BiPredicate; import java.util.function.Predicate; -public class PointedGalonnBlock extends Block implements Falling, Waterloggable { - public static final MapCodec CODEC = createCodec(PointedGalonnBlock::new); +public class PointedGalonnBlock extends Block implements Fallable, SimpleWaterloggedBlock { + public static final MapCodec CODEC = simpleCodec(PointedGalonnBlock::new); public static final EnumProperty VERTICAL_DIRECTION; - public static final EnumProperty THICKNESS; + public static final EnumProperty THICKNESS; public static final BooleanProperty WATERLOGGED; private static final VoxelShape TIP_MERGE_SHAPE; private static final VoxelShape UP_TIP_SHAPE; @@ -57,73 +69,73 @@ public class PointedGalonnBlock extends Block implements Falling, Waterloggable private static final float MAX_HORIZONTAL_MODEL_OFFSET; private static final VoxelShape DRIP_COLLISION_SHAPE; - public MapCodec getCodec() { + public MapCodec codec() { return CODEC; } - public PointedGalonnBlock(AbstractBlock.Settings settings) { + public PointedGalonnBlock(BlockBehaviour.Properties settings) { super(settings); - this.setDefaultState((BlockState)((BlockState)((BlockState)((BlockState)this.stateManager.getDefaultState()).with(VERTICAL_DIRECTION, Direction.UP)).with(THICKNESS, Thickness.TIP)).with(WATERLOGGED, false)); + this.registerDefaultState((BlockState)((BlockState)((BlockState)((BlockState)this.stateDefinition.any()).setValue(VERTICAL_DIRECTION, Direction.UP)).setValue(THICKNESS, DripstoneThickness.TIP)).setValue(WATERLOGGED, false)); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(new Property[]{VERTICAL_DIRECTION, THICKNESS, WATERLOGGED}); } - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - return canPlaceAtWithDirection(world, pos, (Direction)state.get(VERTICAL_DIRECTION)); + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + return canPlaceAtWithDirection(world, pos, (Direction)state.getValue(VERTICAL_DIRECTION)); } - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if ((Boolean)state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if ((Boolean)state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } if (direction != Direction.UP && direction != Direction.DOWN) { return state; } else { - Direction direction2 = (Direction)state.get(VERTICAL_DIRECTION); - if (direction2 == Direction.DOWN && tickView.getBlockTickScheduler().isQueued(pos, this)) { + Direction direction2 = (Direction)state.getValue(VERTICAL_DIRECTION); + if (direction2 == Direction.DOWN && world.getBlockTicks().hasScheduledTick(pos, this)) { return state; - } else if (direction == direction2.getOpposite() && !this.canPlaceAt(state, world, pos)) { + } else if (direction == direction2.getOpposite() && !this.canSurvive(state, world, pos)) { if (direction2 == Direction.DOWN) { - tickView.scheduleBlockTick(pos, this, 2); + world.scheduleTick(pos, this, 2); } else { - tickView.scheduleBlockTick(pos, this, 1); + world.scheduleTick(pos, this, 1); } return state; } else { - boolean bl = state.get(THICKNESS) == Thickness.TIP_MERGE; - Thickness thickness = getThickness(world, pos, direction2, bl); - return (BlockState)state.with(THICKNESS, thickness); + boolean bl = state.getValue(THICKNESS) == DripstoneThickness.TIP_MERGE; + DripstoneThickness thickness = getThickness(world, pos, direction2, bl); + return (BlockState)state.setValue(THICKNESS, thickness); } } } - protected void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient) { + protected void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!world.isClientSide) { BlockPos blockPos = hit.getBlockPos(); - if (world instanceof ServerWorld) { - ServerWorld serverWorld = (ServerWorld)world; - if (projectile.canModifyAt(serverWorld, blockPos) && projectile.canBreakBlocks(serverWorld) && projectile instanceof TridentEntity && projectile.getVelocity().length() > 0.6) { - world.breakBlock(blockPos, true); + if (world instanceof ServerLevel) { + ServerLevel serverWorld = (ServerLevel)world; + if (projectile.mayInteract(serverWorld, blockPos) && projectile.mayBreak(serverWorld) && projectile instanceof ThrownTrident && projectile.getDeltaMovement().length() > 0.6) { + world.destroyBlock(blockPos, true); } } } } - public void onLandedUpon(World world, BlockState state, BlockPos pos, Entity entity, double fallDistance) { - if (state.get(VERTICAL_DIRECTION) == Direction.UP && state.get(THICKNESS) == Thickness.TIP) { - entity.handleFallDamage(fallDistance + 2.5, 2.0F, world.getDamageSources().stalagmite()); + public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) { + if (state.getValue(VERTICAL_DIRECTION) == Direction.UP && state.getValue(THICKNESS) == DripstoneThickness.TIP) { + entity.causeFallDamage(fallDistance + 2.5F, 2.0F, world.damageSources().stalagmite()); } else { - super.onLandedUpon(world, state, pos, entity, fallDistance); + super.fallOn(world, state, pos, entity, fallDistance); } } - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { + public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { if (canDrip(state)) { float f = random.nextFloat(); if (!(f > 0.12F)) { @@ -136,16 +148,16 @@ public void randomDisplayTick(BlockState state, World world, BlockPos pos, Rando } } - protected void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - if (isPointingUp(state) && !this.canPlaceAt(state, world, pos)) { - world.breakBlock(pos, true); + protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + if (isPointingUp(state) && !this.canSurvive(state, world, pos)) { + world.destroyBlock(pos, true); } else { spawnFallingBlock(state, world, pos); } } - protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { dripTick(state, world, pos, random.nextFloat()); if (random.nextFloat() < 0.011377778F && isHeldByPointedDripstone(state, world, pos)) { tryGrow(state, world, pos, random); @@ -154,7 +166,7 @@ protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Ran } @VisibleForTesting - public static void dripTick(BlockState state, ServerWorld world, BlockPos pos, float dripChance) { + public static void dripTick(BlockState state, ServerLevel world, BlockPos pos, float dripChance) { if (!(dripChance > 0.17578125F) || !(dripChance > 0.05859375F)) { if (isHeldByPointedDripstone(state, world, pos)) { Optional optional = getFluid(world, pos, state); @@ -174,20 +186,20 @@ public static void dripTick(BlockState state, ServerWorld world, BlockPos pos, f if (!(dripChance >= f)) { BlockPos blockPos = getTipPos(state, world, pos, 11, false); if (blockPos != null) { - if (((PointedGalonnBlock.DrippingFluid)optional.get()).sourceState.isOf(Blocks.MUD) && fluid == Fluids.WATER) { - BlockState blockState = Blocks.CLAY.getDefaultState(); - world.setBlockState(((PointedGalonnBlock.DrippingFluid)optional.get()).pos, blockState); - Block.pushEntitiesUpBeforeBlockChange(((PointedGalonnBlock.DrippingFluid)optional.get()).sourceState, blockState, world, ((PointedGalonnBlock.DrippingFluid)optional.get()).pos); - world.emitGameEvent(GameEvent.BLOCK_CHANGE, ((PointedGalonnBlock.DrippingFluid)optional.get()).pos, GameEvent.Emitter.of(blockState)); - world.syncWorldEvent(1504, blockPos, 0); + if (((PointedGalonnBlock.DrippingFluid)optional.get()).sourceState.is(Blocks.MUD) && fluid == Fluids.WATER) { + BlockState blockState = Blocks.CLAY.defaultBlockState(); + world.setBlockAndUpdate(((PointedGalonnBlock.DrippingFluid)optional.get()).pos, blockState); + Block.pushEntitiesUp(((PointedGalonnBlock.DrippingFluid)optional.get()).sourceState, blockState, world, ((PointedGalonnBlock.DrippingFluid)optional.get()).pos); + world.gameEvent(GameEvent.BLOCK_CHANGE, ((PointedGalonnBlock.DrippingFluid)optional.get()).pos, GameEvent.Context.of(blockState)); + world.levelEvent(1504, blockPos, 0); } else { BlockPos blockPos2 = getCauldronPos(world, blockPos, fluid); if (blockPos2 != null) { - world.syncWorldEvent(1504, blockPos, 0); + world.levelEvent(1504, blockPos, 0); int i = blockPos.getY() - blockPos2.getY(); int j = 50 + i; BlockState blockState2 = world.getBlockState(blockPos2); - world.scheduleBlockTick(blockPos2, blockState2.getBlock(), j); + world.scheduleTick(blockPos2, blockState2.getBlock(), j); } } } @@ -198,33 +210,34 @@ public static void dripTick(BlockState state, ServerWorld world, BlockPos pos, f } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - WorldAccess worldAccess = ctx.getWorld(); - BlockPos blockPos = ctx.getBlockPos(); - Direction direction = ctx.getVerticalPlayerLookDirection().getOpposite(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + LevelAccessor worldAccess = ctx.getLevel(); + BlockPos blockPos = ctx.getClickedPos(); + Direction direction = ctx.getNearestLookingVerticalDirection().getOpposite(); Direction direction2 = getDirectionToPlaceAt(worldAccess, blockPos, direction); if (direction2 == null) { return null; } else { - boolean bl = !ctx.shouldCancelInteraction(); - Thickness thickness = getThickness(worldAccess, blockPos, direction2, bl); - return thickness == null ? null : (BlockState)((BlockState)((BlockState)this.getDefaultState().with(VERTICAL_DIRECTION, direction2)).with(THICKNESS, thickness)).with(WATERLOGGED, worldAccess.getFluidState(blockPos).getFluid() == Fluids.WATER); + boolean bl = !ctx.isSecondaryUseActive(); + DripstoneThickness thickness = getThickness(worldAccess, blockPos, direction2, bl); + return thickness == null ? null : (BlockState)((BlockState)((BlockState)this.defaultBlockState().setValue(VERTICAL_DIRECTION, direction2)).setValue(THICKNESS, thickness)).setValue(WATERLOGGED, worldAccess.getFluidState(blockPos).getType() == Fluids.WATER); } } protected FluidState getFluidState(BlockState state) { - return (Boolean)state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return (Boolean)state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } - protected VoxelShape getCullingShape(BlockState state) { - return VoxelShapes.empty(); + @Override + protected VoxelShape getOcclusionShape(BlockState state, BlockGetter world, BlockPos pos) { + return Shapes.empty(); } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { VoxelShape var10000; - switch ((Thickness)state.get(THICKNESS)) { + switch ((DripstoneThickness)state.getValue(THICKNESS)) { case TIP_MERGE -> var10000 = TIP_MERGE_SHAPE; - case TIP -> var10000 = state.get(VERTICAL_DIRECTION) == Direction.DOWN ? DOWN_TIP_SHAPE : UP_TIP_SHAPE; + case TIP -> var10000 = state.getValue(VERTICAL_DIRECTION) == Direction.DOWN ? DOWN_TIP_SHAPE : UP_TIP_SHAPE; case FRUSTUM -> var10000 = BASE_SHAPE; case MIDDLE -> var10000 = FRUSTUM_SHAPE; case BASE -> var10000 = MIDDLE_SHAPE; @@ -232,37 +245,38 @@ protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos } VoxelShape voxelShape = var10000; - return voxelShape.offset(state.getModelOffset(pos)); + Vec3 offset = state.getOffset(world, pos); + return voxelShape.move(offset.x, 0.0, offset.z); } - protected boolean isShapeFullCube(BlockState state, BlockView world, BlockPos pos) { + protected boolean isCollisionShapeFullBlock(BlockState state, BlockGetter world, BlockPos pos) { return false; } - protected float getMaxHorizontalModelOffset() { + protected float getMaxHorizontalOffset() { return MAX_HORIZONTAL_MODEL_OFFSET; } - public void onDestroyedOnLanding(World world, BlockPos pos, FallingBlockEntity fallingBlockEntity) { + public void onBrokenAfterFall(Level world, BlockPos pos, FallingBlockEntity fallingBlockEntity) { if (!fallingBlockEntity.isSilent()) { - world.syncWorldEvent(1045, pos, 0); + world.levelEvent(1045, pos, 0); } } - public DamageSource getDamageSource(Entity attacker) { - return attacker.getDamageSources().fallingStalactite(attacker); + public DamageSource getFallDamageSource(Entity attacker) { + return attacker.damageSources().fallingStalactite(attacker); } - private static void spawnFallingBlock(BlockState state, ServerWorld world, BlockPos pos) { - BlockPos.Mutable mutable = pos.mutableCopy(); + private static void spawnFallingBlock(BlockState state, ServerLevel world, BlockPos pos) { + BlockPos.MutableBlockPos mutable = pos.mutable(); for(BlockState blockState = state; isPointingDown(blockState); blockState = world.getBlockState(mutable)) { - FallingBlockEntity fallingBlockEntity = FallingBlockEntity.spawnFromBlock(world, mutable, blockState); + FallingBlockEntity fallingBlockEntity = FallingBlockEntity.fall(world, mutable, blockState); if (isTip(blockState, true)) { int i = Math.max(1 + pos.getY() - mutable.getY(), 6); float f = 1.0F * (float)i; - fallingBlockEntity.setHurtEntities(f, 40); + fallingBlockEntity.setHurtsEntities(f, 40); break; } @@ -272,9 +286,9 @@ private static void spawnFallingBlock(BlockState state, ServerWorld world, Block } @VisibleForTesting - public static void tryGrow(BlockState state, ServerWorld world, BlockPos pos, Random random) { - BlockState blockState = world.getBlockState(pos.up(1)); - BlockState blockState2 = world.getBlockState(pos.up(2)); + public static void tryGrow(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + BlockState blockState = world.getBlockState(pos.above(1)); + BlockState blockState2 = world.getBlockState(pos.above(2)); if (canGrow(blockState, blockState2)) { BlockPos blockPos = getTipPos(state, world, pos, 7, false); if (blockPos != null) { @@ -291,8 +305,8 @@ public static void tryGrow(BlockState state, ServerWorld world, BlockPos pos, Ra } } - private static void tryGrowStalagmite(ServerWorld world, BlockPos pos) { - BlockPos.Mutable mutable = pos.mutableCopy(); + private static void tryGrowStalagmite(ServerLevel world, BlockPos pos) { + BlockPos.MutableBlockPos mutable = pos.mutable(); for(int i = 0; i < 10; ++i) { mutable.move(Direction.DOWN); @@ -306,8 +320,8 @@ private static void tryGrowStalagmite(ServerWorld world, BlockPos pos) { return; } - if (canPlaceAtWithDirection(world, mutable, Direction.UP) && !world.isWater(mutable.down())) { - tryGrow(world, mutable.down(), Direction.UP); + if (canPlaceAtWithDirection(world, mutable, Direction.UP) && !world.isWaterAt(mutable.below())) { + tryGrow(world, mutable.below(), Direction.UP); return; } @@ -318,71 +332,71 @@ private static void tryGrowStalagmite(ServerWorld world, BlockPos pos) { } - private static void tryGrow(ServerWorld world, BlockPos pos, Direction direction) { - BlockPos blockPos = pos.offset(direction); + private static void tryGrow(ServerLevel world, BlockPos pos, Direction direction) { + BlockPos blockPos = pos.relative(direction); BlockState blockState = world.getBlockState(blockPos); if (isTip(blockState, direction.getOpposite())) { growMerged(blockState, world, blockPos); - } else if (blockState.isAir() || blockState.isOf(Blocks.WATER)) { - place(world, blockPos, direction, Thickness.TIP); + } else if (blockState.isAir() || blockState.is(Blocks.WATER)) { + place(world, blockPos, direction, DripstoneThickness.TIP); } } - private static void place(WorldAccess world, BlockPos pos, Direction direction, Thickness thickness) { - BlockState blockState = (BlockState)((BlockState)((BlockState)ModBlocks.POINTED_GALONN.getDefaultState().with(VERTICAL_DIRECTION, direction)).with(THICKNESS, thickness)).with(WATERLOGGED, world.getFluidState(pos).getFluid() == Fluids.WATER); - world.setBlockState(pos, blockState, 3); + private static void place(LevelAccessor world, BlockPos pos, Direction direction, DripstoneThickness thickness) { + BlockState blockState = (BlockState)((BlockState)((BlockState)ModBlocks.POINTED_GALONN.defaultBlockState().setValue(VERTICAL_DIRECTION, direction)).setValue(THICKNESS, thickness)).setValue(WATERLOGGED, world.getFluidState(pos).getType() == Fluids.WATER); + world.setBlock(pos, blockState, 3); } - private static void growMerged(BlockState state, WorldAccess world, BlockPos pos) { + private static void growMerged(BlockState state, LevelAccessor world, BlockPos pos) { BlockPos blockPos2; BlockPos blockPos; - if (state.get(VERTICAL_DIRECTION) == Direction.UP) { + if (state.getValue(VERTICAL_DIRECTION) == Direction.UP) { blockPos = pos; - blockPos2 = pos.up(); + blockPos2 = pos.above(); } else { blockPos2 = pos; - blockPos = pos.down(); + blockPos = pos.below(); } - place(world, blockPos2, Direction.DOWN, Thickness.TIP_MERGE); - place(world, blockPos, Direction.UP, Thickness.TIP_MERGE); + place(world, blockPos2, Direction.DOWN, DripstoneThickness.TIP_MERGE); + place(world, blockPos, Direction.UP, DripstoneThickness.TIP_MERGE); } - public static void createParticle(World world, BlockPos pos, BlockState state) { + public static void createParticle(Level world, BlockPos pos, BlockState state) { getFluid(world, pos, state).ifPresent((fluid) -> { createParticle(world, pos, state, fluid.fluid); }); } - private static void createParticle(World world, BlockPos pos, BlockState state, Fluid fluid) { - Vec3d vec3d = state.getModelOffset(pos); + private static void createParticle(Level world, BlockPos pos, BlockState state, Fluid fluid) { + Vec3 vec3d = state.getOffset(world, pos); double d = 0.0625; double e = (double)pos.getX() + 0.5 + vec3d.x; double f = (double)pos.getY() + DOWN_TIP_Y - 0.0625; double g = (double)pos.getZ() + 0.5 + vec3d.z; Fluid fluid2 = getDripFluid(world, fluid); - ParticleEffect particleEffect = fluid2.isIn(FluidTags.LAVA) ? ParticleTypes.DRIPPING_DRIPSTONE_LAVA : ParticleTypes.DRIPPING_DRIPSTONE_WATER; - world.addParticleClient(particleEffect, e, f, g, 0.0, 0.0, 0.0); + ParticleOptions particleEffect = fluid2.is(FluidTags.LAVA) ? ParticleTypes.DRIPPING_DRIPSTONE_LAVA : ParticleTypes.DRIPPING_DRIPSTONE_WATER; + world.addParticle(particleEffect, e, f, g, 0.0, 0.0, 0.0); } @Nullable - private static BlockPos getTipPos(BlockState state, WorldAccess world, BlockPos pos, int range, boolean allowMerged) { + private static BlockPos getTipPos(BlockState state, LevelAccessor world, BlockPos pos, int range, boolean allowMerged) { if (isTip(state, allowMerged)) { return pos; } else { - Direction direction = (Direction)state.get(VERTICAL_DIRECTION); + Direction direction = (Direction)state.getValue(VERTICAL_DIRECTION); BiPredicate biPredicate = (posx, statex) -> { - return statex.isOf(ModBlocks.POINTED_GALONN) && statex.get(VERTICAL_DIRECTION) == direction; + return statex.is(ModBlocks.POINTED_GALONN) && statex.getValue(VERTICAL_DIRECTION) == direction; }; - return (BlockPos)searchInDirection(world, pos, direction.getDirection(), biPredicate, (statex) -> { + return (BlockPos)searchInDirection(world, pos, direction.getAxisDirection(), biPredicate, (statex) -> { return isTip(statex, allowMerged); }, range).orElse(null); } } @Nullable - private static Direction getDirectionToPlaceAt(WorldView world, BlockPos pos, Direction direction) { + private static Direction getDirectionToPlaceAt(LevelReader world, BlockPos pos, Direction direction) { Direction direction2; if (canPlaceAtWithDirection(world, pos, direction)) { direction2 = direction; @@ -397,31 +411,31 @@ private static Direction getDirectionToPlaceAt(WorldView world, BlockPos pos, Di return direction2; } - private static Thickness getThickness(WorldView world, BlockPos pos, Direction direction, boolean tryMerge) { + private static DripstoneThickness getThickness(LevelReader world, BlockPos pos, Direction direction, boolean tryMerge) { Direction direction2 = direction.getOpposite(); - BlockState blockState = world.getBlockState(pos.offset(direction)); + BlockState blockState = world.getBlockState(pos.relative(direction)); if (isPointedDripstoneFacingDirection(blockState, direction2)) { - return !tryMerge && blockState.get(THICKNESS) != Thickness.TIP_MERGE ? Thickness.TIP : Thickness.TIP_MERGE; + return !tryMerge && blockState.getValue(THICKNESS) != DripstoneThickness.TIP_MERGE ? DripstoneThickness.TIP : DripstoneThickness.TIP_MERGE; } else if (!isPointedDripstoneFacingDirection(blockState, direction)) { - return Thickness.TIP; + return DripstoneThickness.TIP; } else { - Thickness thickness = (Thickness)blockState.get(THICKNESS); - if (thickness != Thickness.TIP && thickness != Thickness.TIP_MERGE) { - BlockState blockState2 = world.getBlockState(pos.offset(direction2)); - return !isPointedDripstoneFacingDirection(blockState2, direction) ? Thickness.BASE : Thickness.MIDDLE; + DripstoneThickness thickness = (DripstoneThickness)blockState.getValue(THICKNESS); + if (thickness != DripstoneThickness.TIP && thickness != DripstoneThickness.TIP_MERGE) { + BlockState blockState2 = world.getBlockState(pos.relative(direction2)); + return !isPointedDripstoneFacingDirection(blockState2, direction) ? DripstoneThickness.BASE : DripstoneThickness.MIDDLE; } else { - return Thickness.FRUSTUM; + return DripstoneThickness.FRUSTUM; } } } public static boolean canDrip(BlockState state) { - return isPointingDown(state) && state.get(THICKNESS) == Thickness.TIP && !(Boolean)state.get(WATERLOGGED); + return isPointingDown(state) && state.getValue(THICKNESS) == DripstoneThickness.TIP && !(Boolean)state.getValue(WATERLOGGED); } - private static boolean canGrow(BlockState state, ServerWorld world, BlockPos pos) { - Direction direction = (Direction)state.get(VERTICAL_DIRECTION); - BlockPos blockPos = pos.offset(direction); + private static boolean canGrow(BlockState state, ServerLevel world, BlockPos pos) { + Direction direction = (Direction)state.getValue(VERTICAL_DIRECTION); + BlockPos blockPos = pos.relative(direction); BlockState blockState = world.getBlockState(blockPos); if (!blockState.getFluidState().isEmpty()) { return false; @@ -430,33 +444,33 @@ private static boolean canGrow(BlockState state, ServerWorld world, BlockPos pos } } - private static Optional getSupportingPos(World world, BlockPos pos, BlockState state, int range) { - Direction direction = (Direction)state.get(VERTICAL_DIRECTION); + private static Optional getSupportingPos(Level world, BlockPos pos, BlockState state, int range) { + Direction direction = (Direction)state.getValue(VERTICAL_DIRECTION); BiPredicate biPredicate = (posx, statex) -> { - return statex.isOf(ModBlocks.POINTED_GALONN) && statex.get(VERTICAL_DIRECTION) == direction; + return statex.is(ModBlocks.POINTED_GALONN) && statex.getValue(VERTICAL_DIRECTION) == direction; }; - return searchInDirection(world, pos, direction.getOpposite().getDirection(), biPredicate, (statex) -> { - return !statex.isOf(ModBlocks.POINTED_GALONN); + return searchInDirection(world, pos, direction.getOpposite().getAxisDirection(), biPredicate, (statex) -> { + return !statex.is(ModBlocks.POINTED_GALONN); }, range); } - private static boolean canPlaceAtWithDirection(WorldView world, BlockPos pos, Direction direction) { - BlockPos blockPos = pos.offset(direction.getOpposite()); + private static boolean canPlaceAtWithDirection(LevelReader world, BlockPos pos, Direction direction) { + BlockPos blockPos = pos.relative(direction.getOpposite()); BlockState blockState = world.getBlockState(blockPos); - return blockState.isSideSolidFullSquare(world, blockPos, direction) || isPointedDripstoneFacingDirection(blockState, direction); + return blockState.isFaceSturdy(world, blockPos, direction) || isPointedDripstoneFacingDirection(blockState, direction); } private static boolean isTip(BlockState state, boolean allowMerged) { - if (!state.isOf(ModBlocks.POINTED_GALONN)) { + if (!state.is(ModBlocks.POINTED_GALONN)) { return false; } else { - Thickness thickness = (Thickness)state.get(THICKNESS); - return thickness == Thickness.TIP || allowMerged && thickness == Thickness.TIP_MERGE; + DripstoneThickness thickness = (DripstoneThickness)state.getValue(THICKNESS); + return thickness == DripstoneThickness.TIP || allowMerged && thickness == DripstoneThickness.TIP_MERGE; } } private static boolean isTip(BlockState state, Direction direction) { - return isTip(state, false) && state.get(VERTICAL_DIRECTION) == direction; + return isTip(state, false) && state.getValue(VERTICAL_DIRECTION) == direction; } private static boolean isPointingDown(BlockState state) { @@ -467,52 +481,52 @@ private static boolean isPointingUp(BlockState state) { return isPointedDripstoneFacingDirection(state, Direction.UP); } - private static boolean isHeldByPointedDripstone(BlockState state, WorldView world, BlockPos pos) { - return isPointingDown(state) && !world.getBlockState(pos.up()).isOf(ModBlocks.POINTED_GALONN); + private static boolean isHeldByPointedDripstone(BlockState state, LevelReader world, BlockPos pos) { + return isPointingDown(state) && !world.getBlockState(pos.above()).is(ModBlocks.POINTED_GALONN); } - protected boolean canPathfindThrough(BlockState state, NavigationType type) { + protected boolean isPathfindable(BlockState state, PathComputationType type) { return false; } private static boolean isPointedDripstoneFacingDirection(BlockState state, Direction direction) { - return state.isOf(ModBlocks.POINTED_GALONN) && state.get(VERTICAL_DIRECTION) == direction; + return state.is(ModBlocks.POINTED_GALONN) && state.getValue(VERTICAL_DIRECTION) == direction; } @Nullable - private static BlockPos getCauldronPos(World world, BlockPos pos, Fluid fluid) { + private static BlockPos getCauldronPos(Level world, BlockPos pos, Fluid fluid) { Predicate predicate = (state) -> { - return state.getBlock() instanceof AbstractCauldronBlock && ((AbstractCauldronBlock)state.getBlock()).canBeFilledByDripstone(fluid); + return state.getBlock() instanceof AbstractCauldronBlock && ((AbstractCauldronBlock)state.getBlock()).canReceiveStalactiteDrip(fluid); }; BiPredicate biPredicate = (posx, state) -> { return canDripThrough(world, posx, state); }; - return (BlockPos)searchInDirection(world, pos, Direction.DOWN.getDirection(), biPredicate, predicate, 11).orElse(null); + return (BlockPos)searchInDirection(world, pos, Direction.DOWN.getAxisDirection(), biPredicate, predicate, 11).orElse(null); } @Nullable - public static BlockPos getDripPos(World world, BlockPos pos) { + public static BlockPos getDripPos(Level world, BlockPos pos) { BiPredicate biPredicate = (posx, state) -> { return canDripThrough(world, posx, state); }; - return (BlockPos)searchInDirection(world, pos, Direction.UP.getDirection(), biPredicate, PointedGalonnBlock::canDrip, 11).orElse(null); + return (BlockPos)searchInDirection(world, pos, Direction.UP.getAxisDirection(), biPredicate, PointedGalonnBlock::canDrip, 11).orElse(null); } - public static Fluid getDripFluid(ServerWorld world, BlockPos pos) { + public static Fluid getDripFluid(ServerLevel world, BlockPos pos) { return (Fluid)getFluid(world, pos, world.getBlockState(pos)).map((fluid) -> { return fluid.fluid; }).filter(PointedGalonnBlock::isFluidLiquid).orElse(Fluids.EMPTY); } - private static Optional getFluid(World world, BlockPos pos, BlockState state) { + private static Optional getFluid(Level world, BlockPos pos, BlockState state) { return !isPointingDown(state) ? Optional.empty() : getSupportingPos(world, pos, state, 11).map((posx) -> { - BlockPos blockPos = posx.up(); + BlockPos blockPos = posx.above(); BlockState blockState = world.getBlockState(blockPos); Object fluid; - if (blockState.isOf(Blocks.MUD) && !world.getDimension().ultrawarm()) { + if (blockState.is(Blocks.MUD) && !world.dimensionType().ultraWarm()) { fluid = Fluids.WATER; } else { - fluid = world.getFluidState(blockPos).getFluid(); + fluid = world.getFluidState(blockPos).getType(); } return new PointedGalonnBlock.DrippingFluid(blockPos, (Fluid)fluid, blockState); @@ -524,29 +538,29 @@ private static boolean isFluidLiquid(Fluid fluid) { } private static boolean canGrow(BlockState dripstoneBlockState, BlockState waterState) { - return dripstoneBlockState.isOf(StoneBlockSets.GALONN_SET.baseBlocks.base()) && waterState.isOf(Blocks.WATER) && waterState.getFluidState().isStill(); + return dripstoneBlockState.is(StoneBlockSets.GALONN_SET.baseBlocks.base()) && waterState.is(Blocks.WATER) && waterState.getFluidState().isSource(); } - private static Fluid getDripFluid(World world, Fluid fluid) { - if (fluid.matchesType(Fluids.EMPTY)) { - return world.getDimension().ultrawarm() ? Fluids.LAVA : Fluids.WATER; + private static Fluid getDripFluid(Level world, Fluid fluid) { + if (fluid.isSame(Fluids.EMPTY)) { + return world.dimensionType().ultraWarm() ? Fluids.LAVA : Fluids.WATER; } else { return fluid; } } - private static Optional searchInDirection(WorldAccess world, BlockPos pos, Direction.AxisDirection direction, BiPredicate continuePredicate, Predicate stopPredicate, int range) { + private static Optional searchInDirection(LevelAccessor world, BlockPos pos, Direction.AxisDirection direction, BiPredicate continuePredicate, Predicate stopPredicate, int range) { Direction direction2 = Direction.get(direction, Direction.Axis.Y); - BlockPos.Mutable mutable = pos.mutableCopy(); + BlockPos.MutableBlockPos mutable = pos.mutable(); for(int i = 1; i < range; ++i) { mutable.move(direction2); BlockState blockState = world.getBlockState(mutable); if (stopPredicate.test(blockState)) { - return Optional.of(mutable.toImmutable()); + return Optional.of(mutable.immutable()); } - if (world.isOutOfHeightLimit(mutable.getY()) || !continuePredicate.test(mutable, blockState)) { + if (world.isOutsideBuildHeight(mutable.getY()) || !continuePredicate.test(mutable, blockState)) { return Optional.empty(); } } @@ -554,32 +568,32 @@ private static Optional searchInDirection(WorldAccess world, BlockPos return Optional.empty(); } - private static boolean canDripThrough(BlockView world, BlockPos pos, BlockState state) { + private static boolean canDripThrough(BlockGetter world, BlockPos pos, BlockState state) { if (state.isAir()) { return true; - } else if (state.isOpaqueFullCube()) { + } else if (state.isSolidRender(world, pos)) { return false; } else if (!state.getFluidState().isEmpty()) { return false; } else { VoxelShape voxelShape = state.getCollisionShape(world, pos); - return !VoxelShapes.matchesAnywhere(DRIP_COLLISION_SHAPE, voxelShape, BooleanBiFunction.AND); + return !Shapes.joinIsNotEmpty(DRIP_COLLISION_SHAPE, voxelShape, BooleanOp.AND); } } static { - VERTICAL_DIRECTION = Properties.VERTICAL_DIRECTION; - THICKNESS = Properties.THICKNESS; - WATERLOGGED = Properties.WATERLOGGED; - TIP_MERGE_SHAPE = Block.createColumnShape(6.0, 0.0, 16.0); - UP_TIP_SHAPE = Block.createColumnShape(6.0, 0.0, 11.0); - DOWN_TIP_SHAPE = Block.createColumnShape(6.0, 5.0, 16.0); - BASE_SHAPE = Block.createColumnShape(8.0, 0.0, 16.0); - FRUSTUM_SHAPE = Block.createColumnShape(10.0, 0.0, 16.0); - MIDDLE_SHAPE = Block.createColumnShape(12.0, 0.0, 16.0); - DOWN_TIP_Y = DOWN_TIP_SHAPE.getMin(Direction.Axis.Y); - MAX_HORIZONTAL_MODEL_OFFSET = (float)MIDDLE_SHAPE.getMin(Direction.Axis.X); - DRIP_COLLISION_SHAPE = Block.createColumnShape(4.0, 0.0, 16.0); + VERTICAL_DIRECTION = BlockStateProperties.VERTICAL_DIRECTION; + THICKNESS = BlockStateProperties.DRIPSTONE_THICKNESS; + WATERLOGGED = BlockStateProperties.WATERLOGGED; + TIP_MERGE_SHAPE = Block.box(5.0, 0.0, 5.0, 11.0, 16.0, 11.0); + UP_TIP_SHAPE = Block.box(5.0, 0.0, 5.0, 11.0, 11.0, 11.0); + DOWN_TIP_SHAPE = Block.box(5.0, 5.0, 5.0, 11.0, 16.0, 11.0); + BASE_SHAPE = Block.box(4.0, 0.0, 4.0, 12.0, 16.0, 12.0); + FRUSTUM_SHAPE = Block.box(3.0, 0.0, 3.0, 13.0, 16.0, 13.0); + MIDDLE_SHAPE = Block.box(2.0, 0.0, 2.0, 14.0, 16.0, 14.0); + DOWN_TIP_Y = DOWN_TIP_SHAPE.min(Direction.Axis.Y); + MAX_HORIZONTAL_MODEL_OFFSET = (float)MIDDLE_SHAPE.min(Direction.Axis.X); + DRIP_COLLISION_SHAPE = Block.box(6.0, 0.0, 6.0, 10.0, 16.0, 10.0); } static record DrippingFluid(BlockPos pos, Fluid fluid, BlockState sourceState) { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pointedBlocks/PointedIzherabanBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pointedBlocks/PointedIzherabanBlock.java index 2d40ec914c..4893bd0952 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pointedBlocks/PointedIzherabanBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pointedBlocks/PointedIzherabanBlock.java @@ -2,50 +2,62 @@ import com.google.common.annotations.VisibleForTesting; import com.mojang.serialization.MapCodec; -import net.minecraft.world.tick.ScheduledTickView; import net.sevenstars.middleearth.block.registration.ModBlocks; import net.sevenstars.middleearth.block.registration.StoneBlockSets; -import net.minecraft.block.*; -import net.minecraft.block.enums.Thickness; -import net.minecraft.entity.Entity; -import net.minecraft.entity.FallingBlockEntity; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.entity.projectile.TridentEntity; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.particle.ParticleEffect; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.tag.FluidTags; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.*; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.block.state.properties.*; +import net.minecraft.tags.FluidTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.item.FallingBlockEntity; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.entity.projectile.ThrownTrident; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.AbstractCauldronBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Fallable; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.DripstoneThickness; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; import java.util.Optional; import java.util.function.BiPredicate; import java.util.function.Predicate; -public class PointedIzherabanBlock extends Block implements Falling, Waterloggable { - public static final MapCodec CODEC = createCodec(PointedIzherabanBlock::new); +public class PointedIzherabanBlock extends Block implements Fallable, SimpleWaterloggedBlock { + public static final MapCodec CODEC = simpleCodec(PointedIzherabanBlock::new); public static final EnumProperty VERTICAL_DIRECTION; - public static final EnumProperty THICKNESS; + public static final EnumProperty THICKNESS; public static final BooleanProperty WATERLOGGED; private static final VoxelShape TIP_MERGE_SHAPE; private static final VoxelShape UP_TIP_SHAPE; @@ -57,73 +69,73 @@ public class PointedIzherabanBlock extends Block implements Falling, Waterloggab private static final float MAX_HORIZONTAL_MODEL_OFFSET; private static final VoxelShape DRIP_COLLISION_SHAPE; - public MapCodec getCodec() { + public MapCodec codec() { return CODEC; } - public PointedIzherabanBlock(AbstractBlock.Settings settings) { + public PointedIzherabanBlock(BlockBehaviour.Properties settings) { super(settings); - this.setDefaultState((BlockState)((BlockState)((BlockState)((BlockState)this.stateManager.getDefaultState()).with(VERTICAL_DIRECTION, Direction.UP)).with(THICKNESS, Thickness.TIP)).with(WATERLOGGED, false)); + this.registerDefaultState((BlockState)((BlockState)((BlockState)((BlockState)this.stateDefinition.any()).setValue(VERTICAL_DIRECTION, Direction.UP)).setValue(THICKNESS, DripstoneThickness.TIP)).setValue(WATERLOGGED, false)); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(new Property[]{VERTICAL_DIRECTION, THICKNESS, WATERLOGGED}); } - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - return canPlaceAtWithDirection(world, pos, (Direction)state.get(VERTICAL_DIRECTION)); + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + return canPlaceAtWithDirection(world, pos, (Direction)state.getValue(VERTICAL_DIRECTION)); } - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if ((Boolean)state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if ((Boolean)state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } if (direction != Direction.UP && direction != Direction.DOWN) { return state; } else { - Direction direction2 = (Direction)state.get(VERTICAL_DIRECTION); - if (direction2 == Direction.DOWN && tickView.getBlockTickScheduler().isQueued(pos, this)) { + Direction direction2 = (Direction)state.getValue(VERTICAL_DIRECTION); + if (direction2 == Direction.DOWN && world.getBlockTicks().hasScheduledTick(pos, this)) { return state; - } else if (direction == direction2.getOpposite() && !this.canPlaceAt(state, world, pos)) { + } else if (direction == direction2.getOpposite() && !this.canSurvive(state, world, pos)) { if (direction2 == Direction.DOWN) { - tickView.scheduleBlockTick(pos, this, 2); + world.scheduleTick(pos, this, 2); } else { - tickView.scheduleBlockTick(pos, this, 1); + world.scheduleTick(pos, this, 1); } return state; } else { - boolean bl = state.get(THICKNESS) == Thickness.TIP_MERGE; - Thickness thickness = getThickness(world, pos, direction2, bl); - return (BlockState)state.with(THICKNESS, thickness); + boolean bl = state.getValue(THICKNESS) == DripstoneThickness.TIP_MERGE; + DripstoneThickness thickness = getThickness(world, pos, direction2, bl); + return (BlockState)state.setValue(THICKNESS, thickness); } } } - protected void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient) { + protected void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!world.isClientSide) { BlockPos blockPos = hit.getBlockPos(); - if (world instanceof ServerWorld) { - ServerWorld serverWorld = (ServerWorld)world; - if (projectile.canModifyAt(serverWorld, blockPos) && projectile.canBreakBlocks(serverWorld) && projectile instanceof TridentEntity && projectile.getVelocity().length() > 0.6) { - world.breakBlock(blockPos, true); + if (world instanceof ServerLevel) { + ServerLevel serverWorld = (ServerLevel)world; + if (projectile.mayInteract(serverWorld, blockPos) && projectile.mayBreak(serverWorld) && projectile instanceof ThrownTrident && projectile.getDeltaMovement().length() > 0.6) { + world.destroyBlock(blockPos, true); } } } } - public void onLandedUpon(World world, BlockState state, BlockPos pos, Entity entity, double fallDistance) { - if (state.get(VERTICAL_DIRECTION) == Direction.UP && state.get(THICKNESS) == Thickness.TIP) { - entity.handleFallDamage(fallDistance + 2.5, 2.0F, world.getDamageSources().stalagmite()); + public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) { + if (state.getValue(VERTICAL_DIRECTION) == Direction.UP && state.getValue(THICKNESS) == DripstoneThickness.TIP) { + entity.causeFallDamage(fallDistance + 2.5F, 2.0F, world.damageSources().stalagmite()); } else { - super.onLandedUpon(world, state, pos, entity, fallDistance); + super.fallOn(world, state, pos, entity, fallDistance); } } - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { + public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { if (canDrip(state)) { float f = random.nextFloat(); if (!(f > 0.12F)) { @@ -136,16 +148,16 @@ public void randomDisplayTick(BlockState state, World world, BlockPos pos, Rando } } - protected void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - if (isPointingUp(state) && !this.canPlaceAt(state, world, pos)) { - world.breakBlock(pos, true); + protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + if (isPointingUp(state) && !this.canSurvive(state, world, pos)) { + world.destroyBlock(pos, true); } else { spawnFallingBlock(state, world, pos); } } - protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { dripTick(state, world, pos, random.nextFloat()); if (random.nextFloat() < 0.011377778F && isHeldByPointedDripstone(state, world, pos)) { tryGrow(state, world, pos, random); @@ -154,7 +166,7 @@ protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Ran } @VisibleForTesting - public static void dripTick(BlockState state, ServerWorld world, BlockPos pos, float dripChance) { + public static void dripTick(BlockState state, ServerLevel world, BlockPos pos, float dripChance) { if (!(dripChance > 0.17578125F) || !(dripChance > 0.05859375F)) { if (isHeldByPointedDripstone(state, world, pos)) { Optional optional = getFluid(world, pos, state); @@ -174,20 +186,20 @@ public static void dripTick(BlockState state, ServerWorld world, BlockPos pos, f if (!(dripChance >= f)) { BlockPos blockPos = getTipPos(state, world, pos, 11, false); if (blockPos != null) { - if (((PointedIzherabanBlock.DrippingFluid)optional.get()).sourceState.isOf(Blocks.MUD) && fluid == Fluids.WATER) { - BlockState blockState = Blocks.CLAY.getDefaultState(); - world.setBlockState(((PointedIzherabanBlock.DrippingFluid)optional.get()).pos, blockState); - Block.pushEntitiesUpBeforeBlockChange(((PointedIzherabanBlock.DrippingFluid)optional.get()).sourceState, blockState, world, ((PointedIzherabanBlock.DrippingFluid)optional.get()).pos); - world.emitGameEvent(GameEvent.BLOCK_CHANGE, ((PointedIzherabanBlock.DrippingFluid)optional.get()).pos, GameEvent.Emitter.of(blockState)); - world.syncWorldEvent(1504, blockPos, 0); + if (((PointedIzherabanBlock.DrippingFluid)optional.get()).sourceState.is(Blocks.MUD) && fluid == Fluids.WATER) { + BlockState blockState = Blocks.CLAY.defaultBlockState(); + world.setBlockAndUpdate(((PointedIzherabanBlock.DrippingFluid)optional.get()).pos, blockState); + Block.pushEntitiesUp(((PointedIzherabanBlock.DrippingFluid)optional.get()).sourceState, blockState, world, ((PointedIzherabanBlock.DrippingFluid)optional.get()).pos); + world.gameEvent(GameEvent.BLOCK_CHANGE, ((PointedIzherabanBlock.DrippingFluid)optional.get()).pos, GameEvent.Context.of(blockState)); + world.levelEvent(1504, blockPos, 0); } else { BlockPos blockPos2 = getCauldronPos(world, blockPos, fluid); if (blockPos2 != null) { - world.syncWorldEvent(1504, blockPos, 0); + world.levelEvent(1504, blockPos, 0); int i = blockPos.getY() - blockPos2.getY(); int j = 50 + i; BlockState blockState2 = world.getBlockState(blockPos2); - world.scheduleBlockTick(blockPos2, blockState2.getBlock(), j); + world.scheduleTick(blockPos2, blockState2.getBlock(), j); } } } @@ -198,33 +210,34 @@ public static void dripTick(BlockState state, ServerWorld world, BlockPos pos, f } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - WorldAccess worldAccess = ctx.getWorld(); - BlockPos blockPos = ctx.getBlockPos(); - Direction direction = ctx.getVerticalPlayerLookDirection().getOpposite(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + LevelAccessor worldAccess = ctx.getLevel(); + BlockPos blockPos = ctx.getClickedPos(); + Direction direction = ctx.getNearestLookingVerticalDirection().getOpposite(); Direction direction2 = getDirectionToPlaceAt(worldAccess, blockPos, direction); if (direction2 == null) { return null; } else { - boolean bl = !ctx.shouldCancelInteraction(); - Thickness thickness = getThickness(worldAccess, blockPos, direction2, bl); - return thickness == null ? null : (BlockState)((BlockState)((BlockState)this.getDefaultState().with(VERTICAL_DIRECTION, direction2)).with(THICKNESS, thickness)).with(WATERLOGGED, worldAccess.getFluidState(blockPos).getFluid() == Fluids.WATER); + boolean bl = !ctx.isSecondaryUseActive(); + DripstoneThickness thickness = getThickness(worldAccess, blockPos, direction2, bl); + return thickness == null ? null : (BlockState)((BlockState)((BlockState)this.defaultBlockState().setValue(VERTICAL_DIRECTION, direction2)).setValue(THICKNESS, thickness)).setValue(WATERLOGGED, worldAccess.getFluidState(blockPos).getType() == Fluids.WATER); } } protected FluidState getFluidState(BlockState state) { - return (Boolean)state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return (Boolean)state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } - protected VoxelShape getCullingShape(BlockState state) { - return VoxelShapes.empty(); + @Override + protected VoxelShape getOcclusionShape(BlockState state, BlockGetter world, BlockPos pos) { + return Shapes.empty(); } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { VoxelShape var10000; - switch ((Thickness)state.get(THICKNESS)) { + switch ((DripstoneThickness)state.getValue(THICKNESS)) { case TIP_MERGE -> var10000 = TIP_MERGE_SHAPE; - case TIP -> var10000 = state.get(VERTICAL_DIRECTION) == Direction.DOWN ? DOWN_TIP_SHAPE : UP_TIP_SHAPE; + case TIP -> var10000 = state.getValue(VERTICAL_DIRECTION) == Direction.DOWN ? DOWN_TIP_SHAPE : UP_TIP_SHAPE; case FRUSTUM -> var10000 = BASE_SHAPE; case MIDDLE -> var10000 = FRUSTUM_SHAPE; case BASE -> var10000 = MIDDLE_SHAPE; @@ -232,37 +245,38 @@ protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos } VoxelShape voxelShape = var10000; - return voxelShape.offset(state.getModelOffset(pos)); + Vec3 offset = state.getOffset(world, pos); + return voxelShape.move(offset.x, 0.0, offset.z); } - protected boolean isShapeFullCube(BlockState state, BlockView world, BlockPos pos) { + protected boolean isCollisionShapeFullBlock(BlockState state, BlockGetter world, BlockPos pos) { return false; } - protected float getMaxHorizontalModelOffset() { + protected float getMaxHorizontalOffset() { return MAX_HORIZONTAL_MODEL_OFFSET; } - public void onDestroyedOnLanding(World world, BlockPos pos, FallingBlockEntity fallingBlockEntity) { + public void onBrokenAfterFall(Level world, BlockPos pos, FallingBlockEntity fallingBlockEntity) { if (!fallingBlockEntity.isSilent()) { - world.syncWorldEvent(1045, pos, 0); + world.levelEvent(1045, pos, 0); } } - public DamageSource getDamageSource(Entity attacker) { - return attacker.getDamageSources().fallingStalactite(attacker); + public DamageSource getFallDamageSource(Entity attacker) { + return attacker.damageSources().fallingStalactite(attacker); } - private static void spawnFallingBlock(BlockState state, ServerWorld world, BlockPos pos) { - BlockPos.Mutable mutable = pos.mutableCopy(); + private static void spawnFallingBlock(BlockState state, ServerLevel world, BlockPos pos) { + BlockPos.MutableBlockPos mutable = pos.mutable(); for(BlockState blockState = state; isPointingDown(blockState); blockState = world.getBlockState(mutable)) { - FallingBlockEntity fallingBlockEntity = FallingBlockEntity.spawnFromBlock(world, mutable, blockState); + FallingBlockEntity fallingBlockEntity = FallingBlockEntity.fall(world, mutable, blockState); if (isTip(blockState, true)) { int i = Math.max(1 + pos.getY() - mutable.getY(), 6); float f = 1.0F * (float)i; - fallingBlockEntity.setHurtEntities(f, 40); + fallingBlockEntity.setHurtsEntities(f, 40); break; } @@ -272,9 +286,9 @@ private static void spawnFallingBlock(BlockState state, ServerWorld world, Block } @VisibleForTesting - public static void tryGrow(BlockState state, ServerWorld world, BlockPos pos, Random random) { - BlockState blockState = world.getBlockState(pos.up(1)); - BlockState blockState2 = world.getBlockState(pos.up(2)); + public static void tryGrow(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + BlockState blockState = world.getBlockState(pos.above(1)); + BlockState blockState2 = world.getBlockState(pos.above(2)); if (canGrow(blockState, blockState2)) { BlockPos blockPos = getTipPos(state, world, pos, 7, false); if (blockPos != null) { @@ -291,8 +305,8 @@ public static void tryGrow(BlockState state, ServerWorld world, BlockPos pos, Ra } } - private static void tryGrowStalagmite(ServerWorld world, BlockPos pos) { - BlockPos.Mutable mutable = pos.mutableCopy(); + private static void tryGrowStalagmite(ServerLevel world, BlockPos pos) { + BlockPos.MutableBlockPos mutable = pos.mutable(); for(int i = 0; i < 10; ++i) { mutable.move(Direction.DOWN); @@ -306,8 +320,8 @@ private static void tryGrowStalagmite(ServerWorld world, BlockPos pos) { return; } - if (canPlaceAtWithDirection(world, mutable, Direction.UP) && !world.isWater(mutable.down())) { - tryGrow(world, mutable.down(), Direction.UP); + if (canPlaceAtWithDirection(world, mutable, Direction.UP) && !world.isWaterAt(mutable.below())) { + tryGrow(world, mutable.below(), Direction.UP); return; } @@ -318,71 +332,71 @@ private static void tryGrowStalagmite(ServerWorld world, BlockPos pos) { } - private static void tryGrow(ServerWorld world, BlockPos pos, Direction direction) { - BlockPos blockPos = pos.offset(direction); + private static void tryGrow(ServerLevel world, BlockPos pos, Direction direction) { + BlockPos blockPos = pos.relative(direction); BlockState blockState = world.getBlockState(blockPos); if (isTip(blockState, direction.getOpposite())) { growMerged(blockState, world, blockPos); - } else if (blockState.isAir() || blockState.isOf(Blocks.WATER)) { - place(world, blockPos, direction, Thickness.TIP); + } else if (blockState.isAir() || blockState.is(Blocks.WATER)) { + place(world, blockPos, direction, DripstoneThickness.TIP); } } - private static void place(WorldAccess world, BlockPos pos, Direction direction, Thickness thickness) { - BlockState blockState = (BlockState)((BlockState)((BlockState)ModBlocks.POINTED_IZHERABAN.getDefaultState().with(VERTICAL_DIRECTION, direction)).with(THICKNESS, thickness)).with(WATERLOGGED, world.getFluidState(pos).getFluid() == Fluids.WATER); - world.setBlockState(pos, blockState, 3); + private static void place(LevelAccessor world, BlockPos pos, Direction direction, DripstoneThickness thickness) { + BlockState blockState = (BlockState)((BlockState)((BlockState)ModBlocks.POINTED_IZHERABAN.defaultBlockState().setValue(VERTICAL_DIRECTION, direction)).setValue(THICKNESS, thickness)).setValue(WATERLOGGED, world.getFluidState(pos).getType() == Fluids.WATER); + world.setBlock(pos, blockState, 3); } - private static void growMerged(BlockState state, WorldAccess world, BlockPos pos) { + private static void growMerged(BlockState state, LevelAccessor world, BlockPos pos) { BlockPos blockPos2; BlockPos blockPos; - if (state.get(VERTICAL_DIRECTION) == Direction.UP) { + if (state.getValue(VERTICAL_DIRECTION) == Direction.UP) { blockPos = pos; - blockPos2 = pos.up(); + blockPos2 = pos.above(); } else { blockPos2 = pos; - blockPos = pos.down(); + blockPos = pos.below(); } - place(world, blockPos2, Direction.DOWN, Thickness.TIP_MERGE); - place(world, blockPos, Direction.UP, Thickness.TIP_MERGE); + place(world, blockPos2, Direction.DOWN, DripstoneThickness.TIP_MERGE); + place(world, blockPos, Direction.UP, DripstoneThickness.TIP_MERGE); } - public static void createParticle(World world, BlockPos pos, BlockState state) { + public static void createParticle(Level world, BlockPos pos, BlockState state) { getFluid(world, pos, state).ifPresent((fluid) -> { createParticle(world, pos, state, fluid.fluid); }); } - private static void createParticle(World world, BlockPos pos, BlockState state, Fluid fluid) { - Vec3d vec3d = state.getModelOffset(pos); + private static void createParticle(Level world, BlockPos pos, BlockState state, Fluid fluid) { + Vec3 vec3d = state.getOffset(world, pos); double d = 0.0625; double e = (double)pos.getX() + 0.5 + vec3d.x; double f = (double)pos.getY() + DOWN_TIP_Y - 0.0625; double g = (double)pos.getZ() + 0.5 + vec3d.z; Fluid fluid2 = getDripFluid(world, fluid); - ParticleEffect particleEffect = fluid2.isIn(FluidTags.LAVA) ? ParticleTypes.DRIPPING_DRIPSTONE_LAVA : ParticleTypes.DRIPPING_DRIPSTONE_WATER; - world.addParticleClient(particleEffect, e, f, g, 0.0, 0.0, 0.0); + ParticleOptions particleEffect = fluid2.is(FluidTags.LAVA) ? ParticleTypes.DRIPPING_DRIPSTONE_LAVA : ParticleTypes.DRIPPING_DRIPSTONE_WATER; + world.addParticle(particleEffect, e, f, g, 0.0, 0.0, 0.0); } @Nullable - private static BlockPos getTipPos(BlockState state, WorldAccess world, BlockPos pos, int range, boolean allowMerged) { + private static BlockPos getTipPos(BlockState state, LevelAccessor world, BlockPos pos, int range, boolean allowMerged) { if (isTip(state, allowMerged)) { return pos; } else { - Direction direction = (Direction)state.get(VERTICAL_DIRECTION); + Direction direction = (Direction)state.getValue(VERTICAL_DIRECTION); BiPredicate biPredicate = (posx, statex) -> { - return statex.isOf(ModBlocks.POINTED_IZHERABAN) && statex.get(VERTICAL_DIRECTION) == direction; + return statex.is(ModBlocks.POINTED_IZHERABAN) && statex.getValue(VERTICAL_DIRECTION) == direction; }; - return (BlockPos)searchInDirection(world, pos, direction.getDirection(), biPredicate, (statex) -> { + return (BlockPos)searchInDirection(world, pos, direction.getAxisDirection(), biPredicate, (statex) -> { return isTip(statex, allowMerged); }, range).orElse(null); } } @Nullable - private static Direction getDirectionToPlaceAt(WorldView world, BlockPos pos, Direction direction) { + private static Direction getDirectionToPlaceAt(LevelReader world, BlockPos pos, Direction direction) { Direction direction2; if (canPlaceAtWithDirection(world, pos, direction)) { direction2 = direction; @@ -397,31 +411,31 @@ private static Direction getDirectionToPlaceAt(WorldView world, BlockPos pos, Di return direction2; } - private static Thickness getThickness(WorldView world, BlockPos pos, Direction direction, boolean tryMerge) { + private static DripstoneThickness getThickness(LevelReader world, BlockPos pos, Direction direction, boolean tryMerge) { Direction direction2 = direction.getOpposite(); - BlockState blockState = world.getBlockState(pos.offset(direction)); + BlockState blockState = world.getBlockState(pos.relative(direction)); if (isPointedDripstoneFacingDirection(blockState, direction2)) { - return !tryMerge && blockState.get(THICKNESS) != Thickness.TIP_MERGE ? Thickness.TIP : Thickness.TIP_MERGE; + return !tryMerge && blockState.getValue(THICKNESS) != DripstoneThickness.TIP_MERGE ? DripstoneThickness.TIP : DripstoneThickness.TIP_MERGE; } else if (!isPointedDripstoneFacingDirection(blockState, direction)) { - return Thickness.TIP; + return DripstoneThickness.TIP; } else { - Thickness thickness = (Thickness)blockState.get(THICKNESS); - if (thickness != Thickness.TIP && thickness != Thickness.TIP_MERGE) { - BlockState blockState2 = world.getBlockState(pos.offset(direction2)); - return !isPointedDripstoneFacingDirection(blockState2, direction) ? Thickness.BASE : Thickness.MIDDLE; + DripstoneThickness thickness = (DripstoneThickness)blockState.getValue(THICKNESS); + if (thickness != DripstoneThickness.TIP && thickness != DripstoneThickness.TIP_MERGE) { + BlockState blockState2 = world.getBlockState(pos.relative(direction2)); + return !isPointedDripstoneFacingDirection(blockState2, direction) ? DripstoneThickness.BASE : DripstoneThickness.MIDDLE; } else { - return Thickness.FRUSTUM; + return DripstoneThickness.FRUSTUM; } } } public static boolean canDrip(BlockState state) { - return isPointingDown(state) && state.get(THICKNESS) == Thickness.TIP && !(Boolean)state.get(WATERLOGGED); + return isPointingDown(state) && state.getValue(THICKNESS) == DripstoneThickness.TIP && !(Boolean)state.getValue(WATERLOGGED); } - private static boolean canGrow(BlockState state, ServerWorld world, BlockPos pos) { - Direction direction = (Direction)state.get(VERTICAL_DIRECTION); - BlockPos blockPos = pos.offset(direction); + private static boolean canGrow(BlockState state, ServerLevel world, BlockPos pos) { + Direction direction = (Direction)state.getValue(VERTICAL_DIRECTION); + BlockPos blockPos = pos.relative(direction); BlockState blockState = world.getBlockState(blockPos); if (!blockState.getFluidState().isEmpty()) { return false; @@ -430,33 +444,33 @@ private static boolean canGrow(BlockState state, ServerWorld world, BlockPos pos } } - private static Optional getSupportingPos(World world, BlockPos pos, BlockState state, int range) { - Direction direction = (Direction)state.get(VERTICAL_DIRECTION); + private static Optional getSupportingPos(Level world, BlockPos pos, BlockState state, int range) { + Direction direction = (Direction)state.getValue(VERTICAL_DIRECTION); BiPredicate biPredicate = (posx, statex) -> { - return statex.isOf(ModBlocks.POINTED_IZHERABAN) && statex.get(VERTICAL_DIRECTION) == direction; + return statex.is(ModBlocks.POINTED_IZHERABAN) && statex.getValue(VERTICAL_DIRECTION) == direction; }; - return searchInDirection(world, pos, direction.getOpposite().getDirection(), biPredicate, (statex) -> { - return !statex.isOf(ModBlocks.POINTED_IZHERABAN); + return searchInDirection(world, pos, direction.getOpposite().getAxisDirection(), biPredicate, (statex) -> { + return !statex.is(ModBlocks.POINTED_IZHERABAN); }, range); } - private static boolean canPlaceAtWithDirection(WorldView world, BlockPos pos, Direction direction) { - BlockPos blockPos = pos.offset(direction.getOpposite()); + private static boolean canPlaceAtWithDirection(LevelReader world, BlockPos pos, Direction direction) { + BlockPos blockPos = pos.relative(direction.getOpposite()); BlockState blockState = world.getBlockState(blockPos); - return blockState.isSideSolidFullSquare(world, blockPos, direction) || isPointedDripstoneFacingDirection(blockState, direction); + return blockState.isFaceSturdy(world, blockPos, direction) || isPointedDripstoneFacingDirection(blockState, direction); } private static boolean isTip(BlockState state, boolean allowMerged) { - if (!state.isOf(ModBlocks.POINTED_IZHERABAN)) { + if (!state.is(ModBlocks.POINTED_IZHERABAN)) { return false; } else { - Thickness thickness = (Thickness)state.get(THICKNESS); - return thickness == Thickness.TIP || allowMerged && thickness == Thickness.TIP_MERGE; + DripstoneThickness thickness = (DripstoneThickness)state.getValue(THICKNESS); + return thickness == DripstoneThickness.TIP || allowMerged && thickness == DripstoneThickness.TIP_MERGE; } } private static boolean isTip(BlockState state, Direction direction) { - return isTip(state, false) && state.get(VERTICAL_DIRECTION) == direction; + return isTip(state, false) && state.getValue(VERTICAL_DIRECTION) == direction; } private static boolean isPointingDown(BlockState state) { @@ -467,52 +481,52 @@ private static boolean isPointingUp(BlockState state) { return isPointedDripstoneFacingDirection(state, Direction.UP); } - private static boolean isHeldByPointedDripstone(BlockState state, WorldView world, BlockPos pos) { - return isPointingDown(state) && !world.getBlockState(pos.up()).isOf(ModBlocks.POINTED_IZHERABAN); + private static boolean isHeldByPointedDripstone(BlockState state, LevelReader world, BlockPos pos) { + return isPointingDown(state) && !world.getBlockState(pos.above()).is(ModBlocks.POINTED_IZHERABAN); } - protected boolean canPathfindThrough(BlockState state, NavigationType type) { + protected boolean isPathfindable(BlockState state, PathComputationType type) { return false; } private static boolean isPointedDripstoneFacingDirection(BlockState state, Direction direction) { - return state.isOf(ModBlocks.POINTED_IZHERABAN) && state.get(VERTICAL_DIRECTION) == direction; + return state.is(ModBlocks.POINTED_IZHERABAN) && state.getValue(VERTICAL_DIRECTION) == direction; } @Nullable - private static BlockPos getCauldronPos(World world, BlockPos pos, Fluid fluid) { + private static BlockPos getCauldronPos(Level world, BlockPos pos, Fluid fluid) { Predicate predicate = (state) -> { - return state.getBlock() instanceof AbstractCauldronBlock && ((AbstractCauldronBlock)state.getBlock()).canBeFilledByDripstone(fluid); + return state.getBlock() instanceof AbstractCauldronBlock && ((AbstractCauldronBlock)state.getBlock()).canReceiveStalactiteDrip(fluid); }; BiPredicate biPredicate = (posx, state) -> { return canDripThrough(world, posx, state); }; - return (BlockPos)searchInDirection(world, pos, Direction.DOWN.getDirection(), biPredicate, predicate, 11).orElse(null); + return (BlockPos)searchInDirection(world, pos, Direction.DOWN.getAxisDirection(), biPredicate, predicate, 11).orElse(null); } @Nullable - public static BlockPos getDripPos(World world, BlockPos pos) { + public static BlockPos getDripPos(Level world, BlockPos pos) { BiPredicate biPredicate = (posx, state) -> { return canDripThrough(world, posx, state); }; - return (BlockPos)searchInDirection(world, pos, Direction.UP.getDirection(), biPredicate, PointedIzherabanBlock::canDrip, 11).orElse(null); + return (BlockPos)searchInDirection(world, pos, Direction.UP.getAxisDirection(), biPredicate, PointedIzherabanBlock::canDrip, 11).orElse(null); } - public static Fluid getDripFluid(ServerWorld world, BlockPos pos) { + public static Fluid getDripFluid(ServerLevel world, BlockPos pos) { return (Fluid)getFluid(world, pos, world.getBlockState(pos)).map((fluid) -> { return fluid.fluid; }).filter(PointedIzherabanBlock::isFluidLiquid).orElse(Fluids.EMPTY); } - private static Optional getFluid(World world, BlockPos pos, BlockState state) { + private static Optional getFluid(Level world, BlockPos pos, BlockState state) { return !isPointingDown(state) ? Optional.empty() : getSupportingPos(world, pos, state, 11).map((posx) -> { - BlockPos blockPos = posx.up(); + BlockPos blockPos = posx.above(); BlockState blockState = world.getBlockState(blockPos); Object fluid; - if (blockState.isOf(Blocks.MUD) && !world.getDimension().ultrawarm()) { + if (blockState.is(Blocks.MUD) && !world.dimensionType().ultraWarm()) { fluid = Fluids.WATER; } else { - fluid = world.getFluidState(blockPos).getFluid(); + fluid = world.getFluidState(blockPos).getType(); } return new PointedIzherabanBlock.DrippingFluid(blockPos, (Fluid)fluid, blockState); @@ -524,29 +538,29 @@ private static boolean isFluidLiquid(Fluid fluid) { } private static boolean canGrow(BlockState dripstoneBlockState, BlockState waterState) { - return dripstoneBlockState.isOf(StoneBlockSets.IZHERABAN_SET.baseBlocks.base()) && waterState.isOf(Blocks.WATER) && waterState.getFluidState().isStill(); + return dripstoneBlockState.is(StoneBlockSets.IZHERABAN_SET.baseBlocks.base()) && waterState.is(Blocks.WATER) && waterState.getFluidState().isSource(); } - private static Fluid getDripFluid(World world, Fluid fluid) { - if (fluid.matchesType(Fluids.EMPTY)) { - return world.getDimension().ultrawarm() ? Fluids.LAVA : Fluids.WATER; + private static Fluid getDripFluid(Level world, Fluid fluid) { + if (fluid.isSame(Fluids.EMPTY)) { + return world.dimensionType().ultraWarm() ? Fluids.LAVA : Fluids.WATER; } else { return fluid; } } - private static Optional searchInDirection(WorldAccess world, BlockPos pos, Direction.AxisDirection direction, BiPredicate continuePredicate, Predicate stopPredicate, int range) { + private static Optional searchInDirection(LevelAccessor world, BlockPos pos, Direction.AxisDirection direction, BiPredicate continuePredicate, Predicate stopPredicate, int range) { Direction direction2 = Direction.get(direction, Direction.Axis.Y); - BlockPos.Mutable mutable = pos.mutableCopy(); + BlockPos.MutableBlockPos mutable = pos.mutable(); for(int i = 1; i < range; ++i) { mutable.move(direction2); BlockState blockState = world.getBlockState(mutable); if (stopPredicate.test(blockState)) { - return Optional.of(mutable.toImmutable()); + return Optional.of(mutable.immutable()); } - if (world.isOutOfHeightLimit(mutable.getY()) || !continuePredicate.test(mutable, blockState)) { + if (world.isOutsideBuildHeight(mutable.getY()) || !continuePredicate.test(mutable, blockState)) { return Optional.empty(); } } @@ -554,32 +568,32 @@ private static Optional searchInDirection(WorldAccess world, BlockPos return Optional.empty(); } - private static boolean canDripThrough(BlockView world, BlockPos pos, BlockState state) { + private static boolean canDripThrough(BlockGetter world, BlockPos pos, BlockState state) { if (state.isAir()) { return true; - } else if (state.isOpaqueFullCube()) { + } else if (state.isSolidRender(world, pos)) { return false; } else if (!state.getFluidState().isEmpty()) { return false; } else { VoxelShape voxelShape = state.getCollisionShape(world, pos); - return !VoxelShapes.matchesAnywhere(DRIP_COLLISION_SHAPE, voxelShape, BooleanBiFunction.AND); + return !Shapes.joinIsNotEmpty(DRIP_COLLISION_SHAPE, voxelShape, BooleanOp.AND); } } static { - VERTICAL_DIRECTION = Properties.VERTICAL_DIRECTION; - THICKNESS = Properties.THICKNESS; - WATERLOGGED = Properties.WATERLOGGED; - TIP_MERGE_SHAPE = Block.createColumnShape(6.0, 0.0, 16.0); - UP_TIP_SHAPE = Block.createColumnShape(6.0, 0.0, 11.0); - DOWN_TIP_SHAPE = Block.createColumnShape(6.0, 5.0, 16.0); - BASE_SHAPE = Block.createColumnShape(8.0, 0.0, 16.0); - FRUSTUM_SHAPE = Block.createColumnShape(10.0, 0.0, 16.0); - MIDDLE_SHAPE = Block.createColumnShape(12.0, 0.0, 16.0); - DOWN_TIP_Y = DOWN_TIP_SHAPE.getMin(Direction.Axis.Y); - MAX_HORIZONTAL_MODEL_OFFSET = (float)MIDDLE_SHAPE.getMin(Direction.Axis.X); - DRIP_COLLISION_SHAPE = Block.createColumnShape(4.0, 0.0, 16.0); + VERTICAL_DIRECTION = BlockStateProperties.VERTICAL_DIRECTION; + THICKNESS = BlockStateProperties.DRIPSTONE_THICKNESS; + WATERLOGGED = BlockStateProperties.WATERLOGGED; + TIP_MERGE_SHAPE = Block.box(5.0, 0.0, 5.0, 11.0, 16.0, 11.0); + UP_TIP_SHAPE = Block.box(5.0, 0.0, 5.0, 11.0, 11.0, 11.0); + DOWN_TIP_SHAPE = Block.box(5.0, 5.0, 5.0, 11.0, 16.0, 11.0); + BASE_SHAPE = Block.box(4.0, 0.0, 4.0, 12.0, 16.0, 12.0); + FRUSTUM_SHAPE = Block.box(3.0, 0.0, 3.0, 13.0, 16.0, 13.0); + MIDDLE_SHAPE = Block.box(2.0, 0.0, 2.0, 14.0, 16.0, 14.0); + DOWN_TIP_Y = DOWN_TIP_SHAPE.min(Direction.Axis.Y); + MAX_HORIZONTAL_MODEL_OFFSET = (float)MIDDLE_SHAPE.min(Direction.Axis.X); + DRIP_COLLISION_SHAPE = Block.box(6.0, 0.0, 6.0, 10.0, 16.0, 10.0); } static record DrippingFluid(BlockPos pos, Fluid fluid, BlockState sourceState) { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pointedBlocks/PointedLimestoneBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pointedBlocks/PointedLimestoneBlock.java index fa7a6cd5c9..48a827d00c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pointedBlocks/PointedLimestoneBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pointedBlocks/PointedLimestoneBlock.java @@ -2,50 +2,62 @@ import com.google.common.annotations.VisibleForTesting; import com.mojang.serialization.MapCodec; -import net.minecraft.world.tick.ScheduledTickView; import net.sevenstars.middleearth.block.registration.ModBlocks; import net.sevenstars.middleearth.block.registration.StoneBlockSets; -import net.minecraft.block.*; -import net.minecraft.block.enums.Thickness; -import net.minecraft.entity.Entity; -import net.minecraft.entity.FallingBlockEntity; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.entity.projectile.TridentEntity; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.particle.ParticleEffect; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.tag.FluidTags; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.*; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleOptions; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.block.state.properties.*; +import net.minecraft.tags.FluidTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.item.FallingBlockEntity; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.entity.projectile.ThrownTrident; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.AbstractCauldronBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Fallable; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.DripstoneThickness; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; import java.util.Optional; import java.util.function.BiPredicate; import java.util.function.Predicate; -public class PointedLimestoneBlock extends Block implements Falling, Waterloggable { - public static final MapCodec CODEC = createCodec(PointedLimestoneBlock::new); +public class PointedLimestoneBlock extends Block implements Fallable, SimpleWaterloggedBlock { + public static final MapCodec CODEC = simpleCodec(PointedLimestoneBlock::new); public static final EnumProperty VERTICAL_DIRECTION; - public static final EnumProperty THICKNESS; + public static final EnumProperty THICKNESS; public static final BooleanProperty WATERLOGGED; private static final VoxelShape TIP_MERGE_SHAPE; private static final VoxelShape UP_TIP_SHAPE; @@ -57,73 +69,73 @@ public class PointedLimestoneBlock extends Block implements Falling, Waterloggab private static final float MAX_HORIZONTAL_MODEL_OFFSET; private static final VoxelShape DRIP_COLLISION_SHAPE; - public MapCodec getCodec() { + public MapCodec codec() { return CODEC; } - public PointedLimestoneBlock(AbstractBlock.Settings settings) { + public PointedLimestoneBlock(BlockBehaviour.Properties settings) { super(settings); - this.setDefaultState((BlockState)((BlockState)((BlockState)((BlockState)this.stateManager.getDefaultState()).with(VERTICAL_DIRECTION, Direction.UP)).with(THICKNESS, Thickness.TIP)).with(WATERLOGGED, false)); + this.registerDefaultState((BlockState)((BlockState)((BlockState)((BlockState)this.stateDefinition.any()).setValue(VERTICAL_DIRECTION, Direction.UP)).setValue(THICKNESS, DripstoneThickness.TIP)).setValue(WATERLOGGED, false)); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(new Property[]{VERTICAL_DIRECTION, THICKNESS, WATERLOGGED}); } - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - return canPlaceAtWithDirection(world, pos, (Direction)state.get(VERTICAL_DIRECTION)); + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + return canPlaceAtWithDirection(world, pos, (Direction)state.getValue(VERTICAL_DIRECTION)); } - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if ((Boolean)state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if ((Boolean)state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } if (direction != Direction.UP && direction != Direction.DOWN) { return state; } else { - Direction direction2 = (Direction)state.get(VERTICAL_DIRECTION); - if (direction2 == Direction.DOWN && tickView.getBlockTickScheduler().isQueued(pos, this)) { + Direction direction2 = (Direction)state.getValue(VERTICAL_DIRECTION); + if (direction2 == Direction.DOWN && world.getBlockTicks().hasScheduledTick(pos, this)) { return state; - } else if (direction == direction2.getOpposite() && !this.canPlaceAt(state, world, pos)) { + } else if (direction == direction2.getOpposite() && !this.canSurvive(state, world, pos)) { if (direction2 == Direction.DOWN) { - tickView.scheduleBlockTick(pos, this, 2); + world.scheduleTick(pos, this, 2); } else { - tickView.scheduleBlockTick(pos, this, 1); + world.scheduleTick(pos, this, 1); } return state; } else { - boolean bl = state.get(THICKNESS) == Thickness.TIP_MERGE; - Thickness thickness = getThickness(world, pos, direction2, bl); - return (BlockState)state.with(THICKNESS, thickness); + boolean bl = state.getValue(THICKNESS) == DripstoneThickness.TIP_MERGE; + DripstoneThickness thickness = getThickness(world, pos, direction2, bl); + return (BlockState)state.setValue(THICKNESS, thickness); } } } - protected void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient) { + protected void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!world.isClientSide) { BlockPos blockPos = hit.getBlockPos(); - if (world instanceof ServerWorld) { - ServerWorld serverWorld = (ServerWorld)world; - if (projectile.canModifyAt(serverWorld, blockPos) && projectile.canBreakBlocks(serverWorld) && projectile instanceof TridentEntity && projectile.getVelocity().length() > 0.6) { - world.breakBlock(blockPos, true); + if (world instanceof ServerLevel) { + ServerLevel serverWorld = (ServerLevel)world; + if (projectile.mayInteract(serverWorld, blockPos) && projectile.mayBreak(serverWorld) && projectile instanceof ThrownTrident && projectile.getDeltaMovement().length() > 0.6) { + world.destroyBlock(blockPos, true); } } } } - public void onLandedUpon(World world, BlockState state, BlockPos pos, Entity entity, double fallDistance) { - if (state.get(VERTICAL_DIRECTION) == Direction.UP && state.get(THICKNESS) == Thickness.TIP) { - entity.handleFallDamage(fallDistance + 2.5, 2.0F, world.getDamageSources().stalagmite()); + public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) { + if (state.getValue(VERTICAL_DIRECTION) == Direction.UP && state.getValue(THICKNESS) == DripstoneThickness.TIP) { + entity.causeFallDamage(fallDistance + 2.5F, 2.0F, world.damageSources().stalagmite()); } else { - super.onLandedUpon(world, state, pos, entity, fallDistance); + super.fallOn(world, state, pos, entity, fallDistance); } } - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { + public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { if (canDrip(state)) { float f = random.nextFloat(); if (!(f > 0.12F)) { @@ -136,16 +148,16 @@ public void randomDisplayTick(BlockState state, World world, BlockPos pos, Rando } } - protected void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { - if (isPointingUp(state) && !this.canPlaceAt(state, world, pos)) { - world.breakBlock(pos, true); + protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + if (isPointingUp(state) && !this.canSurvive(state, world, pos)) { + world.destroyBlock(pos, true); } else { spawnFallingBlock(state, world, pos); } } - protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { + protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { dripTick(state, world, pos, random.nextFloat()); if (random.nextFloat() < 0.011377778F && isHeldByPointedDripstone(state, world, pos)) { tryGrow(state, world, pos, random); @@ -154,7 +166,7 @@ protected void randomTick(BlockState state, ServerWorld world, BlockPos pos, Ran } @VisibleForTesting - public static void dripTick(BlockState state, ServerWorld world, BlockPos pos, float dripChance) { + public static void dripTick(BlockState state, ServerLevel world, BlockPos pos, float dripChance) { if (!(dripChance > 0.17578125F) || !(dripChance > 0.05859375F)) { if (isHeldByPointedDripstone(state, world, pos)) { Optional optional = getFluid(world, pos, state); @@ -174,20 +186,20 @@ public static void dripTick(BlockState state, ServerWorld world, BlockPos pos, f if (!(dripChance >= f)) { BlockPos blockPos = getTipPos(state, world, pos, 11, false); if (blockPos != null) { - if (((PointedLimestoneBlock.DrippingFluid)optional.get()).sourceState.isOf(Blocks.MUD) && fluid == Fluids.WATER) { - BlockState blockState = Blocks.CLAY.getDefaultState(); - world.setBlockState(((PointedLimestoneBlock.DrippingFluid)optional.get()).pos, blockState); - Block.pushEntitiesUpBeforeBlockChange(((PointedLimestoneBlock.DrippingFluid)optional.get()).sourceState, blockState, world, ((PointedLimestoneBlock.DrippingFluid)optional.get()).pos); - world.emitGameEvent(GameEvent.BLOCK_CHANGE, ((PointedLimestoneBlock.DrippingFluid)optional.get()).pos, GameEvent.Emitter.of(blockState)); - world.syncWorldEvent(1504, blockPos, 0); + if (((PointedLimestoneBlock.DrippingFluid)optional.get()).sourceState.is(Blocks.MUD) && fluid == Fluids.WATER) { + BlockState blockState = Blocks.CLAY.defaultBlockState(); + world.setBlockAndUpdate(((PointedLimestoneBlock.DrippingFluid)optional.get()).pos, blockState); + Block.pushEntitiesUp(((PointedLimestoneBlock.DrippingFluid)optional.get()).sourceState, blockState, world, ((PointedLimestoneBlock.DrippingFluid)optional.get()).pos); + world.gameEvent(GameEvent.BLOCK_CHANGE, ((PointedLimestoneBlock.DrippingFluid)optional.get()).pos, GameEvent.Context.of(blockState)); + world.levelEvent(1504, blockPos, 0); } else { BlockPos blockPos2 = getCauldronPos(world, blockPos, fluid); if (blockPos2 != null) { - world.syncWorldEvent(1504, blockPos, 0); + world.levelEvent(1504, blockPos, 0); int i = blockPos.getY() - blockPos2.getY(); int j = 50 + i; BlockState blockState2 = world.getBlockState(blockPos2); - world.scheduleBlockTick(blockPos2, blockState2.getBlock(), j); + world.scheduleTick(blockPos2, blockState2.getBlock(), j); } } } @@ -198,33 +210,34 @@ public static void dripTick(BlockState state, ServerWorld world, BlockPos pos, f } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - WorldAccess worldAccess = ctx.getWorld(); - BlockPos blockPos = ctx.getBlockPos(); - Direction direction = ctx.getVerticalPlayerLookDirection().getOpposite(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + LevelAccessor worldAccess = ctx.getLevel(); + BlockPos blockPos = ctx.getClickedPos(); + Direction direction = ctx.getNearestLookingVerticalDirection().getOpposite(); Direction direction2 = getDirectionToPlaceAt(worldAccess, blockPos, direction); if (direction2 == null) { return null; } else { - boolean bl = !ctx.shouldCancelInteraction(); - Thickness thickness = getThickness(worldAccess, blockPos, direction2, bl); - return thickness == null ? null : (BlockState)((BlockState)((BlockState)this.getDefaultState().with(VERTICAL_DIRECTION, direction2)).with(THICKNESS, thickness)).with(WATERLOGGED, worldAccess.getFluidState(blockPos).getFluid() == Fluids.WATER); + boolean bl = !ctx.isSecondaryUseActive(); + DripstoneThickness thickness = getThickness(worldAccess, blockPos, direction2, bl); + return thickness == null ? null : (BlockState)((BlockState)((BlockState)this.defaultBlockState().setValue(VERTICAL_DIRECTION, direction2)).setValue(THICKNESS, thickness)).setValue(WATERLOGGED, worldAccess.getFluidState(blockPos).getType() == Fluids.WATER); } } protected FluidState getFluidState(BlockState state) { - return (Boolean)state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return (Boolean)state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } - protected VoxelShape getCullingShape(BlockState state) { - return VoxelShapes.empty(); + @Override + protected VoxelShape getOcclusionShape(BlockState state, BlockGetter world, BlockPos pos) { + return Shapes.empty(); } - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { VoxelShape var10000; - switch ((Thickness)state.get(THICKNESS)) { + switch ((DripstoneThickness)state.getValue(THICKNESS)) { case TIP_MERGE -> var10000 = TIP_MERGE_SHAPE; - case TIP -> var10000 = state.get(VERTICAL_DIRECTION) == Direction.DOWN ? DOWN_TIP_SHAPE : UP_TIP_SHAPE; + case TIP -> var10000 = state.getValue(VERTICAL_DIRECTION) == Direction.DOWN ? DOWN_TIP_SHAPE : UP_TIP_SHAPE; case FRUSTUM -> var10000 = BASE_SHAPE; case MIDDLE -> var10000 = FRUSTUM_SHAPE; case BASE -> var10000 = MIDDLE_SHAPE; @@ -232,37 +245,38 @@ protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos } VoxelShape voxelShape = var10000; - return voxelShape.offset(state.getModelOffset(pos)); + Vec3 offset = state.getOffset(world, pos); + return voxelShape.move(offset.x, 0.0, offset.z); } - protected boolean isShapeFullCube(BlockState state, BlockView world, BlockPos pos) { + protected boolean isCollisionShapeFullBlock(BlockState state, BlockGetter world, BlockPos pos) { return false; } - protected float getMaxHorizontalModelOffset() { + protected float getMaxHorizontalOffset() { return MAX_HORIZONTAL_MODEL_OFFSET; } - public void onDestroyedOnLanding(World world, BlockPos pos, FallingBlockEntity fallingBlockEntity) { + public void onBrokenAfterFall(Level world, BlockPos pos, FallingBlockEntity fallingBlockEntity) { if (!fallingBlockEntity.isSilent()) { - world.syncWorldEvent(1045, pos, 0); + world.levelEvent(1045, pos, 0); } } - public DamageSource getDamageSource(Entity attacker) { - return attacker.getDamageSources().fallingStalactite(attacker); + public DamageSource getFallDamageSource(Entity attacker) { + return attacker.damageSources().fallingStalactite(attacker); } - private static void spawnFallingBlock(BlockState state, ServerWorld world, BlockPos pos) { - BlockPos.Mutable mutable = pos.mutableCopy(); + private static void spawnFallingBlock(BlockState state, ServerLevel world, BlockPos pos) { + BlockPos.MutableBlockPos mutable = pos.mutable(); for(BlockState blockState = state; isPointingDown(blockState); blockState = world.getBlockState(mutable)) { - FallingBlockEntity fallingBlockEntity = FallingBlockEntity.spawnFromBlock(world, mutable, blockState); + FallingBlockEntity fallingBlockEntity = FallingBlockEntity.fall(world, mutable, blockState); if (isTip(blockState, true)) { int i = Math.max(1 + pos.getY() - mutable.getY(), 6); float f = 1.0F * (float)i; - fallingBlockEntity.setHurtEntities(f, 40); + fallingBlockEntity.setHurtsEntities(f, 40); break; } @@ -272,9 +286,9 @@ private static void spawnFallingBlock(BlockState state, ServerWorld world, Block } @VisibleForTesting - public static void tryGrow(BlockState state, ServerWorld world, BlockPos pos, Random random) { - BlockState blockState = world.getBlockState(pos.up(1)); - BlockState blockState2 = world.getBlockState(pos.up(2)); + public static void tryGrow(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + BlockState blockState = world.getBlockState(pos.above(1)); + BlockState blockState2 = world.getBlockState(pos.above(2)); if (canGrow(blockState, blockState2)) { BlockPos blockPos = getTipPos(state, world, pos, 7, false); if (blockPos != null) { @@ -291,8 +305,8 @@ public static void tryGrow(BlockState state, ServerWorld world, BlockPos pos, Ra } } - private static void tryGrowStalagmite(ServerWorld world, BlockPos pos) { - BlockPos.Mutable mutable = pos.mutableCopy(); + private static void tryGrowStalagmite(ServerLevel world, BlockPos pos) { + BlockPos.MutableBlockPos mutable = pos.mutable(); for(int i = 0; i < 10; ++i) { mutable.move(Direction.DOWN); @@ -306,8 +320,8 @@ private static void tryGrowStalagmite(ServerWorld world, BlockPos pos) { return; } - if (canPlaceAtWithDirection(world, mutable, Direction.UP) && !world.isWater(mutable.down())) { - tryGrow(world, mutable.down(), Direction.UP); + if (canPlaceAtWithDirection(world, mutable, Direction.UP) && !world.isWaterAt(mutable.below())) { + tryGrow(world, mutable.below(), Direction.UP); return; } @@ -318,71 +332,71 @@ private static void tryGrowStalagmite(ServerWorld world, BlockPos pos) { } - private static void tryGrow(ServerWorld world, BlockPos pos, Direction direction) { - BlockPos blockPos = pos.offset(direction); + private static void tryGrow(ServerLevel world, BlockPos pos, Direction direction) { + BlockPos blockPos = pos.relative(direction); BlockState blockState = world.getBlockState(blockPos); if (isTip(blockState, direction.getOpposite())) { growMerged(blockState, world, blockPos); - } else if (blockState.isAir() || blockState.isOf(Blocks.WATER)) { - place(world, blockPos, direction, Thickness.TIP); + } else if (blockState.isAir() || blockState.is(Blocks.WATER)) { + place(world, blockPos, direction, DripstoneThickness.TIP); } } - private static void place(WorldAccess world, BlockPos pos, Direction direction, Thickness thickness) { - BlockState blockState = (BlockState)((BlockState)((BlockState)ModBlocks.POINTED_LIMESTONE.getDefaultState().with(VERTICAL_DIRECTION, direction)).with(THICKNESS, thickness)).with(WATERLOGGED, world.getFluidState(pos).getFluid() == Fluids.WATER); - world.setBlockState(pos, blockState, 3); + private static void place(LevelAccessor world, BlockPos pos, Direction direction, DripstoneThickness thickness) { + BlockState blockState = (BlockState)((BlockState)((BlockState)ModBlocks.POINTED_LIMESTONE.defaultBlockState().setValue(VERTICAL_DIRECTION, direction)).setValue(THICKNESS, thickness)).setValue(WATERLOGGED, world.getFluidState(pos).getType() == Fluids.WATER); + world.setBlock(pos, blockState, 3); } - private static void growMerged(BlockState state, WorldAccess world, BlockPos pos) { + private static void growMerged(BlockState state, LevelAccessor world, BlockPos pos) { BlockPos blockPos2; BlockPos blockPos; - if (state.get(VERTICAL_DIRECTION) == Direction.UP) { + if (state.getValue(VERTICAL_DIRECTION) == Direction.UP) { blockPos = pos; - blockPos2 = pos.up(); + blockPos2 = pos.above(); } else { blockPos2 = pos; - blockPos = pos.down(); + blockPos = pos.below(); } - place(world, blockPos2, Direction.DOWN, Thickness.TIP_MERGE); - place(world, blockPos, Direction.UP, Thickness.TIP_MERGE); + place(world, blockPos2, Direction.DOWN, DripstoneThickness.TIP_MERGE); + place(world, blockPos, Direction.UP, DripstoneThickness.TIP_MERGE); } - public static void createParticle(World world, BlockPos pos, BlockState state) { + public static void createParticle(Level world, BlockPos pos, BlockState state) { getFluid(world, pos, state).ifPresent((fluid) -> { createParticle(world, pos, state, fluid.fluid); }); } - private static void createParticle(World world, BlockPos pos, BlockState state, Fluid fluid) { - Vec3d vec3d = state.getModelOffset(pos); + private static void createParticle(Level world, BlockPos pos, BlockState state, Fluid fluid) { + Vec3 vec3d = state.getOffset(world, pos); double d = 0.0625; double e = (double)pos.getX() + 0.5 + vec3d.x; double f = (double)pos.getY() + DOWN_TIP_Y - 0.0625; double g = (double)pos.getZ() + 0.5 + vec3d.z; Fluid fluid2 = getDripFluid(world, fluid); - ParticleEffect particleEffect = fluid2.isIn(FluidTags.LAVA) ? ParticleTypes.DRIPPING_DRIPSTONE_LAVA : ParticleTypes.DRIPPING_DRIPSTONE_WATER; - world.addParticleClient(particleEffect, e, f, g, 0.0, 0.0, 0.0); + ParticleOptions particleEffect = fluid2.is(FluidTags.LAVA) ? ParticleTypes.DRIPPING_DRIPSTONE_LAVA : ParticleTypes.DRIPPING_DRIPSTONE_WATER; + world.addParticle(particleEffect, e, f, g, 0.0, 0.0, 0.0); } @Nullable - private static BlockPos getTipPos(BlockState state, WorldAccess world, BlockPos pos, int range, boolean allowMerged) { + private static BlockPos getTipPos(BlockState state, LevelAccessor world, BlockPos pos, int range, boolean allowMerged) { if (isTip(state, allowMerged)) { return pos; } else { - Direction direction = (Direction)state.get(VERTICAL_DIRECTION); + Direction direction = (Direction)state.getValue(VERTICAL_DIRECTION); BiPredicate biPredicate = (posx, statex) -> { - return statex.isOf(ModBlocks.POINTED_LIMESTONE) && statex.get(VERTICAL_DIRECTION) == direction; + return statex.is(ModBlocks.POINTED_LIMESTONE) && statex.getValue(VERTICAL_DIRECTION) == direction; }; - return (BlockPos)searchInDirection(world, pos, direction.getDirection(), biPredicate, (statex) -> { + return (BlockPos)searchInDirection(world, pos, direction.getAxisDirection(), biPredicate, (statex) -> { return isTip(statex, allowMerged); }, range).orElse(null); } } @Nullable - private static Direction getDirectionToPlaceAt(WorldView world, BlockPos pos, Direction direction) { + private static Direction getDirectionToPlaceAt(LevelReader world, BlockPos pos, Direction direction) { Direction direction2; if (canPlaceAtWithDirection(world, pos, direction)) { direction2 = direction; @@ -397,31 +411,31 @@ private static Direction getDirectionToPlaceAt(WorldView world, BlockPos pos, Di return direction2; } - private static Thickness getThickness(WorldView world, BlockPos pos, Direction direction, boolean tryMerge) { + private static DripstoneThickness getThickness(LevelReader world, BlockPos pos, Direction direction, boolean tryMerge) { Direction direction2 = direction.getOpposite(); - BlockState blockState = world.getBlockState(pos.offset(direction)); + BlockState blockState = world.getBlockState(pos.relative(direction)); if (isPointedDripstoneFacingDirection(blockState, direction2)) { - return !tryMerge && blockState.get(THICKNESS) != Thickness.TIP_MERGE ? Thickness.TIP : Thickness.TIP_MERGE; + return !tryMerge && blockState.getValue(THICKNESS) != DripstoneThickness.TIP_MERGE ? DripstoneThickness.TIP : DripstoneThickness.TIP_MERGE; } else if (!isPointedDripstoneFacingDirection(blockState, direction)) { - return Thickness.TIP; + return DripstoneThickness.TIP; } else { - Thickness thickness = (Thickness)blockState.get(THICKNESS); - if (thickness != Thickness.TIP && thickness != Thickness.TIP_MERGE) { - BlockState blockState2 = world.getBlockState(pos.offset(direction2)); - return !isPointedDripstoneFacingDirection(blockState2, direction) ? Thickness.BASE : Thickness.MIDDLE; + DripstoneThickness thickness = (DripstoneThickness)blockState.getValue(THICKNESS); + if (thickness != DripstoneThickness.TIP && thickness != DripstoneThickness.TIP_MERGE) { + BlockState blockState2 = world.getBlockState(pos.relative(direction2)); + return !isPointedDripstoneFacingDirection(blockState2, direction) ? DripstoneThickness.BASE : DripstoneThickness.MIDDLE; } else { - return Thickness.FRUSTUM; + return DripstoneThickness.FRUSTUM; } } } public static boolean canDrip(BlockState state) { - return isPointingDown(state) && state.get(THICKNESS) == Thickness.TIP && !(Boolean)state.get(WATERLOGGED); + return isPointingDown(state) && state.getValue(THICKNESS) == DripstoneThickness.TIP && !(Boolean)state.getValue(WATERLOGGED); } - private static boolean canGrow(BlockState state, ServerWorld world, BlockPos pos) { - Direction direction = (Direction)state.get(VERTICAL_DIRECTION); - BlockPos blockPos = pos.offset(direction); + private static boolean canGrow(BlockState state, ServerLevel world, BlockPos pos) { + Direction direction = (Direction)state.getValue(VERTICAL_DIRECTION); + BlockPos blockPos = pos.relative(direction); BlockState blockState = world.getBlockState(blockPos); if (!blockState.getFluidState().isEmpty()) { return false; @@ -430,33 +444,33 @@ private static boolean canGrow(BlockState state, ServerWorld world, BlockPos pos } } - private static Optional getSupportingPos(World world, BlockPos pos, BlockState state, int range) { - Direction direction = (Direction)state.get(VERTICAL_DIRECTION); + private static Optional getSupportingPos(Level world, BlockPos pos, BlockState state, int range) { + Direction direction = (Direction)state.getValue(VERTICAL_DIRECTION); BiPredicate biPredicate = (posx, statex) -> { - return statex.isOf(ModBlocks.POINTED_LIMESTONE) && statex.get(VERTICAL_DIRECTION) == direction; + return statex.is(ModBlocks.POINTED_LIMESTONE) && statex.getValue(VERTICAL_DIRECTION) == direction; }; - return searchInDirection(world, pos, direction.getOpposite().getDirection(), biPredicate, (statex) -> { - return !statex.isOf(ModBlocks.POINTED_LIMESTONE); + return searchInDirection(world, pos, direction.getOpposite().getAxisDirection(), biPredicate, (statex) -> { + return !statex.is(ModBlocks.POINTED_LIMESTONE); }, range); } - private static boolean canPlaceAtWithDirection(WorldView world, BlockPos pos, Direction direction) { - BlockPos blockPos = pos.offset(direction.getOpposite()); + private static boolean canPlaceAtWithDirection(LevelReader world, BlockPos pos, Direction direction) { + BlockPos blockPos = pos.relative(direction.getOpposite()); BlockState blockState = world.getBlockState(blockPos); - return blockState.isSideSolidFullSquare(world, blockPos, direction) || isPointedDripstoneFacingDirection(blockState, direction); + return blockState.isFaceSturdy(world, blockPos, direction) || isPointedDripstoneFacingDirection(blockState, direction); } private static boolean isTip(BlockState state, boolean allowMerged) { - if (!state.isOf(ModBlocks.POINTED_LIMESTONE)) { + if (!state.is(ModBlocks.POINTED_LIMESTONE)) { return false; } else { - Thickness thickness = (Thickness)state.get(THICKNESS); - return thickness == Thickness.TIP || allowMerged && thickness == Thickness.TIP_MERGE; + DripstoneThickness thickness = (DripstoneThickness)state.getValue(THICKNESS); + return thickness == DripstoneThickness.TIP || allowMerged && thickness == DripstoneThickness.TIP_MERGE; } } private static boolean isTip(BlockState state, Direction direction) { - return isTip(state, false) && state.get(VERTICAL_DIRECTION) == direction; + return isTip(state, false) && state.getValue(VERTICAL_DIRECTION) == direction; } private static boolean isPointingDown(BlockState state) { @@ -467,52 +481,52 @@ private static boolean isPointingUp(BlockState state) { return isPointedDripstoneFacingDirection(state, Direction.UP); } - private static boolean isHeldByPointedDripstone(BlockState state, WorldView world, BlockPos pos) { - return isPointingDown(state) && !world.getBlockState(pos.up()).isOf(ModBlocks.POINTED_LIMESTONE); + private static boolean isHeldByPointedDripstone(BlockState state, LevelReader world, BlockPos pos) { + return isPointingDown(state) && !world.getBlockState(pos.above()).is(ModBlocks.POINTED_LIMESTONE); } - protected boolean canPathfindThrough(BlockState state, NavigationType type) { + protected boolean isPathfindable(BlockState state, PathComputationType type) { return false; } private static boolean isPointedDripstoneFacingDirection(BlockState state, Direction direction) { - return state.isOf(ModBlocks.POINTED_LIMESTONE) && state.get(VERTICAL_DIRECTION) == direction; + return state.is(ModBlocks.POINTED_LIMESTONE) && state.getValue(VERTICAL_DIRECTION) == direction; } @Nullable - private static BlockPos getCauldronPos(World world, BlockPos pos, Fluid fluid) { + private static BlockPos getCauldronPos(Level world, BlockPos pos, Fluid fluid) { Predicate predicate = (state) -> { - return state.getBlock() instanceof AbstractCauldronBlock && ((AbstractCauldronBlock)state.getBlock()).canBeFilledByDripstone(fluid); + return state.getBlock() instanceof AbstractCauldronBlock && ((AbstractCauldronBlock)state.getBlock()).canReceiveStalactiteDrip(fluid); }; BiPredicate biPredicate = (posx, state) -> { return canDripThrough(world, posx, state); }; - return (BlockPos)searchInDirection(world, pos, Direction.DOWN.getDirection(), biPredicate, predicate, 11).orElse(null); + return (BlockPos)searchInDirection(world, pos, Direction.DOWN.getAxisDirection(), biPredicate, predicate, 11).orElse(null); } @Nullable - public static BlockPos getDripPos(World world, BlockPos pos) { + public static BlockPos getDripPos(Level world, BlockPos pos) { BiPredicate biPredicate = (posx, state) -> { return canDripThrough(world, posx, state); }; - return (BlockPos)searchInDirection(world, pos, Direction.UP.getDirection(), biPredicate, PointedLimestoneBlock::canDrip, 11).orElse(null); + return (BlockPos)searchInDirection(world, pos, Direction.UP.getAxisDirection(), biPredicate, PointedLimestoneBlock::canDrip, 11).orElse(null); } - public static Fluid getDripFluid(ServerWorld world, BlockPos pos) { + public static Fluid getDripFluid(ServerLevel world, BlockPos pos) { return (Fluid)getFluid(world, pos, world.getBlockState(pos)).map((fluid) -> { return fluid.fluid; }).filter(PointedLimestoneBlock::isFluidLiquid).orElse(Fluids.EMPTY); } - private static Optional getFluid(World world, BlockPos pos, BlockState state) { + private static Optional getFluid(Level world, BlockPos pos, BlockState state) { return !isPointingDown(state) ? Optional.empty() : getSupportingPos(world, pos, state, 11).map((posx) -> { - BlockPos blockPos = posx.up(); + BlockPos blockPos = posx.above(); BlockState blockState = world.getBlockState(blockPos); Object fluid; - if (blockState.isOf(Blocks.MUD) && !world.getDimension().ultrawarm()) { + if (blockState.is(Blocks.MUD) && !world.dimensionType().ultraWarm()) { fluid = Fluids.WATER; } else { - fluid = world.getFluidState(blockPos).getFluid(); + fluid = world.getFluidState(blockPos).getType(); } return new PointedLimestoneBlock.DrippingFluid(blockPos, (Fluid)fluid, blockState); @@ -524,29 +538,29 @@ private static boolean isFluidLiquid(Fluid fluid) { } private static boolean canGrow(BlockState dripstoneBlockState, BlockState waterState) { - return dripstoneBlockState.isOf(StoneBlockSets.LIMESTONE_SET.baseBlocks.base()) && waterState.isOf(Blocks.WATER) && waterState.getFluidState().isStill(); + return dripstoneBlockState.is(StoneBlockSets.LIMESTONE_SET.baseBlocks.base()) && waterState.is(Blocks.WATER) && waterState.getFluidState().isSource(); } - private static Fluid getDripFluid(World world, Fluid fluid) { - if (fluid.matchesType(Fluids.EMPTY)) { - return world.getDimension().ultrawarm() ? Fluids.LAVA : Fluids.WATER; + private static Fluid getDripFluid(Level world, Fluid fluid) { + if (fluid.isSame(Fluids.EMPTY)) { + return world.dimensionType().ultraWarm() ? Fluids.LAVA : Fluids.WATER; } else { return fluid; } } - private static Optional searchInDirection(WorldAccess world, BlockPos pos, Direction.AxisDirection direction, BiPredicate continuePredicate, Predicate stopPredicate, int range) { + private static Optional searchInDirection(LevelAccessor world, BlockPos pos, Direction.AxisDirection direction, BiPredicate continuePredicate, Predicate stopPredicate, int range) { Direction direction2 = Direction.get(direction, Direction.Axis.Y); - BlockPos.Mutable mutable = pos.mutableCopy(); + BlockPos.MutableBlockPos mutable = pos.mutable(); for(int i = 1; i < range; ++i) { mutable.move(direction2); BlockState blockState = world.getBlockState(mutable); if (stopPredicate.test(blockState)) { - return Optional.of(mutable.toImmutable()); + return Optional.of(mutable.immutable()); } - if (world.isOutOfHeightLimit(mutable.getY()) || !continuePredicate.test(mutable, blockState)) { + if (world.isOutsideBuildHeight(mutable.getY()) || !continuePredicate.test(mutable, blockState)) { return Optional.empty(); } } @@ -554,32 +568,32 @@ private static Optional searchInDirection(WorldAccess world, BlockPos return Optional.empty(); } - private static boolean canDripThrough(BlockView world, BlockPos pos, BlockState state) { + private static boolean canDripThrough(BlockGetter world, BlockPos pos, BlockState state) { if (state.isAir()) { return true; - } else if (state.isOpaqueFullCube()) { + } else if (state.isSolidRender(world, pos)) { return false; } else if (!state.getFluidState().isEmpty()) { return false; } else { VoxelShape voxelShape = state.getCollisionShape(world, pos); - return !VoxelShapes.matchesAnywhere(DRIP_COLLISION_SHAPE, voxelShape, BooleanBiFunction.AND); + return !Shapes.joinIsNotEmpty(DRIP_COLLISION_SHAPE, voxelShape, BooleanOp.AND); } } static { - VERTICAL_DIRECTION = Properties.VERTICAL_DIRECTION; - THICKNESS = Properties.THICKNESS; - WATERLOGGED = Properties.WATERLOGGED; - TIP_MERGE_SHAPE = Block.createColumnShape(6.0, 0.0, 16.0); - UP_TIP_SHAPE = Block.createColumnShape(6.0, 0.0, 11.0); - DOWN_TIP_SHAPE = Block.createColumnShape(6.0, 5.0, 16.0); - BASE_SHAPE = Block.createColumnShape(8.0, 0.0, 16.0); - FRUSTUM_SHAPE = Block.createColumnShape(10.0, 0.0, 16.0); - MIDDLE_SHAPE = Block.createColumnShape(12.0, 0.0, 16.0); - DOWN_TIP_Y = DOWN_TIP_SHAPE.getMin(Direction.Axis.Y); - MAX_HORIZONTAL_MODEL_OFFSET = (float)MIDDLE_SHAPE.getMin(Direction.Axis.X); - DRIP_COLLISION_SHAPE = Block.createColumnShape(4.0, 0.0, 16.0); + VERTICAL_DIRECTION = BlockStateProperties.VERTICAL_DIRECTION; + THICKNESS = BlockStateProperties.DRIPSTONE_THICKNESS; + WATERLOGGED = BlockStateProperties.WATERLOGGED; + TIP_MERGE_SHAPE = Block.box(5.0, 0.0, 5.0, 11.0, 16.0, 11.0); + UP_TIP_SHAPE = Block.box(5.0, 0.0, 5.0, 11.0, 11.0, 11.0); + DOWN_TIP_SHAPE = Block.box(5.0, 5.0, 5.0, 11.0, 16.0, 11.0); + BASE_SHAPE = Block.box(4.0, 0.0, 4.0, 12.0, 16.0, 12.0); + FRUSTUM_SHAPE = Block.box(3.0, 0.0, 3.0, 13.0, 16.0, 13.0); + MIDDLE_SHAPE = Block.box(2.0, 0.0, 2.0, 14.0, 16.0, 14.0); + DOWN_TIP_Y = DOWN_TIP_SHAPE.min(Direction.Axis.Y); + MAX_HORIZONTAL_MODEL_OFFSET = (float)MIDDLE_SHAPE.min(Direction.Axis.X); + DRIP_COLLISION_SHAPE = Block.box(6.0, 0.0, 6.0, 10.0, 16.0, 10.0); } static record DrippingFluid(BlockPos pos, Fluid fluid, BlockState sourceState) { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/AmphoraBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/AmphoraBlock.java index 60cc020e7d..f4997a33ff 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/AmphoraBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/AmphoraBlock.java @@ -1,20 +1,20 @@ package net.sevenstars.middleearth.block.special.pots; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class AmphoraBlock extends LootablePotBlock { - public AmphoraBlock(Settings settings) { + public AmphoraBlock(Properties settings) { super(settings); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(5, 0, 5, 11, 16, 11); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(5, 0, 5, 11, 16, 11); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/FatPotBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/FatPotBlock.java index 3fe04f9621..1b8374734a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/FatPotBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/FatPotBlock.java @@ -1,20 +1,20 @@ package net.sevenstars.middleearth.block.special.pots; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class FatPotBlock extends LootablePotBlock { - public FatPotBlock(Settings settings) { + public FatPotBlock(Properties settings) { super(settings); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(1.5, 0, 1.5, 14.5, 12, 14.5); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(1.5, 0, 1.5, 14.5, 12, 14.5); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/JarBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/JarBlock.java index 0ed613a0ee..1bb038f2d1 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/JarBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/JarBlock.java @@ -1,20 +1,20 @@ package net.sevenstars.middleearth.block.special.pots; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class JarBlock extends LootablePotBlock { - public JarBlock(Settings settings) { + public JarBlock(Properties settings) { super(settings); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(4.5, 0, 4.5, 11.5, 10, 11.5); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(4.5, 0, 4.5, 11.5, 10, 11.5); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/JugBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/JugBlock.java index bc6e59b476..17e02bc727 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/JugBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/JugBlock.java @@ -1,20 +1,20 @@ package net.sevenstars.middleearth.block.special.pots; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class JugBlock extends LootablePotBlock { - public JugBlock(Settings settings) { + public JugBlock(Properties settings) { super(settings); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(3, 0, 3, 13, 16, 13); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(3, 0, 3, 13, 16, 13); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/LootablePotBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/LootablePotBlock.java index e952808058..9c57b3d82a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/LootablePotBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/LootablePotBlock.java @@ -1,46 +1,46 @@ package net.sevenstars.middleearth.block.special.pots; -import net.minecraft.block.BlockState; -import net.minecraft.block.BlockRenderType; -import net.minecraft.block.DecoratedPotBlock; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.WorldView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.DecoratedPotBlock; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; import org.jetbrains.annotations.Nullable; public class LootablePotBlock extends DecoratedPotBlock { - public static final EnumProperty FACING = Properties.HORIZONTAL_FACING; - public static final BooleanProperty CRACKED = Properties.CRACKED; - public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; + public static final EnumProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING; + public static final BooleanProperty CRACKED = BlockStateProperties.CRACKED; + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - public LootablePotBlock(Settings settings) { + public LootablePotBlock(Properties settings) { super(settings); } @Nullable @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - return getDefaultState() - .with(FACING, ctx.getHorizontalPlayerFacing().getOpposite()) - .with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER) - .with(CRACKED, false); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + FluidState fluidState = ctx.getLevel().getFluidState(ctx.getClickedPos()); + return defaultBlockState() + .setValue(HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()) + .setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER) + .setValue(CRACKED, false); } @Override - protected ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData) { + public ItemStack getCloneItemStack(LevelReader world, BlockPos pos, BlockState state) { return new ItemStack(this); } @Override - protected BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.INVISIBLE; + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.INVISIBLE; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/LootablePotBlockEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/LootablePotBlockEntityRenderer.java index 9e103946d4..98032a6b1d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/LootablePotBlockEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/pots/LootablePotBlockEntityRenderer.java @@ -1,76 +1,72 @@ package net.sevenstars.middleearth.block.special.pots; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.DecoratedPotBlockEntity; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.BlockRenderManager; -import net.minecraft.client.render.block.BlockModelRenderer; -import net.minecraft.client.render.block.entity.BlockEntityRenderer; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.render.block.entity.DecoratedPotBlockEntityRenderer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.client.render.RenderLayers; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.Vec3d; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Axis; +import net.minecraft.client.renderer.ItemBlockRenderTypes; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.blockentity.DecoratedPotRenderer; +import net.minecraft.util.Mth; +import net.minecraft.world.level.block.entity.DecoratedPotBlockEntity; +import net.minecraft.world.level.block.state.BlockState; -@Environment(EnvType.CLIENT) public class LootablePotBlockEntityRenderer implements BlockEntityRenderer { private static final float POSITIVE_WOBBLE_SCALE = 0.015625F; - private final DecoratedPotBlockEntityRenderer vanillaRenderer; - private final BlockRenderManager blockRenderManager; + private final DecoratedPotRenderer vanillaRenderer; + private final BlockRenderDispatcher blockRenderManager; - public LootablePotBlockEntityRenderer(BlockEntityRendererFactory.Context context) { - this.vanillaRenderer = new DecoratedPotBlockEntityRenderer(context); - this.blockRenderManager = context.getRenderManager(); + public LootablePotBlockEntityRenderer(BlockEntityRendererProvider.Context context) { + this.vanillaRenderer = new DecoratedPotRenderer(context); + this.blockRenderManager = context.getBlockRenderDispatcher(); } @Override - public void render(DecoratedPotBlockEntity entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { - BlockState state = entity.getCachedState(); + public void render(DecoratedPotBlockEntity entity, float tickProgress, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { + BlockState state = entity.getBlockState(); if (!(state.getBlock() instanceof LootablePotBlock)) { - vanillaRenderer.render(entity, tickProgress, matrices, vertexConsumers, light, overlay, cameraPos); + vanillaRenderer.render(entity, tickProgress, matrices, vertexConsumers, light, overlay); return; } - matrices.push(); + matrices.pushPose(); applyWobble(entity, tickProgress, matrices); - BlockModelRenderer.render( - matrices.peek(), - vertexConsumers.getBuffer(RenderLayers.getEntityBlockLayer(state)), - blockRenderManager.getModel(state), + blockRenderManager.getModelRenderer().renderModel( + matrices.last(), + vertexConsumers.getBuffer(ItemBlockRenderTypes.getRenderType(state, false)), + state, + blockRenderManager.getBlockModel(state), 1.0F, 1.0F, 1.0F, light, overlay ); - matrices.pop(); + matrices.popPose(); } - private static void applyWobble(DecoratedPotBlockEntity entity, float tickProgress, MatrixStack matrices) { - DecoratedPotBlockEntity.WobbleType wobbleType = entity.lastWobbleType; - if (wobbleType == null || entity.getWorld() == null) { + private static void applyWobble(DecoratedPotBlockEntity entity, float tickProgress, PoseStack matrices) { + DecoratedPotBlockEntity.WobbleStyle wobbleType = entity.lastWobbleStyle; + if (wobbleType == null || entity.getLevel() == null) { return; } - float progress = ((float) (entity.getWorld().getTime() - entity.lastWobbleTime) + tickProgress) / wobbleType.lengthInTicks; + float progress = ((float) (entity.getLevel().getGameTime() - entity.wobbleStartedAtTick) + tickProgress) / wobbleType.duration; if (progress < 0.0F || progress > 1.0F) { return; } matrices.translate(0.5D, 0.0D, 0.5D); - if (wobbleType == DecoratedPotBlockEntity.WobbleType.POSITIVE) { - float angle = progress * MathHelper.TAU; - float xRotation = -1.5F * (MathHelper.cos(angle) + 0.5F) * MathHelper.sin(angle / 2.0F); - matrices.multiply(RotationAxis.POSITIVE_X.rotation(xRotation * POSITIVE_WOBBLE_SCALE), 0.0F, 0.0F, 0.0F); - matrices.multiply(RotationAxis.POSITIVE_Z.rotation(MathHelper.sin(angle) * POSITIVE_WOBBLE_SCALE), 0.0F, 0.0F, 0.0F); + if (wobbleType == DecoratedPotBlockEntity.WobbleStyle.POSITIVE) { + float angle = progress * Mth.TWO_PI; + float xRotation = -1.5F * (Mth.cos(angle) + 0.5F) * Mth.sin(angle / 2.0F); + matrices.rotateAround(Axis.XP.rotation(xRotation * POSITIVE_WOBBLE_SCALE), 0.0F, 0.0F, 0.0F); + matrices.rotateAround(Axis.ZP.rotation(Mth.sin(angle) * POSITIVE_WOBBLE_SCALE), 0.0F, 0.0F, 0.0F); } else { - float yaw = MathHelper.sin(-progress * 3.0F * MathHelper.PI) * 0.125F; + float yaw = Mth.sin(-progress * 3.0F * Mth.PI) * 0.125F; float strength = 1.0F - progress; - matrices.multiply(RotationAxis.POSITIVE_Y.rotation(yaw * strength), 0.0F, 0.0F, 0.0F); + matrices.rotateAround(Axis.YP.rotation(yaw * strength), 0.0F, 0.0F, 0.0F); } matrices.translate(-0.5D, 0.0D, -0.5D); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/reinforcedChest/ReinforcedChestBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/reinforcedChest/ReinforcedChestBlock.java index c758bcae46..3e610e0021 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/reinforcedChest/ReinforcedChestBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/reinforcedChest/ReinforcedChestBlock.java @@ -1,39 +1,39 @@ package net.sevenstars.middleearth.block.special.reinforcedChest; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ChestBlock; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; public class ReinforcedChestBlock extends ChestBlock { - public ReinforcedChestBlock(Settings settings) { - super(() -> ModBlockEntities.REINFORCED_CHEST, settings); + public ReinforcedChestBlock(Properties settings) { + super(settings, () -> ModBlockEntities.REINFORCED_CHEST); } @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new ReinforcedChestBlockEntity(pos, state); } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction direction = ctx.getHorizontalPlayerFacing(); - FluidState fluidstate = ctx.getWorld().getFluidState(ctx.getBlockPos()); - return this.getDefaultState().with(FACING, direction).with(WATERLOGGED, fluidstate.getFluid() == Fluids.WATER); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction direction = ctx.getHorizontalDirection(); + FluidState fluidstate = ctx.getLevel().getFluidState(ctx.getClickedPos()); + return this.defaultBlockState().setValue(FACING, direction).setValue(WATERLOGGED, fluidstate.getType() == Fluids.WATER); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 16.0, 16.0); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(0.0, 0.0, 0.0, 16.0, 16.0, 16.0); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/reinforcedChest/ReinforcedChestBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/reinforcedChest/ReinforcedChestBlockEntity.java index eaa19285e4..744b93da7f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/reinforcedChest/ReinforcedChestBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/reinforcedChest/ReinforcedChestBlockEntity.java @@ -1,53 +1,53 @@ package net.sevenstars.middleearth.block.special.reinforcedChest; +import net.minecraft.core.BlockPos; +import net.minecraft.core.NonNullList; +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.CompoundContainer; +import net.minecraft.world.Container; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ChestMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.entity.ContainerOpenersCounter; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModBlockEntities; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.ChestBlockEntity; -import net.minecraft.block.entity.ViewerCountManager; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.DoubleInventory; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.network.listener.ClientPlayPacketListener; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; -import net.minecraft.screen.GenericContainerScreenHandler; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvent; -import net.minecraft.sound.SoundEvents; -import net.minecraft.text.Text; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; public class ReinforcedChestBlockEntity extends ChestBlockEntity { - private final ViewerCountManager stateManager = new ViewerCountManager(){ + private final ContainerOpenersCounter stateManager = new ContainerOpenersCounter(){ @Override - protected void onContainerOpen(World world, BlockPos pos, BlockState state) { - ReinforcedChestBlockEntity.playSound(world, pos, state, SoundEvents.BLOCK_CHEST_OPEN); + protected void onOpen(Level world, BlockPos pos, BlockState state) { + ReinforcedChestBlockEntity.playSound(world, pos, state, SoundEvents.CHEST_OPEN); } @Override - protected void onContainerClose(World world, BlockPos pos, BlockState state) { - ReinforcedChestBlockEntity.playSound(world, pos, state, SoundEvents.BLOCK_CHEST_CLOSE); + protected void onClose(Level world, BlockPos pos, BlockState state) { + ReinforcedChestBlockEntity.playSound(world, pos, state, SoundEvents.CHEST_CLOSE); } @Override - protected void onViewerCountUpdate(World world, BlockPos pos, BlockState state, int oldViewerCount, int newViewerCount) { - ReinforcedChestBlockEntity.this.onViewerCountUpdate(world, pos, state, oldViewerCount, newViewerCount); + protected void openerCountChanged(Level world, BlockPos pos, BlockState state, int oldViewerCount, int newViewerCount) { + ReinforcedChestBlockEntity.this.signalOpenCount(world, pos, state, oldViewerCount, newViewerCount); } @Override - protected boolean isPlayerViewing(PlayerEntity player) { - if (player.currentScreenHandler instanceof GenericContainerScreenHandler) { - Inventory inventory = ((GenericContainerScreenHandler)player.currentScreenHandler).getInventory(); - return inventory == ReinforcedChestBlockEntity.this || inventory instanceof DoubleInventory && ((DoubleInventory)inventory).isPart(ReinforcedChestBlockEntity.this); + protected boolean isOwnContainer(Player player) { + if (player.containerMenu instanceof ChestMenu) { + Container inventory = ((ChestMenu)player.containerMenu).getContainer(); + return inventory == ReinforcedChestBlockEntity.this || inventory instanceof CompoundContainer && ((CompoundContainer)inventory).contains(ReinforcedChestBlockEntity.this); } return false; } @@ -56,65 +56,65 @@ protected boolean isPlayerViewing(PlayerEntity player) { public ReinforcedChestBlockEntity(BlockPos pos, BlockState state) { super(ModBlockEntities.REINFORCED_CHEST, pos, state); - this.setHeldStacks(DefaultedList.ofSize(this.size(), ItemStack.EMPTY)); + this.setItems(NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY)); } @Override - protected ScreenHandler createScreenHandler(int syncId, PlayerInventory playerInventory) { - return GenericContainerScreenHandler.createGeneric9x6(syncId, playerInventory, this); + protected AbstractContainerMenu createMenu(int syncId, Inventory playerInventory) { + return ChestMenu.sixRows(syncId, playerInventory, this); } - static void playSound(World world, BlockPos pos, BlockState state, SoundEvent soundEvent) { + static void playSound(Level world, BlockPos pos, BlockState state, SoundEvent soundEvent) { double d = (double)pos.getX() + 0.5; double e = (double)pos.getY() + 0.5; double f = (double)pos.getZ() + 0.5; - world.playSound(null, d, e, f, soundEvent, SoundCategory.BLOCKS, 0.5f, world.random.nextFloat() * 0.1f - 1.0f); + world.playSound(null, d, e, f, soundEvent, SoundSource.BLOCKS, 0.5f, world.random.nextFloat() * 0.1f - 1.0f); } - protected void onViewerCountUpdate(World world, BlockPos pos, BlockState state, int oldViewerCount, int newViewerCount) { + protected void signalOpenCount(Level world, BlockPos pos, BlockState state, int oldViewerCount, int newViewerCount) { Block block = state.getBlock(); - world.addSyncedBlockEvent(pos, block, 1, newViewerCount); + world.blockEvent(pos, block, 1, newViewerCount); } @Override - public void onOpen(PlayerEntity player) { - if (!this.removed && !player.isSpectator()) { - this.stateManager.openContainer(player, this.getWorld(), this.getPos(), this.getCachedState()); + public void startOpen(Player player) { + if (!this.remove && !player.isSpectator()) { + this.stateManager.incrementOpeners(player, this.getLevel(), this.getBlockPos(), this.getBlockState()); } } @Override - public void onClose(PlayerEntity player) { - if (!this.removed && !player.isSpectator()) { - this.stateManager.closeContainer(player, this.getWorld(), this.getPos(), this.getCachedState()); + public void stopOpen(Player player) { + if (!this.remove && !player.isSpectator()) { + this.stateManager.decrementOpeners(player, this.getLevel(), this.getBlockPos(), this.getBlockState()); } } @Nullable @Override - public Packet toUpdatePacket() { - return BlockEntityUpdateS2CPacket.create(this); + public Packet getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); } @Override - protected Text getContainerName() { - return super.getContainerName(); + protected Component getDefaultName() { + return super.getDefaultName(); } @Override - public int size() { + public int getContainerSize() { return 54; } @Override - public void markDirty() { - super.markDirty(); + public void setChanged() { + super.setChanged(); } @Override - public Text getDisplayName() { - return Text.translatable("screen." + MiddleEarth.MOD_ID + ".reinforced_chest" ); + public Component getDisplayName() { + return Component.translatable("screen." + MiddleEarth.MOD_ID + ".reinforced_chest" ); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/reinforcedChest/ReinforcedChestEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/reinforcedChest/ReinforcedChestEntityRenderer.java index a0c84c286f..9e379d95a4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/reinforcedChest/ReinforcedChestEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/reinforcedChest/ReinforcedChestEntityRenderer.java @@ -1,80 +1,94 @@ package net.sevenstars.middleearth.block.special.reinforcedChest; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.Vec3d; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import net.minecraft.block.*; -import net.minecraft.block.entity.ChestBlockEntity; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Axis; +import net.minecraft.world.level.block.*; import net.minecraft.client.model.*; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.TexturedRenderLayers; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.render.block.entity.ChestBlockEntityRenderer; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.Direction; -import net.minecraft.world.World; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.Sheets; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.blockentity.ChestRenderer; +import net.minecraft.client.resources.model.Material; +import net.minecraft.core.Direction; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ChestBlock; +import net.minecraft.world.level.block.DoubleBlockCombiner; +import net.minecraft.world.level.block.entity.ChestBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; -public class ReinforcedChestEntityRenderer extends ChestBlockEntityRenderer { +public class ReinforcedChestEntityRenderer extends ChestRenderer { private static final String BASE = "bottom"; private static final String LID = "lid"; private static final String LATCH = "lock"; + private static final Material MATERIAL = new Material( + Sheets.CHEST_SHEET, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "model/reinforced_chest") + ); private final ModelPart chestLid; private final ModelPart chestBase; private final ModelPart chestLatch; - public ReinforcedChestEntityRenderer(BlockEntityRendererFactory.Context ctx) { + public ReinforcedChestEntityRenderer(BlockEntityRendererProvider.Context ctx) { super(ctx); - ModelPart modelPart = ctx.getLayerModelPart(EntityModelLayersME.REINFORCED_CHEST); + ModelPart modelPart = ctx.bakeLayer(EntityModelLayersME.REINFORCED_CHEST); this.chestBase = modelPart.getChild(BASE); this.chestLid = modelPart.getChild(LID); this.chestLatch = modelPart.getChild(LATCH); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - modelPartData.addChild(BASE, ModelPartBuilder.create().uv(0, 18).cuboid(-8.0F, 0.0F, -6.0F, 16.0F, 10.0F, 12.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(LID, ModelPartBuilder.create().uv(0, 1).cuboid(-2.0F, -3.0F, -13.0F, 4.0F, 4.0F, 1.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, 10.0F, 6.0F)); - modelPartData.addChild(LATCH, ModelPartBuilder.create().uv(0, 0).cuboid(-8.0F, 0.0F, -12.0F, 16.0F, 6.0F, 12.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, 10.0F, 6.0F)); - return TexturedModelData.of(modelData, 64, 64); + modelPartData.addOrReplaceChild(BASE, CubeListBuilder.create().texOffs(0, 18).addBox(-8.0F, 0.0F, -6.0F, 16.0F, 10.0F, 12.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(LID, CubeListBuilder.create().texOffs(0, 1).addBox(-2.0F, -3.0F, -13.0F, 4.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 10.0F, 6.0F)); + modelPartData.addOrReplaceChild(LATCH, CubeListBuilder.create().texOffs(0, 0).addBox(-8.0F, 0.0F, -12.0F, 16.0F, 6.0F, 12.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 10.0F, 6.0F)); + return LayerDefinition.create(modelData, 64, 64); } @Override - public void render(T entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { - SpriteIdentifier spriteIdentifier = new SpriteIdentifier(TexturedRenderLayers.CHEST_ATLAS_TEXTURE, - Identifier.of(MiddleEarth.MOD_ID, "model/reinforced_chest")); - VertexConsumer vertexConsumer = spriteIdentifier.getVertexConsumer(vertexConsumers, RenderLayer::getEntityCutout); + public void render(T entity, float tickProgress, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { + VertexConsumer vertexConsumer = MATERIAL.buffer(vertexConsumers, RenderType::entityCutout); - World world = entity.getWorld(); - BlockState blockState = world != null ? entity.getCachedState() : Blocks.CHEST.getDefaultState().with(ChestBlock.FACING, Direction.SOUTH); + Level world = entity.getLevel(); + BlockState blockState = world != null ? entity.getBlockState() : Blocks.CHEST.defaultBlockState().setValue(ChestBlock.FACING, Direction.SOUTH); Block block = blockState.getBlock(); ReinforcedChestBlock chest = (ReinforcedChestBlock)block; - DoubleBlockProperties.PropertySource properties; - properties = chest.getBlockEntitySource(blockState, world, entity.getPos(), true); - float g = properties.apply(ReinforcedChestBlock.getAnimationProgressRetriever(entity)).get(tickProgress); + DoubleBlockCombiner.NeighborCombineResult properties; + properties = chest.combine(blockState, world, entity.getBlockPos(), true); + float g = properties.apply(ReinforcedChestBlock.opennessCombiner(entity)).get(tickProgress); g = 1.0F - g; g = 1.0F - g * g * g; - matrices.push(); - float rotation = blockState.get(ChestBlock.FACING).getPositiveHorizontalDegrees(); + matrices.pushPose(); + float rotation = blockState.getValue(ChestBlock.FACING).toYRot(); matrices.translate(0.5D, 0.0D, 0.5D); - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-rotation)); + matrices.mulPose(Axis.YP.rotationDegrees(-rotation)); - chestLatch.pitch = chestLid.pitch = +(g * 1.5707964f); + chestLatch.xRot = chestLid.xRot = +(g * 1.5707964f); chestLid.render(matrices, vertexConsumer, light, overlay); chestLatch.render(matrices, vertexConsumer, light, overlay); chestBase.render(matrices, vertexConsumer, light, overlay); - matrices.pop(); + matrices.popPose(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/sack/SackBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/sack/SackBlock.java index 3b8213ea79..c60eac1bac 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/sack/SackBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/sack/SackBlock.java @@ -1,113 +1,121 @@ package net.sevenstars.middleearth.block.special.sack; import com.mojang.serialization.MapCodec; -import net.minecraft.block.*; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.ShulkerBoxBlockEntity; -import net.minecraft.entity.ItemEntity; -import net.minecraft.entity.mob.PiglinBrain; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.loot.context.LootContextParameters; -import net.minecraft.loot.context.LootWorldContext; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.DyeColor; -import net.minecraft.util.Identifier; -import net.minecraft.util.ItemScatterer; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.monster.piglin.PiglinAi; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.storage.loot.LootParams; +import net.minecraft.world.level.storage.loot.parameters.LootContextParams; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.item.DecorativeItemsME; import org.jetbrains.annotations.Nullable; import java.util.List; -public class SackBlock extends BlockWithEntity { - public static final Identifier CONTENTS_DYNAMIC_DROP_ID; - public static final MapCodec CODEC = createCodec(BarrelBlock::new); +public class SackBlock extends BaseEntityBlock { + public static final ResourceLocation CONTENTS_DYNAMIC_DROP_ID; + public static final MapCodec CODEC = simpleCodec(SackBlock::new); public static final BooleanProperty OPEN; - public SackBlock(Settings settings) { + public SackBlock(Properties settings) { super(settings); - setDefaultState(getDefaultState().with(OPEN, false)); + registerDefaultState(defaultBlockState().setValue(OPEN, false)); } @Override - protected MapCodec getCodec() { + protected MapCodec codec() { return CODEC; } + @Override + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; + } + @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new SackBlockEntity(pos, state); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(4, 0, 4, 12, 9, 12); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(4, 0, 4, 12, 9, 12); } - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if (world instanceof ServerWorld serverWorld) { - NamedScreenHandlerFactory namedScreenHandlerFactory = this.createScreenHandlerFactory(state, world, pos); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (world instanceof ServerLevel serverWorld) { + MenuProvider namedScreenHandlerFactory = this.getMenuProvider(state, world, pos); if (namedScreenHandlerFactory != null) { - player.openHandledScreen(namedScreenHandlerFactory); - PiglinBrain.onGuardedBlockInteracted(serverWorld, player, true); + player.openMenu(namedScreenHandlerFactory); + PiglinAi.angerNearbyPiglins(player, true); } } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } - public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { + public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { BlockEntity blockEntity = world.getBlockEntity(pos); if (blockEntity instanceof SackBlockEntity sackBlockEntity) { - if (!world.isClient && player.shouldSkipBlockDrops() && !sackBlockEntity.isEmpty()) { + if (!world.isClientSide && player.isCreative() && !sackBlockEntity.isEmpty()) { ItemStack itemStack = new ItemStack(DecorativeItemsME.SACK); - itemStack.applyComponentsFrom(blockEntity.createComponentMap()); + itemStack.applyComponents(blockEntity.collectComponents()); ItemEntity itemEntity = new ItemEntity(world, (double)pos.getX() + 0.5, (double)pos.getY() + 0.5, (double)pos.getZ() + 0.5, itemStack); - itemEntity.setToDefaultPickupDelay(); - world.spawnEntity(itemEntity); + itemEntity.setDefaultPickUpDelay(); + world.addFreshEntity(itemEntity); } else { - sackBlockEntity.generateLoot(player); + sackBlockEntity.unpackLootTable(player); } } - return super.onBreak(world, pos, state, player); + return super.playerWillDestroy(world, pos, state, player); } @Override - protected List getDroppedStacks(BlockState state, LootWorldContext.Builder builder) { - BlockEntity blockEntity = builder.getOptional(LootContextParameters.BLOCK_ENTITY); + protected List getDrops(BlockState state, LootParams.Builder builder) { + BlockEntity blockEntity = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); if (blockEntity instanceof SackBlockEntity sackBlockEntity) { - builder = builder.addDynamicDrop(CONTENTS_DYNAMIC_DROP_ID, (lootConsumer) -> { - for(int i = 0; i < sackBlockEntity.size(); ++i) { - lootConsumer.accept(sackBlockEntity.getStack(i)); + builder = builder.withDynamicDrop(CONTENTS_DYNAMIC_DROP_ID, (lootConsumer) -> { + for(int i = 0; i < sackBlockEntity.getContainerSize(); ++i) { + lootConsumer.accept(sackBlockEntity.getItem(i)); } }); } - return super.getDroppedStacks(state, builder); + return super.getDrops(state, builder); } @Override - protected void onStateReplaced(BlockState state, ServerWorld world, BlockPos pos, boolean moved) { - ItemScatterer.onStateReplaced(state, world, pos); + protected void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) { + if (!state.is(newState.getBlock())) { + world.updateNeighbourForOutputSignal(pos, state.getBlock()); + } + super.onRemove(state, world, pos, newState, moved); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(OPEN); } static { - CONTENTS_DYNAMIC_DROP_ID = Identifier.ofVanilla("contents"); - OPEN = Properties.OPEN; + CONTENTS_DYNAMIC_DROP_ID = ResourceLocation.withDefaultNamespace("contents"); + OPEN = BlockStateProperties.OPEN; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/sack/SackBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/sack/SackBlockEntity.java index e6b9e8fdb5..5d951342c2 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/sack/SackBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/sack/SackBlockEntity.java @@ -1,34 +1,27 @@ package net.sevenstars.middleearth.block.special.sack; -import net.minecraft.block.BarrelBlock; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShulkerBoxBlock; -import net.minecraft.block.entity.BarrelBlockEntity; -import net.minecraft.block.entity.ChestBlockEntity; -import net.minecraft.block.entity.LootableContainerBlockEntity; -import net.minecraft.block.entity.ViewerCountManager; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.Inventories; -import net.minecraft.inventory.Inventory; -import net.minecraft.inventory.SidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.network.listener.ClientPlayPacketListener; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; -import net.minecraft.screen.GenericContainerScreenHandler; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.screen.ShulkerBoxScreenHandler; -import net.minecraft.sound.SoundEvents; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.text.Text; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.NonNullList; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.world.ContainerHelper; +import net.minecraft.world.WorldlyContainer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BarrelBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.ShulkerBoxBlock; +import net.minecraft.world.level.block.entity.ContainerOpenersCounter; +import net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import net.sevenstars.middleearth.gui.sack.SackScreenHandler; @@ -36,136 +29,124 @@ import java.util.stream.IntStream; -public class SackBlockEntity extends LootableContainerBlockEntity implements SidedInventory { +public class SackBlockEntity extends RandomizableContainerBlockEntity implements WorldlyContainer { private static final int[] AVAILABLE_SLOTS = IntStream.range(0, 9).toArray(); - private DefaultedList inventory; - private final ViewerCountManager stateManager; + private NonNullList inventory; + private final ContainerOpenersCounter stateManager; public SackBlockEntity(BlockPos pos, BlockState state) { super(ModBlockEntities.SACK, pos, state); - this.inventory = DefaultedList.ofSize(size(), ItemStack.EMPTY); - this.setHeldStacks(DefaultedList.ofSize(this.size(), ItemStack.EMPTY)); - this.stateManager = new ViewerCountManager() { - protected void onContainerOpen(World world, BlockPos pos, BlockState state) { + this.inventory = NonNullList.withSize(getContainerSize(), ItemStack.EMPTY); + this.setItems(NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY)); + this.stateManager = new ContainerOpenersCounter() { + protected void onOpen(Level world, BlockPos pos, BlockState state) { SackBlockEntity.this.setOpen(state, true); } - protected void onContainerClose(World world, BlockPos pos, BlockState state) { + protected void onClose(Level world, BlockPos pos, BlockState state) { SackBlockEntity.this.setOpen(state, false); } - protected void onViewerCountUpdate(World world, BlockPos pos, BlockState state, int oldViewerCount, int newViewerCount) { + protected void openerCountChanged(Level world, BlockPos pos, BlockState state, int oldViewerCount, int newViewerCount) { } - protected boolean isPlayerViewing(PlayerEntity player) { - if (player.currentScreenHandler instanceof GenericContainerScreenHandler) { - Inventory inventory = ((GenericContainerScreenHandler)player.currentScreenHandler).getInventory(); - return inventory == SackBlockEntity.this; - } else { - return false; - } + protected boolean isOwnContainer(Player player) { + return player.containerMenu instanceof SackScreenHandler menu + && menu.isContainer(SackBlockEntity.this); } }; } @Override - public int size() { + public int getContainerSize() { return 9; } @Override - protected ScreenHandler createScreenHandler(int syncId, PlayerInventory playerInventory) { + protected AbstractContainerMenu createMenu(int syncId, Inventory playerInventory) { return new SackScreenHandler(syncId, playerInventory, this); } @Override - public Text getDisplayName() { - return Text.translatable(MiddleEarth.of("sack").toTranslationKey("screen")); + public Component getDisplayName() { + return Component.translatable(MiddleEarth.of("sack").toLanguageKey("screen")); } @Override - protected Text getContainerName() { - return Text.translatable(MiddleEarth.of("sack").toTranslationKey("screen")); + protected Component getDefaultName() { + return Component.translatable(MiddleEarth.of("sack").toLanguageKey("screen")); } - protected void readData(ReadView view) { - super.readData(view); - this.readInventoryNbt(view); + protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.loadAdditional(tag, registries); + this.readInventoryNbt(tag, registries); } - protected void writeData(WriteView view) { - super.writeData(view); - if (!this.writeLootTable(view)) { - Inventories.writeData(view, this.inventory, false); + protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.saveAdditional(tag, registries); + if (!this.trySaveLootTable(tag)) { + ContainerHelper.saveAllItems(tag, this.inventory, false, registries); } } - public void readInventoryNbt(ReadView readView) { - this.inventory = DefaultedList.ofSize(this.size(), ItemStack.EMPTY); - if (!this.readLootTable(readView)) { - Inventories.readData(readView, this.inventory); + public void readInventoryNbt(CompoundTag tag, HolderLookup.Provider registries) { + this.inventory = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); + if (!this.tryLoadLootTable(tag)) { + ContainerHelper.loadAllItems(tag, this.inventory, registries); } } - @Override - public void onBlockReplaced(BlockPos pos, BlockState oldState) { - // Keep empty - } - - public void onOpen(PlayerEntity player) { - if (!this.removed && !player.isSpectator()) { - this.stateManager.openContainer(player, this.getWorld(), this.getPos(), this.getCachedState()); + public void startOpen(Player player) { + if (!this.remove && !player.isSpectator()) { + this.stateManager.incrementOpeners(player, this.getLevel(), this.getBlockPos(), this.getBlockState()); } } - public void onClose(PlayerEntity player) { - if (!this.removed && !player.isSpectator()) { - this.stateManager.closeContainer(player, this.getWorld(), this.getPos(), this.getCachedState()); + public void stopOpen(Player player) { + if (!this.remove && !player.isSpectator()) { + this.stateManager.decrementOpeners(player, this.getLevel(), this.getBlockPos(), this.getBlockState()); } } public void tick() { - if (!this.removed) { - this.stateManager.updateViewerCount(this.getWorld(), this.getPos(), this.getCachedState()); + if (!this.remove) { + this.stateManager.recheckOpeners(this.getLevel(), this.getBlockPos(), this.getBlockState()); } } - protected DefaultedList getHeldStacks() { + protected NonNullList getItems() { return this.inventory; } - protected void setHeldStacks(DefaultedList inventory) { + protected void setItems(NonNullList inventory) { this.inventory = inventory; } @Nullable @Override - public Packet toUpdatePacket() { - return BlockEntityUpdateS2CPacket.create(this); + public Packet getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); } @Override - public void markDirty() { - super.markDirty(); - if (world != null) { - world.updateListeners(pos, getCachedState(), getCachedState(), 3); - } + public void setChanged() { + super.setChanged(); } - public int[] getAvailableSlots(Direction side) { + public int[] getSlotsForFace(Direction side) { return AVAILABLE_SLOTS; } - public boolean canInsert(int slot, ItemStack stack, @Nullable Direction dir) { - return !(Block.getBlockFromItem(stack.getItem()) instanceof ShulkerBoxBlock); + public boolean canPlaceItemThroughFace(int slot, ItemStack stack, @Nullable Direction dir) { + return !(Block.byItem(stack.getItem()) instanceof ShulkerBoxBlock); } - public boolean canExtract(int slot, ItemStack stack, Direction dir) { + public boolean canTakeItemThroughFace(int slot, ItemStack stack, Direction dir) { return true; } void setOpen(BlockState state, boolean open) { - this.world.setBlockState(this.getPos(), (BlockState)state.with(BarrelBlock.OPEN, open), Block.NOTIFY_ALL); + this.level.setBlock(this.getBlockPos(), (BlockState)state.setValue(BarrelBlock.OPEN, open), Block.UPDATE_ALL); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/saplings/VariantSaplingBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/saplings/VariantSaplingBlock.java index e568c93ebb..369ed1f935 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/saplings/VariantSaplingBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/saplings/VariantSaplingBlock.java @@ -1,30 +1,29 @@ package net.sevenstars.middleearth.block.special.saplings; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.SaplingBlock; -import net.minecraft.block.SaplingGenerator; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; - import java.util.List; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SaplingBlock; +import net.minecraft.world.level.block.grower.TreeGrower; +import net.minecraft.world.level.block.state.BlockState; public class VariantSaplingBlock extends SaplingBlock { - private final List trees; + private final List trees; - public VariantSaplingBlock(Settings settings, List trees) { + public VariantSaplingBlock(Properties settings, List trees) { super(trees.getFirst(), settings); this.trees = trees; } @Override - public void generate(ServerWorld world, BlockPos pos, BlockState state, Random random) { - if (state.get(STAGE) == 0) { - world.setBlockState(pos, (BlockState)state.cycle(STAGE), Block.NO_REDRAW); + public void advanceTree(ServerLevel world, BlockPos pos, BlockState state, RandomSource random) { + if (state.getValue(STAGE) == 0) { + world.setBlock(pos, (BlockState)state.cycle(STAGE), Block.UPDATE_INVISIBLE); } else { - SaplingGenerator saplingGenerator = trees.get(random.nextInt(trees.size())); - saplingGenerator.generate(world, world.getChunkManager().getChunkGenerator(), pos, state, random); + TreeGrower saplingGenerator = trees.get(random.nextInt(trees.size())); + saplingGenerator.growTree(world, world.getChunkSource().getGenerator(), pos, state, random); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/saplings/WeightedSaplingBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/saplings/WeightedSaplingBlock.java index dc1dd2679a..6bfe5cd0ba 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/saplings/WeightedSaplingBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/saplings/WeightedSaplingBlock.java @@ -1,35 +1,34 @@ package net.sevenstars.middleearth.block.special.saplings; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.SaplingBlock; -import net.minecraft.block.SaplingGenerator; -import net.minecraft.registry.RegistryKey; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.gen.feature.ConfiguredFeature; - import java.util.List; import java.util.Optional; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceKey; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SaplingBlock; +import net.minecraft.world.level.block.grower.TreeGrower; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; public class WeightedSaplingBlock extends SaplingBlock { private final List trees; - public WeightedSaplingBlock(Settings settings, List trees) { + public WeightedSaplingBlock(Properties settings, List trees) { super(trees.getFirst().saplingGenerator, settings); this.trees = trees; } @Override - public void generate(ServerWorld world, BlockPos pos, BlockState state, Random random) { - if (state.get(STAGE) == 0) { - world.setBlockState(pos, (BlockState)state.cycle(STAGE), Block.NO_REDRAW); + public void advanceTree(ServerLevel world, BlockPos pos, BlockState state, RandomSource random) { + if (state.getValue(STAGE) == 0) { + world.setBlock(pos, (BlockState)state.cycle(STAGE), Block.UPDATE_INVISIBLE); } else { int totalWeight = trees.stream().mapToInt(obj -> obj.weight).sum(); int randomWeight = random.nextInt(totalWeight); int accumulatedWeight = 0; - SaplingGenerator tree = null; + TreeGrower tree = null; for(WeightedTree weightedTree : trees) { if(weightedTree.weight + accumulatedWeight > randomWeight) { tree = weightedTree.saplingGenerator; @@ -38,20 +37,20 @@ public void generate(ServerWorld world, BlockPos pos, BlockState state, Random r accumulatedWeight += weightedTree.weight; } } - if(tree != null) tree.generate(world, world.getChunkManager().getChunkGenerator(), pos, state, random); + if(tree != null) tree.growTree(world, world.getChunkSource().getGenerator(), pos, state, random); } } public static class WeightedTree { - public SaplingGenerator saplingGenerator; + public TreeGrower saplingGenerator; public int weight; - public WeightedTree(SaplingGenerator saplingGenerator, int weight) { + public WeightedTree(TreeGrower saplingGenerator, int weight) { this.saplingGenerator = saplingGenerator; this.weight = weight; } - public WeightedTree(RegistryKey> saplingGenerator, int weight, String name) { - this.saplingGenerator = new SaplingGenerator(name, Optional.empty(), Optional.ofNullable(saplingGenerator), + public WeightedTree(ResourceKey> saplingGenerator, int weight, String name) { + this.saplingGenerator = new TreeGrower(name, Optional.empty(), Optional.ofNullable(saplingGenerator), Optional.empty()); this.weight = weight; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/AbstractShapingAnvilBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/AbstractShapingAnvilBlock.java index 05c79e960b..2172ca3d4e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/AbstractShapingAnvilBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/AbstractShapingAnvilBlock.java @@ -1,104 +1,115 @@ package net.sevenstars.middleearth.block.special.shapingAnvil; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.property.EnumProperty; import net.sevenstars.middleearth.item.items.SmithingHammerItem; -import net.minecraft.block.*; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.stat.Stats; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.ItemScatterer; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.World; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.stats.Stats; +import net.minecraft.world.Container; +import net.minecraft.world.Containers; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.Nullable; -public abstract class AbstractShapingAnvilBlock extends BlockWithEntity implements BlockEntityProvider { - public static final EnumProperty FACING = Properties.HORIZONTAL_FACING; +public abstract class AbstractShapingAnvilBlock extends BaseEntityBlock implements EntityBlock { + public static final EnumProperty FACING = BlockStateProperties.HORIZONTAL_FACING; - public AbstractShapingAnvilBlock(Settings settings) { + public AbstractShapingAnvilBlock(Properties settings) { super(settings); - this.setDefaultState(((this.stateManager.getDefaultState()).with(FACING, Direction.NORTH))); + this.registerDefaultState(((this.stateDefinition.any()).setValue(FACING, Direction.NORTH))); } @Override - protected BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } @Override - protected void onStateReplaced(BlockState state, ServerWorld world, BlockPos pos, boolean moved) { - ItemScatterer.onStateReplaced(state, world, pos); + protected void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) { + Containers.dropContentsOnDestroy(state, newState, world, pos); + super.onRemove(state, world, pos, newState, moved); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - return state.rotate(mirror.getRotation(state.get(FACING))); + public BlockState mirror(BlockState state, Mirror mirror) { + return state.rotate(mirror.getRotation(state.getValue(FACING))); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(FACING, ctx.getHorizontalPlayerFacing().getOpposite()); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState().setValue(FACING, ctx.getHorizontalDirection().getOpposite()); } @Override - public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { + public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { - return super.onBreak(world, pos, state, player); + return super.playerWillDestroy(world, pos, state, player); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - Inventory blockEntity = (Inventory) world.getBlockEntity(pos); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + Container blockEntity = (Container) world.getBlockEntity(pos); - if (!world.isClient) { - if (player.getMainHandStack().isEmpty() && !blockEntity.getStack(0).isEmpty()) { - player.equipStack(EquipmentSlot.MAINHAND, blockEntity.getStack(0)); - blockEntity.removeStack(0); + if (!world.isClientSide) { + if (player.getMainHandItem().isEmpty() && !blockEntity.getItem(0).isEmpty()) { + player.setItemSlot(EquipmentSlot.MAINHAND, blockEntity.getItem(0)); + blockEntity.removeItemNoUpdate(0); } else { - NamedScreenHandlerFactory screenHandlerFactory = state.createScreenHandlerFactory(world, pos); + MenuProvider screenHandlerFactory = state.getMenuProvider(world, pos); if (screenHandlerFactory != null) { - player.openHandledScreen(screenHandlerFactory); + if (screenHandlerFactory instanceof net.sevenstars.middleearth.block.utils.ExtendedMenuProviderME extendedProvider) { + net.sevenstars.middleearth.block.utils.ExtendedMenuProviderME.open(player, extendedProvider); + } else { + player.openMenu(screenHandlerFactory); + } } } } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } @Override - protected void onBlockBreakStart(BlockState state, World world, BlockPos pos, PlayerEntity player) { - ItemStack stack = player.getEquippedStack(EquipmentSlot.MAINHAND); + protected void attack(BlockState state, Level world, BlockPos pos, Player player) { + ItemStack stack = player.getItemBySlot(EquipmentSlot.MAINHAND); BlockEntity blockEntity = world.getBlockEntity(pos); - if (!world.isClient) { - if (stack.getItem() instanceof SmithingHammerItem hammer && player.getAttackCooldownProgress(0.5f) > 0.9f) { - player.incrementStat(Stats.USED.getOrCreateStat(hammer)); - stack.use(world, player, player.getActiveHand()); - player.getStackInHand(player.getActiveHand()).damage(1, player, EquipmentSlot.MAINHAND); + if (!world.isClientSide) { + if (stack.getItem() instanceof SmithingHammerItem hammer && player.getAttackStrengthScale(0.5f) > 0.9f) { + player.awardStat(Stats.ITEM_USED.get(hammer)); + stack.use(world, player, player.getUsedItemHand()); + ItemStack usedTool = stack.copy(); + player.getItemInHand(player.getUsedItemHand()).hurtAndBreak(1, player, EquipmentSlot.MAINHAND); if (blockEntity instanceof ShapingAnvilBlockEntity shapingAnvilBlockEntity) { - ServerWorld serverWorld = (ServerWorld) world; - shapingAnvilBlockEntity.bonk(shapingAnvilBlockEntity, serverWorld, stack); + ServerLevel serverWorld = (ServerLevel) world; + shapingAnvilBlockEntity.bonk(shapingAnvilBlockEntity, serverWorld, usedTool); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/ShapingAnvilBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/ShapingAnvilBlockEntity.java index 01b22db893..f7b62930ad 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/ShapingAnvilBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/ShapingAnvilBlockEntity.java @@ -1,16 +1,49 @@ package net.sevenstars.middleearth.block.special.shapingAnvil; -import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.ExperienceOrbEntity; -import net.minecraft.item.equipment.trim.ArmorTrim; -import net.minecraft.item.equipment.trim.ArmorTrimMaterial; -import net.minecraft.item.equipment.trim.ArmorTrimPattern; -import net.minecraft.recipe.ServerRecipeManager; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.sevenstars.middleearth.block.utils.ExtendedMenuProviderME; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.NonNullList; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.Registries; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.TagKey; +import net.minecraft.world.Container; +import net.minecraft.world.ContainerHelper; +import net.minecraft.world.WorldlyContainer; +import net.minecraft.world.entity.ExperienceOrb; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.world.item.crafting.SingleRecipeInput; +import net.minecraft.world.item.armortrim.ArmorTrim; +import net.minecraft.world.item.armortrim.TrimMaterial; +import net.minecraft.world.item.armortrim.TrimPattern; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import net.sevenstars.middleearth.block.special.forge.MetalTypes; @@ -21,62 +54,30 @@ import net.sevenstars.middleearth.item.dataComponents.TemperatureDataComponent; import net.sevenstars.middleearth.particles.ModParticleTypes; import net.sevenstars.middleearth.recipe.AnvilShapingRecipe; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.Inventories; -import net.minecraft.inventory.Inventory; -import net.minecraft.inventory.SidedInventory; -import net.minecraft.inventory.SimpleInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.network.listener.ClientPlayPacketListener; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; -import net.minecraft.recipe.RecipeEntry; -import net.minecraft.recipe.input.SingleStackRecipeInput; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.screen.PropertyDelegate; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; import java.util.List; -public class ShapingAnvilBlockEntity extends BlockEntity implements ExtendedScreenHandlerFactory, SidedInventory { +public class ShapingAnvilBlockEntity extends BlockEntity implements ExtendedMenuProviderME, WorldlyContainer { private static final String ID = "shaping_anvil"; public int outputIndex = 0; public int maxOutputIndex = 0; - public final DefaultedList inventory = - DefaultedList.ofSize(1, ItemStack.EMPTY); + public final NonNullList inventory = + NonNullList.withSize(1, ItemStack.EMPTY); - protected final PropertyDelegate propertyDelegate; + protected final ContainerData propertyDelegate; + private List> cachedRecipes = List.of(); + private boolean recipeCacheDirty = true; + private boolean clientSyncPending; //TODO make work in creative somehow public ShapingAnvilBlockEntity(BlockPos pos, BlockState state) { super(ModBlockEntities.TREATED_ANVIL, pos, state); - this.propertyDelegate = new PropertyDelegate() { + this.propertyDelegate = new ContainerData() { @Override public int get(int index) { return switch (index) { @@ -94,7 +95,7 @@ public void set(int index, int value) { } @Override - public int size() { + public int getCount() { return 2; } }; @@ -103,7 +104,7 @@ public int size() { public ShapingAnvilBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { super(type, pos, state); - this.propertyDelegate = new PropertyDelegate() { + this.propertyDelegate = new ContainerData() { @Override public int get(int index) { return switch (index) { @@ -121,202 +122,198 @@ public void set(int index, int value) { } @Override - public int size() { + public int getCount() { return 2; } }; } - public static void updateIndex(int index, Vec3d coords, ServerPlayerEntity player){ - BlockPos pos = new BlockPos((int) coords.getX(), (int) coords.getY(), (int) coords.getZ()); - BlockEntity shapingAnvilBlockEntity = player.getWorld().getBlockEntity(pos); + public static void updateIndex(int index, Vec3 coords, ServerPlayer player){ + BlockPos pos = new BlockPos((int) coords.x(), (int) coords.y(), (int) coords.z()); + BlockEntity shapingAnvilBlockEntity = player.level().getBlockEntity(pos); if(shapingAnvilBlockEntity instanceof ShapingAnvilBlockEntity entity){ - if(index >= 0) { + if(index >= 0 && entity.outputIndex != index) { entity.outputIndex = index; - entity.update(); + entity.markPersistedChanged(); } } } public ItemStack getRenderStack(ShapingAnvilBlockEntity entity) { - return entity.getStack(0); + return entity.getItem(0); } - public void bonk(ShapingAnvilBlockEntity entity, ServerWorld world, ItemStack tool){ - ItemStack input = entity.getStack(0); + public void bonk(ShapingAnvilBlockEntity entity, ServerLevel world, ItemStack tool){ + ItemStack input = entity.getItem(0); - ServerRecipeManager serverRecipeManager = (ServerRecipeManager)entity.getWorld().getRecipeManager(); - List> match = serverRecipeManager.getAllMatches(AnvilShapingRecipe.Type.INSTANCE, new SingleStackRecipeInput(input), entity.getWorld()).toList(); + List> match = entity.getMatchingRecipes(world); - if (!match.isEmpty() && hasShapingRecipe(entity)){ - int temperature = 0; - if(input.get(DataComponentTypesME.TEMPERATURE_DATA) != null) { - temperature = input.get(DataComponentTypesME.TEMPERATURE_DATA).temperature(); - } - entity.getWorld().playSound(null, pos, SoundEvents.BLOCK_ANVIL_LAND, SoundCategory.BLOCKS, 1.5f, 1.0f - (float) temperature / 1000); - - int minRandProgress = 7; - int maxRandProgress = 14; - if(temperature <= 0) { - minRandProgress = maxRandProgress = 1; - } else { - RegistryEntry enchantmentRegistryEntry = world.getRegistryManager() - .getOrThrow(RegistryKeys.ENCHANTMENT).getOptional(EnchantmentsME.AULE_BLESSING).orElseThrow(); - boolean hasEnchant = tool.getEnchantments().getEnchantments().contains(enchantmentRegistryEntry); - if (hasEnchant) { - int level = EnchantmentHelper.getLevel(enchantmentRegistryEntry, tool); - minRandProgress = 7 + level; - maxRandProgress = 14 + (2 * level); - } + if (!match.isEmpty()){ + TemperatureDataComponent temperatureData = input.get(DataComponentTypesME.TEMPERATURE_DATA); + int temperature = temperatureData == null ? 0 : temperatureData.temperature(); + + entity.getLevel().playSound(null, worldPosition, SoundEvents.ANVIL_LAND, SoundSource.BLOCKS, 1.5f, 1.0f - (float) temperature / 1000); + + int auleBlessingLevel = 0; + if (temperature > 0 && tool.isEnchanted()) { + Holder auleBlessing = world.registryAccess() + .lookupOrThrow(Registries.ENCHANTMENT) + .getOrThrow(EnchantmentsME.AULE_BLESSING); + auleBlessingLevel = EnchantmentHelper.getItemEnchantmentLevel(auleBlessing, tool); } + int progress = ShapingProgress.roll(world.getRandom()::nextInt, temperature, auleBlessingLevel); + int requiredProgress = match.get(entity.outputIndex).value().getAmount(); - if (input.getMaxDamage() == 0 && input.getDamage() == 0){ - input.set(DataComponentTypes.MAX_DAMAGE, match.get(entity.outputIndex).value().getAmount()); - input.setDamage(match.get(entity.outputIndex).value().getAmount() - (int) (Math.random() * (maxRandProgress - minRandProgress) + minRandProgress)); + if (input.getMaxDamage() == 0 && input.getDamageValue() == 0){ + input.set(DataComponents.MAX_DAMAGE, requiredProgress); + input.setDamageValue(Math.max(0, requiredProgress - progress)); } else{ - input.setDamage(input.getDamage() - (int) (Math.random() * (maxRandProgress - minRandProgress) + minRandProgress)); + input.setDamageValue(Math.max(0, input.getDamageValue() - progress)); } - World serverWorld = this.getWorld(); - if (serverWorld instanceof ServerWorld) { - ((ServerWorld)serverWorld).spawnParticles(ModParticleTypes.ANVIL_SPARK_PARTICLE, pos.getX()+ 0.5f, pos.getY() + 1.0f, pos.getZ() + 0.5f, Math.max(temperature / 10, 3), 0.0, 0.0, 0.0, 0.0); + Level serverWorld = this.getLevel(); + if (serverWorld instanceof ServerLevel) { + ((ServerLevel)serverWorld).sendParticles(ModParticleTypes.ANVIL_SPARK_PARTICLE, worldPosition.getX()+ 0.5f, worldPosition.getY() + 1.0f, worldPosition.getZ() + 0.5f, Math.max(temperature / 10, 3), 0.0, 0.0, 0.0, 0.0); } - int minRandTemperature = 10; - int maxRandTemperature = 18; - int value = (int) (Math.random() * (maxRandTemperature - minRandTemperature) + minRandTemperature); - - if ((input.get(DataComponentTypesME.TEMPERATURE_DATA).temperature() - value) <= 0){ - input.remove(DataComponentTypesME.TEMPERATURE_DATA); - } else { - input.set(DataComponentTypesME.TEMPERATURE_DATA, new TemperatureDataComponent(input.get(DataComponentTypesME.TEMPERATURE_DATA).temperature() - value)); + if (temperatureData != null) { + int cooling = 10 + world.getRandom().nextInt(8); + int cooledTemperature = temperature - cooling; + if (cooledTemperature <= 0){ + input.remove(DataComponentTypesME.TEMPERATURE_DATA); + } else { + input.set(DataComponentTypesME.TEMPERATURE_DATA, new TemperatureDataComponent(cooledTemperature)); + } } - RegistryWrapper.Impl armorTrimMaterialRegistry = entity.getWorld().getRegistryManager().getOrThrow(RegistryKeys.TRIM_MATERIAL); - RegistryWrapper.Impl armorTrimPatternRegistry = entity.getWorld().getRegistryManager().getOrThrow(RegistryKeys.TRIM_PATTERN); + entity.markInventoryChanged(); + HolderLookup.RegistryLookup armorTrimMaterialRegistry = entity.getLevel().registryAccess().lookupOrThrow(Registries.TRIM_MATERIAL); + HolderLookup.RegistryLookup armorTrimPatternRegistry = entity.getLevel().registryAccess().lookupOrThrow(Registries.TRIM_PATTERN); - if (input.getDamage() == 0){ + if (input.getDamageValue() == 0){ int xp = 2; if(input.getItem() == ResourceItemsME.ROD || input.getItem() == ResourceItemsME.ARMOR_PLATE) xp = 4; if(input.getItem() == ResourceItemsME.LARGE_ROD) xp = 7; - ExperienceOrbEntity.spawn(world, entity.getPos().toCenterPos().add(0, 1, 0), xp); + ExperienceOrb.award(world, entity.getBlockPos().getCenter().add(0, 1, 0), xp); - ItemStack output = match.get(entity.outputIndex).value().craft(new SingleStackRecipeInput(input), entity.world.getRegistryManager()); + ItemStack output = match.get(entity.outputIndex).value().assemble(new SingleRecipeInput(input), entity.level.registryAccess()); - if(input.get(DataComponentTypes.TRIM) != null){ - output.set(DataComponentTypes.TRIM, input.get(DataComponentTypes.TRIM)); + if(input.get(DataComponents.TRIM) != null){ + output.set(DataComponents.TRIM, input.get(DataComponents.TRIM)); } else{ MetalTypes metal = MetalTypes.EMPTY; - if(input.isIn(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "ingot_shaping")))) { + if(input.is(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "ingot_shaping")))) { metal = MetalTypes.getMetalByIngot(input.getItem()); - }else if(input.isIn(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "nugget_shaping")))) { + }else if(input.is(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "nugget_shaping")))) { metal = MetalTypes.getMetalByNugget(input.getItem()); } if (metal.isVanilla()){ - output.set(DataComponentTypes.TRIM, new ArmorTrim( - armorTrimMaterialRegistry.getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, Identifier.of(metal.getName()))), - armorTrimPatternRegistry.getOrThrow(RegistryKey.of(RegistryKeys.TRIM_PATTERN, Identifier.of(MiddleEarth.MOD_ID,"smithing_part"))))); + output.set(DataComponents.TRIM, new ArmorTrim( + armorTrimMaterialRegistry.getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, ResourceLocation.parse(metal.getName()))), + armorTrimPatternRegistry.getOrThrow(ResourceKey.create(Registries.TRIM_PATTERN, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID,"smithing_part"))))); } else { - output.set(DataComponentTypes.TRIM, new ArmorTrim( - armorTrimMaterialRegistry.getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, Identifier.of(MiddleEarth.MOD_ID, metal.getName()))), - armorTrimPatternRegistry.getOrThrow(RegistryKey.of(RegistryKeys.TRIM_PATTERN, Identifier.of(MiddleEarth.MOD_ID, "smithing_part"))))); + output.set(DataComponents.TRIM, new ArmorTrim( + armorTrimMaterialRegistry.getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, metal.getName()))), + armorTrimPatternRegistry.getOrThrow(ResourceKey.create(Registries.TRIM_PATTERN, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "smithing_part"))))); } } if (input.get(DataComponentTypesME.TEMPERATURE_DATA) != null){ output.set(DataComponentTypesME.TEMPERATURE_DATA, new TemperatureDataComponent(input.get(DataComponentTypesME.TEMPERATURE_DATA).temperature())); } - entity.getWorld().playSound(null, pos, SoundEvents.BLOCK_ANVIL_USE, SoundCategory.BLOCKS, 1.0f, 1.0f); - entity.setStack(0, output); - entity.update(); + entity.getLevel().playSound(null, worldPosition, SoundEvents.ANVIL_USE, SoundSource.BLOCKS, 1.0f, 1.0f); + entity.setItem(0, output); } } else { - World serverWorld = this.getWorld(); - if (serverWorld instanceof ServerWorld) { - ((ServerWorld)serverWorld).spawnParticles(ModParticleTypes.ANVIL_SPARK_PARTICLE, pos.getX()+ 0.5f, pos.getY() + 1.0f, pos.getZ() + 0.5f, 2, 0.0, 0.0, 0.0, 0.0); + Level serverWorld = this.getLevel(); + if (serverWorld instanceof ServerLevel) { + ((ServerLevel)serverWorld).sendParticles(ModParticleTypes.ANVIL_SPARK_PARTICLE, worldPosition.getX()+ 0.5f, worldPosition.getY() + 1.0f, worldPosition.getZ() + 0.5f, 2, 0.0, 0.0, 0.0, 0.0); } - entity.getWorld().playSound(null, pos, SoundEvents.BLOCK_ANVIL_LAND, SoundCategory.BLOCKS, 1.5f, 1.0f); + entity.getLevel().playSound(null, worldPosition, SoundEvents.ANVIL_LAND, SoundSource.BLOCKS, 1.5f, 1.0f); } } - public static void tick(World world, BlockPos blockPos, BlockState blockState, ShapingAnvilBlockEntity entity) { - ItemStack input = entity.getStack(0); - if (!input.isEmpty()){ - ServerRecipeManager serverRecipeManager = (ServerRecipeManager)entity.getWorld().getRecipeManager(); - List> match = serverRecipeManager.getAllMatches(AnvilShapingRecipe.Type.INSTANCE, new SingleStackRecipeInput(input), entity.getWorld()).toList(); - if(!match.isEmpty()){ - entity.maxOutputIndex = match.size() - 1; - if (entity.outputIndex > entity.maxOutputIndex){ - entity.outputIndex = entity.maxOutputIndex; - } - entity.update(); - } else { - entity.maxOutputIndex = 0; - entity.update(); - } - } else { - entity.maxOutputIndex = 0; - entity.update(); + public static void tick(Level world, BlockPos blockPos, BlockState blockState, ShapingAnvilBlockEntity entity) { + if (entity.recipeCacheDirty) { + entity.refreshRecipeCache(world); } + entity.flushClientSync(world); } - private static boolean hasShapingRecipe(ShapingAnvilBlockEntity entity) { - SimpleInventory inventory1 = new SimpleInventory(entity.size()); - ItemStack input; - - inventory1.setStack(0, entity.getStack(0)); - input = entity.getStack(0); - - if(input.isEmpty()) return false; - - SingleStackRecipeInput inputStack = new SingleStackRecipeInput(input); - ServerRecipeManager serverRecipeManager = (ServerRecipeManager)entity.getWorld().getRecipeManager(); - List> match = serverRecipeManager.getAllMatches(AnvilShapingRecipe.Type.INSTANCE, inputStack, entity.getWorld()).toList(); + private List> getMatchingRecipes(Level world) { + if (this.recipeCacheDirty) { + this.refreshRecipeCache(world); + } + return this.cachedRecipes; + } - return match.getFirst().value().getOutput() != null; + private void refreshRecipeCache(Level world) { + ItemStack input = this.getItem(0); + if (input.isEmpty()) { + this.cachedRecipes = List.of(); + } else { + RecipeManager recipeManager = world.getRecipeManager(); + this.cachedRecipes = recipeManager.getRecipesFor( + AnvilShapingRecipe.Type.INSTANCE, + new SingleRecipeInput(input), + world + ); + } + this.recipeCacheDirty = false; + + int newMaxOutputIndex = this.cachedRecipes.isEmpty() ? 0 : this.cachedRecipes.size() - 1; + int newOutputIndex = this.cachedRecipes.isEmpty() + ? this.outputIndex + : Math.min(this.outputIndex, newMaxOutputIndex); + if (this.maxOutputIndex != newMaxOutputIndex || this.outputIndex != newOutputIndex) { + this.maxOutputIndex = newMaxOutputIndex; + this.outputIndex = newOutputIndex; + this.markPersistedChanged(); + } } @Override - protected void writeData(WriteView view) { - super.writeData(view); - Inventories.writeData(view, this.inventory, true); - view.putInt("current-index", this.outputIndex); - view.putInt("current-max-index", this.maxOutputIndex); + protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.saveAdditional(tag, registries); + ContainerHelper.saveAllItems(tag, this.inventory, true, registries); + tag.putInt("current-index", this.outputIndex); + tag.putInt("current-max-index", this.maxOutputIndex); } @Override - protected void readData(ReadView view) { - super.readData(view); + protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.loadAdditional(tag, registries); this.inventory.clear(); - Inventories.readData(view, this.inventory); - this.outputIndex = view.getInt("current-index", 0); - this.maxOutputIndex = view.getInt("current-max-index", 0); + ContainerHelper.loadAllItems(tag, this.inventory, registries); + this.outputIndex = tag.getInt("current-index"); + this.maxOutputIndex = tag.getInt("current-max-index"); + this.recipeCacheDirty = true; } @Override - public Text getDisplayName() { - return Text.translatable("screen." + MiddleEarth.MOD_ID + "." + ID); + public Component getDisplayName() { + return Component.translatable("screen." + MiddleEarth.MOD_ID + "." + ID); } @Nullable @Override - public ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) { + public AbstractContainerMenu createMenu(int syncId, Inventory playerInventory, Player player) { return new ShapingAnvilScreenHandler(syncId, playerInventory, this, this.propertyDelegate); } @Nullable @Override - public Packet toUpdatePacket() { - return BlockEntityUpdateS2CPacket.create(this); + public Packet getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); } @Override - public NbtCompound toInitialChunkDataNbt(RegistryWrapper.WrapperLookup registryLookup) { - return createNbt(registryLookup); + public CompoundTag getUpdateTag(HolderLookup.Provider registryLookup) { + return saveWithoutMetadata(registryLookup); } @Override - public int[] getAvailableSlots(Direction side) { + public int[] getSlotsForFace(Direction side) { int[] slots = new int[inventory.size()]; for (int i = 0; i < slots.length; i++) { slots[i] = i; @@ -324,30 +321,49 @@ public int[] getAvailableSlots(Direction side) { return slots; } - public void update() { - markDirty(); - world.updateListeners(pos, getCachedState(), getCachedState(), Block.NOTIFY_ALL); + private void markPersistedChanged() { + super.setChanged(); + this.clientSyncPending = true; + } + + private void markInventoryChanged() { + this.recipeCacheDirty = true; + this.markPersistedChanged(); } @Override - public boolean canInsert(int slot, ItemStack stack, @Nullable Direction dir) { - return getStack(0).isEmpty(); + public void setChanged() { + this.recipeCacheDirty = true; + this.markPersistedChanged(); + } + + private void flushClientSync(Level world) { + if (this.clientSyncPending && world instanceof ServerLevel serverWorld) { + BlockState state = this.getBlockState(); + serverWorld.sendBlockUpdated(this.worldPosition, state, state, Block.UPDATE_CLIENTS); + this.clientSyncPending = false; + } + } + + @Override + public boolean canPlaceItemThroughFace(int slot, ItemStack stack, @Nullable Direction dir) { + return getItem(0).isEmpty(); } @Override - public boolean canExtract(int slot, ItemStack stack, Direction dir) { + public boolean canTakeItemThroughFace(int slot, ItemStack stack, Direction dir) { return true; } @Override - public int size() { + public int getContainerSize() { return inventory.size(); } @Override public boolean isEmpty() { - for (int i = 0; i < size(); i++) { - ItemStack itemStack = getStack(i); + for (int i = 0; i < getContainerSize(); i++) { + ItemStack itemStack = getItem(i); if (!itemStack.isEmpty()) { return false; } @@ -356,45 +372,50 @@ public boolean isEmpty() { } @Override - public ItemStack getStack(int slot) { + public ItemStack getItem(int slot) { return inventory.get(slot); } @Override - public ItemStack removeStack(int slot, int amount) { - ItemStack result = Inventories.splitStack(inventory, slot, amount); + public ItemStack removeItem(int slot, int amount) { + ItemStack result = ContainerHelper.removeItem(inventory, slot, amount); if (!result.isEmpty()) { - update(); + this.markInventoryChanged(); } return result; } @Override - public ItemStack removeStack(int slot) { - return Inventories.removeStack(inventory, slot); + public ItemStack removeItemNoUpdate(int slot) { + return ContainerHelper.takeItem(inventory, slot); } @Override - public void setStack(int slot, ItemStack stack) { - inventory.set(slot, stack); - if (stack.getCount() > getMaxCountPerStack()) { - stack.setCount(getMaxCountPerStack()); + public void setItem(int slot, ItemStack stack) { + if (stack.getCount() > getMaxStackSize()) { + stack.setCount(getMaxStackSize()); + } + if (!ItemStack.matches(this.inventory.get(slot), stack)) { + this.inventory.set(slot, stack); + this.markInventoryChanged(); } - update(); } @Override - public boolean canPlayerUse(PlayerEntity player) { - return Inventory.canPlayerUse(this, player); + public boolean stillValid(Player player) { + return Container.stillValidBlockEntity(this, player); } @Override - public void clear() { - inventory.clear(); + public void clearContent() { + if (!this.isEmpty()) { + this.inventory.clear(); + this.markInventoryChanged(); + } } @Override - public Object getScreenOpeningData(ServerPlayerEntity player) { - return pos; + public void writeOpeningData(RegistryFriendlyByteBuf buffer) { + BlockPos.STREAM_CODEC.encode(buffer, worldPosition); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/ShapingAnvilEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/ShapingAnvilEntityRenderer.java index 1e3a6a1dc3..48959e872c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/ShapingAnvilEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/ShapingAnvilEntityRenderer.java @@ -1,67 +1,67 @@ package net.sevenstars.middleearth.block.special.shapingAnvil; -import net.minecraft.client.render.LightmapTextureManager; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BlockEntityRenderer; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.item.BlockItem; -import net.minecraft.item.ItemDisplayContext; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.LightType; -import net.minecraft.world.World; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Axis; +import net.minecraft.client.renderer.LightTexture; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.core.BlockPos; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LightLayer; +import net.minecraft.world.phys.Vec3; public class ShapingAnvilEntityRenderer implements BlockEntityRenderer { - private final BlockEntityRendererFactory.Context context; + private final BlockEntityRendererProvider.Context context; - public ShapingAnvilEntityRenderer(BlockEntityRendererFactory.Context context) { + public ShapingAnvilEntityRenderer(BlockEntityRendererProvider.Context context) { this.context = context; } - private int getLightLevel(World world, BlockPos pos) { - int bLight = world.getLightLevel(LightType.BLOCK, pos); - int sLight = world.getLightLevel(LightType.SKY, pos); - return LightmapTextureManager.pack(bLight, sLight); + private int getLightLevel(Level world, BlockPos pos) { + int bLight = world.getBrightness(LightLayer.BLOCK, pos); + int sLight = world.getBrightness(LightLayer.SKY, pos); + return LightTexture.pack(bLight, sLight); } @Override - public void render(ShapingAnvilBlockEntity entity, float tickProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, Vec3d cameraPos) { + public void render(ShapingAnvilBlockEntity entity, float tickProgress, PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay) { ItemStack stack = entity.getRenderStack(entity); if(stack.isEmpty()) return; - matrices.push(); + matrices.pushPose(); matrices.translate(0.5f, 1.025f, 0.5f); matrices.scale(0.75f, 0.75f, 0.75f); - matrices.multiply(RotationAxis.POSITIVE_X.rotation((float) Math.toRadians(90))); + matrices.mulPose(Axis.XP.rotation((float) Math.toRadians(90))); if (stack.getItem() instanceof BlockItem){ - switch (entity.getCachedState().get(AbstractShapingAnvilBlock.FACING)) { - case NORTH -> matrices.multiply(RotationAxis.POSITIVE_Z.rotation((float) Math.toRadians(270))); - case EAST -> matrices.multiply(RotationAxis.POSITIVE_Z.rotation((float) Math.toRadians(180))); - case SOUTH -> matrices.multiply(RotationAxis.POSITIVE_Z.rotation((float) Math.toRadians(90))); - case WEST -> matrices.multiply(RotationAxis.POSITIVE_Z.rotation((float) Math.toRadians(0))); + switch (entity.getBlockState().getValue(AbstractShapingAnvilBlock.FACING)) { + case NORTH -> matrices.mulPose(Axis.ZP.rotation((float) Math.toRadians(270))); + case EAST -> matrices.mulPose(Axis.ZP.rotation((float) Math.toRadians(180))); + case SOUTH -> matrices.mulPose(Axis.ZP.rotation((float) Math.toRadians(90))); + case WEST -> matrices.mulPose(Axis.ZP.rotation((float) Math.toRadians(0))); } } else { - switch (entity.getCachedState().get(AbstractShapingAnvilBlock.FACING)) { - case NORTH -> matrices.multiply(RotationAxis.POSITIVE_Z.rotation((float) Math.toRadians(225))); - case EAST -> matrices.multiply(RotationAxis.POSITIVE_Z.rotation((float) Math.toRadians(135))); - case SOUTH -> matrices.multiply(RotationAxis.POSITIVE_Z.rotation((float) Math.toRadians(45))); - case WEST -> matrices.multiply(RotationAxis.POSITIVE_Z.rotation((float) Math.toRadians(315))); + switch (entity.getBlockState().getValue(AbstractShapingAnvilBlock.FACING)) { + case NORTH -> matrices.mulPose(Axis.ZP.rotation((float) Math.toRadians(225))); + case EAST -> matrices.mulPose(Axis.ZP.rotation((float) Math.toRadians(135))); + case SOUTH -> matrices.mulPose(Axis.ZP.rotation((float) Math.toRadians(45))); + case WEST -> matrices.mulPose(Axis.ZP.rotation((float) Math.toRadians(315))); } } - int currentLight = getLightLevel(entity.getWorld(), entity.getPos()); + int currentLight = getLightLevel(entity.getLevel(), entity.getBlockPos()); - this.context.getItemRenderer().renderItem(stack, ItemDisplayContext.FIXED, currentLight, OverlayTexture.DEFAULT_UV, - matrices, vertexConsumers, entity.getWorld(), 1); + this.context.getItemRenderer().renderStatic(stack, ItemDisplayContext.FIXED, currentLight, OverlayTexture.NO_OVERLAY, + matrices, vertexConsumers, entity.getLevel(), 1); - matrices.pop(); + matrices.popPose(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/ShapingProgress.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/ShapingProgress.java new file mode 100644 index 0000000000..51a9accfb6 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/ShapingProgress.java @@ -0,0 +1,23 @@ +package net.sevenstars.middleearth.block.special.shapingAnvil; + +import java.util.function.IntUnaryOperator; + +public final class ShapingProgress { + private static final int COLD_PROGRESS = 1; + private static final int HOT_MIN_PROGRESS = 7; + private static final int HOT_MAX_PROGRESS_EXCLUSIVE = 14; + + private ShapingProgress() { + } + + public static int roll(IntUnaryOperator nextInt, int temperature, int auleBlessingLevel) { + if (temperature <= 0) { + return COLD_PROGRESS; + } + + int level = Math.max(0, auleBlessingLevel); + int minimum = HOT_MIN_PROGRESS + level; + int maximumExclusive = HOT_MAX_PROGRESS_EXCLUSIVE + 2 * level; + return minimum + nextInt.applyAsInt(maximumExclusive - minimum); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/dwarvenTreatedAnvil/DwarvenShapingAnvilBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/dwarvenTreatedAnvil/DwarvenShapingAnvilBlock.java index ca0db1b9d9..03be8e2bcd 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/dwarvenTreatedAnvil/DwarvenShapingAnvilBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/dwarvenTreatedAnvil/DwarvenShapingAnvilBlock.java @@ -1,78 +1,78 @@ package net.sevenstars.middleearth.block.special.shapingAnvil.dwarvenTreatedAnvil; import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import net.sevenstars.middleearth.block.special.shapingAnvil.AbstractShapingAnvilBlock; import net.sevenstars.middleearth.block.special.shapingAnvil.ShapingAnvilBlockEntity; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.BlockWithEntity; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; import java.util.stream.Stream; public class DwarvenShapingAnvilBlock extends AbstractShapingAnvilBlock { - public DwarvenShapingAnvilBlock(Settings settings) { + public DwarvenShapingAnvilBlock(Properties settings) { super(settings); } @Override - protected MapCodec getCodec() { - return createCodec(DwarvenShapingAnvilBlock::new); + protected MapCodec codec() { + return simpleCodec(DwarvenShapingAnvilBlock::new); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - switch (state.get(FACING)){ + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + switch (state.getValue(FACING)){ case NORTH, SOUTH -> { return Stream.of( - Block.createCuboidShape(1, 0, 1, 15, 5, 15), - Block.createCuboidShape(2, 5, 3, 14, 12, 13), - Block.createCuboidShape(0, 12, 3, 16, 16, 13), - Block.createCuboidShape(0, 0, 5, 2, 7, 11), - Block.createCuboidShape(14, 0, 5, 16, 7, 11) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(1, 0, 1, 15, 5, 15), + Block.box(2, 5, 3, 14, 12, 13), + Block.box(0, 12, 3, 16, 16, 13), + Block.box(0, 0, 5, 2, 7, 11), + Block.box(14, 0, 5, 16, 7, 11) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } case EAST, WEST -> { return Stream.of( - Block.createCuboidShape(1, 0, 1, 15, 5, 15), - Block.createCuboidShape(3, 5, 2, 13, 12, 14), - Block.createCuboidShape(3, 12, 0, 13, 16, 16), - Block.createCuboidShape(5, 0, 14, 11, 7, 16), - Block.createCuboidShape(5, 0, 0, 11, 7, 2) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(1, 0, 1, 15, 5, 15), + Block.box(3, 5, 2, 13, 12, 14), + Block.box(3, 12, 0, 13, 16, 16), + Block.box(5, 0, 14, 11, 7, 16), + Block.box(5, 0, 0, 11, 7, 2) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } default -> { - return Block.createCuboidShape(1, 0, 1, 15, 16, 15); + return Block.box(1, 0, 1, 15, 16, 15); } } } @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new ShapingAnvilBlockEntity(ModBlockEntities.TREATED_ANVIL, pos, state); } @Nullable @Override - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { + public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { return DwarvenShapingAnvilBlock.validateTicker(world, type, ModBlockEntities.TREATED_ANVIL); } @Nullable - protected static BlockEntityTicker validateTicker(World world, BlockEntityType givenType, BlockEntityType expectedType) { - return world.isClient ? null : DwarvenShapingAnvilBlock.validateTicker(givenType, expectedType, ShapingAnvilBlockEntity::tick); + protected static BlockEntityTicker validateTicker(Level world, BlockEntityType givenType, BlockEntityType expectedType) { + return world.isClientSide ? null : DwarvenShapingAnvilBlock.createTickerHelper(givenType, expectedType, ShapingAnvilBlockEntity::tick); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/elvenTreatedAnvil/ElvenTreatedAnvilblock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/elvenTreatedAnvil/ElvenTreatedAnvilblock.java index 62720d6ea5..7acce5e2a1 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/elvenTreatedAnvil/ElvenTreatedAnvilblock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/elvenTreatedAnvil/ElvenTreatedAnvilblock.java @@ -1,95 +1,95 @@ package net.sevenstars.middleearth.block.special.shapingAnvil.elvenTreatedAnvil; import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import net.sevenstars.middleearth.block.special.shapingAnvil.AbstractShapingAnvilBlock; import net.sevenstars.middleearth.block.special.shapingAnvil.ShapingAnvilBlockEntity; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.BlockWithEntity; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; import java.util.stream.Stream; public class ElvenTreatedAnvilblock extends AbstractShapingAnvilBlock { - public ElvenTreatedAnvilblock(Settings settings) { + public ElvenTreatedAnvilblock(Properties settings) { super(settings); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - switch (state.get(FACING)){ + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + switch (state.getValue(FACING)){ case NORTH -> { return Stream.of( - Block.createCuboidShape(2, 0, 2, 14, 5, 14), - Block.createCuboidShape(12, 12, 6, 16, 16, 10), - Block.createCuboidShape(4, 13, 6, 12, 16, 10), - Block.createCuboidShape(0, 14, 7, 4, 16, 9), - Block.createCuboidShape(5, 5, 6, 11, 13, 10) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(2, 0, 2, 14, 5, 14), + Block.box(12, 12, 6, 16, 16, 10), + Block.box(4, 13, 6, 12, 16, 10), + Block.box(0, 14, 7, 4, 16, 9), + Block.box(5, 5, 6, 11, 13, 10) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } case SOUTH -> { return Stream.of( - Block.createCuboidShape(2, 0, 2, 14, 5, 14), - Block.createCuboidShape(0, 12, 6, 4, 16, 10), - Block.createCuboidShape(4, 13, 6, 12, 16, 10), - Block.createCuboidShape(12, 14, 7, 16, 16, 9), - Block.createCuboidShape(5, 5, 6, 11, 13, 10) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(2, 0, 2, 14, 5, 14), + Block.box(0, 12, 6, 4, 16, 10), + Block.box(4, 13, 6, 12, 16, 10), + Block.box(12, 14, 7, 16, 16, 9), + Block.box(5, 5, 6, 11, 13, 10) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } case EAST -> { return Stream.of( - Block.createCuboidShape(2, 0, 2, 14, 5, 14), - Block.createCuboidShape(6, 12, 12, 10, 16, 16), - Block.createCuboidShape(6, 13, 4, 10, 16, 12), - Block.createCuboidShape(7, 14, 0, 9, 16, 4), - Block.createCuboidShape(6, 5, 5, 10, 13, 11) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(2, 0, 2, 14, 5, 14), + Block.box(6, 12, 12, 10, 16, 16), + Block.box(6, 13, 4, 10, 16, 12), + Block.box(7, 14, 0, 9, 16, 4), + Block.box(6, 5, 5, 10, 13, 11) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } case WEST -> { return Stream.of( - Block.createCuboidShape(2, 0, 2, 14, 5, 14), - Block.createCuboidShape(6, 12, 0, 10, 16, 4), - Block.createCuboidShape(6, 13, 4, 10, 16, 12), - Block.createCuboidShape(7, 14, 12, 9, 16, 16), - Block.createCuboidShape(6, 5, 5, 10, 13, 11) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(2, 0, 2, 14, 5, 14), + Block.box(6, 12, 0, 10, 16, 4), + Block.box(6, 13, 4, 10, 16, 12), + Block.box(7, 14, 12, 9, 16, 16), + Block.box(6, 5, 5, 10, 13, 11) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } default -> { - return Block.createCuboidShape(1, 0, 1, 15, 16, 15); + return Block.box(1, 0, 1, 15, 16, 15); } } } @Override - protected MapCodec getCodec() { - return createCodec(ElvenTreatedAnvilblock::new); + protected MapCodec codec() { + return simpleCodec(ElvenTreatedAnvilblock::new); } @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new ShapingAnvilBlockEntity(ModBlockEntities.TREATED_ANVIL, pos, state); } @Nullable @Override - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { + public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { return ElvenTreatedAnvilblock.validateTicker(world, type, ModBlockEntities.TREATED_ANVIL); } @Nullable - protected static BlockEntityTicker validateTicker(World world, BlockEntityType givenType, BlockEntityType expectedType) { - return world.isClient ? null : ElvenTreatedAnvilblock.validateTicker(givenType, expectedType, ShapingAnvilBlockEntity::tick); + protected static BlockEntityTicker validateTicker(Level world, BlockEntityType givenType, BlockEntityType expectedType) { + return world.isClientSide ? null : ElvenTreatedAnvilblock.createTickerHelper(givenType, expectedType, ShapingAnvilBlockEntity::tick); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/orcishTreatedAnvil/OrcishTreatedAnvilblock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/orcishTreatedAnvil/OrcishTreatedAnvilblock.java index 04423bb23e..277de1956f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/orcishTreatedAnvil/OrcishTreatedAnvilblock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/orcishTreatedAnvil/OrcishTreatedAnvilblock.java @@ -1,77 +1,77 @@ package net.sevenstars.middleearth.block.special.shapingAnvil.orcishTreatedAnvil; import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import net.sevenstars.middleearth.block.special.shapingAnvil.AbstractShapingAnvilBlock; import net.sevenstars.middleearth.block.special.shapingAnvil.ShapingAnvilBlockEntity; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.BlockWithEntity; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; import java.util.stream.Stream; public class OrcishTreatedAnvilblock extends AbstractShapingAnvilBlock { - public OrcishTreatedAnvilblock(Settings settings) { + public OrcishTreatedAnvilblock(Properties settings) { super(settings); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - switch (state.get(FACING)){ + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + switch (state.getValue(FACING)){ case NORTH, SOUTH -> { return Stream.of( - Block.createCuboidShape(3, 0, 3, 13, 10, 13), - Block.createCuboidShape(1, 14, 7, 4, 16, 9), - Block.createCuboidShape(4, 13, 5, 12, 16, 11), - Block.createCuboidShape(12, 14, 7, 15, 16, 9), - Block.createCuboidShape(5, 7, 5, 11, 13, 11) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(3, 0, 3, 13, 10, 13), + Block.box(1, 14, 7, 4, 16, 9), + Block.box(4, 13, 5, 12, 16, 11), + Block.box(12, 14, 7, 15, 16, 9), + Block.box(5, 7, 5, 11, 13, 11) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } case EAST, WEST -> { return Stream.of( - Block.createCuboidShape(3, 0, 3, 13, 10, 13), - Block.createCuboidShape(7, 14, 12, 9, 16, 15), - Block.createCuboidShape(5, 13, 4, 11, 16, 12), - Block.createCuboidShape(7, 14, 1, 9, 16, 4), - Block.createCuboidShape(5, 7, 5, 11, 13, 11) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(3, 0, 3, 13, 10, 13), + Block.box(7, 14, 12, 9, 16, 15), + Block.box(5, 13, 4, 11, 16, 12), + Block.box(7, 14, 1, 9, 16, 4), + Block.box(5, 7, 5, 11, 13, 11) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } default -> { - return Block.createCuboidShape(1, 0, 1, 15, 16, 15); + return Block.box(1, 0, 1, 15, 16, 15); } } } @Override - protected MapCodec getCodec() { - return createCodec(OrcishTreatedAnvilblock::new); + protected MapCodec codec() { + return simpleCodec(OrcishTreatedAnvilblock::new); } @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new ShapingAnvilBlockEntity(ModBlockEntities.TREATED_ANVIL, pos, state); } @Nullable @Override - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { + public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { return OrcishTreatedAnvilblock.validateTicker(world, type, ModBlockEntities.TREATED_ANVIL); } @Nullable - protected static BlockEntityTicker validateTicker(World world, BlockEntityType givenType, BlockEntityType expectedType) { - return world.isClient ? null : OrcishTreatedAnvilblock.validateTicker(givenType, expectedType, ShapingAnvilBlockEntity::tick); + protected static BlockEntityTicker validateTicker(Level world, BlockEntityType givenType, BlockEntityType expectedType) { + return world.isClientSide ? null : OrcishTreatedAnvilblock.createTickerHelper(givenType, expectedType, ShapingAnvilBlockEntity::tick); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/stoneanvil/StoneAnvilBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/stoneanvil/StoneAnvilBlock.java index 6e32bcb09b..a99f38f4f9 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/stoneanvil/StoneAnvilBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/stoneanvil/StoneAnvilBlock.java @@ -1,19 +1,19 @@ package net.sevenstars.middleearth.block.special.shapingAnvil.stoneanvil; import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.BlockWithEntity; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import net.sevenstars.middleearth.block.special.shapingAnvil.AbstractShapingAnvilBlock; import net.sevenstars.middleearth.block.special.shapingAnvil.ShapingAnvilBlockEntity; @@ -23,67 +23,67 @@ public class StoneAnvilBlock extends AbstractShapingAnvilBlock { - public StoneAnvilBlock(Settings settings) { + public StoneAnvilBlock(Properties settings) { super(settings); } @Override - protected MapCodec getCodec() { - return createCodec(StoneAnvilBlock::new); + protected MapCodec codec() { + return simpleCodec(StoneAnvilBlock::new); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - switch (state.get(FACING)){ + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + switch (state.getValue(FACING)){ case NORTH -> { return Stream.of( - Block.createCuboidShape(1, 0, 1, 15, 10, 15), - Block.createCuboidShape(2, 10, 3, 14, 16, 14), - Block.createCuboidShape(3, 10, 1, 10, 14, 3) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(1, 0, 1, 15, 10, 15), + Block.box(2, 10, 3, 14, 16, 14), + Block.box(3, 10, 1, 10, 14, 3) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } case EAST -> { return Stream.of( - Block.createCuboidShape(1, 0, 1, 15, 10, 15), - Block.createCuboidShape(2, 10, 2, 13, 16, 14), - Block.createCuboidShape(13, 10, 3, 15, 14, 10) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(1, 0, 1, 15, 10, 15), + Block.box(2, 10, 2, 13, 16, 14), + Block.box(13, 10, 3, 15, 14, 10) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } case SOUTH -> { return Stream.of( - Block.createCuboidShape(1, 0, 1, 15, 10, 15), - Block.createCuboidShape(2, 10, 2, 14, 16, 13), - Block.createCuboidShape(6, 10, 13, 13, 14, 15) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(1, 0, 1, 15, 10, 15), + Block.box(2, 10, 2, 14, 16, 13), + Block.box(6, 10, 13, 13, 14, 15) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } case WEST -> { return Stream.of( - Block.createCuboidShape(1, 0, 1, 15, 10, 15), - Block.createCuboidShape(3, 10, 2, 14, 16, 14), - Block.createCuboidShape(1, 10, 6, 3, 14, 13) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(1, 0, 1, 15, 10, 15), + Block.box(3, 10, 2, 14, 16, 14), + Block.box(1, 10, 6, 3, 14, 13) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } default -> { - return Block.createCuboidShape(1, 0, 1, 15, 16, 15); + return Block.box(1, 0, 1, 15, 16, 15); } } } @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new StoneAnvilBlockEntity(ModBlockEntities.STONE_ANVIL, pos, state); } @Nullable @Override - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { + public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { return StoneAnvilBlock.validateTicker(world, type, ModBlockEntities.STONE_ANVIL); } @Nullable - protected static BlockEntityTicker validateTicker(World world, BlockEntityType givenType, BlockEntityType expectedType) { - return world.isClient ? null : StoneAnvilBlock.validateTicker(givenType, expectedType, StoneAnvilBlockEntity::tick); + protected static BlockEntityTicker validateTicker(Level world, BlockEntityType givenType, BlockEntityType expectedType) { + return world.isClientSide ? null : StoneAnvilBlock.createTickerHelper(givenType, expectedType, StoneAnvilBlockEntity::tick); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/stoneanvil/StoneAnvilBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/stoneanvil/StoneAnvilBlockEntity.java index 0e12dd5ea3..a57beb8d0a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/stoneanvil/StoneAnvilBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/stoneanvil/StoneAnvilBlockEntity.java @@ -1,16 +1,14 @@ package net.sevenstars.middleearth.block.special.shapingAnvil.stoneanvil; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.item.ItemStack; -import net.minecraft.item.equipment.trim.ArmorTrim; -import net.minecraft.item.equipment.trim.ArmorTrimMaterial; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; +import net.minecraft.resources.ResourceKey; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.armortrim.ArmorTrim; +import net.minecraft.world.item.armortrim.TrimMaterial; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import net.sevenstars.middleearth.block.special.shapingAnvil.ShapingAnvilBlockEntity; @@ -28,17 +26,17 @@ public StoneAnvilBlockEntity(BlockEntityType type, BlockPos pos, BlockState stat } @Override - public void bonk(ShapingAnvilBlockEntity entity, ServerWorld world, ItemStack tool) { - ItemStack input = entity.getStack(0); + public void bonk(ShapingAnvilBlockEntity entity, ServerLevel world, ItemStack tool) { + ItemStack input = entity.getItem(0); - ArmorTrim trim = input.get(DataComponentTypes.TRIM); + ArmorTrim trim = input.get(DataComponents.TRIM); if (trim != null){ - Optional> armorTrimMaterialRegistryKey = trim.material().getKey(); + Optional> armorTrimMaterialRegistryKey = trim.material().unwrapKey(); if(armorTrimMaterialRegistryKey.isPresent()) { - RegistryKey armorTrimMaterial = armorTrimMaterialRegistryKey.get(); - if (!armorTrimMaterial.getValue().equals(MiddleEarth.of("bronze")) && - !armorTrimMaterial.getValue().equals(MiddleEarth.of("crude")) && - !armorTrimMaterial.getValue().equals(MiddleEarth.of("iron"))) { + ResourceKey armorTrimMaterial = armorTrimMaterialRegistryKey.get(); + if (!armorTrimMaterial.location().equals(MiddleEarth.of("bronze")) && + !armorTrimMaterial.location().equals(MiddleEarth.of("crude")) && + !armorTrimMaterial.location().equals(MiddleEarth.of("iron"))) { return; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/treatedAnvil/TreatedAnvilblock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/treatedAnvil/TreatedAnvilblock.java index c7258c64a0..4dab510f5b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/treatedAnvil/TreatedAnvilblock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shapingAnvil/treatedAnvil/TreatedAnvilblock.java @@ -1,73 +1,73 @@ package net.sevenstars.middleearth.block.special.shapingAnvil.treatedAnvil; import com.mojang.serialization.MapCodec; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import net.sevenstars.middleearth.block.special.shapingAnvil.AbstractShapingAnvilBlock; import net.sevenstars.middleearth.block.special.shapingAnvil.ShapingAnvilBlockEntity; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.BlockWithEntity; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; import java.util.stream.Stream; public class TreatedAnvilblock extends AbstractShapingAnvilBlock { - public TreatedAnvilblock(Settings settings) { + public TreatedAnvilblock(Properties settings) { super(settings); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - switch (state.get(FACING)){ + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + switch (state.getValue(FACING)){ case NORTH, SOUTH -> { return Stream.of( - Block.createCuboidShape(1, 0, 1, 15, 6, 15), - Block.createCuboidShape(1, 12, 4, 15, 16, 12), - Block.createCuboidShape(4, 6, 5, 12, 12, 11) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(1, 0, 1, 15, 6, 15), + Block.box(1, 12, 4, 15, 16, 12), + Block.box(4, 6, 5, 12, 12, 11) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } case EAST, WEST -> { return Stream.of( - Block.createCuboidShape(1, 0, 1, 15, 6, 15), - Block.createCuboidShape(4, 12, 1, 12, 16, 15), - Block.createCuboidShape(5, 6, 4, 11, 12, 12) - ).reduce((v1, v2) -> VoxelShapes.combineAndSimplify(v1, v2, BooleanBiFunction.OR)).get(); + Block.box(1, 0, 1, 15, 6, 15), + Block.box(4, 12, 1, 12, 16, 15), + Block.box(5, 6, 4, 11, 12, 12) + ).reduce((v1, v2) -> Shapes.join(v1, v2, BooleanOp.OR)).get(); } default -> { - return Block.createCuboidShape(1, 0, 1, 15, 16, 15); + return Block.box(1, 0, 1, 15, 16, 15); } } } @Override - protected MapCodec getCodec() { - return createCodec(TreatedAnvilblock::new); + protected MapCodec codec() { + return simpleCodec(TreatedAnvilblock::new); } @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new ShapingAnvilBlockEntity(ModBlockEntities.TREATED_ANVIL, pos, state); } @Nullable @Override - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { + public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { return TreatedAnvilblock.validateTicker(world, type, ModBlockEntities.TREATED_ANVIL); } @Nullable - protected static BlockEntityTicker validateTicker(World world, BlockEntityType givenType, BlockEntityType expectedType) { - return world.isClient ? null : TreatedAnvilblock.validateTicker(givenType, expectedType, ShapingAnvilBlockEntity::tick); + protected static BlockEntityTicker validateTicker(Level world, BlockEntityType givenType, BlockEntityType expectedType) { + return world.isClientSide ? null : TreatedAnvilblock.createTickerHelper(givenType, expectedType, ShapingAnvilBlockEntity::tick); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shelobiteeggs/AbstractShelobiteLarvaEgg.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shelobiteeggs/AbstractShelobiteLarvaEgg.java index 68679a385b..0bc322ba00 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shelobiteeggs/AbstractShelobiteLarvaEgg.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shelobiteeggs/AbstractShelobiteLarvaEgg.java @@ -1,43 +1,44 @@ package net.sevenstars.middleearth.block.special.shelobiteeggs; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.entity.SpawnReason; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.ServerWorldAccess; -import net.minecraft.world.World; -import net.minecraft.world.event.GameEvent; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.gameevent.GameEvent; import net.sevenstars.middleearth.entity.EntitiesME; import net.sevenstars.middleearth.entity.spider.larva.ShelobiteLarvaEntity; import java.util.Random; public abstract class AbstractShelobiteLarvaEgg extends Block { - public AbstractShelobiteLarvaEgg(Settings settings) { + public AbstractShelobiteLarvaEgg(Properties settings) { super(settings); } - public static void breakEgg(World world, BlockPos pos, BlockState state) { - world.playSound((PlayerEntity)null, pos, SoundEvents.ENTITY_TURTLE_EGG_BREAK, SoundCategory.BLOCKS, 0.7F, 0.9F + world.random.nextFloat() * 0.2F); - world.emitGameEvent(GameEvent.BLOCK_DESTROY, pos, GameEvent.Emitter.of(state)); - world.syncWorldEvent(2001, pos, Block.getRawIdFromState(state)); + public static void breakEgg(Level world, BlockPos pos, BlockState state) { + if (!(world instanceof ServerLevel serverLevel)) { + return; + } + world.playSound((Player)null, pos, SoundEvents.TURTLE_EGG_BREAK, SoundSource.BLOCKS, 0.7F, 0.9F + world.random.nextFloat() * 0.2F); + world.gameEvent(GameEvent.BLOCK_DESTROY, pos, GameEvent.Context.of(state)); + world.levelEvent(2001, pos, Block.getId(state)); Random random = new Random(); int amountOfSpider = random.nextInt(1, 4); for(int i = 0; i < amountOfSpider; i++) - SpawnSpider(pos, world); + spawnSpider(pos, serverLevel); world.removeBlock(pos, false); } - private static void SpawnSpider(BlockPos pos, World world){ + private static void spawnSpider(BlockPos pos, ServerLevel world){ ShelobiteLarvaEntity entity = new ShelobiteLarvaEntity(EntitiesME.SHELOBITE_LARVA, world); - entity.age = 0; - entity.refreshPositionAndAngles(pos, 0, 0); - if(world instanceof ServerWorldAccess serverWorldAccess) { - entity.initialize(serverWorldAccess, serverWorldAccess.getLocalDifficulty(pos), SpawnReason.NATURAL, null); - } - world.spawnEntity(entity); + entity.tickCount = 0; + entity.moveTo(pos, 0, 0); + entity.finalizeSpawn(world, world.getCurrentDifficultyAt(pos), MobSpawnType.NATURAL, null); + world.addFreshEntity(entity); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shelobiteeggs/ShelobiteLarvaEggBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shelobiteeggs/ShelobiteLarvaEggBlock.java index de3357b646..f4f960feb3 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shelobiteeggs/ShelobiteLarvaEggBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shelobiteeggs/ShelobiteLarvaEggBlock.java @@ -1,108 +1,77 @@ package net.sevenstars.middleearth.block.special.shelobiteeggs; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.Entity; -import net.minecraft.entity.SpawnReason; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.registry.tag.EntityTypeTags; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.ServerWorldAccess; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; -import net.minecraft.world.tick.ScheduledTickView; -import net.sevenstars.middleearth.entity.EntitiesME; -import net.sevenstars.middleearth.entity.spider.larva.ShelobiteLarvaEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.tags.EntityTypeTags; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; -import java.util.Random; - public class ShelobiteLarvaEggBlock extends AbstractShelobiteLarvaEgg { private static final EnumProperty FACING; - public ShelobiteLarvaEggBlock(Settings settings) { + public ShelobiteLarvaEggBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(FACING, Direction.EAST)); + this.registerDefaultState(this.defaultBlockState().setValue(FACING, Direction.EAST)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState() - .with(FACING, ctx.getHorizontalPlayerFacing()); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState() + .setValue(FACING, ctx.getHorizontalDirection()); } - public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - BlockPos blockPos = pos.down(); - return world.getBlockState(blockPos).isSolidBlock(world, blockPos); + public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + BlockPos blockPos = pos.below(); + return world.getBlockState(blockPos).isRedstoneConductor(world, blockPos); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, net.minecraft.util.math.random.Random random) { - return !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + return !state.canSurvive(world, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override - public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) { - if(!entity.collidedSoftly && !entity.getType().isIn(EntityTypeTags.ARTHROPOD)){ + public void stepOn(Level world, BlockPos pos, BlockState state, Entity entity) { + if(!entity.minorHorizontalCollision && !entity.getType().is(EntityTypeTags.ARTHROPOD)){ breakEgg(world, pos, state); - super.onSteppedOn(world, pos, state, entity); + super.stepOn(world, pos, state, entity); } } @Override - public void onLandedUpon(World world, BlockState state, BlockPos pos, Entity entity, double fallDistance) { - if(!entity.collidedSoftly && !entity.getType().isIn(EntityTypeTags.ARTHROPOD)) { - super.onLandedUpon(world, state, pos, entity, fallDistance); + public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) { + if(!entity.minorHorizontalCollision && !entity.getType().is(EntityTypeTags.ARTHROPOD)) { + super.fallOn(world, state, pos, entity, fallDistance); breakEgg(world, pos, state); } } - - public static void breakEgg(World world, BlockPos pos, BlockState state) { - world.playSound(null, pos, SoundEvents.ENTITY_TURTLE_EGG_BREAK, SoundCategory.BLOCKS, 0.7F, 0.9F + world.random.nextFloat() * 0.2F); - world.emitGameEvent(GameEvent.BLOCK_DESTROY, pos, GameEvent.Emitter.of(state)); - world.syncWorldEvent(2001, pos, Block.getRawIdFromState(state)); - Random random = new Random(); - int amountOfSpider = random.nextInt(1, 4); - for(int i = 0; i < amountOfSpider; i++) - SpawnSpider(pos, world); - world.removeBlock(pos, false); - } - - public static void SpawnSpider(BlockPos pos, World world){ - ShelobiteLarvaEntity entity = new ShelobiteLarvaEntity(EntitiesME.SHELOBITE_LARVA, world); - entity.age = 0; - entity.refreshPositionAndAngles(pos, 0, 0); - if(world instanceof ServerWorldAccess serverWorldAccess) { - entity.initialize(serverWorldAccess, serverWorldAccess.getLocalDifficulty(pos), SpawnReason.NATURAL, null); - } - world.spawnEntity(entity); - } - @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return VoxelShapes.union( - Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 8.0, 16.0)); + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Shapes.or( + Block.box(0.0, 0.0, 0.0, 16.0, 8.0, 16.0)); } static { - FACING = Properties.HORIZONTAL_FACING; + FACING = BlockStateProperties.HORIZONTAL_FACING; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shelobiteeggs/ShelobiteLarvaEggHangingBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shelobiteeggs/ShelobiteLarvaEggHangingBlock.java index e0615e7b34..20ef21e5cd 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shelobiteeggs/ShelobiteLarvaEggHangingBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/shelobiteeggs/ShelobiteLarvaEggHangingBlock.java @@ -1,114 +1,113 @@ package net.sevenstars.middleearth.block.special.shelobiteeggs; import com.mojang.serialization.MapCodec; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.enums.BlockHalf; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCollisionHandler; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.Half; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.entity.EntitiesME; import org.jetbrains.annotations.Nullable; import java.util.Objects; public class ShelobiteLarvaEggHangingBlock extends AbstractShelobiteLarvaEgg { - public static final EnumProperty BLOCK_HALF = Properties.BLOCK_HALF; + public static final EnumProperty BLOCK_HALF = BlockStateProperties.HALF; - public ShelobiteLarvaEggHangingBlock(Settings settings) { + public ShelobiteLarvaEggHangingBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(BLOCK_HALF, BlockHalf.TOP)); + this.registerDefaultState(this.defaultBlockState().setValue(BLOCK_HALF, Half.TOP)); } @Override - protected MapCodec getCodec() { - return createCodec(ShelobiteLarvaEggHangingBlock::new); + protected MapCodec codec() { + return simpleCodec(ShelobiteLarvaEggHangingBlock::new); } - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - return direction == Direction.UP && !this.canPlaceAt(state, world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + return direction == Direction.UP && !this.canSurvive(state, world, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } - protected boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { - if (Objects.requireNonNull(state.get(BLOCK_HALF)) == BlockHalf.BOTTOM) { - return !world.isWater(pos) && world.getBlockState(pos.down()).isAir(); + protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { + if (Objects.requireNonNull(state.getValue(BLOCK_HALF)) == Half.BOTTOM) { + return !world.isWaterAt(pos) && world.getBlockState(pos.below()).isAir(); } - return Block.sideCoversSmallSquare(world, pos.up(), Direction.DOWN) && !world.isWater(pos) && world.getBlockState(pos.down()).isAir(); + return Block.canSupportCenter(world, pos.above(), Direction.DOWN) && !world.isWaterAt(pos) && world.getBlockState(pos.below()).isAir(); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(BLOCK_HALF); } - public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { - super.onPlaced(world, pos, state, placer, itemStack); - if (!world.isClient) { - BlockPos blockPos = pos.down(); - world.setBlockState(blockPos, (BlockState)state.with(BLOCK_HALF, BlockHalf.BOTTOM), 3); - world.updateNeighbors(pos, Blocks.AIR); - state.updateNeighbors(world, pos, 3); + public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { + super.setPlacedBy(world, pos, state, placer, itemStack); + if (!world.isClientSide) { + BlockPos blockPos = pos.below(); + world.setBlock(blockPos, (BlockState)state.setValue(BLOCK_HALF, Half.BOTTOM), 3); + world.updateNeighborsAt(pos, Blocks.AIR); + state.updateNeighbourShapes(world, pos, 3); } } @Override - public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { - if (!world.isClient) { - if (state.get(BLOCK_HALF) == BlockHalf.BOTTOM){ - world.setBlockState(pos.up(), Blocks.AIR.getDefaultState(), 35); - world.syncWorldEvent(player, 2001, pos.up(), Block.getRawIdFromState(state)); + public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { + if (!world.isClientSide) { + if (state.getValue(BLOCK_HALF) == Half.BOTTOM){ + world.setBlock(pos.above(), Blocks.AIR.defaultBlockState(), 35); + world.levelEvent(player, 2001, pos.above(), Block.getId(state)); } else{ - world.setBlockState(pos.down(), Blocks.AIR.getDefaultState(), 35); - world.syncWorldEvent(player, 2001, pos.down(), Block.getRawIdFromState(state)); + world.setBlock(pos.below(), Blocks.AIR.defaultBlockState(), 35); + world.levelEvent(player, 2001, pos.below(), Block.getId(state)); } } - return super.onBreak(world, pos, state, player); + return super.playerWillDestroy(world, pos, state, player); } @Override - protected VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return switch (state.get(BLOCK_HALF)) { - case BOTTOM -> Block.createCuboidShape(4, 4, 4, 12, 16, 12); + protected VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return switch (state.getValue(BLOCK_HALF)) { + case BOTTOM -> Block.box(4, 4, 4, 12, 16, 12); case TOP -> { - if (world.getBlockState(pos.down()).isOf(this)){ - yield VoxelShapes.combineAndSimplify(Block.createCuboidShape(0, 14, 0, 16, 16, 16), Block.createCuboidShape(5, 0, 5, 11, 14, 11), BooleanBiFunction.OR); + if (world.getBlockState(pos.below()).is(this)){ + yield Shapes.join(Block.box(0, 14, 0, 16, 16, 16), Block.box(5, 0, 5, 11, 14, 11), BooleanOp.OR); } else { - yield Block.createCuboidShape(0, 0, 0, 0, 0, 0); + yield Block.box(0, 0, 0, 0, 0, 0); } } }; } @Override - protected void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity, EntityCollisionHandler handler) { - super.onEntityCollision(state, world, pos, entity, handler); - if (entity.getType() != EntitiesME.SHELOBITE_SCUTTLER && state.get(BLOCK_HALF) == BlockHalf.BOTTOM){ + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + super.entityInside(state, world, pos, entity); + if (entity.getType() != EntitiesME.SHELOBITE_SCUTTLER && state.getValue(BLOCK_HALF) == Half.BOTTOM){ breakEgg(world, pos, state); } } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return switch (state.get(BLOCK_HALF)) { - case BOTTOM -> Block.createCuboidShape(4, 4, 4, 12, 16, 12); - case TOP -> VoxelShapes.combineAndSimplify(Block.createCuboidShape(0, 14, 0, 16, 16, 16), Block.createCuboidShape(5, 0, 5, 11, 14, 11), BooleanBiFunction.OR); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return switch (state.getValue(BLOCK_HALF)) { + case BOTTOM -> Block.box(4, 4, 4, 12, 16, 12); + case TOP -> Shapes.join(Block.box(0, 14, 0, 16, 16, 16), Block.box(5, 0, 5, 11, 14, 11), BooleanOp.OR); }; } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/skull/OldSkullBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/skull/OldSkullBlock.java index 77e681f578..e998978dea 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/skull/OldSkullBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/skull/OldSkullBlock.java @@ -1,81 +1,85 @@ package net.sevenstars.middleearth.block.special.skull; import com.mojang.serialization.MapCodec; -import net.minecraft.block.*; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.RotationPropertyHelper; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; -import net.sevenstars.middleearth.block.special.bellows.BellowsBlock; -import net.sevenstars.middleearth.block.special.bellows.BellowsBlockEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.block.state.properties.RotationSegment; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; -public class OldSkullBlock extends BlockWithEntity { - public static final IntProperty ROTATION = Properties.ROTATION; - public static final int MAX_ROTATION_INDEX = RotationPropertyHelper.getMax(); - private static final int MAX_ROTATIONS = MAX_ROTATION_INDEX + 1; - private static final VoxelShape SHAPE = Block.createColumnShape(8.0, 0.0, 8.0); +public class OldSkullBlock extends BaseEntityBlock { + public static final MapCodec CODEC = simpleCodec(OldSkullBlock::new); + public static final IntegerProperty ROTATION = BlockStateProperties.ROTATION_16; + public static final int MAX_ROTATION_INDEX = RotationSegment.getMaxSegmentIndex(); + private static final int ROTATIONS = MAX_ROTATION_INDEX + 1; + private static final VoxelShape SHAPE = Block.box(4.0, 0.0, 4.0, 12.0, 8.0, 12.0); - public OldSkullBlock(Settings settings) { - super(settings); - this.setDefaultState((this.stateManager.getDefaultState()).with(ROTATION, 0)); + public OldSkullBlock(Properties properties) { + super(properties); + registerDefaultState(defaultBlockState().setValue(ROTATION, 0)); } @Override - protected MapCodec getCodec() { - return createCodec(OldSkullBlock::new); + protected MapCodec codec() { + return CODEC; } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(ROTATION); } @Override - protected boolean canPathfindThrough(BlockState state, NavigationType type) { + protected boolean isPathfindable(BlockState state, PathComputationType type) { return false; } @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - return super.getPlacementState(ctx).with(ROTATION, RotationPropertyHelper.fromYaw(ctx.getPlayerYaw())); + public BlockState getStateForPlacement(BlockPlaceContext context) { + return defaultBlockState().setValue(ROTATION, RotationSegment.convertToSegment(context.getRotation())); } - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - return direction == Direction.DOWN && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : - super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + @Override + protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, + LevelAccessor level, BlockPos pos, BlockPos neighborPos) { + return direction == Direction.DOWN && !state.canSurvive(level, pos) + ? Blocks.AIR.defaultBlockState() + : super.updateShape(state, direction, neighborState, level, pos, neighborPos); } @Override - protected BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(ROTATION, rotation.rotate((Integer)state.get(ROTATION), MAX_ROTATIONS)); + protected BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(ROTATION, rotation.rotate(state.getValue(ROTATION), ROTATIONS)); } @Override - protected BlockState mirror(BlockState state, BlockMirror mirror) { - return state.with(ROTATION, mirror.mirror((Integer)state.get(ROTATION), MAX_ROTATIONS)); + protected BlockState mirror(BlockState state, Mirror mirror) { + return state.setValue(ROTATION, mirror.mirror(state.getValue(ROTATION), ROTATIONS)); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { return SHAPE; } @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new OldSkullBlockEntity(pos, state); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/skull/OldSkullBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/skull/OldSkullBlockEntity.java index 0901b892b4..10cdfe0c54 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/skull/OldSkullBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/skull/OldSkullBlockEntity.java @@ -1,8 +1,8 @@ package net.sevenstars.middleearth.block.special.skull; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.block.registration.ModBlockEntities; public class OldSkullBlockEntity extends BlockEntity { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/skull/OldSkullBlockEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/skull/OldSkullBlockEntityRenderer.java index a3eeb51e62..13c58cb77f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/skull/OldSkullBlockEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/skull/OldSkullBlockEntityRenderer.java @@ -1,86 +1,60 @@ package net.sevenstars.middleearth.block.special.skull; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.block.BlockState; -import net.minecraft.block.SkullBlock; -import net.minecraft.block.WallSkullBlock; -import net.minecraft.client.model.*; -import net.minecraft.client.render.*; -import net.minecraft.client.render.block.entity.BlockEntityRenderer; -import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; -import net.minecraft.client.render.block.entity.SkullBlockEntityModel; -import net.minecraft.client.render.entity.model.*; -import net.minecraft.client.texture.SpriteAtlasTexture; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.RotationPropertyHelper; -import net.minecraft.util.math.Vec3d; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.math.Axis; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.resources.model.Material; +import net.minecraft.world.level.block.state.properties.RotationSegment; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import org.jetbrains.annotations.Nullable; -@Environment(EnvType.CLIENT) +@OnlyIn(Dist.CLIENT) public class OldSkullBlockEntityRenderer implements BlockEntityRenderer { - private final ModelPart skull; - - public OldSkullBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) { - ModelPart modelPart = ctx.getLayerModelPart(EntityModelLayersME.OLD_SKULL); - this.skull = modelPart.getChild("skull"); - } - - @Nullable - public static SkullBlockEntityModel getModels(LoadedEntityModels models) { - return new SkullEntityModel(models.getModelPart(EntityModelLayers.SKELETON_SKULL)); - } - - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData skull = modelPartData.addChild("skull", ModelPartBuilder.create().uv(0, 0) - .cuboid(-12.0F, -8.0F, 4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.0F)), ModelTransform.origin(8.0F, 24.0F, -8.0F)); - return TexturedModelData.of(modelData, 64, 64); - } - - public void render(OldSkullBlockEntity skullBlockEntity, float f, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j, Vec3d vec3d) { - BlockState blockState = skullBlockEntity.getCachedState(); - boolean bl = blockState.getBlock() instanceof WallSkullBlock; - Direction direction = bl ? blockState.get(WallSkullBlock.FACING) : null; - int k = bl ? RotationPropertyHelper.fromDirection(direction.getOpposite()) : (Integer)blockState.get(SkullBlock.ROTATION); - float h = RotationPropertyHelper.toDegrees(k); - - VertexConsumer vertexConsumer = getSpriteIdentifier().getVertexConsumer(vertexConsumerProvider, RenderLayer::getEntityCutout); + private static final Material MATERIAL = new Material( + TextureAtlas.LOCATION_BLOCKS, + MiddleEarth.of("model/old_skull")); - RenderLayer renderLayer = getRenderLayer(); - renderSkull(direction, h, 0, matrixStack, vertexConsumer, i, skull, renderLayer); - } - - public static void renderSkull(@Nullable Direction direction, float yaw, float animationProgress, MatrixStack matrices, - VertexConsumer vertexConsumers, int light, ModelPart model, RenderLayer renderLayer) { - matrices.push(); - if (direction == null) { - matrices.translate(0.5F, 0.0F, 0.5F); - } else { - float f = 0.25F; - matrices.translate(0.5F - direction.getOffsetX() * 0.25F, 0.25F, 0.5F - direction.getOffsetZ() * 0.25F); - } + private final ModelPart skull; - matrices.translate(0, 1.5f, 0); - matrices.scale(-1.0F, -1.0F, 1.0F); - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(yaw)); - model.render(matrices, vertexConsumers, light, OverlayTexture.DEFAULT_UV); - matrices.pop(); + public OldSkullBlockEntityRenderer(BlockEntityRendererProvider.Context context) { + skull = context.bakeLayer(EntityModelLayersME.OLD_SKULL).getChild("skull"); } - public static RenderLayer getRenderLayer() { - return RenderLayer.getEntityCutoutNoCullZOffset(Identifier.of(MiddleEarth.MOD_ID, "model/old_skull")); + public static LayerDefinition getTexturedModelData() { + MeshDefinition mesh = new MeshDefinition(); + PartDefinition root = mesh.getRoot(); + root.addOrReplaceChild("skull", CubeListBuilder.create().texOffs(0, 0) + .addBox(-12.0F, -8.0F, 4.0F, 8.0F, 8.0F, 8.0F, CubeDeformation.NONE), + PartPose.offset(8.0F, 24.0F, -8.0F)); + return LayerDefinition.create(mesh, 64, 64); } - private SpriteIdentifier getSpriteIdentifier(){ - return new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, - Identifier.of(MiddleEarth.MOD_ID, "model/old_skull")); + @Override + public void render(OldSkullBlockEntity entity, float partialTick, PoseStack poseStack, + MultiBufferSource buffers, int packedLight, int packedOverlay) { + float yaw = RotationSegment.convertToDegrees(entity.getBlockState().getValue(OldSkullBlock.ROTATION)); + VertexConsumer consumer = MATERIAL.buffer(buffers, RenderType::entityCutout); + + poseStack.pushPose(); + poseStack.translate(0.5F, 1.5F, 0.5F); + poseStack.scale(-1.0F, -1.0F, 1.0F); + poseStack.mulPose(Axis.YP.rotationDegrees(yaw)); + skull.render(poseStack, consumer, packedLight, OverlayTexture.NO_OVERLAY); + poseStack.popPose(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/statues/FlipStatueBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/statues/FlipStatueBlock.java index f1106788c4..f6001bf712 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/statues/FlipStatueBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/statues/FlipStatueBlock.java @@ -1,60 +1,45 @@ package net.sevenstars.middleearth.block.special.statues; -import net.minecraft.block.*; -import net.minecraft.block.enums.DoubleBlockHalf; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; +import net.minecraft.world.phys.BlockHitResult; public class FlipStatueBlock extends StatueBlock { - public static final BooleanProperty FLIP = BooleanProperty.of("flip"); + public static final BooleanProperty FLIP = BooleanProperty.create("flip"); - public FlipStatueBlock(Settings settings) { + public FlipStatueBlock(Properties settings) { super(settings); - setDefaultState(getDefaultState().with(HORIZONTAL_FACING, Direction.NORTH).with(HALF, DoubleBlockHalf.LOWER).with(WATERLOGGED, false).with(FLIP, false)); + registerDefaultState(defaultBlockState().setValue(HORIZONTAL_FACING, Direction.NORTH).setValue(HALF, DoubleBlockHalf.LOWER).setValue(WATERLOGGED, false).setValue(FLIP, false)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FLIP); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if (!world.isClient && player.getAbilities().allowModifyWorld) { - world.setBlockState(pos, state.cycle(FLIP)); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (!world.isClientSide && player.getAbilities().mayBuild) { + world.setBlockAndUpdate(pos, state.cycle(FLIP)); BlockState updatedState = world.getBlockState(pos); - if(state.get(HALF) == DoubleBlockHalf.LOWER) { - BlockState otherState = world.getBlockState(pos.up()); - world.setBlockState(pos.up(), otherState.with(FLIP, updatedState.get(FLIP))); + if(state.getValue(HALF) == DoubleBlockHalf.LOWER) { + BlockState otherState = world.getBlockState(pos.above()); + world.setBlockAndUpdate(pos.above(), otherState.setValue(FLIP, updatedState.getValue(FLIP))); } else { - BlockState otherState = world.getBlockState(pos.down()); - world.setBlockState(pos.down(), otherState.with(FLIP, updatedState.get(FLIP))); + BlockState otherState = world.getBlockState(pos.below()); + world.setBlockAndUpdate(pos.below(), otherState.setValue(FLIP, updatedState.getValue(FLIP))); } } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/statues/StatueBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/statues/StatueBlock.java index 1d8b417fde..aa10fa6f6a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/statues/StatueBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/statues/StatueBlock.java @@ -1,51 +1,56 @@ package net.sevenstars.middleearth.block.special.statues; -import net.minecraft.block.*; -import net.minecraft.block.enums.DoubleBlockHalf; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; -public class StatueBlock extends Block implements Waterloggable { - public static final EnumProperty HORIZONTAL_FACING = Properties.HORIZONTAL_FACING; - public static final EnumProperty HALF = Properties.DOUBLE_BLOCK_HALF; - public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; +public class StatueBlock extends Block implements SimpleWaterloggedBlock { + public static final EnumProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING; + public static final EnumProperty HALF = BlockStateProperties.DOUBLE_BLOCK_HALF; + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - public StatueBlock(Settings settings) { + public StatueBlock(Properties settings) { super(settings); - setDefaultState(getDefaultState().with(HORIZONTAL_FACING, Direction.NORTH).with(HALF, DoubleBlockHalf.LOWER).with(WATERLOGGED, false)); + registerDefaultState(defaultBlockState().setValue(HORIZONTAL_FACING, Direction.NORTH).setValue(HALF, DoubleBlockHalf.LOWER).setValue(WATERLOGGED, false)); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(HORIZONTAL_FACING, HALF, WATERLOGGED); } - public BlockState getPlacementState(ItemPlacementContext ctx) { - BlockPos blockPos = ctx.getBlockPos(); - BlockState blockState = ctx.getWorld().getBlockState(ctx.getBlockPos()); - World world = ctx.getWorld(); - if(blockPos.getY() < world.getTopYInclusive() - 1 && world.getBlockState(blockPos.up()).canReplace(ctx)){ - if(blockState.isOf(Blocks.WATER)){ - return (BlockState)((BlockState)this.getDefaultState().with(HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()).with(HALF, DoubleBlockHalf.LOWER).with(WATERLOGGED, true)); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + BlockPos blockPos = ctx.getClickedPos(); + BlockState blockState = ctx.getLevel().getBlockState(ctx.getClickedPos()); + Level world = ctx.getLevel(); + if(blockPos.getY() < world.getMaxBuildHeight() - 1 && world.getBlockState(blockPos.above()).canBeReplaced(ctx)){ + if(blockState.is(Blocks.WATER)){ + return (BlockState)((BlockState)this.defaultBlockState().setValue(HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()).setValue(HALF, DoubleBlockHalf.LOWER).setValue(WATERLOGGED, true)); } else{ - return (BlockState)((BlockState)this.getDefaultState().with(HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()).with(HALF, DoubleBlockHalf.LOWER).with(WATERLOGGED, false)); + return (BlockState)((BlockState)this.defaultBlockState().setValue(HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()).setValue(HALF, DoubleBlockHalf.LOWER).setValue(WATERLOGGED, false)); } } else { return null; @@ -55,79 +60,79 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { @Override public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - DoubleBlockHalf doubleBlockHalf = (DoubleBlockHalf) state.get(HALF); - if (direction.getAxis() == Direction.Axis.Y && doubleBlockHalf == DoubleBlockHalf.LOWER == (direction == Direction.UP) && (!neighborState.isOf(this) || neighborState.get(HALF) == doubleBlockHalf)) { - return Blocks.AIR.getDefaultState(); + DoubleBlockHalf doubleBlockHalf = (DoubleBlockHalf) state.getValue(HALF); + if (direction.getAxis() == Direction.Axis.Y && doubleBlockHalf == DoubleBlockHalf.LOWER == (direction == Direction.UP) && (!neighborState.is(this) || neighborState.getValue(HALF) == doubleBlockHalf)) { + return Blocks.AIR.defaultBlockState(); } else { - return doubleBlockHalf == DoubleBlockHalf.LOWER && direction == Direction.DOWN && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return doubleBlockHalf == DoubleBlockHalf.LOWER && direction == Direction.DOWN && !state.canSurvive(world, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(HORIZONTAL_FACING, rotation.rotate(state.get(HORIZONTAL_FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(HORIZONTAL_FACING, rotation.rotate(state.getValue(HORIZONTAL_FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(HORIZONTAL_FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(HORIZONTAL_FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); } - public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { - if (!world.isClient && (player.isCreative() || !player.canHarvest(state))) { - DoubleBlockHalf doubleBlockHalf = (DoubleBlockHalf)state.get(HALF); + public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) { + if (!world.isClientSide && (player.isCreative() || !player.hasCorrectToolForDrops(state))) { + DoubleBlockHalf doubleBlockHalf = (DoubleBlockHalf)state.getValue(HALF); if (doubleBlockHalf == DoubleBlockHalf.UPPER) { - BlockPos blockPos = pos.down(); + BlockPos blockPos = pos.below(); BlockState blockState = world.getBlockState(blockPos); - if (blockState.isOf(state.getBlock()) && blockState.get(HALF) == DoubleBlockHalf.LOWER) { - BlockState blockState2 = blockState.getFluidState().isOf(Fluids.WATER) ? Blocks.WATER.getDefaultState() : Blocks.AIR.getDefaultState(); - world.setBlockState(blockPos, blockState2, 35); - world.syncWorldEvent(player, 2001, blockPos, Block.getRawIdFromState(blockState)); + if (blockState.is(state.getBlock()) && blockState.getValue(HALF) == DoubleBlockHalf.LOWER) { + BlockState blockState2 = blockState.getFluidState().is(Fluids.WATER) ? Blocks.WATER.defaultBlockState() : Blocks.AIR.defaultBlockState(); + world.setBlock(blockPos, blockState2, 35); + world.levelEvent(player, 2001, blockPos, Block.getId(blockState)); } } else{ - BlockPos blockPos = pos.up(); + BlockPos blockPos = pos.above(); BlockState blockState = world.getBlockState(blockPos); - if (blockState.isOf(state.getBlock()) && blockState.get(HALF) == DoubleBlockHalf.UPPER) { - BlockState blockState2 = blockState.getFluidState().isOf(Fluids.WATER) ? Blocks.WATER.getDefaultState() : Blocks.AIR.getDefaultState(); - world.setBlockState(blockPos, blockState2, 35); - world.syncWorldEvent(player, 2001, blockPos, Block.getRawIdFromState(blockState)); + if (blockState.is(state.getBlock()) && blockState.getValue(HALF) == DoubleBlockHalf.UPPER) { + BlockState blockState2 = blockState.getFluidState().is(Fluids.WATER) ? Blocks.WATER.defaultBlockState() : Blocks.AIR.defaultBlockState(); + world.setBlock(blockPos, blockState2, 35); + world.levelEvent(player, 2001, blockPos, Block.getId(blockState)); } } } - return super.onBreak(world, pos, state, player); + return super.playerWillDestroy(world, pos, state, player); } - public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { - if (world.getBlockState(pos.up()).isOf(Blocks.WATER)){ - world.setBlockState(pos.up(), (BlockState)state.with(HALF, DoubleBlockHalf.UPPER).with(WATERLOGGED, true), 3); + public void setPlacedBy(Level world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) { + if (world.getBlockState(pos.above()).is(Blocks.WATER)){ + world.setBlock(pos.above(), (BlockState)state.setValue(HALF, DoubleBlockHalf.UPPER).setValue(WATERLOGGED, true), 3); } else { - world.setBlockState(pos.up(), (BlockState)state.with(HALF, DoubleBlockHalf.UPPER).with(WATERLOGGED, false), 3); + world.setBlock(pos.above(), (BlockState)state.setValue(HALF, DoubleBlockHalf.UPPER).setValue(WATERLOGGED, false), 3); } } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(3, 0, 3, 13, 16, 13); + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(3, 0, 3, 13, 16, 13); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/StructureManagerBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/StructureManagerBlock.java index 7b701f3419..e4cb75df9e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/StructureManagerBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/StructureManagerBlock.java @@ -1,120 +1,130 @@ package net.sevenstars.middleearth.block.special.structureManager; import com.mojang.serialization.MapCodec; -import net.minecraft.block.*; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import org.jetbrains.annotations.Nullable; -public class StructureManagerBlock extends BlockWithEntity implements BlockEntityProvider { - public static final EnumProperty FACING = Properties.HORIZONTAL_FACING; +public class StructureManagerBlock extends BaseEntityBlock implements EntityBlock { + public static final EnumProperty FACING = BlockStateProperties.HORIZONTAL_FACING; - public StructureManagerBlock(Settings settings) { + public StructureManagerBlock(Properties settings) { super(settings); - this.setDefaultState(((this.stateManager.getDefaultState()).with(FACING, Direction.NORTH))); + this.registerDefaultState(((this.stateDefinition.any()).setValue(FACING, Direction.NORTH))); } @Override - protected MapCodec getCodec() { - return createCodec(StructureManagerBlock::new); + protected MapCodec codec() { + return simpleCodec(StructureManagerBlock::new); } @Override - public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { - super.onPlaced(world, pos, state, placer, itemStack); + public void setPlacedBy(Level world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { + super.setPlacedBy(world, pos, state, placer, itemStack); } @Override - public BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + public RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - Direction direction = ctx.getHorizontalPlayerFacing().getOpposite(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + Direction direction = ctx.getHorizontalDirection().getOpposite(); - return this.getDefaultState().with(FACING, direction); + return this.defaultBlockState().setValue(FACING, direction); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - return state.rotate(mirror.getRotation(state.get(FACING))); + public BlockState mirror(BlockState state, Mirror mirror) { + return state.rotate(mirror.getRotation(state.getValue(FACING))); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); } @Override - protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return switch (state.get(FACING)){ + protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return switch (state.getValue(FACING)){ case DOWN, UP -> null; - case NORTH -> Block.createCuboidShape(0, 0, 2, 16, 16, 16); - case WEST -> Block.createCuboidShape(2, 0, 0, 16, 16, 16); - case SOUTH -> Block.createCuboidShape(0, 0, 0, 16, 16, 14); - case EAST -> Block.createCuboidShape(0, 0, 0, 14, 16, 16); + case NORTH -> Block.box(0, 0, 2, 16, 16, 16); + case WEST -> Block.box(2, 0, 0, 16, 16, 16); + case SOUTH -> Block.box(0, 0, 0, 16, 16, 14); + case EAST -> Block.box(0, 0, 0, 14, 16, 16); }; } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if (world.isClient) { - return ActionResult.SUCCESS; - } else if(player.isCreative() && player.isCreativeLevelTwoOp()) { - NamedScreenHandlerFactory screenHandlerFactory = state.createScreenHandlerFactory(world, pos); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (world.isClientSide) { + return InteractionResult.SUCCESS; + } else if(player.isCreative() && player.canUseGameMasterBlocks()) { + MenuProvider screenHandlerFactory = state.getMenuProvider(world, pos); if(screenHandlerFactory != null) { - player.openHandledScreen(screenHandlerFactory); + if (screenHandlerFactory instanceof net.sevenstars.middleearth.block.utils.ExtendedMenuProviderME extendedProvider) { + net.sevenstars.middleearth.block.utils.ExtendedMenuProviderME.open(player, extendedProvider); + } else { + player.openMenu(screenHandlerFactory); + } } - return ActionResult.CONSUME; + return InteractionResult.CONSUME; } - return ActionResult.FAIL; + return InteractionResult.FAIL; } @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new StructureManagerBlockEntity(pos, state); } @Nullable @Override - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { + public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { return validateTicker(world, type, ModBlockEntities.STRUCTURE_MANAGER); } @Nullable - protected static BlockEntityTicker validateTicker(World world, BlockEntityType givenType, BlockEntityType expectedType) { + protected static BlockEntityTicker validateTicker(Level world, BlockEntityType givenType, BlockEntityType expectedType) { BlockEntityTicker ticker; - if (world.isClient) { + if (world.isClientSide) { return null; } - ticker = validateTicker(givenType, expectedType, (worldx, pos, state, blockEntity) -> { + ticker = createTickerHelper(givenType, expectedType, (worldx, pos, state, blockEntity) -> { StructureManagerBlockEntity.tickEvent(world, pos, state, blockEntity); }); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/StructureManagerBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/StructureManagerBlockEntity.java index c326c992da..78e176a076 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/StructureManagerBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/StructureManagerBlockEntity.java @@ -1,24 +1,26 @@ package net.sevenstars.middleearth.block.special.structureManager; -import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.sevenstars.middleearth.block.utils.ExtendedMenuProviderME; +import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtOps; +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import net.sevenstars.middleearth.block.special.structureManager.features.SpawnNestManager; @@ -26,15 +28,15 @@ import net.sevenstars.middleearth.block.special.structureManager.features.StructureNestList; import net.sevenstars.middleearth.gui.structuremanager.StructureManagerScreenData; import net.sevenstars.middleearth.gui.structuremanager.StructureManagerScreenHandler; -import net.sevenstars.middleearth.registries.DynamicRegistriesME; import net.sevenstars.middleearth.resources.datas.structure_manager_datas.SpawnNestNodeData; import net.sevenstars.middleearth.resources.datas.structure_manager_datas.StructureManagerData; import org.jetbrains.annotations.Nullable; import java.util.Optional; +import java.util.Objects; import java.util.UUID; -public class StructureManagerBlockEntity extends BlockEntity implements ExtendedScreenHandlerFactory { +public class StructureManagerBlockEntity extends BlockEntity implements ExtendedMenuProviderME { private static final String ID = "structure_manager"; private enum SyncedData { @@ -53,7 +55,7 @@ private enum SyncedData { private boolean enabled; private boolean toInitialize; @Nullable - protected Identifier structureManagerIdentifier; + protected ResourceLocation structureManagerIdentifier; private StructureNestList structureNestList; private boolean wellnessChecked; @@ -64,9 +66,9 @@ private enum SyncedData { private boolean registered = false; @Override - public void markRemoved() { + public void setRemoved() { StructureManagerService.unregister(this); - super.markRemoved(); + super.setRemoved(); } public StructureManagerBlockEntity(BlockPos pos, BlockState state) { @@ -81,76 +83,96 @@ public StructureManagerBlockEntity(BlockPos pos, BlockState state) { } // region [Basic Overrides] - public void updateData(Identifier structureManagerId, boolean isActive, boolean toInitialize) { + public void updateData(ResourceLocation structureManagerId, boolean isActive, boolean toInitialize) { + if (!canChangeStructureManagerId(structureManagerId)) { + return; + } + if (registered) { + StructureManagerService.unregister(this); + registered = false; + } this.structureManagerIdentifier = structureManagerId; this.enabled = isActive; this.toInitialize = toInitialize; + this.managerData = null; + if (this.level != null && !this.level.isClientSide && this.enabled) { + resolveManagerData(this.level); + } + syncRegistration(); updateListeners(); } @Override - public Text getDisplayName() { - return Text.translatable("screen.%s.%s".formatted(MiddleEarth.MOD_ID, ID)); + public Component getDisplayName() { + return Component.translatable("screen.%s.%s".formatted(MiddleEarth.MOD_ID, ID)); } @Override - public Object getScreenOpeningData(ServerPlayerEntity serverPlayerEntity) { - return new StructureManagerScreenData(this.pos, this.enabled, this.toInitialize, Optional.ofNullable(this.structureManagerIdentifier)); + public void writeOpeningData(RegistryFriendlyByteBuf buffer) { + StructureManagerScreenData.PACKET_CODEC.encode(buffer, + new StructureManagerScreenData(this.worldPosition, this.enabled, this.toInitialize, + Optional.ofNullable(this.structureManagerIdentifier))); } @Override - public BlockEntityUpdateS2CPacket toUpdatePacket() { - return BlockEntityUpdateS2CPacket.create(this); + public ClientboundBlockEntityDataPacket getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); } @Nullable @Override - public ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) { + public AbstractContainerMenu createMenu(int syncId, Inventory playerInventory, Player player) { return new StructureManagerScreenHandler(syncId, playerInventory, - new StructureManagerScreenData(this.pos, this.enabled, this.toInitialize, Optional.ofNullable(this.structureManagerIdentifier)) + new StructureManagerScreenData(this.worldPosition, this.enabled, this.toInitialize, Optional.ofNullable(this.structureManagerIdentifier)) ); } - public static void tickEvent(World world, BlockPos blockPos, BlockState blockState, StructureManagerBlockEntity entity) { + public static void tickEvent(Level world, BlockPos blockPos, BlockState blockState, StructureManagerBlockEntity entity) { entity.tickEvent(world, blockPos, blockState); } @Override - protected void writeData(WriteView view) { - super.writeData(view); - view.putBoolean(SyncedData.ENABLED.name, this.enabled); - view.putBoolean(SyncedData.TO_INITIALIZE.name, this.toInitialize); - if(structureManagerIdentifier != null) - view.put(SyncedData.IDENTIFIER.name, Identifier.CODEC, this.structureManagerIdentifier); - if(structureNestList != null) - view.put(SyncedData.SPAWN_NEST_LIST.name, StructureNestList.CODEC, this.structureNestList); + protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.saveAdditional(tag, registries); + tag.putBoolean(SyncedData.ENABLED.name, this.enabled); + tag.putBoolean(SyncedData.TO_INITIALIZE.name, this.toInitialize); + if (structureManagerIdentifier != null) { + tag.putString(SyncedData.IDENTIFIER.name, structureManagerIdentifier.toString()); + } + if (structureNestList != null) { + StructureNestList.CODEC.encodeStart(NbtOps.INSTANCE, structureNestList).result() + .ifPresent(encoded -> tag.put(SyncedData.SPAWN_NEST_LIST.name, encoded)); + } } @Override - protected void readData(ReadView view) { - super.readData(view); - this.enabled = view.getBoolean(SyncedData.ENABLED.name, false); - this.toInitialize = view.getBoolean(SyncedData.TO_INITIALIZE.name, false); - view.read(SyncedData.IDENTIFIER.name, Identifier.CODEC) - .ifPresent(x -> structureManagerIdentifier = x); - view.read(SyncedData.SPAWN_NEST_LIST.name, StructureNestList.CODEC) - .ifPresent(x -> structureNestList = x); + protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.loadAdditional(tag, registries); + this.enabled = tag.getBoolean(SyncedData.ENABLED.name); + this.toInitialize = tag.getBoolean(SyncedData.TO_INITIALIZE.name); + if (tag.contains(SyncedData.IDENTIFIER.name)) { + structureManagerIdentifier = ResourceLocation.tryParse(tag.getString(SyncedData.IDENTIFIER.name)); + } + if (tag.contains(SyncedData.SPAWN_NEST_LIST.name)) { + StructureNestList.CODEC.parse(NbtOps.INSTANCE, tag.get(SyncedData.SPAWN_NEST_LIST.name)).result() + .ifPresent(value -> structureNestList = value); + } } // endregion @Override - public void setWorld(World world) { - super.setWorld(world); + public void setLevel(Level world) { + super.setLevel(world); worldWasSet = true; } public void showAllEntities() { - if(structureNestList == null) + if(structureNestList == null || !(level instanceof ServerLevel serverLevel)) return; for(SpawnNestManager nest : structureNestList.getManagers()){ for(UUID uuid : nest.getEntityUuids()){ - if(world.getEntity(uuid) instanceof LivingEntity livingEntity){ - livingEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.GLOWING, 10*20)); + if(serverLevel.getEntity(uuid) instanceof LivingEntity livingEntity){ + livingEntity.addEffect(new MobEffectInstance(MobEffects.GLOWING, 10*20)); } } } @@ -159,71 +181,108 @@ public void showAllEntities() { public void respawnAllEntities() { if(structureNestList == null) return; - if(world == null || world.isClient) + if(level == null || level.isClientSide) return; + resolveManagerData(level); + if (managerData == null) { + return; + } for(var nest : structureNestList.getManagers()){ - nest.forceRespawn(managerData, (ServerWorld) world, pos); + nest.forceRespawn(managerData, (ServerLevel) level, worldPosition); } } - public boolean subscribeNest(BlockPos nestPos, Identifier managerId, Identifier nestId, int spawnRadius) { - if(!enabled || managerId == null || structureManagerIdentifier == null || managerData == null || managerId.compareTo(this.structureManagerIdentifier) != 0) + public boolean subscribeNest(BlockPos nestPos, ResourceLocation managerId, ResourceLocation nestId, int spawnRadius) { + if(!acceptsNest(managerId) || nestId == null) return false; SpawnNestNodeData data = managerData.getNpcSpawnNest(nestId); + if (data == null) { + return false; + } + if (this.structureNestList == null) { + this.structureNestList = new StructureNestList(); + } SpawnNestManager manager = new SpawnNestManager(data, nestPos, spawnRadius); this.structureNestList.addNest(manager); + this.setChanged(); return true; } - public static void triggerDeathSignal(BlockPos pos, LivingEntity entity) { - if(entity.getWorld().isClient) + public boolean isOperational() { + return enabled + && structureManagerIdentifier != null + && managerData != null + && !isRemoved(); + } + + public boolean acceptsNest(@Nullable ResourceLocation managerId) { + return managerId != null + && isOperational() + && managerId.equals(this.structureManagerIdentifier); + } + + public void removeManagedEntity(UUID uuid) { + if (level == null || level.isClientSide || structureNestList == null) { return; - StructureManagerBlockEntity blockEntity = (StructureManagerBlockEntity) entity.getWorld().getBlockEntity(pos); - if(blockEntity != null && !blockEntity.isRemoved()){ - blockEntity.structureNestList.computeDeath(entity); - blockEntity.world.markDirty(pos); + } + if (structureNestList.removeEntity(level, uuid)) { + setChanged(); + level.blockEntityChanged(worldPosition); } } - private void tickEvent(World world, BlockPos blockPos, BlockState blockState) { - if(!world.isClient && worldWasSet){ + private void tickEvent(Level world, BlockPos blockPos, BlockState blockState) { + long tickOffset = Math.floorMod(worldPosition.asLong(), 20L); + boolean shouldRetryInitialization = toInitialize + && !enabled + && Math.floorMod(world.getGameTime() + tickOffset, 20L) == 0; + if(!world.isClientSide && (worldWasSet || shouldRetryInitialization)){ tryToInitializeManager(world); this.worldWasSet = false; } - if (!world.isClient && !this.registered) { - StructureManagerService.register(this); - this.registered = true; + if (!world.isClientSide && !this.registered) { + resolveManagerData(world); + } + if (!world.isClientSide) { + syncRegistration(); } if(!enabled) return; - ServerWorld serverWorld = (ServerWorld) world; - if(structureNestList == null) + ServerLevel serverWorld = (ServerLevel) world; + if(structureNestList == null || managerData == null) return; - long timeOfDay = serverWorld.getTime() % 24000; - long gameTick = serverWorld.getTime(); - if((timeOfDay > 0 && timeOfDay < 11000) || (timeOfDay > 12000 && timeOfDay < 23000) && wellnessChecked) + long timeOfDay = serverWorld.getGameTime() % 24000; + long gameTick = serverWorld.getGameTime(); + boolean outsideWellnessWindow = (timeOfDay > 0 && timeOfDay < 11000) + || (timeOfDay > 12000 && timeOfDay < 23000); + if(outsideWellnessWindow && wellnessChecked) wellnessChecked = false; - boolean haveToDoWellnessCheck = (timeOfDay > 11000 && timeOfDay < 12000) || (timeOfDay >= 23000) && !wellnessChecked; + boolean insideWellnessWindow = (timeOfDay > 11000 && timeOfDay < 12000) + || timeOfDay >= 23000; + boolean haveToDoWellnessCheck = insideWellnessWindow && !wellnessChecked; + boolean wellnessStateChanged = false; for(SpawnNestManager data : structureNestList.getManagers()){ - if(managerData == null) - managerData = StructureManagerService.getStructureManagerData(serverWorld, structureManagerIdentifier); if(haveToDoWellnessCheck){ - data.doWellnessCheck(managerData, serverWorld, blockPos); + wellnessStateChanged |= data.doWellnessCheck(managerData, serverWorld, blockPos); } data.tick(managerData, gameTick, serverWorld, blockPos); } + if (wellnessStateChanged) { + setChanged(); + world.blockEntityChanged(worldPosition); + } if(haveToDoWellnessCheck && !wellnessChecked) wellnessChecked = true; } - private void tryToInitializeManager(World world){ - if(world.isClient) + private void tryToInitializeManager(Level world){ + if(world.isClientSide) return; if(!toInitialize || enabled) return; @@ -231,39 +290,102 @@ private void tryToInitializeManager(World world){ return; this.managerData = StructureManagerService.getStructureManagerData(world, structureManagerIdentifier); - if(structureNestList == null) - this.structureNestList = new StructureNestList(); if(managerData == null) { return; - }; + } + this.structureNestList = new StructureNestList(); this.toInitialize = false; this.enabled = true; + updateListeners(); + } + + private void resolveManagerData(Level world) { + if (!enabled || managerData != null || structureManagerIdentifier == null) { + return; + } + managerData = StructureManagerService.getStructureManagerData( + world, structureManagerIdentifier); + if (managerData != null && structureNestList == null) { + structureNestList = new StructureNestList(); + } + } + + private void syncRegistration() { + if (level == null || level.isClientSide) { + return; + } + if (isOperational()) { + if (!registered) { + StructureManagerService.register(this); + registered = true; + } + } else if (registered) { + StructureManagerService.unregister(this); + registered = false; + } } public void setInitializationState(boolean toInitialize) { + if (this.toInitialize == toInitialize) { + return; + } this.toInitialize = toInitialize; updateListeners(); } public void setActiveState(boolean activate) { + if (this.enabled == activate) { + return; + } this.enabled = activate; + if (!activate) { + this.managerData = null; + } + syncRegistration(); updateListeners(); } - public void setStructureManagerId(Identifier identifier) { + public void setStructureManagerId(ResourceLocation identifier) { + if (Objects.equals(this.structureManagerIdentifier, identifier)) { + return; + } + if (!canChangeStructureManagerId(identifier)) { + return; + } this.structureManagerIdentifier = identifier; + this.managerData = null; + syncRegistration(); updateListeners(); } + private boolean canChangeStructureManagerId(ResourceLocation identifier) { + return Objects.equals(this.structureManagerIdentifier, identifier) + || structureNestList == null + || structureNestList.getManagers().isEmpty(); + } + private void updateListeners() { - this.markDirty(); - this.world.updateListeners(this.getPos(), this.getCachedState(), this.getCachedState(), Block.NOTIFY_ALL); + this.setChanged(); + if (this.level != null) { + this.level.sendBlockUpdated( + this.getBlockPos(), + this.getBlockState(), + this.getBlockState(), + Block.UPDATE_CLIENTS + ); + } } public void fetchBeds(){ // TODO : Fetch all beds surrounding the nodes, making sure there's no duplicate - StructureManagerData managerData = getWorld().getRegistryManager().getOptional(DynamicRegistriesME.STRUCTURE_MANAGER_DATA).get().get(structureManagerIdentifier); + StructureManagerData managerData = StructureManagerService.getStructureManagerData(getLevel(), structureManagerIdentifier); + if (managerData == null) { + return; + } + if (structureNestList == null) { + return; + } for(SpawnNestManager data : structureNestList.getManagers()) { SpawnNestNodeData nodeData = managerData.getNpcSpawnNest(data.getId()); if(nodeData == null) diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/SpatialIdentityIndex.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/SpatialIdentityIndex.java new file mode 100644 index 0000000000..c2c6ca5471 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/SpatialIdentityIndex.java @@ -0,0 +1,216 @@ +package net.sevenstars.middleearth.block.special.structureManager.features; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Predicate; + +final class SpatialIdentityIndex { + static final int CELL_SIZE = 64; + + private final ConcurrentHashMap>> + cells = new ConcurrentHashMap<>(); + + void register(Position position, T owner) { + long cellKey = cellKey(position); + cells.compute(cellKey, (key, registrations) -> { + ConcurrentHashMap> updated = + registrations == null ? new ConcurrentHashMap<>() : registrations; + updated.put(position, new Registration<>(position, owner)); + return updated; + }); + } + + void unregister(Position position, T owner) { + long cellKey = cellKey(position); + cells.computeIfPresent(cellKey, (key, registrations) -> { + registrations.computeIfPresent(position, (registeredPosition, registration) -> + registration.owner() == owner ? null : registration + ); + return registrations.isEmpty() ? null : registrations; + }); + } + + boolean containsWithin(int centerX, int centerY, int centerZ, int radius) { + int safeRadius = Math.max(0, radius); + double radiusSquared = (double) safeRadius * safeRadius; + CellBounds bounds = bounds(centerX, centerZ, safeRadius); + + if (shouldScanAllCells(bounds)) { + for (Map> registrations : cells.values()) { + if (containsWithin( + registrations, + centerX, + centerY, + centerZ, + radiusSquared + )) { + return true; + } + } + return false; + } + + for (int cellX = bounds.minX(); cellX <= bounds.maxX(); cellX++) { + for (int cellZ = bounds.minZ(); cellZ <= bounds.maxZ(); cellZ++) { + Map> registrations = + cells.get(cellKey(cellX, cellZ)); + if (registrations != null + && containsWithin( + registrations, + centerX, + centerY, + centerZ, + radiusSquared + )) { + return true; + } + } + } + return false; + } + + Registration findClosest( + int centerX, + int centerY, + int centerZ, + int radius, + Predicate> filter + ) { + int safeRadius = Math.max(0, radius); + double radiusSquared = (double) safeRadius * safeRadius; + CellBounds bounds = bounds(centerX, centerZ, safeRadius); + Registration closest = null; + double closestDistance = Double.MAX_VALUE; + + if (shouldScanAllCells(bounds)) { + for (Map> registrations : cells.values()) { + for (Registration registration : registrations.values()) { + double distance = registration.position().distanceSquared( + centerX, centerY, centerZ + ); + if (distance <= radiusSquared + && distance < closestDistance + && filter.test(registration)) { + closest = registration; + closestDistance = distance; + } + } + } + return closest; + } + + for (int cellX = bounds.minX(); cellX <= bounds.maxX(); cellX++) { + for (int cellZ = bounds.minZ(); cellZ <= bounds.maxZ(); cellZ++) { + Map> registrations = + cells.get(cellKey(cellX, cellZ)); + if (registrations == null) { + continue; + } + for (Registration registration : registrations.values()) { + double distance = registration.position().distanceSquared( + centerX, centerY, centerZ + ); + if (distance <= radiusSquared + && distance < closestDistance + && filter.test(registration)) { + closest = registration; + closestDistance = distance; + } + } + } + } + return closest; + } + + void remove(Registration registration) { + long cellKey = cellKey(registration.position()); + cells.computeIfPresent(cellKey, (key, registrations) -> { + registrations.remove(registration.position(), registration); + return registrations.isEmpty() ? null : registrations; + }); + } + + int size() { + return cells.values().stream().mapToInt(Map::size).sum(); + } + + private boolean shouldScanAllCells(CellBounds bounds) { + long queryCellCount = + ((long) bounds.maxX() - bounds.minX() + 1) + * ((long) bounds.maxZ() - bounds.minZ() + 1); + return queryCellCount > Math.max(16L, (long) cells.size() * 4L); + } + + private static boolean containsWithin( + Map> registrations, + int centerX, + int centerY, + int centerZ, + double radiusSquared + ) { + for (Registration registration : registrations.values()) { + if (registration.position().distanceSquared( + centerX, centerY, centerZ + ) <= radiusSquared) { + return true; + } + } + return false; + } + + private static CellBounds bounds(int centerX, int centerZ, int radius) { + return new CellBounds( + cellCoordinate((long) centerX - radius), + cellCoordinate((long) centerX + radius), + cellCoordinate((long) centerZ - radius), + cellCoordinate((long) centerZ + radius) + ); + } + + private static int cellCoordinate(long blockCoordinate) { + return (int) Math.floorDiv(blockCoordinate, CELL_SIZE); + } + + private static long cellKey(Position position) { + return cellKey( + Math.floorDiv(position.x(), CELL_SIZE), + Math.floorDiv(position.z(), CELL_SIZE) + ); + } + + private static long cellKey(int cellX, int cellZ) { + return (cellX & 0xffffffffL) | ((long) cellZ << 32); + } + + static final class Registration { + private final Position position; + private final T owner; + + Registration(Position position, T owner) { + this.position = position; + this.owner = owner; + } + + Position position() { + return position; + } + + T owner() { + return owner; + } + } + + private record CellBounds(int minX, int maxX, int minZ, int maxZ) { + } + + record Position(int x, int y, int z) { + double distanceSquared(int otherX, int otherY, int otherZ) { + long deltaX = (long) x - otherX; + long deltaY = (long) y - otherY; + long deltaZ = (long) z - otherZ; + return (double) deltaX * deltaX + + (double) deltaY * deltaY + + (double) deltaZ * deltaZ; + } + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/SpawnNestManager.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/SpawnNestManager.java index ef978342db..b6713a8214 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/SpawnNestManager.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/SpawnNestManager.java @@ -3,68 +3,88 @@ import com.google.common.collect.Lists; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.block.BedBlock; -import net.minecraft.block.DoubleBlockProperties; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.Identifier; -import net.minecraft.util.Uuids; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.UUIDUtil; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.block.BedBlock; +import net.minecraft.world.level.block.DoubleBlockCombiner; import net.sevenstars.middleearth.MiddleEarth; -import net.sevenstars.middleearth.block.special.structureManager.StructureManagerBlockEntity; -import net.sevenstars.middleearth.entity.npcs.NpcEntity; import net.sevenstars.middleearth.resources.datas.structure_manager_datas.SpawnNestNodeData; import net.sevenstars.middleearth.resources.datas.structure_manager_datas.StructureManagerData; import net.sevenstars.middleearth.resources.datas.structure_manager_datas.StructureSpawnNestPool; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.UUID; import java.util.function.Predicate; public class SpawnNestManager { public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( - Identifier.CODEC.fieldOf("id").forGetter(SpawnNestManager::getId), - Codec.list(Uuids.CODEC).fieldOf("entity_uuid").forGetter(SpawnNestManager::getEntityUuids), + ResourceLocation.CODEC.fieldOf("id").forGetter(SpawnNestManager::getId), + Codec.list(UUIDUtil.AUTHLIB_CODEC).fieldOf("entity_uuid").forGetter(SpawnNestManager::getEntityUuids), Codec.LONG.fieldOf("respawn_event_trigger_tick").forGetter(SpawnNestManager::getRespawnEventTriggerTick), Codec.INT.fieldOf("respawn_tick_delay").forGetter(SpawnNestManager::getRespawnTickDelay), BlockPos.CODEC.fieldOf("origin_pos").forGetter(SpawnNestManager::getOriginPos), - Codec.INT.fieldOf("spawn_radius").forGetter(SpawnNestManager::getSpawnRadius) + Codec.INT.fieldOf("spawn_radius").forGetter(SpawnNestManager::getSpawnRadius), + Codec.list(TrackedEntity.CODEC).optionalFieldOf("last_known_positions", List.of()) + .forGetter(SpawnNestManager::getTrackedEntities) ).apply(instance, SpawnNestManager::new)); private static final String ID = "spawn_nest_data"; - private Identifier id; + private ResourceLocation id; private ArrayList entities; private long respawnEventTriggerTick; private int respawnTickDelay; private BlockPos originPos; private int spawnRadius; + private final Map lastKnownPositions; private List beds = new ArrayList<>(); - public SpawnNestManager(Identifier dataId, List dataEntities, long dataRespawnEventTriggerTick, int dataRespawnTickDelay, BlockPos position, int spawnRadius) { + public SpawnNestManager( + ResourceLocation dataId, + List dataEntities, + long dataRespawnEventTriggerTick, + int dataRespawnTickDelay, + BlockPos position, + int spawnRadius, + List trackedEntities + ) { this.id = dataId; - this.entities = Lists.newArrayList(); + this.entities = Lists.newArrayList(); this.entities.addAll(dataEntities); this.respawnEventTriggerTick = dataRespawnEventTriggerTick; this.respawnTickDelay = dataRespawnTickDelay; this.originPos = position; this.spawnRadius = spawnRadius; + this.lastKnownPositions = new HashMap<>(); + for (TrackedEntity trackedEntity : trackedEntities) { + if (this.entities.contains(trackedEntity.uuid())) { + this.lastKnownPositions.put( + trackedEntity.uuid(), trackedEntity.pos().immutable()); + } + } } public SpawnNestManager(SpawnNestNodeData spawnNestNodeData, BlockPos position, int spawnRadius) { this.entities = new ArrayList(); this.id = spawnNestNodeData.getId(); this.respawnTickDelay = spawnNestNodeData.getRespawnTickDelay(); - this.respawnEventTriggerTick = 0; + this.respawnEventTriggerTick = -((long) this.respawnTickDelay) - 1L; this.originPos = position; this.spawnRadius = spawnRadius; + this.lastKnownPositions = new HashMap<>(); } - public Identifier getId() { + public ResourceLocation getId() { return this.id; } @@ -86,82 +106,139 @@ public int getSpawnRadius() { return this.spawnRadius; } + private List getTrackedEntities() { + ArrayList trackedEntities = new ArrayList<>(lastKnownPositions.size()); + for (Map.Entry entry : lastKnownPositions.entrySet()) { + trackedEntities.add(new TrackedEntity(entry.getKey(), entry.getValue())); + } + return trackedEntities; + } + public void addEntity(LivingEntity entity){ - if(entity.getWorld().isClient) + if(entity.level().isClientSide) return; - UUID uuid = entity.getUuid(); + UUID uuid = entity.getUUID(); if(this.entities == null) this.entities = new ArrayList(); - this.entities.add(uuid); + if (!this.entities.contains(uuid)) { + this.entities.add(uuid); + } + this.lastKnownPositions.put(uuid, entity.blockPosition().immutable()); } public boolean removeEntity(LivingEntity entity){ - if(entity.getWorld().isClient || !this.entities.contains(entity.getUuid())) + if(entity.level().isClientSide || !this.entities.contains(entity.getUUID())) return false; - this.entities.remove(entity.getUuid()); + this.entities.remove(entity.getUUID()); + this.lastKnownPositions.remove(entity.getUUID()); if(this.entities.isEmpty()){ - beginRespawnSequence(entity.getWorld()); + beginRespawnSequence(entity.level()); } return true; } - public void removeEntity(World world, UUID uuid){ - if(world.isClient || !this.entities.contains(uuid)) - return; + public boolean removeEntity(Level world, UUID uuid){ + return removeEntity(world, uuid, true); + } + + private boolean removeEntity(Level world, UUID uuid, boolean forgetTracking){ + if(world.isClientSide || !this.entities.contains(uuid)) + return false; this.entities.remove(uuid); + this.lastKnownPositions.remove(uuid); + if (forgetTracking && world instanceof ServerLevel serverLevel) { + StructureManagerService.forgetManagedEntity(serverLevel, uuid); + } if(this.entities.isEmpty()){ beginRespawnSequence(world); } + return true; } - private void beginRespawnSequence(World world) { - this.respawnEventTriggerTick = world.getTime(); + private void beginRespawnSequence(Level world) { + this.respawnEventTriggerTick = world.getGameTime(); } public boolean canRespawn(long time){ return (entities.isEmpty() && time > respawnEventTriggerTick + respawnTickDelay); } - public void tick(StructureManagerData structureManagerData, long currentTick, ServerWorld world, BlockPos sourcePos) { + public void tick(StructureManagerData structureManagerData, long currentTick, ServerLevel world, BlockPos sourcePos) { if(canRespawn(currentTick)){ respawnAll(structureManagerData, world, sourcePos); } } - public void doWellnessCheck(StructureManagerData structureManagerData, World world, BlockPos sourcePos) { + public boolean doWellnessCheck(StructureManagerData structureManagerData, ServerLevel world, BlockPos sourcePos) { + boolean changed = false; if(entities != null && !entities.isEmpty()){ List toRemove = new ArrayList<>(); + List legacyUnknown = new ArrayList<>(); for (UUID uuid : entities){ // Wellness check + StructureManagedEntityData.Entry tracked = + StructureManagedEntityData.get(world).get(uuid); + if (tracked != null && tracked.dead()) { + toRemove.add(uuid); + continue; + } var entity = world.getEntity(uuid); - if(entity == null || !entity.isAlive()) + if (entity instanceof LivingEntity livingEntity && livingEntity.isAlive()) { + BlockPos currentPos = livingEntity.blockPosition().immutable(); + if (!currentPos.equals(lastKnownPositions.put(uuid, currentPos))) { + changed = true; + } + StructureManagedEntityData.get(world).track( + uuid, sourcePos, currentPos); + } else if (entity != null) { toRemove.add(uuid); + } else { + BlockPos lastKnownPos = tracked != null + ? tracked.lastPos() + : lastKnownPositions.get(uuid); + if (lastKnownPos == null) { + StructureManagedEntityData.get(world).markDead( + uuid, sourcePos, originPos); + legacyUnknown.add(uuid); + } else if (world.areEntitiesLoaded(ChunkPos.asLong(lastKnownPos))) { + toRemove.add(uuid); + } + } + } + for (UUID uuid : toRemove) { + changed |= removeEntity(world, uuid); + } + for (UUID uuid : legacyUnknown) { + changed |= removeEntity(world, uuid, false); } - for (UUID uuid : toRemove) - removeEntity(world, uuid); } + return changed; } - private void respawnAll(StructureManagerData structureManagerData, ServerWorld world, BlockPos structureManagerPos) { + private void respawnAll(StructureManagerData structureManagerData, ServerLevel world, BlockPos structureManagerPos) { if(structureManagerData == null) return; SpawnNestNodeData data = structureManagerData.getNpcSpawnNest(id); if(data != null){ - StructureSpawnNestPool pool = data.getRandomPool(); - int entityAmountToSpawn = pool.getEntityAmount(); + StructureSpawnNestPool pool = data.getRandomPool(world.getRandom()); + if (pool == null) { + this.respawnEventTriggerTick = world.getGameTime(); + return; + } + int entityAmountToSpawn = pool.getEntityAmount(world.getRandom()); for(int i = 0; i < entityAmountToSpawn; i ++){ - LivingEntity entityToAdd = StructureManagerService.spawnEntity(world, pool, originPos, spawnRadius); - if(entityToAdd instanceof NpcEntity npcEntity){ - npcEntity.assignStructureManager((StructureManagerBlockEntity) world.getBlockEntity(structureManagerPos)); + LivingEntity entityToAdd = StructureManagerService.spawnEntity( + world, pool, originPos, spawnRadius, structureManagerPos); + if(entityToAdd == null) { + continue; } - if(entityToAdd != null) - addEntity(entityToAdd); + addEntity(entityToAdd); } - world.markDirty(structureManagerPos); + world.blockEntityChanged(structureManagerPos); } - this.respawnEventTriggerTick = -1; + this.respawnEventTriggerTick = entities.isEmpty() ? world.getGameTime() : -1L; } public boolean computeDeath(LivingEntity entity) { @@ -171,31 +248,36 @@ public boolean computeDeath(LivingEntity entity) { return false; } - public void forceRespawn(StructureManagerData structureManagerData, ServerWorld world, BlockPos structureManagerPos) { - for(var uuid : getEntityUuids()){ + public void forceRespawn(StructureManagerData structureManagerData, ServerLevel world, BlockPos structureManagerPos) { + for(var uuid : List.copyOf(getEntityUuids())){ if(world.getEntity(uuid) instanceof LivingEntity livingEntity){ livingEntity.setRemoved(Entity.RemovalReason.DISCARDED); MiddleEarth.LOGGER.logDebugMsg("Removed %s".formatted(uuid)); + } else { + BlockPos lastKnownPos = lastKnownPositions.getOrDefault(uuid, originPos); + StructureManagedEntityData.get(world).markDead( + uuid, structureManagerPos, lastKnownPos); } } entities = new ArrayList(); + lastKnownPositions.clear(); refreshBeds(structureManagerData, world); respawnAll(structureManagerData, world, structureManagerPos); } - public void refreshBeds(StructureManagerData structureManagerData, World world){ + public void refreshBeds(StructureManagerData structureManagerData, Level world){ // TODO : Connect with the @StructureManagerBlockEntity.fetchBeds() / Redistribute BlockPos origin = getOriginPos(); int bedRadius = 10; List bedBlockPositions = new ArrayList<>(); - BlockPos.findClosest(origin, bedRadius, 5, new Predicate() { + BlockPos.findClosestMatch(origin, bedRadius, 5, new Predicate() { @Override public boolean test(BlockPos blockPos) { var blockState = world.getBlockState(blockPos); if(blockState.getBlock() instanceof BedBlock bedBlock){ - if(BedBlock.getBedPart(blockState) == DoubleBlockProperties.Type.FIRST){ + if(BedBlock.getBlockType(blockState) == DoubleBlockCombiner.BlockType.FIRST){ bedBlockPositions.add(blockPos); } } @@ -203,5 +285,13 @@ public boolean test(BlockPos blockPos) { } }); } + + private record TrackedEntity(UUID uuid, BlockPos pos) { + private static final Codec CODEC = RecordCodecBuilder.create(instance -> + instance.group( + UUIDUtil.AUTHLIB_CODEC.fieldOf("uuid").forGetter(TrackedEntity::uuid), + BlockPos.CODEC.fieldOf("pos").forGetter(TrackedEntity::pos) + ).apply(instance, TrackedEntity::new)); + } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/StructureManagedEntityData.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/StructureManagedEntityData.java new file mode 100644 index 0000000000..f0eff53d3b --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/StructureManagedEntityData.java @@ -0,0 +1,113 @@ +package net.sevenstars.middleearth.block.special.structureManager.features; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.Tag; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.saveddata.SavedData; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +public final class StructureManagedEntityData extends SavedData { + private static final String DATA_NAME = "middle_earth_structure_managed_entities"; + private static final String ENTRIES = "Entries"; + private static final String UUID_KEY = "Uuid"; + private static final String MANAGER_POS = "ManagerPos"; + private static final String LAST_POS = "LastPos"; + private static final String DEAD = "Dead"; + private static final Factory FACTORY = + new Factory<>(StructureManagedEntityData::new, StructureManagedEntityData::load); + + private final Map entries = new HashMap<>(); + + public static StructureManagedEntityData get(ServerLevel level) { + return level.getDataStorage().computeIfAbsent(FACTORY, DATA_NAME); + } + + private static StructureManagedEntityData load( + CompoundTag tag, HolderLookup.Provider registries + ) { + StructureManagedEntityData data = new StructureManagedEntityData(); + ListTag entries = tag.getList(ENTRIES, Tag.TAG_COMPOUND); + for (Tag rawEntry : entries) { + if (!(rawEntry instanceof CompoundTag entryTag) + || !entryTag.hasUUID(UUID_KEY) + || !entryTag.contains(MANAGER_POS, Tag.TAG_LONG) + || !entryTag.contains(LAST_POS, Tag.TAG_LONG)) { + continue; + } + UUID uuid = entryTag.getUUID(UUID_KEY); + data.entries.put(uuid, new Entry( + BlockPos.of(entryTag.getLong(MANAGER_POS)), + BlockPos.of(entryTag.getLong(LAST_POS)), + entryTag.getBoolean(DEAD) + )); + } + return data; + } + + @Override + public CompoundTag save(CompoundTag tag, HolderLookup.Provider registries) { + ListTag savedEntries = new ListTag(); + entries.entrySet().stream() + .sorted(Map.Entry.comparingByKey()) + .forEach(entry -> { + CompoundTag entryTag = new CompoundTag(); + entryTag.putUUID(UUID_KEY, entry.getKey()); + entryTag.putLong(MANAGER_POS, entry.getValue().managerPos().asLong()); + entryTag.putLong(LAST_POS, entry.getValue().lastPos().asLong()); + entryTag.putBoolean(DEAD, entry.getValue().dead()); + savedEntries.add(entryTag); + }); + tag.put(ENTRIES, savedEntries); + return tag; + } + + public void track(UUID uuid, BlockPos managerPos, BlockPos lastPos) { + Entry replacement = new Entry( + managerPos.immutable(), lastPos.immutable(), false); + if (!replacement.equals(entries.put(uuid, replacement))) { + setDirty(); + } + } + + public void markDead(UUID uuid, BlockPos managerPos, BlockPos lastPos) { + Entry replacement = new Entry( + managerPos.immutable(), lastPos.immutable(), true); + if (!replacement.equals(entries.put(uuid, replacement))) { + setDirty(); + } + } + + @Nullable + public Entry get(UUID uuid) { + return entries.get(uuid); + } + + public List deadEntitiesFor(BlockPos managerPos) { + ArrayList result = new ArrayList<>(); + for (Map.Entry entry : entries.entrySet()) { + if (entry.getValue().dead() + && entry.getValue().managerPos().equals(managerPos)) { + result.add(entry.getKey()); + } + } + return List.copyOf(result); + } + + public void remove(UUID uuid) { + if (entries.remove(uuid) != null) { + setDirty(); + } + } + + public record Entry(BlockPos managerPos, BlockPos lastPos, boolean dead) { + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/StructureManagerService.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/StructureManagerService.java index 787b1de1b0..c39c413d05 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/StructureManagerService.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/StructureManagerService.java @@ -1,135 +1,257 @@ package net.sevenstars.middleearth.block.special.structureManager.features; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.SpawnReason; -import net.minecraft.entity.mob.MobEntity; -import net.minecraft.registry.RegistryKey; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.SpawnPlacements; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.structureManager.StructureManagerBlockEntity; import net.sevenstars.middleearth.entity.EntitiesME; +import net.sevenstars.middleearth.entity.npcs.NpcEntity; import net.sevenstars.middleearth.entity.npcs.initializer.NpcEntityBuilder; import net.sevenstars.middleearth.resources.datas.structure_manager_datas.StructureManagerData; import net.sevenstars.middleearth.resources.datas.structure_manager_datas.StructureManagerDataLookup; import net.sevenstars.middleearth.resources.datas.structure_manager_datas.StructureSpawnNestPool; +import org.jetbrains.annotations.Nullable; -import java.util.HashMap; -import java.util.HashSet; +import java.util.List; import java.util.Map; -import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; public class StructureManagerService { - private static final Map, Set> STRUCTURE_MANAGERS = new HashMap<>(); + private static final String MANAGER_POS_TAG = + MiddleEarth.NEOFORGE_MOD_ID + ":structure_manager_pos"; + private static final Map< + Level, + SpatialIdentityIndex + > STRUCTURE_MANAGERS = + new ConcurrentHashMap<>(); - public static StructureManagerData getStructureManagerData(World world, Identifier structureManagerDataId){ + public static StructureManagerData getStructureManagerData(Level world, ResourceLocation structureManagerDataId){ if(world == null) return null; var data = StructureManagerDataLookup.getStructureManagerData(world, structureManagerDataId); return data.orElse(null); } - public static LivingEntity spawnEntity(ServerWorld world, StructureSpawnNestPool pool, BlockPos pos, int spawnRadius){ + public static LivingEntity spawnEntity( + ServerLevel world, + StructureSpawnNestPool pool, + BlockPos pos, + int spawnRadius, + BlockPos managerPos + ) { var random = world.getRandom(); - int chances = 5; - BlockPos chosenBlockPos = null; - for(BlockPos blockPos : BlockPos.iterateRandomly(random, chances, pos, spawnRadius)){ - blockPos = blockPos.withY(pos.getY()); - if(world.getBlockState(blockPos).isAir() && world.getBlockState(blockPos.up()).isAir()){ - chosenBlockPos = blockPos; - break; + EntityType entityType = pool.getEntityType(); + Entity entity; + if(entityType == EntitiesME.NPC){ + ResourceLocation npcIdentifier = pool.getNpcIdentifier().orElse(null); + if (npcIdentifier == null) { + return null; } - } - if(chosenBlockPos == null) - chosenBlockPos = pos; - - LivingEntity entity; - if(pool.getEntityType() == EntitiesME.NPC){ - - entity = new NpcEntityBuilder(world, chosenBlockPos) - .withNpcType(pool.getNpcIdentifier().get()) + entity = new NpcEntityBuilder(world, null) + .withNpcType(npcIdentifier) .build(); } else { - entity = (LivingEntity) pool.getEntityType().create(world, SpawnReason.STRUCTURE); - if(entity instanceof MobEntity mob) - mob.initialize(world, world.getLocalDifficulty(pos), SpawnReason.STRUCTURE, null); - entity.setPosition(chosenBlockPos.toCenterPos()); + entity = entityType.create(world); } - if(entity instanceof LivingEntity livEntity){ - world.spawnEntity(entity); - return livEntity; + if (!(entity instanceof LivingEntity livingEntity) || entity.isRemoved()) { + return null; + } + + int radius = Math.max(0, spawnRadius); + Iterable candidates = radius == 0 + ? List.of(pos) + : BlockPos.randomInCube(random, 16, pos, radius); + for (BlockPos randomPos : candidates) { + BlockPos candidate = randomPos.atY(pos.getY()); + if (!world.isInWorldBounds(candidate) + || !world.getWorldBorder().isWithinBounds(candidate) + || (SpawnPlacements.hasPlacement(entityType) + && !SpawnPlacements.isSpawnPositionOk(entityType, world, candidate))) { + continue; + } + + entity.setPos(candidate.getCenter()); + if (!world.noCollision(entity) || !world.isUnobstructed(entity)) { + continue; + } + if (entity instanceof Mob mob && !mob.checkSpawnObstruction(world)) { + continue; + } + + if (entity instanceof Mob mob) { + mob.finalizeSpawn( + world, + world.getCurrentDifficultyAt(candidate), + MobSpawnType.STRUCTURE, + null + ); + mob.setPersistenceRequired(); + } + bindManagedEntity(livingEntity, managerPos); + if (world.addFreshEntity(entity)) { + return livingEntity; + } + forgetManagedEntity(world, livingEntity.getUUID()); + clearBoundManager(livingEntity); + return null; } return null; } public static void register(StructureManagerBlockEntity manager) { - World world = manager.getWorld(); - if (world == null || world.isClient()) + Level world = manager.getLevel(); + if (world == null || world.isClientSide() || !manager.isOperational()) return; - STRUCTURE_MANAGERS.computeIfAbsent(world.getRegistryKey(), key -> new HashSet<>()) - .add(manager.getPos().toImmutable()); + STRUCTURE_MANAGERS + .computeIfAbsent(world, key -> new SpatialIdentityIndex<>()) + .register(indexPosition(manager.getBlockPos()), manager); + applyRecordedDeaths(manager); } public static void unregister(StructureManagerBlockEntity manager) { - World world = manager.getWorld(); - if (world == null || world.isClient()) + Level world = manager.getLevel(); + if (world == null || world.isClientSide()) return; - Set managers = STRUCTURE_MANAGERS.get(world.getRegistryKey()); - if (managers == null) - return; - - managers.remove(manager.getPos()); - if (managers.isEmpty()) - STRUCTURE_MANAGERS.remove(world.getRegistryKey()); + SpatialIdentityIndex managers = + STRUCTURE_MANAGERS.get(world); + if (managers != null) { + managers.unregister(indexPosition(manager.getBlockPos()), manager); + } } - public static boolean isClose(World world, BlockPos pos, int radius) { - Set managers = STRUCTURE_MANAGERS.get(world.getRegistryKey()); + public static boolean isClose(Level world, BlockPos pos, int radius) { + SpatialIdentityIndex managers = + STRUCTURE_MANAGERS.get(world); + return managers != null + && managers.containsWithin( + pos.getX(), pos.getY(), pos.getZ(), radius + ); + } + public static StructureManagerBlockEntity getClosest( + Level world, BlockPos pos, int radius, ResourceLocation managerId + ) { + SpatialIdentityIndex managers = + STRUCTURE_MANAGERS.get(world); if (managers == null) { - return false; + return null; } - int radiusSquared = radius * radius; + SpatialIdentityIndex.Registration closest = + managers.findClosest( + pos.getX(), + pos.getY(), + pos.getZ(), + radius, + registration -> { + StructureManagerBlockEntity manager = + registration.owner(); + SpatialIdentityIndex.Position position = + registration.position(); + BlockEntity current = world.getBlockEntity(new BlockPos( + position.x(), position.y(), position.z() + )); + if (current != manager || !manager.isOperational()) { + managers.remove(registration); + return false; + } + return manager.acceptsNest(managerId); + } + ); + return closest == null ? null : closest.owner(); + } - for (BlockPos managerPos : managers) { - if (managerPos.getSquaredDistance(pos) <= radiusSquared) { - return true; - } - } + private static SpatialIdentityIndex.Position indexPosition(BlockPos position) { + return new SpatialIdentityIndex.Position( + position.getX(), position.getY(), position.getZ() + ); + } - return false; + public static void clear(Level world) { + STRUCTURE_MANAGERS.remove(world); } - public static StructureManagerBlockEntity getClosest(World world, BlockPos pos, int radius) { - Set managers = STRUCTURE_MANAGERS.get(world.getRegistryKey()); + public static void clearAll() { + STRUCTURE_MANAGERS.clear(); + } - if (managers == null) { - return null; + public static void bindManagedEntity(LivingEntity entity, BlockPos managerPos) { + entity.getPersistentData().putLong(MANAGER_POS_TAG, managerPos.asLong()); + if (entity instanceof NpcEntity npc) { + npc.assignStructureManager(managerPos); + } + if (entity instanceof Mob mob) { + mob.setPersistenceRequired(); } + recordManagedEntityPosition(entity, managerPos); + } - int radiusSquared = radius * radius; - double closestDistance = Double.MAX_VALUE; - StructureManagerBlockEntity closest = null; + public static void recordManagedEntityPosition( + LivingEntity entity, BlockPos managerPos + ) { + if (entity.level() instanceof ServerLevel world) { + StructureManagedEntityData.get(world).track( + entity.getUUID(), managerPos, entity.blockPosition()); + } + } - for (BlockPos managerPos : managers) { - double distance = managerPos.getSquaredDistance(pos); + @Nullable + public static BlockPos getBoundManagerPos(LivingEntity entity) { + if (!entity.getPersistentData().contains(MANAGER_POS_TAG)) { + return null; + } + return BlockPos.of(entity.getPersistentData().getLong(MANAGER_POS_TAG)); + } - if (distance > radiusSquared || distance >= closestDistance) { - continue; - } + public static void clearBoundManager(LivingEntity entity) { + entity.getPersistentData().remove(MANAGER_POS_TAG); + if (entity instanceof NpcEntity npc) { + npc.clearStructureManager(); + } + } - BlockEntity blockEntity = world.getBlockEntity(managerPos); + public static void signalManagedEntityDeath(LivingEntity entity) { + BlockPos managerPos = getBoundManagerPos(entity); + if (managerPos == null) { + return; + } + signalManagedEntityDeath(entity, managerPos); + } - if (blockEntity instanceof StructureManagerBlockEntity structureManager) { - closestDistance = distance; - closest = structureManager; - } + public static void signalManagedEntityDeath(LivingEntity entity, BlockPos managerPos) { + if (!(entity.level() instanceof ServerLevel world)) { + return; + } + StructureManagedEntityData.get(world).markDead( + entity.getUUID(), managerPos, entity.blockPosition()); + if (world.getBlockEntity(managerPos) instanceof StructureManagerBlockEntity manager) { + manager.removeManagedEntity(entity.getUUID()); } + } + + public static void forgetManagedEntity(ServerLevel world, UUID uuid) { + StructureManagedEntityData.get(world).remove(uuid); + } - return closest; + private static void applyRecordedDeaths(StructureManagerBlockEntity manager) { + Level world = manager.getLevel(); + if (!(world instanceof ServerLevel serverLevel)) { + return; + } + for (UUID uuid : StructureManagedEntityData.get(serverLevel) + .deadEntitiesFor(manager.getBlockPos())) { + manager.removeManagedEntity(uuid); + } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/StructureNestList.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/StructureNestList.java index 393db0e1ef..3e11059933 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/StructureNestList.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/features/StructureNestList.java @@ -3,19 +3,23 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import io.netty.buffer.ByteBuf; -import net.minecraft.entity.LivingEntity; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; +import net.minecraft.core.BlockPos; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.level.Level; import net.sevenstars.api.utils.ModLogger; import net.sevenstars.middleearth.MiddleEarth; import java.util.ArrayList; import java.util.List; +import java.util.UUID; public class StructureNestList { ModLogger logger = MiddleEarth.LOGGER; public static final Codec CODEC; - public static final PacketCodec PACKET_CODEC; + public static final StreamCodec PACKET_CODEC; private static final String ID = "spawn_nest_list"; private List managers; @@ -25,7 +29,7 @@ public StructureNestList() { } public StructureNestList(List managers) { - this.managers = managers; + this.managers = new ArrayList<>(managers); } public void computeDeath(LivingEntity entity) { @@ -35,6 +39,15 @@ public void computeDeath(LivingEntity entity) { } } + public boolean removeEntity(Level world, UUID uuid) { + for (SpawnNestManager nest : managers) { + if (nest.removeEntity(world, uuid)) { + return true; + } + } + return false; + } + public List getManagers() { return managers; } @@ -48,11 +61,23 @@ public List content() { CODEC = RecordCodecBuilder.create(instance -> instance.group( Codec.list(SpawnNestManager.CODEC).fieldOf("Managers").forGetter(StructureNestList::content) ).apply(instance, StructureNestList::new)); - PACKET_CODEC = PacketCodecs.codec(CODEC); + PACKET_CODEC = ByteBufCodecs.fromCodec(CODEC); } - public void addNest(SpawnNestManager spawnNestManager) { - this.managers = new ArrayList<>(managers); + public boolean addNest(SpawnNestManager spawnNestManager) { + if (contains(spawnNestManager.getId(), spawnNestManager.getOriginPos())) { + return false; + } this.managers.add(spawnNestManager); + return true; + } + + public boolean contains(ResourceLocation id, BlockPos originPos) { + for (SpawnNestManager manager : managers) { + if (manager.getId().equals(id) && manager.getOriginPos().equals(originPos)) { + return true; + } + } + return false; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/nest/StructureNestBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/nest/StructureNestBlock.java index be2e52a6d5..d220ab79e4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/nest/StructureNestBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/nest/StructureNestBlock.java @@ -1,111 +1,123 @@ package net.sevenstars.middleearth.block.special.structureManager.nest; import com.mojang.serialization.MapCodec; -import net.minecraft.block.*; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.state.property.Property; -import net.minecraft.util.ActionResult; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.BlockHitResult; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import org.jetbrains.annotations.Nullable; -public class StructureNestBlock extends BlockWithEntity implements BlockEntityProvider, Waterloggable { - public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; - public static final BooleanProperty ENABLED = BooleanProperty.of("enabled"); +public class StructureNestBlock extends BaseEntityBlock implements EntityBlock, SimpleWaterloggedBlock { + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; + public static final BooleanProperty ENABLED = BooleanProperty.create("enabled"); - public StructureNestBlock(Settings settings) { + public StructureNestBlock(Properties settings) { super(settings); - setDefaultState(getDefaultState().with(ENABLED, false)); + registerDefaultState(defaultBlockState().setValue(ENABLED, false)); } @Override - protected MapCodec getCodec() { - return createCodec(StructureNestBlock::new); + protected MapCodec codec() { + return simpleCodec(StructureNestBlock::new); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if (world.isClient) { - return ActionResult.SUCCESS; + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (!player.isCreative() || !player.canUseGameMasterBlocks()) { + return InteractionResult.PASS; + } + if (world.isClientSide) { + return InteractionResult.SUCCESS; } else { - NamedScreenHandlerFactory screenHandlerFactory = state.createScreenHandlerFactory(world, pos); + MenuProvider screenHandlerFactory = state.getMenuProvider(world, pos); if(screenHandlerFactory != null) { - player.openHandledScreen(screenHandlerFactory); + if (screenHandlerFactory instanceof net.sevenstars.middleearth.block.utils.ExtendedMenuProviderME extendedProvider) { + net.sevenstars.middleearth.block.utils.ExtendedMenuProviderME.open(player, extendedProvider); + } else { + player.openMenu(screenHandlerFactory); + } } - return ActionResult.CONSUME; + return InteractionResult.CONSUME; } } @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new StructureNestBlockEntity(pos, state); } - protected boolean isTransparent(BlockState state) { + protected boolean propagatesSkylightDown(BlockState state) { return state.getFluidState().isEmpty(); } - protected BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } - protected float getAmbientOcclusionLightLevel(BlockState state, BlockView world, BlockPos pos) { + protected float getShadeBrightness(BlockState state, BlockGetter world, BlockPos pos) { return 1.0F; } - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if ((Boolean)state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if ((Boolean)state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return super.updateShape(state, direction, neighborState, world, pos, neighborPos); } protected FluidState getFluidState(BlockState state) { - return (Boolean)state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return (Boolean)state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - return (BlockState)this.getDefaultState().with(WATERLOGGED, ctx.getWorld().getFluidState(ctx.getBlockPos()).getFluid() == Fluids.WATER); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return (BlockState)this.defaultBlockState().setValue(WATERLOGGED, ctx.getLevel().getFluidState(ctx.getClickedPos()).getType() == Fluids.WATER); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(WATERLOGGED, ENABLED); } @Nullable @Override - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { + public BlockEntityTicker getTicker(Level world, BlockState state, BlockEntityType type) { return validateTicker(world, type, ModBlockEntities.STRUCTURE_NEST); } @Nullable - protected static BlockEntityTicker validateTicker(World world, BlockEntityType givenType, BlockEntityType expectedType) { + protected static BlockEntityTicker validateTicker(Level world, BlockEntityType givenType, BlockEntityType expectedType) { BlockEntityTicker ticker; - if (world.isClient) { + if (world.isClientSide) { return null; } - ticker = validateTicker(givenType, expectedType, (worldx, pos, state, blockEntity) -> { + ticker = createTickerHelper(givenType, expectedType, (worldx, pos, state, blockEntity) -> { StructureNestBlockEntity.tickEvent(world, pos, state, blockEntity); }); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/nest/StructureNestBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/nest/StructureNestBlockEntity.java index 490c059922..f9eca654de 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/nest/StructureNestBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/structureManager/nest/StructureNestBlockEntity.java @@ -1,21 +1,21 @@ package net.sevenstars.middleearth.block.special.structureManager.nest; -import com.mojang.serialization.Codec; -import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.sevenstars.middleearth.block.utils.ExtendedMenuProviderME; +import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import net.sevenstars.middleearth.block.special.structureManager.StructureManagerBlockEntity; @@ -24,10 +24,11 @@ import net.sevenstars.middleearth.gui.structuremanager.structurenest.StructureNestScreenHandler; import org.jetbrains.annotations.Nullable; +import java.util.Objects; import java.util.Optional; import java.util.function.Predicate; -public class StructureNestBlockEntity extends BlockEntity implements ExtendedScreenHandlerFactory { +public class StructureNestBlockEntity extends BlockEntity implements ExtendedMenuProviderME { private static final String ID = "structure_nest"; private enum SyncedData { @@ -42,9 +43,9 @@ private enum SyncedData { } } @Nullable - protected Identifier managerId; + protected ResourceLocation managerId; @Nullable - protected Identifier nestId; + protected ResourceLocation nestId; protected int spawnRadius; protected boolean isEnabled; @@ -56,23 +57,19 @@ public StructureNestBlockEntity(BlockPos pos, BlockState state) { } @Override - public Object getScreenOpeningData(ServerPlayerEntity serverPlayerEntity) { - return new StructureNestScreenData(this.pos, - Optional.ofNullable(this.managerId), - Optional.ofNullable(this.nestId), - spawnRadius, - isEnabled - ); + public void writeOpeningData(RegistryFriendlyByteBuf buffer) { + StructureNestScreenData.PACKET_CODEC.encode(buffer, new StructureNestScreenData(this.worldPosition, + Optional.ofNullable(this.managerId), Optional.ofNullable(this.nestId), spawnRadius, isEnabled)); } - public Text getDisplayName() { - return Text.translatable("screen.%s.%s".formatted(MiddleEarth.MOD_ID, ID)); + public Component getDisplayName() { + return Component.translatable("screen.%s.%s".formatted(MiddleEarth.MOD_ID, ID)); } @Nullable @Override - public ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) { - return new StructureNestScreenHandler(syncId, playerInventory, new StructureNestScreenData(this.pos, + public AbstractContainerMenu createMenu(int syncId, Inventory playerInventory, Player player) { + return new StructureNestScreenHandler(syncId, playerInventory, new StructureNestScreenData(this.worldPosition, Optional.ofNullable(this.managerId), Optional.ofNullable(this.nestId), this.spawnRadius, @@ -80,92 +77,110 @@ public ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, Pla } @Override - protected void readData(ReadView view) { - super.readData(view); - Optional managerId = view.read(SyncedData.MANAGER_ID.name, Identifier.CODEC); - managerId.ifPresent(identifier -> this.managerId = identifier); - Optional nestId = view.read(SyncedData.NEST_ID.name, Identifier.CODEC); - nestId.ifPresent(identifier -> this.nestId = identifier); - spawnRadius = view.getInt(SyncedData.SPAWN_RADIUS.name, 0); - isEnabled = view.getBoolean(SyncedData.IS_ENABLED.name, false); + protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.loadAdditional(tag, registries); + if (tag.contains(SyncedData.MANAGER_ID.name)) { + managerId = ResourceLocation.tryParse(tag.getString(SyncedData.MANAGER_ID.name)); + } + if (tag.contains(SyncedData.NEST_ID.name)) { + nestId = ResourceLocation.tryParse(tag.getString(SyncedData.NEST_ID.name)); + } + spawnRadius = tag.getInt(SyncedData.SPAWN_RADIUS.name); + isEnabled = tag.getBoolean(SyncedData.IS_ENABLED.name); } @Override - protected void writeData(WriteView view) { - super.writeData(view); - if(nestId != null) - view.put(SyncedData.NEST_ID.name, Identifier.CODEC, this.nestId); - if(managerId != null) - view.put(SyncedData.MANAGER_ID.name, Identifier.CODEC, this.managerId); - view.put(SyncedData.SPAWN_RADIUS.name, Codec.INT, this.spawnRadius); - view.put(SyncedData.IS_ENABLED.name, Codec.BOOL, this.isEnabled); + protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.saveAdditional(tag, registries); + if (nestId != null) { + tag.putString(SyncedData.NEST_ID.name, nestId.toString()); + } + if (managerId != null) { + tag.putString(SyncedData.MANAGER_ID.name, managerId.toString()); + } + tag.putInt(SyncedData.SPAWN_RADIUS.name, this.spawnRadius); + tag.putBoolean(SyncedData.IS_ENABLED.name, this.isEnabled); } @Override - public BlockEntityUpdateS2CPacket toUpdatePacket() { - return BlockEntityUpdateS2CPacket.create(this); + public ClientboundBlockEntityDataPacket getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); } - public void setStructureManagerId(Identifier structureManagerId) { + public void applySettings( + @Nullable ResourceLocation structureManagerId, + @Nullable ResourceLocation structureNestId, + int newRadius, + boolean enabled + ) { + if (Objects.equals(this.managerId, structureManagerId) + && Objects.equals(this.nestId, structureNestId) + && this.spawnRadius == newRadius + && this.isEnabled == enabled) { + return; + } this.managerId = structureManagerId; - updateListeners(); - } - - public void setStructureNestId(Identifier structureNestId) { this.nestId = structureNestId; - updateListeners(); - } - - public void setSpawnRadius(int newRadius) { this.spawnRadius = newRadius; - updateListeners(); - } - - public void setIsEnabled(boolean isEnabled) { - this.isEnabled = isEnabled; + this.isEnabled = enabled; updateListeners(); } private void updateListeners() { - this.markDirty(); - this.world.updateListeners(this.getPos(), this.getCachedState(), this.getCachedState(), Block.NOTIFY_ALL); + this.setChanged(); + if (this.level != null) { + this.level.sendBlockUpdated( + this.getBlockPos(), + this.getBlockState(), + this.getBlockState(), + Block.UPDATE_CLIENTS + ); + } } - public static void tickEvent(World world, BlockPos blockPos, BlockState blockState, StructureNestBlockEntity entity) { + public static void tickEvent(Level world, BlockPos blockPos, BlockState blockState, StructureNestBlockEntity entity) { entity.tickEvent(world, blockState); } - private void tickEvent(World world, BlockState blockState) { - if(world.isClient) + private void tickEvent(Level world, BlockState blockState) { + if(world.isClientSide) return; - if(!blockState.get(StructureNestBlock.ENABLED)) { + if(!blockState.getValue(StructureNestBlock.ENABLED)) { fails = 0; return; } - if(managerId == null || nestId == null || world.getTickOrder() % 20 != 0) // every 1 seconds + int retryInterval = fails < 12 ? 20 : 100; + long tickOffset = Math.floorMod(worldPosition.asLong(), retryInterval); + if(managerId == null || nestId == null + || Math.floorMod(world.getGameTime() + tickOffset, retryInterval) != 0) return; - StructureManagerBlockEntity structureManagerBlockEntity = StructureManagerService.getClosest(world, pos, 20); + StructureManagerBlockEntity structureManagerBlockEntity = + StructureManagerService.getClosest(world, worldPosition, 20, managerId); if(structureManagerBlockEntity == null) { - fails++; + recordFailure(); } else { - if(structureManagerBlockEntity.subscribeNest(this.pos, this.managerId, this.nestId, this.spawnRadius)) + if(structureManagerBlockEntity.subscribeNest(this.worldPosition, this.managerId, this.nestId, this.spawnRadius)) { - world.breakBlock(pos, false); - world.removeBlockEntity(pos); + world.destroyBlock(worldPosition, false); initialized = true; - updateListeners(); } else { - fails++; + recordFailure(); } } - if(fails >= 12) { - world.breakBlock(pos, false); - world.removeBlockEntity(pos); - updateListeners(); + } + + private void recordFailure() { + if (fails < 12) { + fails++; + if (fails == 12) { + MiddleEarth.LOGGER.logWarn( + "Structure nest at %s is waiting for manager %s and nest data %s" + .formatted(worldPosition, managerId, nestId)); + } } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/AbstractToggeableLightBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/AbstractToggeableLightBlock.java index 14209255a8..1ec57afc75 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/AbstractToggeableLightBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/AbstractToggeableLightBlock.java @@ -1,85 +1,86 @@ package net.sevenstars.middleearth.block.special.toggeable_lights; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.BlockStateComponent; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.resource.featuretoggle.FeatureSet; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.BlockRenderView; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.event.GameEvent; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.component.DataComponents; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.ItemTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.flag.FeatureFlagSet; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.component.BlockItemStateProperties; +import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.Nullable; public abstract class AbstractToggeableLightBlock extends Block { public static final BooleanProperty LIT; - public static final IntProperty LEVEL_15; + public static final IntegerProperty LEVEL_15; public static final BooleanProperty WATERLOGGED; - protected AbstractToggeableLightBlock(Settings settings) { + protected AbstractToggeableLightBlock(Properties settings) { super(settings); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(LEVEL_15, LIT, WATERLOGGED); } @Override - public BlockState getAppearance(BlockState state, BlockRenderView renderView, BlockPos pos, Direction side, @Nullable BlockState sourceState, @Nullable BlockPos sourcePos) { + public BlockState getAppearance(BlockState state, BlockAndTintGetter renderView, BlockPos pos, Direction side, @Nullable BlockState sourceState, @Nullable BlockPos sourcePos) { return super.getAppearance(state, renderView, pos, side, sourceState, sourcePos); } - public ItemStack getPickStack(WorldView world, BlockPos pos, BlockState state, boolean includeData) { - return addNbtForLevel(super.getPickStack(world, pos, state, false), state.get(LEVEL_15)); + @Override + public ItemStack getCloneItemStack(LevelReader world, BlockPos pos, BlockState state) { + return addNbtForLevel(super.getCloneItemStack(world, pos, state), state.getValue(LEVEL_15)); } public static ItemStack addNbtForLevel(ItemStack stack, int level) { if (level != 15) { - stack.set(DataComponentTypes.BLOCK_STATE, BlockStateComponent.DEFAULT.with(LEVEL_15, level)); + stack.set(DataComponents.BLOCK_STATE, BlockItemStateProperties.EMPTY.with(LEVEL_15, level)); } return stack; } @Override - public boolean isEnabled(FeatureSet enabledFeatures) { + public boolean isEnabled(FeatureFlagSet enabledFeatures) { return super.isEnabled(enabledFeatures); } @Override - public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { + public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { Direction direction = attachedDirection(state).getOpposite(); - return Block.sideCoversSmallSquare(world, pos.offset(direction), direction.getOpposite()); + return Block.canSupportCenter(world, pos.relative(direction), direction.getOpposite()); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return attachedDirection(state).getOpposite() == direction && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return attachedDirection(state).getOpposite() == direction && !state.canSurvive(world, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @@ -87,54 +88,54 @@ protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world @Override public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Override - protected boolean canPathfindThrough(BlockState state, NavigationType type) { + protected boolean isPathfindable(BlockState state, PathComputationType type) { return false; } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - Hand hand = player.getActiveHand(); - if (!world.isClient && player.getAbilities().allowModifyWorld) { - if(player.isInCreativeMode()){ - world.setBlockState(pos, state.cycle(LIT)); + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + InteractionHand hand = player.getUsedItemHand(); + if (!world.isClientSide && player.getAbilities().mayBuild) { + if(player.hasInfiniteMaterials()){ + world.setBlockAndUpdate(pos, state.cycle(LIT)); } else { - ItemStack itemStack = player.getStackInHand(hand); - if (state.get(LIT) && itemStack.isIn(ItemTags.SHOVELS)) { + ItemStack itemStack = player.getItemInHand(hand); + if (state.getValue(LIT) && itemStack.is(ItemTags.SHOVELS)) { extinguish(null, state, world, pos); - } else if (!state.get(LIT) && itemStack.isOf(Items.FLINT_AND_STEEL) || itemStack.isOf(Items.TORCH)) { + } else if (!state.getValue(LIT) && itemStack.is(Items.FLINT_AND_STEEL) || itemStack.is(Items.TORCH)) { setLit(world, state, pos, true); } } } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } public static boolean emitsLight(BlockState state){ - return state.get(LIT); + return state.getValue(LIT); } - protected static void setLit(WorldAccess world, BlockState state, BlockPos pos, boolean lit) { - world.setBlockState(pos, state.with(LIT, lit).cycle(LEVEL_15), 2 | 3); + protected static void setLit(LevelAccessor world, BlockState state, BlockPos pos, boolean lit) { + world.setBlock(pos, state.setValue(LIT, lit).cycle(LEVEL_15), 2 | 3); if(lit){ - world.playSound(null, pos, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.5F, 1.0F); + world.playSound(null, pos, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.5F, 1.0F); } } - protected static void extinguish(@Nullable PlayerEntity player, BlockState state, WorldAccess world, BlockPos pos) { + protected static void extinguish(@Nullable Player player, BlockState state, LevelAccessor world, BlockPos pos) { setLit(world, state, pos, false); - world.playSound(null, pos, SoundEvents.BLOCK_CANDLE_EXTINGUISH, SoundCategory.BLOCKS, 1.5F, 1.0F); - world.emitGameEvent(player, GameEvent.BLOCK_CHANGE, pos); + world.playSound(null, pos, SoundEvents.CANDLE_EXTINGUISH, SoundSource.BLOCKS, 1.5F, 1.0F); + world.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); } static { - LIT = Properties.LIT; - LEVEL_15 = Properties.LEVEL_15; - WATERLOGGED = Properties.WATERLOGGED; + LIT = BlockStateProperties.LIT; + LEVEL_15 = BlockStateProperties.LEVEL; + WATERLOGGED = BlockStateProperties.WATERLOGGED; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/CrudeLanternBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/CrudeLanternBlock.java index ba65f5efbf..3df930eb4a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/CrudeLanternBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/CrudeLanternBlock.java @@ -1,52 +1,52 @@ package net.sevenstars.middleearth.block.special.toggeable_lights; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; import java.util.function.ToIntFunction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class CrudeLanternBlock extends AbstractToggeableLightBlock { public static final BooleanProperty HANGING; public static final ToIntFunction STATE_TO_LUMINANCE; private static final VoxelShape SHAPE; - public CrudeLanternBlock(Settings settings) { + public CrudeLanternBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(LIT, false).with(HANGING, false).with(WATERLOGGED, false).with(LEVEL_15, 15)); + this.registerDefaultState(this.defaultBlockState().setValue(LIT, false).setValue(HANGING, false).setValue(WATERLOGGED, false).setValue(LEVEL_15, 15)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add (HANGING); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + FluidState fluidState = ctx.getLevel().getFluidState(ctx.getClickedPos()); + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; if (direction.getAxis() == Direction.Axis.Y) { - BlockState blockState = this.getDefaultState().with(HANGING, direction == Direction.UP); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { - return blockState.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); + BlockState blockState = this.defaultBlockState().setValue(HANGING, direction == Direction.UP); + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { + return blockState.setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER); } } } @@ -54,26 +54,26 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { return null; } - public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient && projectile.isOnFire() && !state.get(LIT)) { - world.setBlockState(hit.getBlockPos(), state.with(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); + public void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!world.isClientSide && projectile.isOnFire() && !state.getValue(LIT)) { + world.setBlock(hit.getBlockPos(), state.setValue(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); } } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override protected Direction attachedDirection(BlockState state) { - return state.get(HANGING) ? Direction.DOWN : Direction.UP; + return state.getValue(HANGING) ? Direction.DOWN : Direction.UP; } static { - HANGING = Properties.HANGING; - STATE_TO_LUMINANCE = (state) -> { return state.get(LIT) ? state.get(LEVEL_15) : 0; }; + HANGING = BlockStateProperties.HANGING; + STATE_TO_LUMINANCE = (state) -> { return state.getValue(LIT) ? state.getValue(LEVEL_15) : 0; }; - SHAPE = Block.createCuboidShape(4, 0, 4, 12, 10, 12); + SHAPE = Block.box(4, 0, 4, 12, 10, 12); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/CrystalLampBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/CrystalLampBlock.java index 7bfb00cb46..e3dca9b0f6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/CrystalLampBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/CrystalLampBlock.java @@ -1,51 +1,51 @@ package net.sevenstars.middleearth.block.special.toggeable_lights; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; import java.util.function.ToIntFunction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class CrystalLampBlock extends AbstractToggeableLightBlock { public static final BooleanProperty HANGING; public static final ToIntFunction STATE_TO_LUMINANCE; private static final VoxelShape SHAPE; - public CrystalLampBlock(Settings settings) { + public CrystalLampBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(LIT, false).with(HANGING, false).with(WATERLOGGED, false).with(LEVEL_15, 15)); + this.registerDefaultState(this.defaultBlockState().setValue(LIT, false).setValue(HANGING, false).setValue(WATERLOGGED, false).setValue(LEVEL_15, 15)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add (HANGING); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + FluidState fluidState = ctx.getLevel().getFluidState(ctx.getClickedPos()); + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for (Direction direction : var3) { if (direction.getAxis() == Direction.Axis.Y) { - BlockState blockState = this.getDefaultState().with(HANGING, direction == Direction.UP); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { - return blockState.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); + BlockState blockState = this.defaultBlockState().setValue(HANGING, direction == Direction.UP); + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { + return blockState.setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER); } } } @@ -53,26 +53,26 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { return null; } - public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient && projectile.isOnFire() && !state.get(LIT)) { - world.setBlockState(hit.getBlockPos(), state.with(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); + public void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!world.isClientSide && projectile.isOnFire() && !state.getValue(LIT)) { + world.setBlock(hit.getBlockPos(), state.setValue(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); } } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override protected Direction attachedDirection(BlockState state) { - return state.get(HANGING) ? Direction.DOWN : Direction.UP; + return state.getValue(HANGING) ? Direction.DOWN : Direction.UP; } static { - HANGING = Properties.HANGING; - STATE_TO_LUMINANCE = (state) -> { return state.get(LIT) ? state.get(LEVEL_15) : 0; }; + HANGING = BlockStateProperties.HANGING; + STATE_TO_LUMINANCE = (state) -> { return state.getValue(LIT) ? state.getValue(LEVEL_15) : 0; }; - SHAPE = Block.createCuboidShape(4, 0, 4, 12, 11, 12); + SHAPE = Block.box(4, 0, 4, 12, 11, 12); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/DwarvenLanternBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/DwarvenLanternBlock.java index 850ea658b9..017078427b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/DwarvenLanternBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/DwarvenLanternBlock.java @@ -1,52 +1,52 @@ package net.sevenstars.middleearth.block.special.toggeable_lights; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; import java.util.function.ToIntFunction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class DwarvenLanternBlock extends AbstractToggeableLightBlock { public static final BooleanProperty HANGING; public static final ToIntFunction STATE_TO_LUMINANCE; private static final VoxelShape SHAPE; - public DwarvenLanternBlock(Settings settings) { + public DwarvenLanternBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(LIT, false).with(HANGING, false).with(WATERLOGGED, false).with(LEVEL_15, 15)); + this.registerDefaultState(this.defaultBlockState().setValue(LIT, false).setValue(HANGING, false).setValue(WATERLOGGED, false).setValue(LEVEL_15, 15)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add (HANGING); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + FluidState fluidState = ctx.getLevel().getFluidState(ctx.getClickedPos()); + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; if (direction.getAxis() == Direction.Axis.Y) { - BlockState blockState = this.getDefaultState().with(HANGING, direction == Direction.UP); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { - return blockState.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); + BlockState blockState = this.defaultBlockState().setValue(HANGING, direction == Direction.UP); + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { + return blockState.setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER); } } } @@ -54,26 +54,26 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { return null; } - public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient && projectile.isOnFire() && !state.get(LIT)) { - world.setBlockState(hit.getBlockPos(), state.with(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); + public void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!world.isClientSide && projectile.isOnFire() && !state.getValue(LIT)) { + world.setBlock(hit.getBlockPos(), state.setValue(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); } } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override protected Direction attachedDirection(BlockState state) { - return state.get(HANGING) ? Direction.DOWN : Direction.UP; + return state.getValue(HANGING) ? Direction.DOWN : Direction.UP; } static { - HANGING = Properties.HANGING; - STATE_TO_LUMINANCE = (state) -> { return state.get(LIT) ? state.get(LEVEL_15) : 0; }; + HANGING = BlockStateProperties.HANGING; + STATE_TO_LUMINANCE = (state) -> { return state.getValue(LIT) ? state.getValue(LEVEL_15) : 0; }; - SHAPE = Block.createCuboidShape(4, 0, 4, 12, 11, 12); + SHAPE = Block.box(4, 0, 4, 12, 11, 12); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/ElvenLanternBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/ElvenLanternBlock.java index 4a11916784..e98822db17 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/ElvenLanternBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/ElvenLanternBlock.java @@ -1,52 +1,52 @@ package net.sevenstars.middleearth.block.special.toggeable_lights; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; import java.util.function.ToIntFunction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class ElvenLanternBlock extends AbstractToggeableLightBlock { public static final BooleanProperty HANGING; public static final ToIntFunction STATE_TO_LUMINANCE; private static final VoxelShape SHAPE; - public ElvenLanternBlock(Settings settings) { + public ElvenLanternBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(LIT, false).with(HANGING, false).with(WATERLOGGED, false).with(LEVEL_15, 15)); + this.registerDefaultState(this.defaultBlockState().setValue(LIT, false).setValue(HANGING, false).setValue(WATERLOGGED, false).setValue(LEVEL_15, 15)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add (HANGING); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + FluidState fluidState = ctx.getLevel().getFluidState(ctx.getClickedPos()); + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; if (direction.getAxis() == Direction.Axis.Y) { - BlockState blockState = this.getDefaultState().with(HANGING, direction == Direction.UP); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { - return blockState.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); + BlockState blockState = this.defaultBlockState().setValue(HANGING, direction == Direction.UP); + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { + return blockState.setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER); } } } @@ -54,26 +54,26 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { return null; } - public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient && projectile.isOnFire() && !state.get(LIT)) { - world.setBlockState(hit.getBlockPos(), state.with(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); + public void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!world.isClientSide && projectile.isOnFire() && !state.getValue(LIT)) { + world.setBlock(hit.getBlockPos(), state.setValue(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); } } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override protected Direction attachedDirection(BlockState state) { - return state.get(HANGING) ? Direction.DOWN : Direction.UP; + return state.getValue(HANGING) ? Direction.DOWN : Direction.UP; } static { - HANGING = Properties.HANGING; - STATE_TO_LUMINANCE = (state) -> { return state.get(LIT) ? state.get(LEVEL_15) : 0; }; + HANGING = BlockStateProperties.HANGING; + STATE_TO_LUMINANCE = (state) -> { return state.getValue(LIT) ? state.getValue(LEVEL_15) : 0; }; - SHAPE = Block.createCuboidShape(5, 0, 5, 11, 11, 11); + SHAPE = Block.box(5, 0, 5, 11, 11, 11); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/LeadLanternBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/LeadLanternBlock.java index d171d60074..a034b93a57 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/LeadLanternBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/LeadLanternBlock.java @@ -1,52 +1,52 @@ package net.sevenstars.middleearth.block.special.toggeable_lights; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; import java.util.function.ToIntFunction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class LeadLanternBlock extends AbstractToggeableLightBlock { public static final BooleanProperty HANGING; public static final ToIntFunction STATE_TO_LUMINANCE; private static final VoxelShape SHAPE; - public LeadLanternBlock(Settings settings) { + public LeadLanternBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(LIT, false).with(HANGING, false).with(WATERLOGGED, false).with(LEVEL_15, 15)); + this.registerDefaultState(this.defaultBlockState().setValue(LIT, false).setValue(HANGING, false).setValue(WATERLOGGED, false).setValue(LEVEL_15, 15)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add (HANGING); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + FluidState fluidState = ctx.getLevel().getFluidState(ctx.getClickedPos()); + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; if (direction.getAxis() == Direction.Axis.Y) { - BlockState blockState = this.getDefaultState().with(HANGING, direction == Direction.UP); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { - return blockState.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); + BlockState blockState = this.defaultBlockState().setValue(HANGING, direction == Direction.UP); + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { + return blockState.setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER); } } } @@ -54,26 +54,26 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { return null; } - public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient && projectile.isOnFire() && !state.get(LIT)) { - world.setBlockState(hit.getBlockPos(), state.with(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); + public void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!world.isClientSide && projectile.isOnFire() && !state.getValue(LIT)) { + world.setBlock(hit.getBlockPos(), state.setValue(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); } } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return SHAPE; } @Override protected Direction attachedDirection(BlockState state) { - return state.get(HANGING) ? Direction.DOWN : Direction.UP; + return state.getValue(HANGING) ? Direction.DOWN : Direction.UP; } static { - HANGING = Properties.HANGING; - STATE_TO_LUMINANCE = (state) -> { return state.get(LIT) ? state.get(LEVEL_15) : 0; }; + HANGING = BlockStateProperties.HANGING; + STATE_TO_LUMINANCE = (state) -> { return state.getValue(LIT) ? state.getValue(LEVEL_15) : 0; }; - SHAPE = Block.createCuboidShape(3, 0, 3, 13, 14, 13); + SHAPE = Block.box(3, 0, 3, 13, 14, 13); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/ShireLanternBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/ShireLanternBlock.java index 8d3dae92e1..600175367c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/ShireLanternBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/ShireLanternBlock.java @@ -1,24 +1,24 @@ package net.sevenstars.middleearth.block.special.toggeable_lights; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; import java.util.function.ToIntFunction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class ShireLanternBlock extends AbstractToggeableLightBlock { public static final BooleanProperty HANGING; @@ -26,28 +26,28 @@ public class ShireLanternBlock extends AbstractToggeableLightBlock { private static final VoxelShape SHAPE; private static final VoxelShape SHAPE_HANGING; - public ShireLanternBlock(Settings settings) { + public ShireLanternBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(LIT, false).with(HANGING, false).with(WATERLOGGED, false).with(LEVEL_15, 15)); + this.registerDefaultState(this.defaultBlockState().setValue(LIT, false).setValue(HANGING, false).setValue(WATERLOGGED, false).setValue(LEVEL_15, 15)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add (HANGING); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + FluidState fluidState = ctx.getLevel().getFluidState(ctx.getClickedPos()); + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; if (direction.getAxis() == Direction.Axis.Y) { - BlockState blockState = this.getDefaultState().with(HANGING, direction == Direction.UP); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { - return blockState.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); + BlockState blockState = this.defaultBlockState().setValue(HANGING, direction == Direction.UP); + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { + return blockState.setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER); } } } @@ -55,15 +55,15 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { return null; } - public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient && projectile.isOnFire() && !state.get(LIT)) { - world.setBlockState(hit.getBlockPos(), state.with(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); + public void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!world.isClientSide && projectile.isOnFire() && !state.getValue(LIT)) { + world.setBlock(hit.getBlockPos(), state.setValue(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); } } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if (state.get(HANGING)){ + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + if (state.getValue(HANGING)){ return SHAPE_HANGING; } else { return SHAPE; @@ -72,14 +72,14 @@ public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos po @Override protected Direction attachedDirection(BlockState state) { - return state.get(HANGING) ? Direction.DOWN : Direction.UP; + return state.getValue(HANGING) ? Direction.DOWN : Direction.UP; } static { - HANGING = Properties.HANGING; - STATE_TO_LUMINANCE = (state) -> { return state.get(LIT) ? state.get(LEVEL_15) : 0; }; + HANGING = BlockStateProperties.HANGING; + STATE_TO_LUMINANCE = (state) -> { return state.getValue(LIT) ? state.getValue(LEVEL_15) : 0; }; - SHAPE = Block.createCuboidShape(4, 0, 4, 12, 8, 12); - SHAPE_HANGING = Block.createCuboidShape(4, 3, 4, 12, 11, 12); + SHAPE = Block.box(4, 0, 4, 12, 8, 12); + SHAPE_HANGING = Block.box(4, 3, 4, 12, 11, 12); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/SilverLanternBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/SilverLanternBlock.java index 6738535cc0..f0551de3f3 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/SilverLanternBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/SilverLanternBlock.java @@ -1,53 +1,52 @@ package net.sevenstars.middleearth.block.special.toggeable_lights; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; import java.util.function.ToIntFunction; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; public class SilverLanternBlock extends AbstractToggeableLightBlock { public static final BooleanProperty HANGING; public static final ToIntFunction STATE_TO_LUMINANCE; private static final VoxelShape STANDING_SHAPE; - public SilverLanternBlock(Settings settings) { + public SilverLanternBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(LIT, false).with(HANGING, false).with(WATERLOGGED, false).with(LEVEL_15, 15)); + this.registerDefaultState(this.defaultBlockState().setValue(LIT, false).setValue(HANGING, false).setValue(WATERLOGGED, false).setValue(LEVEL_15, 15)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add (HANGING); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + FluidState fluidState = ctx.getLevel().getFluidState(ctx.getClickedPos()); + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; if (direction.getAxis() == Direction.Axis.Y) { - BlockState blockState = this.getDefaultState().with(HANGING, direction == Direction.UP); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { - return blockState.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); + BlockState blockState = this.defaultBlockState().setValue(HANGING, direction == Direction.UP); + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { + return blockState.setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER); } } } @@ -55,26 +54,26 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { return null; } - public void onProjectileHit(World world, BlockState state, BlockHitResult hit, ProjectileEntity projectile) { - if (!world.isClient && projectile.isOnFire() && !state.get(LIT)) { - world.setBlockState(hit.getBlockPos(), state.with(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); + public void onProjectileHit(Level world, BlockState state, BlockHitResult hit, Projectile projectile) { + if (!world.isClientSide && projectile.isOnFire() && !state.getValue(LIT)) { + world.setBlock(hit.getBlockPos(), state.setValue(LIT, true), STATE_TO_LUMINANCE.applyAsInt(state)); } } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { return STANDING_SHAPE; } @Override protected Direction attachedDirection(BlockState state) { - return state.get(HANGING) ? Direction.DOWN : Direction.UP; + return state.getValue(HANGING) ? Direction.DOWN : Direction.UP; } static { - HANGING = Properties.HANGING; - STATE_TO_LUMINANCE = (state) -> { return state.get(LIT) ? state.get(LEVEL_15) : 0; }; + HANGING = BlockStateProperties.HANGING; + STATE_TO_LUMINANCE = (state) -> { return state.getValue(LIT) ? state.getValue(LEVEL_15) : 0; }; - STANDING_SHAPE = Block.createCuboidShape(6, 0, 6, 10, 13, 10); + STANDING_SHAPE = Block.box(6, 0, 6, 10, 13, 10); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallCrudeLanternBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallCrudeLanternBlock.java index b2f4d592f6..72c84fd90e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallCrudeLanternBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallCrudeLanternBlock.java @@ -1,58 +1,58 @@ package net.sevenstars.middleearth.block.special.toggeable_lights; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; public class WallCrudeLanternBlock extends DwarvenLanternBlock { private static final EnumProperty FACING; private static final VoxelShape WALL_SHAPE; - public WallCrudeLanternBlock(Settings settings) { + public WallCrudeLanternBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(FACING, Direction.EAST)); + this.registerDefaultState(this.defaultBlockState().setValue(FACING, Direction.EAST)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); @@ -60,18 +60,18 @@ public BlockState mirror(BlockState state, BlockMirror mirror) { @Nullable @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + FluidState fluidState = ctx.getLevel().getFluidState(ctx.getClickedPos()); + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; - BlockState blockState = this.getDefaultState() - .with(HANGING, false) - .with(FACING, direction.getOpposite()); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { - return blockState.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); + BlockState blockState = this.defaultBlockState() + .setValue(HANGING, false) + .setValue(FACING, direction.getOpposite()); + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { + return blockState.setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER); } } @@ -79,48 +79,48 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - switch (state.get(FACING)){ + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + switch (state.getValue(FACING)){ case SOUTH -> { - return Block.createCuboidShape(4, 0, 8, 12, 14, 16); + return Block.box(4, 0, 8, 12, 14, 16); } case EAST -> { - return Block.createCuboidShape(8, 0, 4, 16, 14, 12); + return Block.box(8, 0, 4, 16, 14, 12); } case WEST -> { - return Block.createCuboidShape(0, 0, 4, 8, 14, 12); + return Block.box(0, 0, 4, 8, 14, 12); } default -> { - return Block.createCuboidShape(4, 0, 0, 12, 14, 8); + return Block.box(4, 0, 0, 12, 14, 8); } } } @Override - public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { + public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { Direction direction = attachedDirection(state).getOpposite(); - return Block.sideCoversSmallSquare(world, pos.offset(direction), direction.getOpposite()); + return Block.canSupportCenter(world, pos.relative(direction), direction.getOpposite()); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return attachedDirection(state).getOpposite() == direction && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return attachedDirection(state).getOpposite() == direction && !state.canSurvive(world, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } protected Direction attachedDirection(BlockState state) { - return state.get(FACING); + return state.getValue(FACING); } static { - FACING = Properties.FACING; + FACING = BlockStateProperties.FACING; - WALL_SHAPE = VoxelShapes.union( - Block.createCuboidShape(5.0, 3.0, 5.0, 11.0, 9.0, 11.0), - Block.createCuboidShape(6.0, 9.0, 6.0, 10.0, 10.0, 10.0)); + WALL_SHAPE = Shapes.or( + Block.box(5.0, 3.0, 5.0, 11.0, 9.0, 11.0), + Block.box(6.0, 9.0, 6.0, 10.0, 10.0, 10.0)); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallCrystalLampBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallCrystalLampBlock.java index 9498706496..aa5298804c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallCrystalLampBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallCrystalLampBlock.java @@ -1,59 +1,58 @@ package net.sevenstars.middleearth.block.special.toggeable_lights; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; public class WallCrystalLampBlock extends CrystalLampBlock { private static final EnumProperty FACING; private static final VoxelShape WALL_SHAPE; - public WallCrystalLampBlock(Settings settings) { + public WallCrystalLampBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(FACING, Direction.EAST)); + this.registerDefaultState(this.defaultBlockState().setValue(FACING, Direction.EAST)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); @@ -61,18 +60,18 @@ public BlockState mirror(BlockState state, BlockMirror mirror) { @Nullable @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + FluidState fluidState = ctx.getLevel().getFluidState(ctx.getClickedPos()); + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; - BlockState blockState = this.getDefaultState() - .with(HANGING, false) - .with(FACING, direction.getOpposite()); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { - return blockState.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); + BlockState blockState = this.defaultBlockState() + .setValue(HANGING, false) + .setValue(FACING, direction.getOpposite()); + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { + return blockState.setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER); } } @@ -80,48 +79,48 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - switch (state.get(FACING)){ + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + switch (state.getValue(FACING)){ case SOUTH -> { - return Block.createCuboidShape(4, 1, 2, 12, 12, 10); + return Block.box(4, 1, 2, 12, 12, 10); } case EAST -> { - return Block.createCuboidShape(2, 1, 4, 10, 12, 12); + return Block.box(2, 1, 4, 10, 12, 12); } case WEST -> { - return Block.createCuboidShape(6, 1, 4, 14, 12, 12); + return Block.box(6, 1, 4, 14, 12, 12); } default -> { - return Block.createCuboidShape(4, 1, 6, 12, 12, 14); + return Block.box(4, 1, 6, 12, 12, 14); } } } @Override - public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { + public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { Direction direction = attachedDirection(state).getOpposite(); - return Block.sideCoversSmallSquare(world, pos.offset(direction), direction.getOpposite()); + return Block.canSupportCenter(world, pos.relative(direction), direction.getOpposite()); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return attachedDirection(state).getOpposite() == direction && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return attachedDirection(state).getOpposite() == direction && !state.canSurvive(world, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } protected Direction attachedDirection(BlockState state) { - return state.get(FACING); + return state.getValue(FACING); } static { - FACING = Properties.FACING; + FACING = BlockStateProperties.FACING; - WALL_SHAPE = VoxelShapes.union( - Block.createCuboidShape(5.0, 3.0, 5.0, 11.0, 9.0, 11.0), - Block.createCuboidShape(6.0, 9.0, 6.0, 10.0, 10.0, 10.0)); + WALL_SHAPE = Shapes.or( + Block.box(5.0, 3.0, 5.0, 11.0, 9.0, 11.0), + Block.box(6.0, 9.0, 6.0, 10.0, 10.0, 10.0)); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallDwarvenLanternBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallDwarvenLanternBlock.java index 986093be15..2e436e9cc3 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallDwarvenLanternBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallDwarvenLanternBlock.java @@ -1,59 +1,58 @@ package net.sevenstars.middleearth.block.special.toggeable_lights; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; public class WallDwarvenLanternBlock extends DwarvenLanternBlock { private static final EnumProperty FACING; private static final VoxelShape WALL_SHAPE; - public WallDwarvenLanternBlock(Settings settings) { + public WallDwarvenLanternBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(FACING, Direction.EAST)); + this.registerDefaultState(this.defaultBlockState().setValue(FACING, Direction.EAST)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); @@ -61,18 +60,18 @@ public BlockState mirror(BlockState state, BlockMirror mirror) { @Nullable @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + FluidState fluidState = ctx.getLevel().getFluidState(ctx.getClickedPos()); + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; - BlockState blockState = this.getDefaultState() - .with(HANGING, false) - .with(FACING, direction.getOpposite()); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { - return blockState.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); + BlockState blockState = this.defaultBlockState() + .setValue(HANGING, false) + .setValue(FACING, direction.getOpposite()); + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { + return blockState.setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER); } } @@ -80,48 +79,48 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - switch (state.get(FACING)){ + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + switch (state.getValue(FACING)){ case SOUTH -> { - return Block.createCuboidShape(4, 0, 6, 12, 11, 14) ; + return Block.box(4, 0, 6, 12, 11, 14) ; } case EAST -> { - return Block.createCuboidShape(6, 0, 4, 14, 11, 12) ; + return Block.box(6, 0, 4, 14, 11, 12) ; } case WEST -> { - return Block.createCuboidShape(2, 0, 4, 10, 11, 12); + return Block.box(2, 0, 4, 10, 11, 12); } default -> { - return Block.createCuboidShape(4, 0, 2, 12, 11, 10); + return Block.box(4, 0, 2, 12, 11, 10); } } } @Override - public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { + public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { Direction direction = attachedDirection(state).getOpposite(); - return Block.sideCoversSmallSquare(world, pos.offset(direction), direction.getOpposite()); + return Block.canSupportCenter(world, pos.relative(direction), direction.getOpposite()); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return attachedDirection(state).getOpposite() == direction && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return attachedDirection(state).getOpposite() == direction && !state.canSurvive(world, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } protected Direction attachedDirection(BlockState state) { - return state.get(FACING); + return state.getValue(FACING); } static { - FACING = Properties.FACING; + FACING = BlockStateProperties.FACING; - WALL_SHAPE = VoxelShapes.union( - Block.createCuboidShape(5.0, 3.0, 5.0, 11.0, 9.0, 11.0), - Block.createCuboidShape(6.0, 9.0, 6.0, 10.0, 10.0, 10.0)); + WALL_SHAPE = Shapes.or( + Block.box(5.0, 3.0, 5.0, 11.0, 9.0, 11.0), + Block.box(6.0, 9.0, 6.0, 10.0, 10.0, 10.0)); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallElvenLanternBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallElvenLanternBlock.java index 8b9038e0ee..c38b66e464 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallElvenLanternBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallElvenLanternBlock.java @@ -1,59 +1,58 @@ package net.sevenstars.middleearth.block.special.toggeable_lights; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; public class WallElvenLanternBlock extends CrystalLampBlock { private static final EnumProperty FACING; private static final VoxelShape WALL_SHAPE; - public WallElvenLanternBlock(Settings settings) { + public WallElvenLanternBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(FACING, Direction.EAST)); + this.registerDefaultState(this.defaultBlockState().setValue(FACING, Direction.EAST)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); @@ -61,18 +60,18 @@ public BlockState mirror(BlockState state, BlockMirror mirror) { @Nullable @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + FluidState fluidState = ctx.getLevel().getFluidState(ctx.getClickedPos()); + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; - BlockState blockState = this.getDefaultState() - .with(HANGING, false) - .with(FACING, direction.getOpposite()); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { - return blockState.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); + BlockState blockState = this.defaultBlockState() + .setValue(HANGING, false) + .setValue(FACING, direction.getOpposite()); + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { + return blockState.setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER); } } @@ -80,49 +79,49 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - switch (state.get(FACING)){ + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + switch (state.getValue(FACING)){ case SOUTH -> { - return Block.createCuboidShape(5, 0, 8, 11, 11, 14); + return Block.box(5, 0, 8, 11, 11, 14); } case EAST -> { - return Block.createCuboidShape(8, 0, 5, 14, 11, 11); + return Block.box(8, 0, 5, 14, 11, 11); } case WEST -> { - return Block.createCuboidShape(2, 0, 5, 8, 11, 11); + return Block.box(2, 0, 5, 8, 11, 11); } default -> { - return Block.createCuboidShape(5, 0, 2, 11, 11, 8); + return Block.box(5, 0, 2, 11, 11, 8); } } } @Override - public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { + public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { Direction direction = attachedDirection(state).getOpposite(); - return Block.sideCoversSmallSquare(world, pos.offset(direction), direction.getOpposite()); + return Block.canSupportCenter(world, pos.relative(direction), direction.getOpposite()); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return attachedDirection(state).getOpposite() == direction && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return attachedDirection(state).getOpposite() == direction && !state.canSurvive(world, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } protected Direction attachedDirection(BlockState state) { - return state.get(FACING); + return state.getValue(FACING); } static { - FACING = Properties.FACING; + FACING = BlockStateProperties.FACING; - WALL_SHAPE = VoxelShapes.union( - Block.createCuboidShape(5.0, 3.0, 5.0, 11.0, 9.0, 11.0), - Block.createCuboidShape(6.0, 9.0, 6.0, 10.0, 10.0, 10.0)); + WALL_SHAPE = Shapes.or( + Block.box(5.0, 3.0, 5.0, 11.0, 9.0, 11.0), + Block.box(6.0, 9.0, 6.0, 10.0, 10.0, 10.0)); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallLeadLanternBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallLeadLanternBlock.java index fd69cbab36..5ad060720c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallLeadLanternBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallLeadLanternBlock.java @@ -1,57 +1,56 @@ package net.sevenstars.middleearth.block.special.toggeable_lights; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; public class WallLeadLanternBlock extends DwarvenLanternBlock { private static final EnumProperty FACING; - public WallLeadLanternBlock(Settings settings) { + public WallLeadLanternBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(FACING, Direction.EAST)); + this.registerDefaultState(this.defaultBlockState().setValue(FACING, Direction.EAST)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); @@ -59,18 +58,18 @@ public BlockState mirror(BlockState state, BlockMirror mirror) { @Nullable @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + FluidState fluidState = ctx.getLevel().getFluidState(ctx.getClickedPos()); + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; - BlockState blockState = this.getDefaultState() - .with(HANGING, false) - .with(FACING, direction.getOpposite()); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { - return blockState.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); + BlockState blockState = this.defaultBlockState() + .setValue(HANGING, false) + .setValue(FACING, direction.getOpposite()); + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { + return blockState.setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER); } } @@ -78,31 +77,31 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return Block.createCuboidShape(3, 0, 3, 13, 14, 13); + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Block.box(3, 0, 3, 13, 14, 13); } @Override - public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { + public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { Direction direction = attachedDirection(state).getOpposite(); - return Block.sideCoversSmallSquare(world, pos.offset(direction), direction.getOpposite()); + return Block.canSupportCenter(world, pos.relative(direction), direction.getOpposite()); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return attachedDirection(state).getOpposite() == direction && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return attachedDirection(state).getOpposite() == direction && !state.canSurvive(world, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } protected Direction attachedDirection(BlockState state) { - return state.get(FACING); + return state.getValue(FACING); } static { - FACING = Properties.FACING; + FACING = BlockStateProperties.FACING; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallShireLanternBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallShireLanternBlock.java index 92a33ad8f2..45f65349bd 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallShireLanternBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallShireLanternBlock.java @@ -1,58 +1,58 @@ package net.sevenstars.middleearth.block.special.toggeable_lights; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; public class WallShireLanternBlock extends DwarvenLanternBlock { private static final EnumProperty FACING; private static final VoxelShape WALL_SHAPE; - public WallShireLanternBlock(Settings settings) { + public WallShireLanternBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(FACING, Direction.EAST)); + this.registerDefaultState(this.defaultBlockState().setValue(FACING, Direction.EAST)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); @@ -60,18 +60,18 @@ public BlockState mirror(BlockState state, BlockMirror mirror) { @Nullable @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + FluidState fluidState = ctx.getLevel().getFluidState(ctx.getClickedPos()); + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; - BlockState blockState = this.getDefaultState() - .with(HANGING, false) - .with(FACING, direction.getOpposite()); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { - return blockState.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); + BlockState blockState = this.defaultBlockState() + .setValue(HANGING, false) + .setValue(FACING, direction.getOpposite()); + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { + return blockState.setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER); } } @@ -79,48 +79,48 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - switch (state.get(FACING)){ + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + switch (state.getValue(FACING)){ case SOUTH -> { - return Block.createCuboidShape(4, 0, 8, 12, 8, 16); + return Block.box(4, 0, 8, 12, 8, 16); } case EAST -> { - return Block.createCuboidShape(8, 0, 4, 16, 8, 12); + return Block.box(8, 0, 4, 16, 8, 12); } case WEST -> { - return Block.createCuboidShape(0, 0, 4, 8, 8, 12); + return Block.box(0, 0, 4, 8, 8, 12); } default -> { - return Block.createCuboidShape(4, 0, 0, 12, 8, 8); + return Block.box(4, 0, 0, 12, 8, 8); } } } @Override - public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { + public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { Direction direction = attachedDirection(state).getOpposite(); - return Block.sideCoversSmallSquare(world, pos.offset(direction), direction.getOpposite()); + return Block.canSupportCenter(world, pos.relative(direction), direction.getOpposite()); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return attachedDirection(state).getOpposite() == direction && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return attachedDirection(state).getOpposite() == direction && !state.canSurvive(world, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } protected Direction attachedDirection(BlockState state) { - return state.get(FACING); + return state.getValue(FACING); } static { - FACING = Properties.FACING; + FACING = BlockStateProperties.FACING; - WALL_SHAPE = VoxelShapes.union( - Block.createCuboidShape(5.0, 3.0, 5.0, 11.0, 9.0, 11.0), - Block.createCuboidShape(6.0, 9.0, 6.0, 10.0, 10.0, 10.0)); + WALL_SHAPE = Shapes.or( + Block.box(5.0, 3.0, 5.0, 11.0, 9.0, 11.0), + Block.box(6.0, 9.0, 6.0, 10.0, 10.0, 10.0)); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallSilverLanternBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallSilverLanternBlock.java index ca934af171..5b0d4144c0 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallSilverLanternBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/toggeable_lights/WallSilverLanternBlock.java @@ -1,56 +1,54 @@ package net.sevenstars.middleearth.block.special.toggeable_lights; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; public class WallSilverLanternBlock extends SilverLanternBlock { private static final EnumProperty FACING; - public WallSilverLanternBlock(Settings settings) { + public WallSilverLanternBlock(Properties settings) { super(settings); - this.setDefaultState(this.getDefaultState().with(FACING, Direction.EAST)); + this.registerDefaultState(this.defaultBlockState().setValue(FACING, Direction.EAST)); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING); - super.appendProperties(builder); + super.createBlockStateDefinition(builder); } @Nullable @Override - public BlockState getPlacementState(ItemPlacementContext ctx) { - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - Direction[] var3 = ctx.getPlacementDirections(); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + FluidState fluidState = ctx.getLevel().getFluidState(ctx.getClickedPos()); + Direction[] var3 = ctx.getNearestLookingDirections(); int var4 = var3.length; for(int var5 = 0; var5 < var4; ++var5) { Direction direction = var3[var5]; - BlockState blockState = this.getDefaultState() - .with(HANGING, false) - .with(FACING, direction.getOpposite()); - if (blockState.canPlaceAt(ctx.getWorld(), ctx.getBlockPos())) { - return blockState.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); + BlockState blockState = this.defaultBlockState() + .setValue(HANGING, false) + .setValue(FACING, direction.getOpposite()); + if (blockState.canSurvive(ctx.getLevel(), ctx.getClickedPos())) { + return blockState.setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER); } } @@ -58,56 +56,56 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return switch (state.get(FACING)) { - case SOUTH -> Block.createCuboidShape(6, -2, 10, 10, 11, 14); - case EAST -> Block.createCuboidShape(10, -2, 6, 14, 11, 10); - case WEST -> Block.createCuboidShape(2, -2, 6, 6, 11, 10); - default -> Block.createCuboidShape(6, -2, 2, 10, 11, 6); + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return switch (state.getValue(FACING)) { + case SOUTH -> Block.box(6, -2, 10, 10, 11, 14); + case EAST -> Block.box(10, -2, 6, 14, 11, 10); + case WEST -> Block.box(2, -2, 6, 6, 11, 10); + default -> Block.box(6, -2, 2, 10, 11, 6); }; } @Override - public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { + public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { Direction direction = attachedDirection(state).getOpposite(); - return Block.sideCoversSmallSquare(world, pos.offset(direction), direction.getOpposite()); + return Block.canSupportCenter(world, pos.relative(direction), direction.getOpposite()); } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return attachedDirection(state).getOpposite() == direction && !state.canPlaceAt(world, pos) ? Blocks.AIR.getDefaultState() : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return attachedDirection(state).getOpposite() == direction && !state.canSurvive(world, pos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } protected Direction attachedDirection(BlockState state) { - return state.get(FACING); + return state.getValue(FACING); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = state.get(FACING); + public BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = state.getValue(FACING); switch (mirror) { case LEFT_RIGHT -> { if (direction.getAxis() != Direction.Axis.Z) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } case FRONT_BACK -> { if (direction.getAxis() != Direction.Axis.X) break; - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } return super.mirror(state, mirror); } static { - FACING = Properties.FACING; + FACING = BlockStateProperties.FACING; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/torches/METorchBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/torches/METorchBlock.java index a66f07281d..24a95dd553 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/torches/METorchBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/torches/METorchBlock.java @@ -1,90 +1,90 @@ package net.sevenstars.middleearth.block.special.torches; -import net.minecraft.block.Block; -import net.minecraft.block.BlockRenderType; -import net.minecraft.block.BlockState; -import net.minecraft.block.TorchBlock; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.state.property.Property; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.event.GameEvent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.ItemTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.TorchBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.Property; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.Nullable; public class METorchBlock extends TorchBlock { - public static final BooleanProperty LIT = Properties.LIT; + public static final BooleanProperty LIT = BlockStateProperties.LIT; - public METorchBlock(Settings settings) { + public METorchBlock(Properties settings) { super(ParticleTypes.FLAME, settings); - this.setDefaultState((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)this.stateManager.getDefaultState()).with(LIT, true))))); + this.registerDefaultState((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)this.stateDefinition.any()).setValue(LIT, true))))); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - Hand hand = player.getActiveHand(); - if (!world.isClient && player.getAbilities().allowModifyWorld) { + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + InteractionHand hand = player.getUsedItemHand(); + if (!world.isClientSide && player.getAbilities().mayBuild) { if(player.isCreative()){ - world.setBlockState(pos, state.cycle(LIT)); + world.setBlockAndUpdate(pos, state.cycle(LIT)); } else { - ItemStack itemStack = player.getStackInHand(hand); - if (state.get(LIT) && itemStack.isIn(ItemTags.SHOVELS)) { + ItemStack itemStack = player.getItemInHand(hand); + if (state.getValue(LIT) && itemStack.is(ItemTags.SHOVELS)) { extinguish(null, state, world, pos); - } else if (!state.get(LIT) && itemStack.isOf(Items.FLINT_AND_STEEL) || itemStack.isOf(Items.TORCH)) { + } else if (!state.getValue(LIT) && itemStack.is(Items.FLINT_AND_STEEL) || itemStack.is(Items.TORCH)) { setLit(world, state, pos, true); } } } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } - protected static void setLit(WorldAccess world, BlockState state, BlockPos pos, boolean lit) { - world.setBlockState(pos, state.with(LIT, lit), 2 | 3); + protected static void setLit(LevelAccessor world, BlockState state, BlockPos pos, boolean lit) { + world.setBlock(pos, state.setValue(LIT, lit), 2 | 3); if(lit){ - world.playSound(null, pos, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.5F, 1.0F); + world.playSound(null, pos, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.5F, 1.0F); } } - protected static void extinguish(@Nullable PlayerEntity player, BlockState state, WorldAccess world, BlockPos pos) { + protected static void extinguish(@Nullable Player player, BlockState state, LevelAccessor world, BlockPos pos) { setLit(world, state, pos, false); - world.playSound(null, pos, SoundEvents.BLOCK_CANDLE_EXTINGUISH, SoundCategory.BLOCKS, 1.5F, 1.0F); - world.emitGameEvent(player, GameEvent.BLOCK_CHANGE, pos); + world.playSound(null, pos, SoundEvents.CANDLE_EXTINGUISH, SoundSource.BLOCKS, 1.5F, 1.0F); + world.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(new Property[]{LIT}); } - protected BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } @Override - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { - if(state.get(LIT)){ + public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { + if(state.getValue(LIT)){ double d = (double)pos.getX() + 0.5; double e = (double)pos.getY() + 0.9; double f = (double)pos.getZ() + 0.5; - world.addParticleClient(ParticleTypes.SMOKE, d, e, f, 0.0, 0.0, 0.0); + world.addParticle(ParticleTypes.SMOKE, d, e, f, 0.0, 0.0, 0.0); } } public static boolean isLitTorch(BlockState state) { - return state.contains(LIT) && (Boolean)state.get(LIT) && state.getBlock() instanceof METorchBlock; + return state.hasProperty(LIT) && (Boolean)state.getValue(LIT) && state.getBlock() instanceof METorchBlock; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/torches/MEWallTorchBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/torches/MEWallTorchBlock.java index 2833502a3e..c166276f4d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/torches/MEWallTorchBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/torches/MEWallTorchBlock.java @@ -1,94 +1,94 @@ package net.sevenstars.middleearth.block.special.torches; -import net.minecraft.block.Block; -import net.minecraft.block.BlockRenderType; -import net.minecraft.block.BlockState; -import net.minecraft.block.WallTorchBlock; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.event.GameEvent; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.ItemTags; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.WallTorchBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.gameevent.GameEvent; +import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.Nullable; public class MEWallTorchBlock extends WallTorchBlock { - public static final BooleanProperty LIT = Properties.LIT; + public static final BooleanProperty LIT = BlockStateProperties.LIT; - public MEWallTorchBlock(Settings settings) { + public MEWallTorchBlock(Properties settings) { super(ParticleTypes.FLAME, settings); - this.setDefaultState((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)this.stateManager.getDefaultState()).with(LIT, true).with(FACING, Direction.NORTH))))); + this.registerDefaultState((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)this.stateDefinition.any()).setValue(LIT, true).setValue(FACING, Direction.NORTH))))); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - Hand hand = player.getActiveHand(); - if (!world.isClient && player.getAbilities().allowModifyWorld) { + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + InteractionHand hand = player.getUsedItemHand(); + if (!world.isClientSide && player.getAbilities().mayBuild) { if(player.isCreative()){ - world.setBlockState(pos, state.cycle(LIT)); + world.setBlockAndUpdate(pos, state.cycle(LIT)); } else { - ItemStack itemStack = player.getStackInHand(hand); - if (state.get(LIT) && itemStack.isIn(ItemTags.SHOVELS)) { + ItemStack itemStack = player.getItemInHand(hand); + if (state.getValue(LIT) && itemStack.is(ItemTags.SHOVELS)) { extinguish(null, state, world, pos); - } else if (!state.get(LIT) && itemStack.isOf(Items.FLINT_AND_STEEL) || itemStack.isOf(Items.TORCH)) { + } else if (!state.getValue(LIT) && itemStack.is(Items.FLINT_AND_STEEL) || itemStack.is(Items.TORCH)) { setLit(world, state, pos, true); } } } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } - protected static void setLit(WorldAccess world, BlockState state, BlockPos pos, boolean lit) { - world.setBlockState(pos, state.cycle(LIT), 2 | 3); + protected static void setLit(LevelAccessor world, BlockState state, BlockPos pos, boolean lit) { + world.setBlock(pos, state.cycle(LIT), 2 | 3); if(lit){ - world.playSound(null, pos, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.5F, 1.0F); + world.playSound(null, pos, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.5F, 1.0F); } } - protected static void extinguish(@Nullable PlayerEntity player, BlockState state, WorldAccess world, BlockPos pos) { + protected static void extinguish(@Nullable Player player, BlockState state, LevelAccessor world, BlockPos pos) { setLit(world, state, pos, false); - world.playSound(null, pos, SoundEvents.BLOCK_CANDLE_EXTINGUISH, SoundCategory.BLOCKS, 1.5F, 1.0F); - world.emitGameEvent(player, GameEvent.BLOCK_CHANGE, pos); + world.playSound(null, pos, SoundEvents.CANDLE_EXTINGUISH, SoundSource.BLOCKS, 1.5F, 1.0F); + world.gameEvent(player, GameEvent.BLOCK_CHANGE, pos); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING, LIT); } - protected BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + protected RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } @Override - public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) { - if(state.get(LIT)){ - Direction direction = (Direction)state.get(FACING); + public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) { + if(state.getValue(LIT)){ + Direction direction = (Direction)state.getValue(FACING); double d = (double)pos.getX() + 0.5; double e = (double)pos.getY() + 0.9; double f = (double)pos.getZ() + 0.5; double g = 0.22; double h = 0.27; Direction direction2 = direction.getOpposite(); - world.addParticleClient(ParticleTypes.SMOKE, d + 0.27 * (double)direction2.getOffsetX(), e + 0.22, f + 0.27 * (double)direction2.getOffsetZ(), 0.0, 0.0, 0.0); + world.addParticle(ParticleTypes.SMOKE, d + 0.27 * (double)direction2.getStepX(), e + 0.22, f + 0.27 * (double)direction2.getStepZ(), 0.0, 0.0, 0.0); } } public static boolean isLitWallTorch(BlockState state) { - return state.contains(LIT) && (Boolean)state.get(LIT) && state.getBlock() instanceof MEWallTorchBlock; + return state.hasProperty(LIT) && (Boolean)state.getValue(LIT) && state.getBlock() instanceof MEWallTorchBlock; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/torches/OrcSconceBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/torches/OrcSconceBlock.java index e996eb2680..afbee7c6d9 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/torches/OrcSconceBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/torches/OrcSconceBlock.java @@ -1,40 +1,40 @@ package net.sevenstars.middleearth.block.special.torches; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.math.Direction; +import net.minecraft.core.Direction; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.EnumProperty; import org.jetbrains.annotations.Nullable; public class OrcSconceBlock extends METorchBlock{ - public static final EnumProperty HORIZONTAL_FACING = Properties.HORIZONTAL_FACING; + public static final EnumProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING; - public OrcSconceBlock(Settings settings) { + public OrcSconceBlock(Properties settings) { super(settings); - this.setDefaultState((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)this.stateManager.getDefaultState()).with(LIT, true).with(HORIZONTAL_FACING, Direction.NORTH))))); + this.registerDefaultState((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)this.stateDefinition.any()).setValue(LIT, true).setValue(HORIZONTAL_FACING, Direction.NORTH))))); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(HORIZONTAL_FACING, LIT); } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(HORIZONTAL_FACING, rotation.rotate(state.get(HORIZONTAL_FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(HORIZONTAL_FACING, rotation.rotate(state.getValue(HORIZONTAL_FACING))); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState().setValue(HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()); } @Override - public BlockState mirror(BlockState state, BlockMirror mirror) { - return state.rotate(mirror.getRotation(state.get(HORIZONTAL_FACING))); + public BlockState mirror(BlockState state, Mirror mirror) { + return state.rotate(mirror.getRotation(state.getValue(HORIZONTAL_FACING))); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/verticalSlabs/TransparentVerticalSlab.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/verticalSlabs/TransparentVerticalSlab.java index 6caf3dda6b..8200b9302e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/verticalSlabs/TransparentVerticalSlab.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/verticalSlabs/TransparentVerticalSlab.java @@ -1,37 +1,36 @@ package net.sevenstars.middleearth.block.special.verticalSlabs; import com.mojang.serialization.MapCodec; -import net.minecraft.block.BlockState; -import net.minecraft.block.ShapeContext; -import net.minecraft.block.TransparentBlock; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; public class TransparentVerticalSlab extends VerticalSlabBlock{ - protected MapCodec getCodec() { - return createCodec(TransparentVerticalSlab::new); + protected MapCodec codec() { + return simpleCodec(TransparentVerticalSlab::new); } - public TransparentVerticalSlab(Settings settings) { + public TransparentVerticalSlab(Properties settings) { super(settings); } - protected boolean isTransparent(BlockState state) { + protected boolean propagatesSkylightDown(BlockState state) { return true; } - protected boolean isSideInvisible(BlockState state, BlockState stateFrom, Direction direction) { - return stateFrom.isOf(this) ? true : super.isSideInvisible(state, stateFrom, direction); + protected boolean skipRendering(BlockState state, BlockState stateFrom, Direction direction) { + return stateFrom.is(this) ? true : super.skipRendering(state, stateFrom, direction); } - protected VoxelShape getCameraCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return VoxelShapes.empty(); + protected VoxelShape getVisualShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return Shapes.empty(); } - protected float getAmbientOcclusionLightLevel(BlockState state, BlockView world, BlockPos pos) { + protected float getShadeBrightness(BlockState state, BlockGetter world, BlockPos pos) { return 1.0F; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/verticalSlabs/VerticalSlabBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/verticalSlabs/VerticalSlabBlock.java index 74936c5f68..ac3430fa47 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/verticalSlabs/VerticalSlabBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/verticalSlabs/VerticalSlabBlock.java @@ -1,164 +1,169 @@ package net.sevenstars.middleearth.block.special.verticalSlabs; -import net.minecraft.block.*; -import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldView; -import net.minecraft.world.tick.ScheduledTickView; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.util.RandomSource; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.SimpleWaterloggedBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.BooleanProperty; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.material.FluidState; +import net.minecraft.world.level.material.Fluids; +import net.minecraft.world.level.pathfinder.PathComputationType; +import net.minecraft.world.phys.shapes.BooleanOp; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; -public class VerticalSlabBlock extends Block implements Waterloggable { - public static final EnumProperty FACING = HorizontalFacingBlock.FACING; - public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; - public static final BooleanProperty DOUBLE = BooleanProperty.of("double"); - public static final EnumProperty SHAPE = EnumProperty.of("shape", VerticalSlabShape.class); +public class VerticalSlabBlock extends Block implements SimpleWaterloggedBlock { + public static final EnumProperty FACING = HorizontalDirectionalBlock.FACING; + public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; + public static final BooleanProperty DOUBLE = BooleanProperty.create("double"); + public static final EnumProperty SHAPE = EnumProperty.create("shape", VerticalSlabShape.class); - public VerticalSlabBlock(Settings settings) { + public VerticalSlabBlock(Properties settings) { super(settings); - this.setDefaultState((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)this.stateManager.getDefaultState()).with(FACING, Direction.NORTH).with(WATERLOGGED, false).with(DOUBLE, false).with(SHAPE, VerticalSlabShape.STRAIGHT))))); + this.registerDefaultState((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)this.stateDefinition.any()).setValue(FACING, Direction.NORTH).setValue(WATERLOGGED, false).setValue(DOUBLE, false).setValue(SHAPE, VerticalSlabShape.STRAIGHT))))); } - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(FACING, WATERLOGGED, DOUBLE, SHAPE); } @Override - public boolean hasSidedTransparency(BlockState state) { - return !state.get(DOUBLE); + public boolean useShapeForLightOcclusion(BlockState state) { + return !state.getValue(DOUBLE); } @Override - protected boolean canPathfindThrough(BlockState state, NavigationType type) { + protected boolean isPathfindable(BlockState state, PathComputationType type) { return false; } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - BlockPos blockPos = ctx.getBlockPos(); - BlockState blockState = ctx.getWorld().getBlockState(blockPos); - if (blockState.isOf(this)) { - return (blockState.with(DOUBLE, true)).with(WATERLOGGED, false); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + BlockPos blockPos = ctx.getClickedPos(); + BlockState blockState = ctx.getLevel().getBlockState(blockPos); + if (blockState.is(this)) { + return (blockState.setValue(DOUBLE, true)).setValue(WATERLOGGED, false); } else { - FluidState fluidState = ctx.getWorld().getFluidState(blockPos); - BlockState blockState2 = (BlockState)((BlockState)((BlockState)this.getDefaultState().with(FACING, ctx.getHorizontalPlayerFacing().getOpposite())).with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER)); - return (BlockState)blockState2.with(SHAPE, getVerticalSlabShape(blockState2, ctx.getWorld(), blockPos)); + FluidState fluidState = ctx.getLevel().getFluidState(blockPos); + BlockState blockState2 = (BlockState)((BlockState)((BlockState)this.defaultBlockState().setValue(FACING, ctx.getHorizontalDirection().getOpposite())).setValue(WATERLOGGED, fluidState.getType() == Fluids.WATER)); + return (BlockState)blockState2.setValue(SHAPE, getVerticalSlabShape(blockState2, ctx.getLevel(), blockPos)); } } @Override - protected BlockState getStateForNeighborUpdate(BlockState state, WorldView world, ScheduledTickView tickView, BlockPos pos, Direction direction, BlockPos neighborPos, BlockState neighborState, Random random) { - if (state.get(WATERLOGGED)) { - tickView.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (state.getValue(WATERLOGGED)) { + world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world)); } - return direction.getAxis().isHorizontal() ? (BlockState)state.with(SHAPE, getVerticalSlabShape(state, world, pos)) : super.getStateForNeighborUpdate(state, world, tickView, pos, direction, neighborPos, neighborState, random); + return direction.getAxis().isHorizontal() ? (BlockState)state.setValue(SHAPE, getVerticalSlabShape(state, world, pos)) : super.updateShape(state, direction, neighborState, world, pos, neighborPos); } @Override - public boolean canReplace(BlockState state, ItemPlacementContext context) { - ItemStack itemStack = context.getStack(); - if (state.get(DOUBLE) || !itemStack.isOf(this.asItem())) { + public boolean canBeReplaced(BlockState state, BlockPlaceContext context) { + ItemStack itemStack = context.getItemInHand(); + if (state.getValue(DOUBLE) || !itemStack.is(this.asItem())) { return false; } - if (context.canReplaceExisting()) { - return context.getSide() == state.get(FACING); + if (context.replacingClickedOnBlock()) { + return context.getClickedFace() == state.getValue(FACING); } return true; } @Override public FluidState getFluidState(BlockState state) { - return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); + return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - if(state.get(DOUBLE)){ - return VoxelShapes.cuboid(0, 0, 0.0, 1, 1, 1); + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + if(state.getValue(DOUBLE)){ + return Shapes.box(0, 0, 0.0, 1, 1, 1); } else { - if(state.get(SHAPE) == VerticalSlabShape.STRAIGHT){ - return switch(state.get(Properties.HORIZONTAL_FACING)) { - case WEST -> VoxelShapes.cuboid(0.5, 0, 0, 1, 1, 1); - case EAST -> VoxelShapes.cuboid(0, 0, 0, 0.5, 1, 1); - case SOUTH -> VoxelShapes.cuboid(0, 0, 0, 1, 1, 0.5); - case NORTH -> VoxelShapes.cuboid(0, 0, 0.5, 1, 1, 1); - default -> VoxelShapes.cuboid(1,1,1,1,1,1); + if(state.getValue(SHAPE) == VerticalSlabShape.STRAIGHT){ + return switch(state.getValue(BlockStateProperties.HORIZONTAL_FACING)) { + case WEST -> Shapes.box(0.5, 0, 0, 1, 1, 1); + case EAST -> Shapes.box(0, 0, 0, 0.5, 1, 1); + case SOUTH -> Shapes.box(0, 0, 0, 1, 1, 0.5); + case NORTH -> Shapes.box(0, 0, 0.5, 1, 1, 1); + default -> Shapes.box(1,1,1,1,1,1); }; - } else if (state.get(SHAPE) == VerticalSlabShape.OUTER_LEFT) { - return switch (state.get(Properties.HORIZONTAL_FACING)) { - case WEST -> Block.createCuboidShape(8, 0, 0, 16, 16, 8); - case EAST -> Block.createCuboidShape(0, 0, 8, 8, 16, 16); - case SOUTH -> Block.createCuboidShape(0, 0, 0, 8, 16, 8); - case NORTH -> Block.createCuboidShape(8, 0, 8, 16, 16, 16); - default -> VoxelShapes.cuboid(1, 1, 1, 1, 1, 1); + } else if (state.getValue(SHAPE) == VerticalSlabShape.OUTER_LEFT) { + return switch (state.getValue(BlockStateProperties.HORIZONTAL_FACING)) { + case WEST -> Block.box(8, 0, 0, 16, 16, 8); + case EAST -> Block.box(0, 0, 8, 8, 16, 16); + case SOUTH -> Block.box(0, 0, 0, 8, 16, 8); + case NORTH -> Block.box(8, 0, 8, 16, 16, 16); + default -> Shapes.box(1, 1, 1, 1, 1, 1); }; - }else if (state.get(SHAPE) == VerticalSlabShape.OUTER_RIGHT) { - return switch (state.get(Properties.HORIZONTAL_FACING)) { - case WEST -> Block.createCuboidShape(8, 0, 8, 16, 16, 16); - case EAST -> Block.createCuboidShape(0, 0, 0, 8, 16, 8); - case SOUTH -> Block.createCuboidShape(8, 0, 0, 16, 16, 8); - case NORTH -> Block.createCuboidShape(0, 0, 8, 8, 16, 16); - default -> VoxelShapes.cuboid(1, 1, 1, 1, 1, 1); + }else if (state.getValue(SHAPE) == VerticalSlabShape.OUTER_RIGHT) { + return switch (state.getValue(BlockStateProperties.HORIZONTAL_FACING)) { + case WEST -> Block.box(8, 0, 8, 16, 16, 16); + case EAST -> Block.box(0, 0, 0, 8, 16, 8); + case SOUTH -> Block.box(8, 0, 0, 16, 16, 8); + case NORTH -> Block.box(0, 0, 8, 8, 16, 16); + default -> Shapes.box(1, 1, 1, 1, 1, 1); }; - }else if (state.get(SHAPE) == VerticalSlabShape.INNER_LEFT) { //good - return switch (state.get(Properties.HORIZONTAL_FACING)) { - case WEST -> VoxelShapes.combineAndSimplify(Block.createCuboidShape(8, 0, 0, 16, 16, 16), Block.createCuboidShape(0, 0, 0, 8, 16, 8), BooleanBiFunction.OR); - case EAST -> VoxelShapes.combineAndSimplify(Block.createCuboidShape(0, 0, 0, 8, 16, 16), Block.createCuboidShape(8, 0, 8, 16, 16, 16), BooleanBiFunction.OR); - case SOUTH -> VoxelShapes.combineAndSimplify(Block.createCuboidShape(0, 0, 0, 16, 16, 8), Block.createCuboidShape(0, 0, 8, 8, 16, 16), BooleanBiFunction.OR); - case NORTH -> VoxelShapes.combineAndSimplify(Block.createCuboidShape(0, 0, 8, 16, 16, 16), Block.createCuboidShape(8, 0, 0, 16, 16, 8), BooleanBiFunction.OR); - default -> VoxelShapes.cuboid(1, 1, 1, 1, 1, 1); + }else if (state.getValue(SHAPE) == VerticalSlabShape.INNER_LEFT) { //good + return switch (state.getValue(BlockStateProperties.HORIZONTAL_FACING)) { + case WEST -> Shapes.join(Block.box(8, 0, 0, 16, 16, 16), Block.box(0, 0, 0, 8, 16, 8), BooleanOp.OR); + case EAST -> Shapes.join(Block.box(0, 0, 0, 8, 16, 16), Block.box(8, 0, 8, 16, 16, 16), BooleanOp.OR); + case SOUTH -> Shapes.join(Block.box(0, 0, 0, 16, 16, 8), Block.box(0, 0, 8, 8, 16, 16), BooleanOp.OR); + case NORTH -> Shapes.join(Block.box(0, 0, 8, 16, 16, 16), Block.box(8, 0, 0, 16, 16, 8), BooleanOp.OR); + default -> Shapes.box(1, 1, 1, 1, 1, 1); }; } else { - return switch (state.get(Properties.HORIZONTAL_FACING)) { //good - case WEST -> VoxelShapes.combineAndSimplify(Block.createCuboidShape(0, 0, 8, 16, 16, 16), Block.createCuboidShape(8, 0, 0, 16, 16, 8), BooleanBiFunction.OR); - case EAST -> VoxelShapes.combineAndSimplify(Block.createCuboidShape(0, 0, 0, 16, 16, 8), Block.createCuboidShape(0, 0, 8, 8, 16, 16), BooleanBiFunction.OR); - case SOUTH ->VoxelShapes.combineAndSimplify(Block.createCuboidShape(8, 0, 0, 16, 16, 16), Block.createCuboidShape(0, 0, 0, 8, 16, 8), BooleanBiFunction.OR); - case NORTH -> VoxelShapes.combineAndSimplify(Block.createCuboidShape(0, 0, 0, 8, 16, 16), Block.createCuboidShape(8, 0, 8, 16, 16, 16), BooleanBiFunction.OR); - default -> VoxelShapes.cuboid(1, 1, 1, 1, 1, 1); + return switch (state.getValue(BlockStateProperties.HORIZONTAL_FACING)) { //good + case WEST -> Shapes.join(Block.box(0, 0, 8, 16, 16, 16), Block.box(8, 0, 0, 16, 16, 8), BooleanOp.OR); + case EAST -> Shapes.join(Block.box(0, 0, 0, 16, 16, 8), Block.box(0, 0, 8, 8, 16, 16), BooleanOp.OR); + case SOUTH ->Shapes.join(Block.box(8, 0, 0, 16, 16, 16), Block.box(0, 0, 0, 8, 16, 8), BooleanOp.OR); + case NORTH -> Shapes.join(Block.box(0, 0, 0, 8, 16, 16), Block.box(8, 0, 8, 16, 16, 16), BooleanOp.OR); + default -> Shapes.box(1, 1, 1, 1, 1, 1); }; } } } - protected BlockState mirror(BlockState state, BlockMirror mirror) { - Direction direction = (Direction) state.get(FACING); - VerticalSlabShape verticalSlabShape = (VerticalSlabShape) state.get(SHAPE); + protected BlockState mirror(BlockState state, Mirror mirror) { + Direction direction = (Direction) state.getValue(FACING); + VerticalSlabShape verticalSlabShape = (VerticalSlabShape) state.getValue(SHAPE); switch (mirror) { case LEFT_RIGHT: if (direction.getAxis() == Direction.Axis.Z) { switch (verticalSlabShape) { case INNER_LEFT -> { - return (BlockState) state.rotate(BlockRotation.CLOCKWISE_180).with(SHAPE, VerticalSlabShape.INNER_RIGHT); + return (BlockState) state.rotate(Rotation.CLOCKWISE_180).setValue(SHAPE, VerticalSlabShape.INNER_RIGHT); } case INNER_RIGHT -> { - return (BlockState) state.rotate(BlockRotation.CLOCKWISE_180).with(SHAPE, VerticalSlabShape.INNER_LEFT); + return (BlockState) state.rotate(Rotation.CLOCKWISE_180).setValue(SHAPE, VerticalSlabShape.INNER_LEFT); } case OUTER_LEFT -> { - return (BlockState) state.rotate(BlockRotation.CLOCKWISE_180).with(SHAPE, VerticalSlabShape.OUTER_RIGHT); + return (BlockState) state.rotate(Rotation.CLOCKWISE_180).setValue(SHAPE, VerticalSlabShape.OUTER_RIGHT); } case OUTER_RIGHT -> { - return (BlockState) state.rotate(BlockRotation.CLOCKWISE_180).with(SHAPE, VerticalSlabShape.OUTER_LEFT); + return (BlockState) state.rotate(Rotation.CLOCKWISE_180).setValue(SHAPE, VerticalSlabShape.OUTER_LEFT); } default -> { - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } } @@ -167,19 +172,19 @@ protected BlockState mirror(BlockState state, BlockMirror mirror) { if (direction.getAxis() == Direction.Axis.X) { switch (verticalSlabShape) { case INNER_LEFT -> { - return (BlockState) state.rotate(BlockRotation.CLOCKWISE_180).with(SHAPE, VerticalSlabShape.INNER_LEFT); + return (BlockState) state.rotate(Rotation.CLOCKWISE_180).setValue(SHAPE, VerticalSlabShape.INNER_LEFT); } case INNER_RIGHT -> { - return (BlockState) state.rotate(BlockRotation.CLOCKWISE_180).with(SHAPE, VerticalSlabShape.INNER_RIGHT); + return (BlockState) state.rotate(Rotation.CLOCKWISE_180).setValue(SHAPE, VerticalSlabShape.INNER_RIGHT); } case OUTER_LEFT -> { - return (BlockState) state.rotate(BlockRotation.CLOCKWISE_180).with(SHAPE, VerticalSlabShape.OUTER_RIGHT); + return (BlockState) state.rotate(Rotation.CLOCKWISE_180).setValue(SHAPE, VerticalSlabShape.OUTER_RIGHT); } case OUTER_RIGHT -> { - return (BlockState) state.rotate(BlockRotation.CLOCKWISE_180).with(SHAPE, VerticalSlabShape.OUTER_LEFT); + return (BlockState) state.rotate(Rotation.CLOCKWISE_180).setValue(SHAPE, VerticalSlabShape.OUTER_LEFT); } case STRAIGHT -> { - return state.rotate(BlockRotation.CLOCKWISE_180); + return state.rotate(Rotation.CLOCKWISE_180); } } } @@ -188,26 +193,26 @@ protected BlockState mirror(BlockState state, BlockMirror mirror) { } @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(FACING, rotation.rotate(state.get(FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(FACING, rotation.rotate(state.getValue(FACING))); } public static boolean isVerticalSlab(BlockState state) { return state.getBlock() instanceof VerticalSlabBlock; } - private static boolean isDifferentOrientation(BlockState state, BlockView world, BlockPos pos, Direction dir) { - BlockState blockState = world.getBlockState(pos.offset(dir)); - return !isVerticalSlab(blockState) || blockState.get(FACING) != state.get(FACING); + private static boolean isDifferentOrientation(BlockState state, BlockGetter world, BlockPos pos, Direction dir) { + BlockState blockState = world.getBlockState(pos.relative(dir)); + return !isVerticalSlab(blockState) || blockState.getValue(FACING) != state.getValue(FACING); } - private static VerticalSlabShape getVerticalSlabShape(BlockState state, BlockView world, BlockPos pos) { - Direction direction = (Direction)state.get(FACING); - BlockState blockState = world.getBlockState(pos.offset(direction)); + private static VerticalSlabShape getVerticalSlabShape(BlockState state, BlockGetter world, BlockPos pos) { + Direction direction = (Direction)state.getValue(FACING); + BlockState blockState = world.getBlockState(pos.relative(direction)); if (isVerticalSlab(blockState) ) { - Direction direction2 = (Direction)blockState.get(FACING); - if (direction2.getAxis() != ((Direction)state.get(FACING)).getAxis() && isDifferentOrientation(state, world, pos, direction2.getOpposite())) { - if (direction2 == direction.rotateYCounterclockwise()) { + Direction direction2 = (Direction)blockState.getValue(FACING); + if (direction2.getAxis() != ((Direction)state.getValue(FACING)).getAxis() && isDifferentOrientation(state, world, pos, direction2.getOpposite())) { + if (direction2 == direction.getCounterClockWise()) { return VerticalSlabShape.INNER_LEFT; } @@ -215,11 +220,11 @@ private static VerticalSlabShape getVerticalSlabShape(BlockState state, BlockVie } } - BlockState blockState2 = world.getBlockState(pos.offset(direction.getOpposite())); + BlockState blockState2 = world.getBlockState(pos.relative(direction.getOpposite())); if (isVerticalSlab(blockState2)) { - Direction direction3 = (Direction)blockState2.get(FACING); - if (direction3.getAxis() != ((Direction)state.get(FACING)).getAxis() && isDifferentOrientation(state, world, pos, direction3)) { - if (direction3 == direction.rotateYCounterclockwise()) { + Direction direction3 = (Direction)blockState2.getValue(FACING); + if (direction3.getAxis() != ((Direction)state.getValue(FACING)).getAxis() && isDifferentOrientation(state, world, pos, direction3)) { + if (direction3 == direction.getCounterClockWise()) { return VerticalSlabShape.OUTER_LEFT; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/verticalSlabs/VerticalSlabShape.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/verticalSlabs/VerticalSlabShape.java index c0f0d44c96..84da24042d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/verticalSlabs/VerticalSlabShape.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/verticalSlabs/VerticalSlabShape.java @@ -1,8 +1,8 @@ package net.sevenstars.middleearth.block.special.verticalSlabs; -import net.minecraft.util.StringIdentifiable; +import net.minecraft.util.StringRepresentable; -public enum VerticalSlabShape implements StringIdentifiable { +public enum VerticalSlabShape implements StringRepresentable { STRAIGHT("straight"), INNER_LEFT("inner_left"), INNER_RIGHT("inner_right"), @@ -20,7 +20,7 @@ public String toString() { return this.name; } - public String asString() { + public String getSerializedName() { return this.name; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/wood_pile/WoodPileBlock.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/wood_pile/WoodPileBlock.java index efdc2c5b27..03cd89e2f6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/wood_pile/WoodPileBlock.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/wood_pile/WoodPileBlock.java @@ -1,96 +1,108 @@ package net.sevenstars.middleearth.block.special.wood_pile; import com.mojang.serialization.MapCodec; -import net.minecraft.block.*; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.EnumProperty; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; +import net.minecraft.world.level.block.*; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.tags.ItemTags; import net.minecraft.util.*; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; +import net.minecraft.world.Container; +import net.minecraft.world.Containers; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.BaseEntityBlock; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.FurnaceBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.EnumProperty; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.Nullable; -public class WoodPileBlock extends BlockWithEntity implements BlockEntityProvider { - public static final IntProperty STAGE = IntProperty.of("stage", 0, 3); - public static final EnumProperty HORIZONTAL_FACING = Properties.HORIZONTAL_FACING; +public class WoodPileBlock extends BaseEntityBlock implements EntityBlock { + public static final IntegerProperty STAGE = IntegerProperty.create("stage", 0, 3); + public static final EnumProperty HORIZONTAL_FACING = BlockStateProperties.HORIZONTAL_FACING; private static final VoxelShape STAGE_0, STAGE_1, STAGE_2, STAGE_3; - public static final MapCodec CODEC = FurnaceBlock.createCodec(WoodPileBlock::new); + public static final MapCodec CODEC = FurnaceBlock.simpleCodec(WoodPileBlock::new); - public WoodPileBlock(Settings settings) { + public WoodPileBlock(Properties settings) { super(settings); - this.setDefaultState((this.stateManager.getDefaultState()).with(HORIZONTAL_FACING, Direction.NORTH).with(STAGE, 0)); + this.registerDefaultState((this.stateDefinition.any()).setValue(HORIZONTAL_FACING, Direction.NORTH).setValue(STAGE, 0)); } @Override - protected MapCodec getCodec() { + protected MapCodec codec() { return CODEC; } @Override - public BlockRenderType getRenderType(BlockState state) { - return BlockRenderType.MODEL; + public RenderShape getRenderShape(BlockState state) { + return RenderShape.MODEL; } @Override - protected VoxelShape getSidesShape(BlockState state, BlockView world, BlockPos pos) { - return VoxelShapes.empty(); + protected VoxelShape getBlockSupportShape(BlockState state, BlockGetter world, BlockPos pos) { + return Shapes.empty(); } @Override - protected void appendProperties(StateManager.Builder builder) { + protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(HORIZONTAL_FACING, STAGE); } @Nullable - public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()).with(STAGE, 0); + public BlockState getStateForPlacement(BlockPlaceContext ctx) { + return this.defaultBlockState().setValue(HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite()).setValue(STAGE, 0); } @Override - protected void onStateReplaced(BlockState state, ServerWorld world, BlockPos pos, boolean moved) { - ItemScatterer.onStateReplaced(state, world, pos); + protected void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) { + Containers.dropContentsOnDestroy(state, newState, world, pos); + super.onRemove(state, world, pos, newState, moved); } @Override - protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) { - if (world.isClient) { - return ActionResult.SUCCESS; + protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) { + if (world.isClientSide) { + return InteractionResult.SUCCESS; } else { - if (player.isInCreativeMode() && player.isSneaking()) { - world.setBlockState(pos, state.cycle(STAGE)); + if (player.hasInfiniteMaterials() && player.isShiftKeyDown()) { + world.setBlockAndUpdate(pos, state.cycle(STAGE)); } else { - if (addStackRightClick(world, pos, player, player.getActiveHand())) { - NamedScreenHandlerFactory screenHandlerFactory = state.createScreenHandlerFactory(world, pos); + if (addStackRightClick(world, pos, player, player.getUsedItemHand())) { + MenuProvider screenHandlerFactory = state.getMenuProvider(world, pos); if (screenHandlerFactory != null) { - player.openHandledScreen(screenHandlerFactory); + player.openMenu(screenHandlerFactory); } } } } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } - public boolean addStackRightClick(World world, BlockPos pos, PlayerEntity player, Hand hand){ - Inventory blockEntity = (Inventory) world.getBlockEntity(pos); + public boolean addStackRightClick(Level world, BlockPos pos, Player player, InteractionHand hand){ + Container blockEntity = (Container) world.getBlockEntity(pos); - if (!player.getStackInHand(hand).isEmpty() && player.getStackInHand(hand).isIn(ItemTags.LOGS)) { + if (!player.getItemInHand(hand).isEmpty() && player.getItemInHand(hand).is(ItemTags.LOGS)) { for(int i = 0;i <= 8; i++){ - if (blockEntity.getStack(i).isEmpty()) { - blockEntity.setStack(i, player.getStackInHand(hand).copy()); - player.getStackInHand(hand).setCount(0); + if (blockEntity.getItem(i).isEmpty()) { + blockEntity.setItem(i, player.getItemInHand(hand).copy()); + player.getItemInHand(hand).setCount(0); } } } else { @@ -101,21 +113,21 @@ public boolean addStackRightClick(World world, BlockPos pos, PlayerEntity player @Nullable @Override - public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new WoodPileBlockEntity(pos,state); } - public BlockState rotate(BlockState state, BlockRotation rotation) { - return state.with(HORIZONTAL_FACING, rotation.rotate(state.get(HORIZONTAL_FACING))); + public BlockState rotate(BlockState state, Rotation rotation) { + return state.setValue(HORIZONTAL_FACING, rotation.rotate(state.getValue(HORIZONTAL_FACING))); } - public BlockState mirror(BlockState state, BlockMirror mirror) { - return state.rotate(mirror.getRotation(state.get(HORIZONTAL_FACING))); + public BlockState mirror(BlockState state, Mirror mirror) { + return state.rotate(mirror.getRotation(state.getValue(HORIZONTAL_FACING))); } @Override - public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return switch (state.get(STAGE)) { + public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { + return switch (state.getValue(STAGE)) { case 3 -> STAGE_3; case 2 -> STAGE_2; case 1 -> STAGE_1; @@ -124,15 +136,15 @@ public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos po } static { - STAGE_0 = VoxelShapes.union( - Block.createCuboidShape(0, 0, 0, 16, 4, 16)); + STAGE_0 = Shapes.or( + Block.box(0, 0, 0, 16, 4, 16)); - STAGE_1 = VoxelShapes.union( - Block.createCuboidShape(0, 0, 0, 16, 7, 16)); + STAGE_1 = Shapes.or( + Block.box(0, 0, 0, 16, 7, 16)); - STAGE_2 = VoxelShapes.union( - Block.createCuboidShape(0, 0, 0, 16, 9, 16)); + STAGE_2 = Shapes.or( + Block.box(0, 0, 0, 16, 9, 16)); - STAGE_3 = Block.createCuboidShape(0, 0, 0, 16, 16, 16); + STAGE_3 = Block.box(0, 0, 0, 16, 16, 16); } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/wood_pile/WoodPileBlockEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/wood_pile/WoodPileBlockEntity.java index f38fbbc0bb..297c1f207b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/wood_pile/WoodPileBlockEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/special/wood_pile/WoodPileBlockEntity.java @@ -1,130 +1,124 @@ package net.sevenstars.middleearth.block.special.wood_pile; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModBlockEntities; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import net.sevenstars.middleearth.gui.wood_pile.WoodPileScreenHandler; import net.sevenstars.middleearth.utils.ImplementedInventory; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.LootableContainerBlockEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.Inventories; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.network.listener.ClientPlayPacketListener; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.screen.NamedScreenHandlerFactory; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.state.property.Properties; -import net.minecraft.text.Text; -import net.minecraft.util.collection.DefaultedList; -import net.minecraft.util.math.BlockPos; import org.jetbrains.annotations.Nullable; import static net.sevenstars.middleearth.block.special.wood_pile.WoodPileBlock.STAGE; -public class WoodPileBlockEntity extends LootableContainerBlockEntity implements NamedScreenHandlerFactory, ImplementedInventory { +import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.NonNullList; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.Packet; +import net.minecraft.network.protocol.game.ClientGamePacketListener; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.world.Container; +import net.minecraft.world.ContainerHelper; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; + +public class WoodPileBlockEntity extends RandomizableContainerBlockEntity implements MenuProvider, ImplementedInventory { private static final String ID = "wood_pile"; - private DefaultedList inventory = DefaultedList.ofSize(9, ItemStack.EMPTY); + private NonNullList inventory = NonNullList.withSize(9, ItemStack.EMPTY); public WoodPileBlockEntity(BlockPos pos, BlockState state) { super(ModBlockEntities.WOOD_PILE, pos, state); } @Override - public Text getDisplayName() { - return Text.translatable("screen." + MiddleEarth.MOD_ID + "." + ID); + public Component getDisplayName() { + return Component.translatable("screen." + MiddleEarth.MOD_ID + "." + ID); } @Override - protected Text getContainerName() { - return Text.translatable("me.container.wood_pile"); + protected Component getDefaultName() { + return Component.translatable("me.container.wood_pile"); } @Override - protected DefaultedList getHeldStacks() { - return this.inventory; - } - - @Override - protected void setHeldStacks(DefaultedList inventory) { + protected void setItems(NonNullList inventory) { this.inventory = inventory; } @Nullable @Override - public ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) { + public AbstractContainerMenu createMenu(int syncId, Inventory playerInventory, Player player) { return new WoodPileScreenHandler(syncId, playerInventory, this); } @Override - protected ScreenHandler createScreenHandler(int syncId, PlayerInventory playerInventory) { + protected AbstractContainerMenu createMenu(int syncId, Inventory playerInventory) { return null; } @Override - protected void readData(ReadView view) { - super.readData(view); - this.inventory = DefaultedList.ofSize(this.size(), ItemStack.EMPTY); - if (!this.readLootTable(view)) { - Inventories.readData(view, this.inventory); + protected void loadAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.loadAdditional(tag, registries); + this.inventory = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); + if (!this.tryLoadLootTable(tag)) { + ContainerHelper.loadAllItems(tag, this.inventory, registries); } } @Override - protected void writeData(WriteView view) { - super.writeData(view); - if (!this.writeLootTable(view)) { - Inventories.writeData(view, this.inventory); + protected void saveAdditional(CompoundTag tag, HolderLookup.Provider registries) { + super.saveAdditional(tag, registries); + if (!this.trySaveLootTable(tag)) { + ContainerHelper.saveAllItems(tag, this.inventory, registries); } } - public void setInventory(DefaultedList inventory) { + public void setInventory(NonNullList inventory) { for (int i = 0; i < inventory.size(); i++) { this.inventory.set(i, inventory.get(i)); } } @Override - public DefaultedList getItems() { + public NonNullList getItems() { return inventory; } @Override - public void setStack(int slot, ItemStack stack) { + public void setItem(int slot, ItemStack stack) { inventory.set(slot, stack); - if (stack.getCount() > getMaxCountPerStack()) { - stack.setCount(getMaxCountPerStack()); + if (stack.getCount() > getMaxStackSize()) { + stack.setCount(getMaxStackSize()); } if(this.hasAmount(9)){ - this.getWorld().setBlockState(this.getPos(), ModDecorativeBlocks.WOOD_PILE.getDefaultState() - .with(STAGE, 3) - .with(Properties.HORIZONTAL_FACING, this.getWorld().getBlockState(this.getPos()).get(Properties.HORIZONTAL_FACING))); + this.getLevel().setBlockAndUpdate(this.getBlockPos(), ModDecorativeBlocks.WOOD_PILE.defaultBlockState() + .setValue(STAGE, 3) + .setValue(BlockStateProperties.HORIZONTAL_FACING, this.getLevel().getBlockState(this.getBlockPos()).getValue(BlockStateProperties.HORIZONTAL_FACING))); } else if (this.hasAmount(5)){ - this.getWorld().setBlockState(this.getPos(), ModDecorativeBlocks.WOOD_PILE.getDefaultState() - .with(STAGE, 2) - .with(Properties.HORIZONTAL_FACING, this.getWorld().getBlockState(this.getPos()).get(Properties.HORIZONTAL_FACING))); + this.getLevel().setBlockAndUpdate(this.getBlockPos(), ModDecorativeBlocks.WOOD_PILE.defaultBlockState() + .setValue(STAGE, 2) + .setValue(BlockStateProperties.HORIZONTAL_FACING, this.getLevel().getBlockState(this.getBlockPos()).getValue(BlockStateProperties.HORIZONTAL_FACING))); } else if (this.isEmpty()){ - this.getWorld().setBlockState(this.getPos(), ModDecorativeBlocks.WOOD_PILE.getDefaultState() - .with(STAGE, 0) - .with(Properties.HORIZONTAL_FACING, this.getWorld().getBlockState(this.getPos()).get(Properties.HORIZONTAL_FACING))); + this.getLevel().setBlockAndUpdate(this.getBlockPos(), ModDecorativeBlocks.WOOD_PILE.defaultBlockState() + .setValue(STAGE, 0) + .setValue(BlockStateProperties.HORIZONTAL_FACING, this.getLevel().getBlockState(this.getBlockPos()).getValue(BlockStateProperties.HORIZONTAL_FACING))); } else if (!this.hasAmount(5) && !isEmpty()){ - this.getWorld().setBlockState(this.getPos(), ModDecorativeBlocks.WOOD_PILE.getDefaultState() - .with(STAGE, 1) - .with(Properties.HORIZONTAL_FACING, this.getWorld().getBlockState(this.getPos()).get(Properties.HORIZONTAL_FACING))); + this.getLevel().setBlockAndUpdate(this.getBlockPos(), ModDecorativeBlocks.WOOD_PILE.defaultBlockState() + .setValue(STAGE, 1) + .setValue(BlockStateProperties.HORIZONTAL_FACING, this.getLevel().getBlockState(this.getBlockPos()).getValue(BlockStateProperties.HORIZONTAL_FACING))); } } @Override - public ItemStack removeStack(int slot, int count) { - ItemStack result = Inventories.splitStack(getItems(), slot, count); + public ItemStack removeItem(int slot, int count) { + ItemStack result = ContainerHelper.removeItem(getItems(), slot, count); if (!result.isEmpty()) { - markDirty(); + setChanged(); } return result; @@ -132,8 +126,8 @@ public ItemStack removeStack(int slot, int count) { public boolean hasAmount(int amount) { int result = 0; - for (int i = 0; i < size(); i++) { - ItemStack stack = getStack(i); + for (int i = 0; i < getContainerSize(); i++) { + ItemStack stack = getItem(i); if (!stack.isEmpty()) { result++; } @@ -142,24 +136,24 @@ public boolean hasAmount(int amount) { } @Override - public void markDirty() { - super.markDirty(); + public void setChanged() { + super.setChanged(); } @Nullable @Override - public Packet toUpdatePacket() { - return BlockEntityUpdateS2CPacket.create(this); + public Packet getUpdatePacket() { + return ClientboundBlockEntityDataPacket.create(this); } @Override - public void clear() { + public void clearContent() { inventory.clear(); } @Override - public boolean canPlayerUse(PlayerEntity player) { - return Inventory.canPlayerUse(this, player); + public boolean stillValid(Player player) { + return Container.stillValidBlockEntity(this, player); } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/BlockAuthor.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/BlockAuthor.java index 3b7e89b37d..101cd14965 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/BlockAuthor.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/BlockAuthor.java @@ -2,13 +2,13 @@ import com.mojang.serialization.Codec; import io.netty.buffer.ByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.util.StringIdentifiable; -import net.minecraft.util.function.ValueLists; import java.util.function.IntFunction; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.util.ByIdMap; +import net.minecraft.util.StringRepresentable; -public enum BlockAuthor implements StringIdentifiable { +public enum BlockAuthor implements StringRepresentable { BOENNDAL(0, "Boenndal"), SCOSHER(1, "Scosher"), COFFEE_VIKING(2, "CoffeeViking"), @@ -17,12 +17,12 @@ public enum BlockAuthor implements StringIdentifiable { ANGMARZKU(5, "Angmarzku") ; - private static final IntFunction BY_ID = ValueLists.createIndexToValueFunction(BlockAuthor::getId, BlockAuthor.values(), ValueLists.OutOfBoundsHandling.ZERO);; + private static final IntFunction BY_ID = ByIdMap.continuous(BlockAuthor::getId, BlockAuthor.values(), ByIdMap.OutOfBoundsStrategy.ZERO);; private final int id; private final String authorName; - public static final Codec CODEC = StringIdentifiable.createBasicCodec(BlockAuthor::values); - public static final PacketCodec PACKET_CODEC = PacketCodecs.indexed(BY_ID, BlockAuthor::getId); + public static final Codec CODEC = StringRepresentable.fromValues(BlockAuthor::values); + public static final StreamCodec PACKET_CODEC = ByteBufCodecs.idMapper(BY_ID, BlockAuthor::getId); BlockAuthor(int id, String authorName) { this.id = id; @@ -34,7 +34,7 @@ public int getId() { } @Override - public String asString() { + public String getSerializedName() { return this.name(); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/BlockDataMapCollector.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/BlockDataMapCollector.java new file mode 100644 index 0000000000..1b03a34644 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/BlockDataMapCollector.java @@ -0,0 +1,116 @@ +package net.sevenstars.middleearth.block.utils; + +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ComposterBlock; +import net.minecraft.world.level.block.FireBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.neoforged.neoforge.common.ItemAbilities; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.event.furnace.FurnaceFuelBurnTimeEvent; +import net.neoforged.neoforge.event.level.BlockEvent; + +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * Owns block behavior declarations that NeoForge represents as data maps. + * Runtime event fallbacks keep dev runs correct even before generated data is present. + */ +public final class BlockDataMapCollector { + private static final Map FUELS = new LinkedHashMap<>(); + private static final Map COMPOSTABLES = new LinkedHashMap<>(); + private static final Map STRIPPABLES = new LinkedHashMap<>(); + private static final Map OXIDIZABLES = new LinkedHashMap<>(); + private static final Map PREVIOUS_OXIDIZABLES = new LinkedHashMap<>(); + private static final Map WAXABLES = new LinkedHashMap<>(); + private static final Map UNWAXED = new LinkedHashMap<>(); + + static { + NeoForge.EVENT_BUS.addListener(BlockDataMapCollector::onFuelBurnTime); + NeoForge.EVENT_BUS.addListener(BlockDataMapCollector::onToolModification); + } + + private BlockDataMapCollector() { + } + + public static void registerFlammable(Block block, int burnChance, int spreadChance) { + ((FireBlock) Blocks.FIRE).setFlammable(block, burnChance, spreadChance); + } + + public static void registerFuel(ItemLike itemLike, int ticks) { + Item item = itemLike.asItem(); + if (item != Items.AIR && ticks > 0) { + FUELS.put(item, ticks); + } + } + + public static void registerCompostable(ItemLike itemLike, float chance) { + Item item = itemLike.asItem(); + if (item != Items.AIR && chance > 0.0F) { + COMPOSTABLES.put(item, chance); + ComposterBlock.COMPOSTABLES.put(item, chance); + } + } + + public static void registerStrippable(Block input, Block stripped) { + STRIPPABLES.put(input, stripped); + } + + public static void registerOxidizable(Block lessOxidized, Block moreOxidized) { + OXIDIZABLES.put(lessOxidized, moreOxidized); + PREVIOUS_OXIDIZABLES.put(moreOxidized, lessOxidized); + } + + public static void registerWaxable(Block unwaxed, Block waxed) { + WAXABLES.put(unwaxed, waxed); + UNWAXED.put(waxed, unwaxed); + } + + public static Map fuels() { + return Collections.unmodifiableMap(FUELS); + } + + public static Map compostables() { + return Collections.unmodifiableMap(COMPOSTABLES); + } + + public static Map strippables() { + return Collections.unmodifiableMap(STRIPPABLES); + } + + public static Map oxidizables() { + return Collections.unmodifiableMap(OXIDIZABLES); + } + + public static Map waxables() { + return Collections.unmodifiableMap(WAXABLES); + } + + private static void onFuelBurnTime(FurnaceFuelBurnTimeEvent event) { + Integer burnTime = FUELS.get(event.getItemStack().getItem()); + if (burnTime != null) { + event.setBurnTime(burnTime); + } + } + + private static void onToolModification(BlockEvent.BlockToolModificationEvent event) { + Block target = null; + if (event.getItemAbility() == ItemAbilities.AXE_STRIP) { + target = STRIPPABLES.get(event.getState().getBlock()); + } else if (event.getItemAbility() == ItemAbilities.AXE_SCRAPE) { + target = PREVIOUS_OXIDIZABLES.get(event.getState().getBlock()); + } else if (event.getItemAbility() == ItemAbilities.AXE_WAX_OFF) { + target = UNWAXED.get(event.getState().getBlock()); + } + + if (target != null) { + BlockState finalState = target.withPropertiesOf(event.getState()); + event.setFinalState(finalState); + } + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/BlockRecordTypes.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/BlockRecordTypes.java index 1b95c020f3..2fd40f3124 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/BlockRecordTypes.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/BlockRecordTypes.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.block.utils; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.level.block.Block; public class BlockRecordTypes { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/BlockSetRegistration.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/BlockSetRegistration.java index e7e9481858..f6b6ae5eda 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/BlockSetRegistration.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/BlockSetRegistration.java @@ -1,14 +1,34 @@ package net.sevenstars.middleearth.block.utils; -import net.fabricmc.fabric.api.registry.FlammableBlockRegistry; -import net.fabricmc.fabric.api.registry.FuelRegistryEvents; -import net.minecraft.block.*; -import net.minecraft.block.enums.NoteBlockInstrument; -import net.minecraft.block.piston.PistonBehavior; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.Registries; -import net.minecraft.sound.BlockSoundGroup; -import net.minecraft.util.Identifier; +import net.minecraft.world.level.block.*; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.ButtonBlock; +import net.minecraft.world.level.block.DoorBlock; +import net.minecraft.world.level.block.FenceBlock; +import net.minecraft.world.level.block.FenceGateBlock; +import net.minecraft.world.level.block.HugeMushroomBlock; +import net.minecraft.world.level.block.PressurePlateBlock; +import net.minecraft.world.level.block.RotatedPillarBlock; +import net.minecraft.world.level.block.SlabBlock; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.StairBlock; +import net.minecraft.world.level.block.TransparentBlock; +import net.minecraft.world.level.block.TrapDoorBlock; +import net.minecraft.world.level.block.WallBlock; +import net.minecraft.world.level.block.WeatheringCopper; +import net.minecraft.world.level.block.WeatheringCopperFullBlock; +import net.minecraft.world.level.block.WeatheringCopperSlabBlock; +import net.minecraft.world.level.block.WeatheringCopperStairBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.properties.BlockSetType; +import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; +import net.minecraft.world.level.block.state.properties.WoodType; +import net.minecraft.world.level.material.MapColor; +import net.minecraft.world.level.material.PushReaction; import net.sevenstars.middleearth.block.registration.ModBlocks; import net.sevenstars.middleearth.block.special.*; import net.sevenstars.middleearth.block.special.verticalSlabs.TransparentVerticalSlab; @@ -21,20 +41,20 @@ public class BlockSetRegistration { - public static BlockRecordTypes.RegularSet createRegularSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, BlockSoundGroup soundGroup, boolean pillar, List group, boolean requiresTool) { + public static BlockRecordTypes.RegularSet createRegularSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, SoundType soundGroup, boolean pillar, List group, boolean requiresTool) { Block base; - AbstractBlock.Settings baseSettings; + BlockBehaviour.Properties baseSettings; if (requiresTool){ - baseSettings = AbstractBlock.Settings.create() - .mapColor(mapColor).instrument(instrument).sounds(soundGroup).strength(hardness, blastResistance).requiresTool(); + baseSettings = BlockBehaviour.Properties.of() + .mapColor(mapColor).instrument(instrument).sound(soundGroup).strength(hardness, blastResistance).requiresCorrectToolForDrops(); } else { - baseSettings = AbstractBlock.Settings.create() - .mapColor(mapColor).instrument(instrument).sounds(soundGroup).strength(hardness, blastResistance); + baseSettings = BlockBehaviour.Properties.of() + .mapColor(mapColor).instrument(instrument).sound(soundGroup).strength(hardness, blastResistance); } if(pillar){ - base = getVanillaOrCreateNew(name, PillarBlock::new, + base = getVanillaOrCreateNew(name, RotatedPillarBlock::new, baseSettings, group); }else{ base = getVanillaOrCreateNew(name, Block::new, @@ -51,8 +71,8 @@ public static BlockRecordTypes.RegularSet createRegularSet(String name, float ha Block verticalSlab = getVanillaOrCreateNew(name + "_vertical_slab", VerticalSlabBlock::new, baseSettings, group); - Block stairs = getVanillaOrCreateNew(name + "_stairs", (settings) -> new StairsBlock( - base.getDefaultState(), settings), baseSettings, group); + Block stairs = getVanillaOrCreateNew(name + "_stairs", (settings) -> new StairBlock( + base.defaultBlockState(), settings), baseSettings, group); Block wall = getVanillaOrCreateNew(name + "_wall", WallBlock::new, baseSettings, group); @@ -60,16 +80,16 @@ public static BlockRecordTypes.RegularSet createRegularSet(String name, float ha return new BlockRecordTypes.RegularSet(base, slab, verticalSlab, stairs, wall); } - public static BlockRecordTypes.SimpleBlocks createSimpleSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, BlockSoundGroup soundGroup, boolean pillar, List group, boolean requiresTool) { + public static BlockRecordTypes.SimpleBlocks createSimpleSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, SoundType soundGroup, boolean pillar, List group, boolean requiresTool) { Block base; - AbstractBlock.Settings baseSettings; + BlockBehaviour.Properties baseSettings; if (requiresTool){ - baseSettings = AbstractBlock.Settings.create() - .mapColor(mapColor).instrument(instrument).sounds(soundGroup).strength(hardness, blastResistance).requiresTool(); + baseSettings = BlockBehaviour.Properties.of() + .mapColor(mapColor).instrument(instrument).sound(soundGroup).strength(hardness, blastResistance).requiresCorrectToolForDrops(); } else { - baseSettings = AbstractBlock.Settings.create() - .mapColor(mapColor).instrument(instrument).sounds(soundGroup).strength(hardness, blastResistance); + baseSettings = BlockBehaviour.Properties.of() + .mapColor(mapColor).instrument(instrument).sound(soundGroup).strength(hardness, blastResistance); } base = getVanillaOrCreateNew(name, Block::new, baseSettings, group); @@ -80,43 +100,43 @@ public static BlockRecordTypes.SimpleBlocks createSimpleSet(String name, float h Block verticalSlab = getVanillaOrCreateNew(name + "_vertical_slab", VerticalSlabBlock::new, baseSettings, group); - Block stairs = getVanillaOrCreateNew(name + "_stairs", (settings) -> new StairsBlock( - base.getDefaultState(), settings), baseSettings, group); + Block stairs = getVanillaOrCreateNew(name + "_stairs", (settings) -> new StairBlock( + base.defaultBlockState(), settings), baseSettings, group); return new BlockRecordTypes.SimpleBlocks(base, slab, verticalSlab, stairs); } - public static BlockRecordTypes.RegularSet createOxidizableSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, BlockSoundGroup soundGroup, boolean pillar, List group, boolean requiresTool, Oxidizable.OxidationLevel level) { + public static BlockRecordTypes.RegularSet createOxidizableSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, SoundType soundGroup, boolean pillar, List group, boolean requiresTool, WeatheringCopper.WeatherState level) { Block base; - AbstractBlock.Settings baseSettings; + BlockBehaviour.Properties baseSettings; if (requiresTool){ - baseSettings = AbstractBlock.Settings.create() - .mapColor(mapColor).instrument(instrument).sounds(soundGroup).strength(hardness, blastResistance).requiresTool(); + baseSettings = BlockBehaviour.Properties.of() + .mapColor(mapColor).instrument(instrument).sound(soundGroup).strength(hardness, blastResistance).requiresCorrectToolForDrops(); } else { - baseSettings = AbstractBlock.Settings.create() - .mapColor(mapColor).instrument(instrument).sounds(soundGroup).strength(hardness, blastResistance); + baseSettings = BlockBehaviour.Properties.of() + .mapColor(mapColor).instrument(instrument).sound(soundGroup).strength(hardness, blastResistance); } if(pillar){ - base = getVanillaOrCreateNew(name, PillarBlock::new, + base = getVanillaOrCreateNew(name, RotatedPillarBlock::new, baseSettings, group); }else{ - base = getVanillaOrCreateNew(name, (settings) -> new OxidizableBlock(level, settings), + base = getVanillaOrCreateNew(name, (settings) -> new WeatheringCopperFullBlock(level, settings), baseSettings, group); } name = name.replaceAll("_bricks", "_brick"); name = name.replaceAll("_tiles", "_tile"); - Block slab = getVanillaOrCreateNew(name + "_slab",(settings) -> new OxidizableSlabBlock(level, settings), + Block slab = getVanillaOrCreateNew(name + "_slab",(settings) -> new WeatheringCopperSlabBlock(level, settings), baseSettings, group); Block verticalSlab = getVanillaOrCreateNew(name + "_vertical_slab",(settings) -> new OxidizableVerticalSlabBlock(level, settings), baseSettings, group); - Block stairs = getVanillaOrCreateNew(name + "_stairs", (settings) -> new OxidizableStairsBlock( - level, base.getDefaultState(), settings), baseSettings, group); + Block stairs = getVanillaOrCreateNew(name + "_stairs", (settings) -> new WeatheringCopperStairBlock( + level, base.defaultBlockState(), settings), baseSettings, group); Block wall = getVanillaOrCreateNew(name + "_wall",(settings) -> new OxidizableWallBlock(level, settings), baseSettings, group); @@ -124,299 +144,291 @@ public static BlockRecordTypes.RegularSet createOxidizableSet(String name, float return new BlockRecordTypes.RegularSet(base, slab, verticalSlab, stairs, wall); } - public static BlockRecordTypes.WoodSet createWoodSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, BlockSoundGroup soundGroup, List group) { + public static BlockRecordTypes.WoodSet createWoodSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, SoundType soundGroup, List group) { - Block log = getVanillaOrCreateNew(name + "_log", PillarBlock::new, - AbstractBlock.Settings.create() - .mapColor(mapColor).instrument(instrument).sounds(soundGroup).strength(hardness, blastResistance), group); + Block log = getVanillaOrCreateNew(name + "_log", RotatedPillarBlock::new, + BlockBehaviour.Properties.of() + .mapColor(mapColor).instrument(instrument).sound(soundGroup).strength(hardness, blastResistance), group); - Block wood = getVanillaOrCreateNew(name + "_wood", PillarBlock::new, - AbstractBlock.Settings.create() - .mapColor(mapColor).instrument(instrument).sounds(soundGroup).strength(hardness, blastResistance), group); + Block wood = getVanillaOrCreateNew(name + "_wood", RotatedPillarBlock::new, + BlockBehaviour.Properties.of() + .mapColor(mapColor).instrument(instrument).sound(soundGroup).strength(hardness, blastResistance), group); Block slab = getVanillaOrCreateNew(name + "_wood_slab", SlabBlock::new, - AbstractBlock.Settings.copy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); + BlockBehaviour.Properties.ofFullCopy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); Block verticalSlab = getVanillaOrCreateNew(name + "_wood_vertical_slab", VerticalSlabBlock::new, - AbstractBlock.Settings.copy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); + BlockBehaviour.Properties.ofFullCopy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); - Block stairs = getVanillaOrCreateNew(name + "_wood_stairs", (settings) -> new StairsBlock( - wood.getDefaultState(), settings), AbstractBlock.Settings.copy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); + Block stairs = getVanillaOrCreateNew(name + "_wood_stairs", (settings) -> new StairBlock( + wood.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); Block wall = getVanillaOrCreateNew(name + "_wood_wall", WallBlock::new, - AbstractBlock.Settings.copy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); + BlockBehaviour.Properties.ofFullCopy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); Block fence = getVanillaOrCreateNew(name + "_wood_fence", FenceBlock::new, - AbstractBlock.Settings.copy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); - - FlammableBlockRegistry.getDefaultInstance().add(log, 5, 5); - FlammableBlockRegistry.getDefaultInstance().add(wood, 5, 5); - FlammableBlockRegistry.getDefaultInstance().add(slab, 5, 5); - FlammableBlockRegistry.getDefaultInstance().add(verticalSlab, 5, 5); - FlammableBlockRegistry.getDefaultInstance().add(stairs, 5, 5); - FlammableBlockRegistry.getDefaultInstance().add(wall, 5, 5); - FlammableBlockRegistry.getDefaultInstance().add(fence, 5, 5); - - FuelRegistryEvents.BUILD.register(((builder, context) -> { - builder.add(slab, 150); - builder.add(stairs, 300); - builder.add(verticalSlab, 150); - builder.add(wall, 300); - builder.add(fence, 300); - })); + BlockBehaviour.Properties.ofFullCopy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); + + BlockDataMapCollector.registerFlammable(log, 5, 5); + BlockDataMapCollector.registerFlammable(wood, 5, 5); + BlockDataMapCollector.registerFlammable(slab, 5, 5); + BlockDataMapCollector.registerFlammable(verticalSlab, 5, 5); + BlockDataMapCollector.registerFlammable(stairs, 5, 5); + BlockDataMapCollector.registerFlammable(wall, 5, 5); + BlockDataMapCollector.registerFlammable(fence, 5, 5); + + BlockDataMapCollector.registerFuel(slab, 150); + BlockDataMapCollector.registerFuel(stairs, 300); + BlockDataMapCollector.registerFuel(verticalSlab, 150); + BlockDataMapCollector.registerFuel(wall, 300); + BlockDataMapCollector.registerFuel(fence, 300); return new BlockRecordTypes.WoodSet(log, wood, slab, verticalSlab, stairs, wall, fence); } - public static BlockRecordTypes.WoodSet createStemSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, BlockSoundGroup soundGroup, List group) { + public static BlockRecordTypes.WoodSet createStemSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, SoundType soundGroup, List group) { - Block log = getVanillaOrCreateNew(name + "_stem", PillarBlock::new, - AbstractBlock.Settings.create() - .mapColor(mapColor).instrument(instrument).sounds(soundGroup).strength(hardness, blastResistance), group); + Block log = getVanillaOrCreateNew(name + "_stem", RotatedPillarBlock::new, + BlockBehaviour.Properties.of() + .mapColor(mapColor).instrument(instrument).sound(soundGroup).strength(hardness, blastResistance), group); - Block wood = getVanillaOrCreateNew(name + "_hyphae", PillarBlock::new, - AbstractBlock.Settings.create() - .mapColor(mapColor).instrument(instrument).sounds(soundGroup).strength(hardness, blastResistance), group); + Block wood = getVanillaOrCreateNew(name + "_hyphae", RotatedPillarBlock::new, + BlockBehaviour.Properties.of() + .mapColor(mapColor).instrument(instrument).sound(soundGroup).strength(hardness, blastResistance), group); Block slab = getVanillaOrCreateNew(name + "_hyphae_slab", SlabBlock::new, - AbstractBlock.Settings.copy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); + BlockBehaviour.Properties.ofFullCopy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); Block verticalSlab = getVanillaOrCreateNew(name + "_hyphae_vertical_slab", VerticalSlabBlock::new, - AbstractBlock.Settings.copy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); + BlockBehaviour.Properties.ofFullCopy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); - Block stairs = getVanillaOrCreateNew(name + "_hyphae_stairs", (settings) -> new StairsBlock( - wood.getDefaultState(), settings), AbstractBlock.Settings.copy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); + Block stairs = getVanillaOrCreateNew(name + "_hyphae_stairs", (settings) -> new StairBlock( + wood.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); Block wall = getVanillaOrCreateNew(name + "_hyphae_wall", WallBlock::new, - AbstractBlock.Settings.copy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); + BlockBehaviour.Properties.ofFullCopy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); Block fence = getVanillaOrCreateNew(name + "_hyphae_fence", FenceBlock::new, - AbstractBlock.Settings.copy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); + BlockBehaviour.Properties.ofFullCopy(wood).mapColor(mapColor).strength(hardness, blastResistance), group); return new BlockRecordTypes.WoodSet(log, wood, slab, verticalSlab, stairs, wall, fence); } - public static BlockRecordTypes.MushroomStemSet createMushroomStemSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, BlockSoundGroup soundGroup, List group) { + public static BlockRecordTypes.MushroomStemSet createMushroomStemSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, SoundType soundGroup, List group) { - Block stem = getVanillaOrCreateNew(name + "_stem", MushroomBlock::new, - AbstractBlock.Settings.create() - .mapColor(mapColor).instrument(instrument).sounds(soundGroup).strength(hardness, blastResistance), group); + Block stem = getVanillaOrCreateNew(name + "_stem", HugeMushroomBlock::new, + BlockBehaviour.Properties.of() + .mapColor(mapColor).instrument(instrument).sound(soundGroup).strength(hardness, blastResistance), group); Block slab = getVanillaOrCreateNew(name + "_stem_slab", SlabBlock::new, - AbstractBlock.Settings.copy(stem).mapColor(mapColor).strength(hardness, blastResistance), group); + BlockBehaviour.Properties.ofFullCopy(stem).mapColor(mapColor).strength(hardness, blastResistance), group); Block verticalSlab = getVanillaOrCreateNew(name + "_stem_vertical_slab", VerticalSlabBlock::new, - AbstractBlock.Settings.copy(stem).mapColor(mapColor).strength(hardness, blastResistance), group); + BlockBehaviour.Properties.ofFullCopy(stem).mapColor(mapColor).strength(hardness, blastResistance), group); - Block stairs = getVanillaOrCreateNew(name + "_stem_stairs", (settings) -> new StairsBlock( - stem.getDefaultState(), settings), AbstractBlock.Settings.copy(stem).mapColor(mapColor).strength(hardness, blastResistance), group); + Block stairs = getVanillaOrCreateNew(name + "_stem_stairs", (settings) -> new StairBlock( + stem.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(stem).mapColor(mapColor).strength(hardness, blastResistance), group); Block wall = getVanillaOrCreateNew(name + "_stem_wall", WallBlock::new, - AbstractBlock.Settings.copy(stem).mapColor(mapColor).strength(hardness, blastResistance), group); + BlockBehaviour.Properties.ofFullCopy(stem).mapColor(mapColor).strength(hardness, blastResistance), group); Block fence = getVanillaOrCreateNew(name + "_stem_fence", FenceBlock::new, - AbstractBlock.Settings.copy(stem).mapColor(mapColor).strength(hardness, blastResistance), group); + BlockBehaviour.Properties.ofFullCopy(stem).mapColor(mapColor).strength(hardness, blastResistance), group); return new BlockRecordTypes.MushroomStemSet(stem, slab, verticalSlab, stairs, wall, fence); } - public static BlockRecordTypes.PlanksSet createPlanksSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, BlockSoundGroup soundGroup, List group) { + public static BlockRecordTypes.PlanksSet createPlanksSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, SoundType soundGroup, List group) { Block base = getVanillaOrCreateNew(name, Block::new, - AbstractBlock.Settings.create() - .mapColor(mapColor).instrument(instrument).sounds(soundGroup).strength(hardness, blastResistance), group); + BlockBehaviour.Properties.of() + .mapColor(mapColor).instrument(instrument).sound(soundGroup).strength(hardness, blastResistance), group); name = name.replaceAll("_planks", ""); Block slab = getVanillaOrCreateNew(name + "_slab", SlabBlock::new, - AbstractBlock.Settings.copy(base).strength(hardness, blastResistance), group); + BlockBehaviour.Properties.ofFullCopy(base).strength(hardness, blastResistance), group); Block verticalSlab = getVanillaOrCreateNew(name + "_vertical_slab", VerticalSlabBlock::new, - AbstractBlock.Settings.copy(base).strength(hardness, blastResistance), group); + BlockBehaviour.Properties.ofFullCopy(base).strength(hardness, blastResistance), group); - Block stairs = getVanillaOrCreateNew(name + "_stairs", (settings) -> new StairsBlock( - base.getDefaultState(), settings), AbstractBlock.Settings.copy(base).strength(hardness, blastResistance), group); + Block stairs = getVanillaOrCreateNew(name + "_stairs", (settings) -> new StairBlock( + base.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(base).strength(hardness, blastResistance), group); Block fence = getVanillaOrCreateNew(name + "_fence", FenceBlock::new, - AbstractBlock.Settings.copy(base).strength(hardness, blastResistance), group); + BlockBehaviour.Properties.ofFullCopy(base).strength(hardness, blastResistance), group); Block gate = getVanillaOrCreateNew(name + "_fence_gate", (settings) -> new FenceGateBlock( - WoodType.OAK, settings), AbstractBlock.Settings.copy(base).strength(hardness, blastResistance), group); - - FlammableBlockRegistry.getDefaultInstance().add(base, 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(slab, 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(verticalSlab, 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(stairs, 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(fence, 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(gate, 5, 20); - - FuelRegistryEvents.BUILD.register(((builder, context) -> { - builder.add(slab, 150); - builder.add(verticalSlab, 150); - builder.add(stairs, 300); - builder.add(fence, 300); - builder.add(gate, 300); - })); + WoodType.OAK, settings), BlockBehaviour.Properties.ofFullCopy(base).strength(hardness, blastResistance), group); + + BlockDataMapCollector.registerFlammable(base, 5, 20); + BlockDataMapCollector.registerFlammable(slab, 5, 20); + BlockDataMapCollector.registerFlammable(verticalSlab, 5, 20); + BlockDataMapCollector.registerFlammable(stairs, 5, 20); + BlockDataMapCollector.registerFlammable(fence, 5, 20); + BlockDataMapCollector.registerFlammable(gate, 5, 20); + + BlockDataMapCollector.registerFuel(slab, 150); + BlockDataMapCollector.registerFuel(verticalSlab, 150); + BlockDataMapCollector.registerFuel(stairs, 300); + BlockDataMapCollector.registerFuel(fence, 300); + BlockDataMapCollector.registerFuel(gate, 300); return new BlockRecordTypes.PlanksSet(base, slab, verticalSlab, stairs, fence, gate); } - public static BlockRecordTypes.WoodRedstoneBlocks createWoodRedstoneSet(String name, float hardness, float blastResistance, MapColor mapColor, BlockSoundGroup soundGroup, Block base, List group) { + public static BlockRecordTypes.WoodRedstoneBlocks createWoodRedstoneSet(String name, float hardness, float blastResistance, MapColor mapColor, SoundType soundGroup, Block base, List group) { Block door = getVanillaOrCreateNew(name + "_door", (settings) -> new DoorBlock( - BlockSetType.OAK, settings), AbstractBlock.Settings.copy(base).strength(hardness, blastResistance).mapColor(mapColor).sounds(soundGroup).nonOpaque(), group); + BlockSetType.OAK, settings), BlockBehaviour.Properties.ofFullCopy(base).strength(hardness, blastResistance).mapColor(mapColor).sound(soundGroup).noOcclusion(), group); - Block trapdoor = getVanillaOrCreateNew(name + "_trapdoor", (settings) -> new TrapdoorBlock( - BlockSetType.OAK, settings), AbstractBlock.Settings.copy(base).strength(hardness, blastResistance).mapColor(mapColor).sounds(soundGroup).nonOpaque(), group); + Block trapdoor = getVanillaOrCreateNew(name + "_trapdoor", (settings) -> new TrapDoorBlock( + BlockSetType.OAK, settings), BlockBehaviour.Properties.ofFullCopy(base).strength(hardness, blastResistance).mapColor(mapColor).sound(soundGroup).noOcclusion(), group); Block pressurePlate = getVanillaOrCreateNew(name + "_pressure_plate", (settings) -> new PressurePlateBlock( - BlockSetType.OAK, settings), AbstractBlock.Settings.copy(base).strength(0.5f, blastResistance).mapColor(mapColor).sounds(soundGroup).noCollision(), group); + BlockSetType.OAK, settings), BlockBehaviour.Properties.ofFullCopy(base).strength(0.5f, blastResistance).mapColor(mapColor).sound(soundGroup).noCollission(), group); Block button = getVanillaOrCreateNew(name + "_button", (settings) -> new ButtonBlock( - BlockSetType.OAK, 30, settings), AbstractBlock.Settings.copy(base).strength(0.5f, blastResistance).mapColor(mapColor).sounds(soundGroup).noCollision().pistonBehavior(PistonBehavior.DESTROY), group); + BlockSetType.OAK, 30, settings), BlockBehaviour.Properties.ofFullCopy(base).strength(0.5f, blastResistance).mapColor(mapColor).sound(soundGroup).noCollission().pushReaction(PushReaction.DESTROY), group); - FuelRegistryEvents.BUILD.register(((builder, context) -> { - builder.add(button, 100); - builder.add(pressurePlate, 300); - builder.add(door, 200); - builder.add(trapdoor, 200); - })); + BlockDataMapCollector.registerFuel(button, 100); + BlockDataMapCollector.registerFuel(pressurePlate, 300); + BlockDataMapCollector.registerFuel(door, 200); + BlockDataMapCollector.registerFuel(trapdoor, 200); return new BlockRecordTypes.WoodRedstoneBlocks(door, trapdoor, pressurePlate, button); } - public static BlockRecordTypes.WoodFurnitureBlocks createWoodFurnitureSet(String name, float hardness, float blastResistance, MapColor mapColor, BlockSoundGroup soundGroup, Block base, List group) { + public static BlockRecordTypes.WoodFurnitureBlocks createWoodFurnitureSet(String name, float hardness, float blastResistance, MapColor mapColor, SoundType soundGroup, Block base, List group) { Block table = ModBlocks.registerWoodBlock(name + "_table", WoodTableBlock::new, - AbstractBlock.Settings.copy(base).strength(hardness, blastResistance).mapColor(mapColor).sounds(soundGroup).nonOpaque(),false); + BlockBehaviour.Properties.ofFullCopy(base).strength(hardness, blastResistance).mapColor(mapColor).sound(soundGroup).noOcclusion(),false); Block chair = ModBlocks.registerWoodBlock(name + "_chair", WoodChairBlock::new, - AbstractBlock.Settings.copy(base).strength(hardness, blastResistance).mapColor(mapColor).sounds(soundGroup).nonOpaque(),false); + BlockBehaviour.Properties.ofFullCopy(base).strength(hardness, blastResistance).mapColor(mapColor).sound(soundGroup).noOcclusion(),false); Block stool = ModBlocks.registerWoodBlock(name + "_stool", WoodStoolBlock::new, - AbstractBlock.Settings.copy(base).strength(hardness, blastResistance).mapColor(mapColor).sounds(soundGroup).nonOpaque(),false); + BlockBehaviour.Properties.ofFullCopy(base).strength(hardness, blastResistance).mapColor(mapColor).sound(soundGroup).noOcclusion(),false); Block bench = ModBlocks.registerWoodBlock(name + "_bench", WoodBenchBlock::new, - AbstractBlock.Settings.copy(base).strength(hardness, blastResistance).mapColor(mapColor).sounds(soundGroup).nonOpaque(),false); + BlockBehaviour.Properties.ofFullCopy(base).strength(hardness, blastResistance).mapColor(mapColor).sound(soundGroup).noOcclusion(),false); Block ladder = ModBlocks.registerWoodBlock(name + "_ladder", ThickLadderBlock::new, - AbstractBlock.Settings.copy(base).sounds(BlockSoundGroup.LADDER).nonOpaque(),false); + BlockBehaviour.Properties.ofFullCopy(base).sound(SoundType.LADDER).noOcclusion(),false); - FlammableBlockRegistry.getDefaultInstance().add(stool, 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(bench, 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(table, 5, 20); - FlammableBlockRegistry.getDefaultInstance().add(chair, 5, 20); + BlockDataMapCollector.registerFlammable(stool, 5, 20); + BlockDataMapCollector.registerFlammable(bench, 5, 20); + BlockDataMapCollector.registerFlammable(table, 5, 20); + BlockDataMapCollector.registerFlammable(chair, 5, 20); - FuelRegistryEvents.BUILD.register(((builder, context) -> { - builder.add(table, 300); - builder.add(chair, 300); - builder.add(bench, 300); - builder.add(stool, 300); - })); + BlockDataMapCollector.registerFuel(table, 300); + BlockDataMapCollector.registerFuel(chair, 300); + BlockDataMapCollector.registerFuel(bench, 300); + BlockDataMapCollector.registerFuel(stool, 300); return new BlockRecordTypes.WoodFurnitureBlocks(table, chair, stool, bench, ladder); } - public static BlockRecordTypes.BaseStoneSet createMainStoneSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, BlockSoundGroup soundGroup, List group) { + public static BlockRecordTypes.BaseStoneSet createMainStoneSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, SoundType soundGroup, List group) { if (Objects.equals(name, "dripstone")) { name = "dripstone_block"; } Block base = getVanillaOrCreateNew(name, Block::new, - AbstractBlock.Settings.create().strength(hardness, blastResistance) - .mapColor(mapColor).instrument(instrument).sounds(soundGroup).requiresTool(), group); + BlockBehaviour.Properties.of().strength(hardness, blastResistance) + .mapColor(mapColor).instrument(instrument).sound(soundGroup).requiresCorrectToolForDrops(), group); name = name.replaceAll("dripstone_block", "dripstone"); Block slab = getVanillaOrCreateNew(name + "_slab", SlabBlock::new, - AbstractBlock.Settings.copy(base), group); + BlockBehaviour.Properties.ofFullCopy(base), group); Block verticalSlab = getVanillaOrCreateNew(name + "_vertical_slab", VerticalSlabBlock::new, - AbstractBlock.Settings.copy(base), group); + BlockBehaviour.Properties.ofFullCopy(base), group); - Block stairs = getVanillaOrCreateNew(name + "_stairs", (settings) -> new StairsBlock( - base.getDefaultState(), settings), AbstractBlock.Settings.copy(base), group); + Block stairs = getVanillaOrCreateNew(name + "_stairs", (settings) -> new StairBlock( + base.defaultBlockState(), settings), BlockBehaviour.Properties.ofFullCopy(base), group); Block wall = getVanillaOrCreateNew(name + "_wall", WallBlock::new, - AbstractBlock.Settings.copy(base), group); + BlockBehaviour.Properties.ofFullCopy(base), group); Block pressurePlate = getVanillaOrCreateNew(name + "_pressure_plate", (settings) -> new PressurePlateBlock( - BlockSetType.STONE, settings), AbstractBlock.Settings.copy(base).noCollision(), group); + BlockSetType.STONE, settings), BlockBehaviour.Properties.ofFullCopy(base).noCollission(), group); Block button = getVanillaOrCreateNew(name + "_button", (settings) -> new ButtonBlock( - BlockSetType.STONE, 20, settings), AbstractBlock.Settings.copy(base).noCollision(), group); + BlockSetType.STONE, 20, settings), BlockBehaviour.Properties.ofFullCopy(base).noCollission(), group); - Block trapdoor = getVanillaOrCreateNew(name + "_trapdoor", (settings) -> new TrapdoorBlock( - BlockSetType.STONE, settings), AbstractBlock.Settings.copy(base).nonOpaque(), group); + Block trapdoor = getVanillaOrCreateNew(name + "_trapdoor", (settings) -> new TrapDoorBlock( + BlockSetType.STONE, settings), BlockBehaviour.Properties.ofFullCopy(base).noOcclusion(), group); Block rocks = getVanillaOrCreateNew(name + "_rocks", RocksBlock::new, - AbstractBlock.Settings.copy(base).nonOpaque(), group); + BlockBehaviour.Properties.ofFullCopy(base).noOcclusion(), group); Block stool = getVanillaOrCreateNew(name + "_stool", StoolBlock::new, - AbstractBlock.Settings.copy(base).nonOpaque(), group); + BlockBehaviour.Properties.ofFullCopy(base).noOcclusion(), group); Block table = getVanillaOrCreateNew(name + "_table", StoneTableBlock::new, - AbstractBlock.Settings.copy(base).nonOpaque(), group); + BlockBehaviour.Properties.ofFullCopy(base).noOcclusion(), group); Block chair = getVanillaOrCreateNew(name + "_chair", StoneChairBlock::new, - AbstractBlock.Settings.copy(base).nonOpaque(), group); + BlockBehaviour.Properties.ofFullCopy(base).noOcclusion(), group); - ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(stool.asItem().getDefaultStack()); - ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(table.asItem().getDefaultStack()); - ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(chair.asItem().getDefaultStack()); + ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(stool.asItem().getDefaultInstance()); + ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(table.asItem().getDefaultInstance()); + ItemGroupsME.DECORATIVES_BLOCKS_CONTENT.add(chair.asItem().getDefaultInstance()); return new BlockRecordTypes.BaseStoneSet(base, slab, verticalSlab, stairs, wall, pressurePlate, button, trapdoor, stool, table, chair, rocks); } - public static BlockRecordTypes.PillarSet createStonePillarSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, BlockSoundGroup soundGroup, List group) { + public static BlockRecordTypes.PillarSet createStonePillarSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, SoundType soundGroup, List group) { - Block base = getVanillaOrCreateNew(name, PillarBlock::new, - AbstractBlock.Settings.create() - .mapColor(mapColor).instrument(instrument).sounds(soundGroup).strength(hardness, blastResistance).requiresTool(), group); + Block base = getVanillaOrCreateNew(name, RotatedPillarBlock::new, + BlockBehaviour.Properties.of() + .mapColor(mapColor).instrument(instrument).sound(soundGroup).strength(hardness, blastResistance).requiresCorrectToolForDrops(), group); Block verticalSlab = getVanillaOrCreateNew(name + "_vertical_slab", VerticalSlabBlock::new, - AbstractBlock.Settings.copy(base).strength(hardness, blastResistance).requiresTool(), group); + BlockBehaviour.Properties.ofFullCopy(base).strength(hardness, blastResistance).requiresCorrectToolForDrops(), group); Block wall = getVanillaOrCreateNew(name + "_wall", WallBlock::new, - AbstractBlock.Settings.copy(base).strength(hardness, blastResistance).requiresTool(), group); + BlockBehaviour.Properties.ofFullCopy(base).strength(hardness, blastResistance).requiresCorrectToolForDrops(), group); return new BlockRecordTypes.PillarSet(base, verticalSlab, wall); } - public static BlockRecordTypes.PillarSet createStoneChiseledSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, BlockSoundGroup soundGroup, List group) { + public static BlockRecordTypes.PillarSet createStoneChiseledSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, SoundType soundGroup, List group) { - Block block = getVanillaOrCreateNew("chiseled_" + name, PillarBlock::new, - AbstractBlock.Settings.create() - .mapColor(mapColor).instrument(instrument).sounds(soundGroup).strength(hardness, blastResistance).requiresTool(), group); + Block block = getVanillaOrCreateNew("chiseled_" + name, RotatedPillarBlock::new, + BlockBehaviour.Properties.of() + .mapColor(mapColor).instrument(instrument).sound(soundGroup).strength(hardness, blastResistance).requiresCorrectToolForDrops(), group); Block verticalSlab = getVanillaOrCreateNew("chiseled_" + name + "_vertical_slab", VerticalSlabBlock::new, - AbstractBlock.Settings.copy(block).strength(hardness, blastResistance).requiresTool(), group); + BlockBehaviour.Properties.ofFullCopy(block).strength(hardness, blastResistance).requiresCorrectToolForDrops(), group); Block wall = getVanillaOrCreateNew("chiseled_" + name + "_wall", WallBlock::new, - AbstractBlock.Settings.copy(block).strength(hardness, blastResistance).requiresTool(), group); + BlockBehaviour.Properties.ofFullCopy(block).strength(hardness, blastResistance).requiresCorrectToolForDrops(), group); return new BlockRecordTypes.PillarSet(block, verticalSlab, wall); } - public static BlockRecordTypes.CarvedWindow createCarvedWindowSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, BlockSoundGroup soundGroup, List group) { + public static BlockRecordTypes.CarvedWindow createCarvedWindowSet(String name, float hardness, float blastResistance, MapColor mapColor, NoteBlockInstrument instrument, SoundType soundGroup, List group) { Block block = getVanillaOrCreateNew(name, TransparentBlock::new, - AbstractBlock.Settings.create() - .mapColor(mapColor).instrument(instrument).sounds(soundGroup).strength(hardness, blastResistance).requiresTool() - .nonOpaque().allowsSpawning(Blocks::never).solidBlock(Blocks::never).suffocates(Blocks::never).blockVision(Blocks::never), group); + BlockBehaviour.Properties.of() + .mapColor(mapColor).instrument(instrument).sound(soundGroup).strength(hardness, blastResistance).requiresCorrectToolForDrops() + .noOcclusion().isValidSpawn(ModBlocks::never).isRedstoneConductor(ModBlocks::never).isSuffocating(ModBlocks::never).isViewBlocking(ModBlocks::never), group); Block verticalSlab = getVanillaOrCreateNew(name + "_vertical_slab", TransparentVerticalSlab::new, - AbstractBlock.Settings.copy(block).strength(hardness, blastResistance).requiresTool() - .nonOpaque().allowsSpawning(Blocks::never).solidBlock(Blocks::never).suffocates(Blocks::never).blockVision(Blocks::never), group); + BlockBehaviour.Properties.ofFullCopy(block).strength(hardness, blastResistance).requiresCorrectToolForDrops() + .noOcclusion().isValidSpawn(ModBlocks::never).isRedstoneConductor(ModBlocks::never).isSuffocating(ModBlocks::never).isViewBlocking(ModBlocks::never), group); return new BlockRecordTypes.CarvedWindow(block, verticalSlab); } - public static Block getVanillaOrCreateNew(String path, Function factory, AbstractBlock.Settings settings, List group){ - if (Registries.BLOCK.get(Identifier.ofVanilla(path)) == Blocks.AIR){ + public static Block getVanillaOrCreateNew(String path, Function factory, BlockBehaviour.Properties settings, List group){ + if (BuiltInRegistries.BLOCK.get(ResourceLocation.withDefaultNamespace(path)) == Blocks.AIR){ return ModBlocks.registerBlock(path, factory, settings, false, group); } else { - return Registries.BLOCK.get(Identifier.ofVanilla(path)); + return BuiltInRegistries.BLOCK.get(ResourceLocation.withDefaultNamespace(path)); } } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/ExtendedMenuProviderME.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/ExtendedMenuProviderME.java new file mode 100644 index 0000000000..e136b5579d --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/ExtendedMenuProviderME.java @@ -0,0 +1,16 @@ +package net.sevenstars.middleearth.block.utils; + +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.entity.player.Player; + +public interface ExtendedMenuProviderME extends MenuProvider { + void writeOpeningData(RegistryFriendlyByteBuf buffer); + + static void open(Player player, ExtendedMenuProviderME provider) { + if (player instanceof ServerPlayer serverPlayer) { + serverPlayer.openMenu(provider, provider::writeOpeningData); + } + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/GenericBlockSetBuilder.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/GenericBlockSetBuilder.java index 9b29e9cc53..ec4749ff60 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/GenericBlockSetBuilder.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/GenericBlockSetBuilder.java @@ -1,9 +1,9 @@ package net.sevenstars.middleearth.block.utils.setBuilders; -import net.minecraft.block.MapColor; -import net.minecraft.block.enums.NoteBlockInstrument; -import net.minecraft.item.ItemStack; -import net.minecraft.sound.BlockSoundGroup; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; +import net.minecraft.world.level.material.MapColor; import net.sevenstars.middleearth.block.utils.BlockRecordTypes; import net.sevenstars.middleearth.block.utils.StoneBlockTypes; @@ -19,12 +19,12 @@ public class GenericBlockSetBuilder { public float blastResistance; public MapColor mapColor; public NoteBlockInstrument instrument; - public BlockSoundGroup soundGroup; + public SoundType soundGroup; public boolean requiresTool; public List group; public GenericBlockSetBuilder(String name, float hardness, float blastResistance, - MapColor mapColor, NoteBlockInstrument instrument, BlockSoundGroup soundGroup, boolean requiresTool, + MapColor mapColor, NoteBlockInstrument instrument, SoundType soundGroup, boolean requiresTool, List group){ this.setName = name; this.hardness = hardness; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/OxidizableBlockSetBuilder.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/OxidizableBlockSetBuilder.java index 6446160a89..d594922d01 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/OxidizableBlockSetBuilder.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/OxidizableBlockSetBuilder.java @@ -1,21 +1,21 @@ package net.sevenstars.middleearth.block.utils.setBuilders; -import net.minecraft.block.MapColor; -import net.minecraft.block.Oxidizable; -import net.minecraft.block.enums.NoteBlockInstrument; -import net.minecraft.item.ItemStack; -import net.minecraft.sound.BlockSoundGroup; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.WeatheringCopper; +import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; +import net.minecraft.world.level.material.MapColor; import net.sevenstars.middleearth.block.utils.BlockRecordTypes; import java.util.List; public class OxidizableBlockSetBuilder extends GenericBlockSetBuilder{ - public Oxidizable.OxidationLevel level; + public WeatheringCopper.WeatherState level; public OxidizableBlockSetBuilder(String name, float hardness, float blastResistance, - MapColor mapColor, NoteBlockInstrument instrument, BlockSoundGroup soundGroup, boolean requiresTool, - List group, Oxidizable.OxidationLevel level){ + MapColor mapColor, NoteBlockInstrument instrument, SoundType soundGroup, boolean requiresTool, + List group, WeatheringCopper.WeatherState level){ super(name, hardness, blastResistance, mapColor, instrument, soundGroup, requiresTool, group); this.level = level; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/SimpleBlockSetBuilder.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/SimpleBlockSetBuilder.java index b750abf0c0..4c3d83f939 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/SimpleBlockSetBuilder.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/SimpleBlockSetBuilder.java @@ -1,9 +1,9 @@ package net.sevenstars.middleearth.block.utils.setBuilders; -import net.minecraft.block.MapColor; -import net.minecraft.block.enums.NoteBlockInstrument; -import net.minecraft.item.ItemStack; -import net.minecraft.sound.BlockSoundGroup; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; +import net.minecraft.world.level.material.MapColor; import net.sevenstars.middleearth.block.utils.BlockRecordTypes; import java.util.List; @@ -17,12 +17,12 @@ public class SimpleBlockSetBuilder { public float blastResistance; public MapColor mapColor; public NoteBlockInstrument instrument; - public BlockSoundGroup soundGroup; + public SoundType soundGroup; public boolean requiresTool; public List group; public SimpleBlockSetBuilder(String name, float hardness, float blastResistance, - MapColor mapColor, NoteBlockInstrument instrument, BlockSoundGroup soundGroup, boolean requiresTool, + MapColor mapColor, NoteBlockInstrument instrument, SoundType soundGroup, boolean requiresTool, List group){ this.setName = name; this.hardness = hardness; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/StoneBlockSetBuilder.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/StoneBlockSetBuilder.java index dc42135a57..a66a034c0d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/StoneBlockSetBuilder.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/StoneBlockSetBuilder.java @@ -1,8 +1,8 @@ package net.sevenstars.middleearth.block.utils.setBuilders; -import net.minecraft.block.MapColor; -import net.minecraft.block.enums.NoteBlockInstrument; -import net.minecraft.sound.BlockSoundGroup; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; +import net.minecraft.world.level.material.MapColor; import net.sevenstars.middleearth.block.utils.BlockRecordTypes; import net.sevenstars.middleearth.block.utils.StoneBlockTypes; @@ -55,7 +55,7 @@ public class StoneBlockSetBuilder { public float blastResistance; public MapColor mapColor; public NoteBlockInstrument instrument; - public BlockSoundGroup soundGroup; + public SoundType soundGroup; public boolean hasMossy; public boolean hasCracked; public boolean isVanilla; @@ -63,13 +63,15 @@ public class StoneBlockSetBuilder { public boolean hasVanillaPolished; public StoneBlockSetBuilder(String name, float hardness, float blastResistance, - MapColor mapColor, NoteBlockInstrument instrument, BlockSoundGroup soundGroup, boolean hasMossy, boolean hasCracked){ - this(name, hardness,blastResistance, mapColor, instrument, soundGroup, hasMossy, hasCracked, false, false, false); + MapColor mapColor, NoteBlockInstrument instrument, SoundType soundGroup, boolean hasMossy, boolean hasCracked){ + this(name, hardness, blastResistance, mapColor, instrument, soundGroup, hasMossy, hasCracked, + false, false, false); } public StoneBlockSetBuilder(String name, float hardness, float blastResistance, - MapColor mapColor, NoteBlockInstrument instrument, BlockSoundGroup soundGroup, boolean hasMossy, - boolean hasCracked, boolean isVanilla, boolean hasVanillaCobble, boolean hasVanillaPolished){ + MapColor mapColor, NoteBlockInstrument instrument, SoundType soundGroup, + boolean hasMossy, boolean hasCracked, boolean isVanilla, + boolean hasVanillaCobble, boolean hasVanillaPolished) { this.setName = name; this.hardness = hardness; this.blastResistance = blastResistance; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/WoodBlockSetBuilder.java b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/WoodBlockSetBuilder.java index beb6c96e99..e996b75eb6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/WoodBlockSetBuilder.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/block/utils/setBuilders/WoodBlockSetBuilder.java @@ -1,9 +1,9 @@ package net.sevenstars.middleearth.block.utils.setBuilders; -import net.minecraft.block.Block; -import net.minecraft.block.MapColor; -import net.minecraft.block.enums.NoteBlockInstrument; -import net.minecraft.sound.BlockSoundGroup; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; +import net.minecraft.world.level.material.MapColor; import net.sevenstars.middleearth.block.utils.BlockRecordTypes; import net.sevenstars.middleearth.block.utils.WoodBlockTypes; @@ -37,10 +37,10 @@ public class WoodBlockSetBuilder { public MapColor mapColor; public MapColor leavesMapColor; public NoteBlockInstrument instrument; - public BlockSoundGroup soundGroup; + public SoundType soundGroup; public WoodBlockSetBuilder(String name, float hardness, float blastResistance, - MapColor mapColor, NoteBlockInstrument instrument, BlockSoundGroup soundGroup, Block sapling){ + MapColor mapColor, NoteBlockInstrument instrument, SoundType soundGroup, Block sapling){ this.setName = name; this.hardness = hardness; this.blastResistance = blastResistance; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/BlockColorsME.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/BlockColorsME.java index 4d1a1c4d53..de727970a0 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/BlockColorsME.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/BlockColorsME.java @@ -1,43 +1,44 @@ package net.sevenstars.middleearth.client; -import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry; -import net.minecraft.client.color.world.BiomeColors; -import net.minecraft.world.biome.FoliageColors; -import net.minecraft.world.biome.GrassColors; +import net.minecraft.client.renderer.BiomeColors; +import net.minecraft.world.level.FoliageColor; +import net.minecraft.world.level.GrassColor; +import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; import net.sevenstars.middleearth.block.registration.ModBlocks; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; import net.sevenstars.middleearth.block.registration.WoodBlockSets; public class BlockColorsME { - public static void initializeBlockColors() { - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0x677006, WoodBlockSets.BEECH_SET.leaves); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0x758f28, WoodBlockSets.LARCH_SET.leaves); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0x628842, WoodBlockSets.CHESTNUT_SET.leaves); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0x46684a, WoodBlockSets.FIR_SET.leaves); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0x3f5f3f, WoodBlockSets.HOLLY_SET.leaves); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0xffe45a, ModNatureBlocks.FLOWERING_MALLORN_LEAVES); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0xffe45a, WoodBlockSets.MALLORN_SET.leaves); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0x9c802a, WoodBlockSets.MAPLE_SET.leaves); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0x0e260c, WoodBlockSets.MIRKWOOD_SET.leaves); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0x6c8031, WoodBlockSets.PALM_SET.leaves); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0x41461c, WoodBlockSets.PINE_SET.leaves); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0x324931, WoodBlockSets.BLACK_PINE_SET.leaves); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0x415730, WoodBlockSets.WILLOW_SET.leaves); + public static void registerBlockColors(RegisterColorHandlersEvent.Block event) { + event.register((state, view, pos, tintIndex) -> 0x677006, WoodBlockSets.BEECH_SET.leaves); + event.register((state, view, pos, tintIndex) -> 0x758f28, WoodBlockSets.LARCH_SET.leaves); + event.register((state, view, pos, tintIndex) -> 0x628842, WoodBlockSets.CHESTNUT_SET.leaves); + event.register((state, view, pos, tintIndex) -> 0x46684a, WoodBlockSets.FIR_SET.leaves); + event.register((state, view, pos, tintIndex) -> 0x3f5f3f, WoodBlockSets.HOLLY_SET.leaves); + event.register((state, view, pos, tintIndex) -> 0xffe45a, ModNatureBlocks.FLOWERING_MALLORN_LEAVES); + event.register((state, view, pos, tintIndex) -> 0xffe45a, WoodBlockSets.MALLORN_SET.leaves); + event.register((state, view, pos, tintIndex) -> 0x9c802a, WoodBlockSets.MAPLE_SET.leaves); + event.register((state, view, pos, tintIndex) -> 0x0e260c, WoodBlockSets.MIRKWOOD_SET.leaves); + event.register((state, view, pos, tintIndex) -> 0x6c8031, WoodBlockSets.PALM_SET.leaves); + event.register((state, view, pos, tintIndex) -> 0x41461c, WoodBlockSets.PINE_SET.leaves); + event.register((state, view, pos, tintIndex) -> 0x324931, WoodBlockSets.BLACK_PINE_SET.leaves); + event.register((state, view, pos, tintIndex) -> 0x415730, WoodBlockSets.WILLOW_SET.leaves); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0x876b00, ModNatureBlocks.DRY_LARCH_LEAVES); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0x5b4f2c, ModNatureBlocks.DRY_PINE_LEAVES); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0x244324, ModNatureBlocks.LEBETHRON_LEAVES); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0x925121, ModNatureBlocks.ORANGE_MAPLE_LEAVES); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0x913720, ModNatureBlocks.RED_MAPLE_LEAVES); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> 0x926821, ModNatureBlocks.YELLOW_MAPLE_LEAVES); + event.register((state, view, pos, tintIndex) -> 0x876b00, ModNatureBlocks.DRY_LARCH_LEAVES); + event.register((state, view, pos, tintIndex) -> 0x5b4f2c, ModNatureBlocks.DRY_PINE_LEAVES); + event.register((state, view, pos, tintIndex) -> 0x244324, ModNatureBlocks.LEBETHRON_LEAVES); + event.register((state, view, pos, tintIndex) -> 0x925121, ModNatureBlocks.ORANGE_MAPLE_LEAVES); + event.register((state, view, pos, tintIndex) -> 0x913720, ModNatureBlocks.RED_MAPLE_LEAVES); + event.register((state, view, pos, tintIndex) -> 0x926821, ModNatureBlocks.YELLOW_MAPLE_LEAVES); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> { + event.register((state, view, pos, tintIndex) -> { if (view == null || pos == null) { - return GrassColors.getDefaultColor(); + return GrassColor.getDefaultColor(); } - return BiomeColors.getGrassColor(view, pos); - }, ModNatureBlocks.WILD_GRASS, ModNatureBlocks.LARGE_BUSH, ModNatureBlocks.GRASS_TUFT, ModNatureBlocks.WHEATGRASS, + return BiomeColors.getAverageGrassColor(view, pos); + }, ModNatureBlocks.WILD_GRASS, ModNatureBlocks.LARGE_BUSH, ModNatureBlocks.BUSH, + ModNatureBlocks.GRASS_TUFT, ModNatureBlocks.WHEATGRASS, ModNatureBlocks.BRACKEN, ModNatureBlocks.GIANT_BUTTERBUR, ModBlocks.GRASSY_DIRT, ModBlocks.GRASSY_DIRT_SLAB, ModBlocks.GRASSY_DIRT_STAIRS, ModBlocks.CHALKSOIL_GRASS_BLOCK, ModBlocks.LOAM_GRASS_BLOCK, ModBlocks.PEAT_GRASS_BLOCK, ModBlocks.SILT_GRASS_BLOCK, @@ -54,11 +55,15 @@ public static void initializeBlockColors() { ModNatureBlocks.LILY_PADS, ModNatureBlocks.FLOWERING_LILY_PADS, ModNatureBlocks.LARGE_LILY_PAD, ModNatureBlocks.LARGE_FLOWERING_LILY_PAD); - ColorProviderRegistry.BLOCK.register((state, view, pos, tintIndex) -> { + event.register((state, view, pos, tintIndex) -> { if (view == null || pos == null) { - return FoliageColors.DEFAULT; + return FoliageColor.getDefaultColor(); } - return BiomeColors.getFoliageColor(view, pos); + return BiomeColors.getAverageFoliageColor(view, pos); }, ModNatureBlocks.FALLEN_LEAVES, WoodBlockSets.BEECH_SET.leaves); + + // 1.21.1 has no dry-foliage colormap. This is the 1.21.8 fallback color, + // used only by the compatibility leaf-litter model. + event.register((state, view, pos, tintIndex) -> 0x5C3C32, ModNatureBlocks.LEAF_LITTER); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/ItemColorsME.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/ItemColorsME.java new file mode 100644 index 0000000000..eac684cbd8 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/ItemColorsME.java @@ -0,0 +1,80 @@ +package net.sevenstars.middleearth.client; + +import net.minecraft.world.item.Item; +import net.minecraft.world.item.component.DyedItemColor; +import net.minecraft.world.level.GrassColor; +import net.minecraft.world.level.ItemLike; +import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; +import net.sevenstars.middleearth.block.registration.ModBlocks; +import net.sevenstars.middleearth.block.registration.ModNatureBlocks; +import net.sevenstars.middleearth.block.registration.WoodBlockSets; +import net.sevenstars.middleearth.datageneration.content.models.SimpleDyeableItemModel; +import net.sevenstars.middleearth.item.ResourceItemsME; +import net.sevenstars.middleearth.item.items.ColoredBundleItem; + +public final class ItemColorsME { + private static final ItemLike[] GRASS_TINT_ITEMS = { + ModNatureBlocks.BRACKEN, + ModBlocks.CHALKSOIL_GRASS_BLOCK, + ModNatureBlocks.CLOVERS, + ModNatureBlocks.DUCKWEED, + ModNatureBlocks.FALLEN_LEAVES, + ModNatureBlocks.FOREST_MOSS_BLOCK, + ModNatureBlocks.FOREST_MOSS_CARPET, + ModNatureBlocks.GIANT_BUTTERBUR, + ModBlocks.GRASSY_CHALKSOIL, + ModBlocks.GRASSY_CHALKSOIL_SLAB, + ModBlocks.GRASSY_CHALKSOIL_STAIRS, + ModBlocks.GRASSY_DIRT, + ModBlocks.GRASSY_DIRT_SLAB, + ModBlocks.GRASSY_DIRT_STAIRS, + ModBlocks.GRASSY_LOAM, + ModBlocks.GRASSY_LOAM_SLAB, + ModBlocks.GRASSY_LOAM_STAIRS, + ModBlocks.GRASSY_PEAT, + ModBlocks.GRASSY_PEAT_SLAB, + ModBlocks.GRASSY_PEAT_STAIRS, + ModBlocks.GRASSY_SILT, + ModBlocks.GRASSY_SILT_SLAB, + ModBlocks.GRASSY_SILT_STAIRS, + ModNatureBlocks.LARGE_LILY_PAD, + ModNatureBlocks.LILY_PADS, + ModBlocks.LOAM_GRASS_BLOCK, + ModBlocks.PEAT_GRASS_BLOCK, + ModBlocks.PEBBLED_GRASS, + ModBlocks.PEBBLED_GRASS_SLAB, + ModBlocks.PEBBLED_GRASS_STAIRS, + ModBlocks.SILT_GRASS_BLOCK, + ModNatureBlocks.SMALL_LILY_PADS, + ModBlocks.TURF, + ModBlocks.TURF_SLAB, + ModBlocks.TURF_STAIRS, + ModBlocks.TURF_VERTICAL_SLAB + }; + + private ItemColorsME() { + } + + public static void register(RegisterColorHandlersEvent.Item event) { + event.register( + (stack, tintIndex) -> tintIndex == 0 ? GrassColor.get(0.5D, 1.0D) : -1, + GRASS_TINT_ITEMS + ); + event.register( + (stack, tintIndex) -> tintIndex == 0 + ? DyedItemColor.getOrDefault(stack, -6265536) + : -1, + SimpleDyeableItemModel.items.toArray(Item[]::new) + ); + event.register( + (stack, tintIndex) -> tintIndex == 0 ? 0xFF48B518 : -1, + WoodBlockSets.BEECH_SET.leaves + ); + event.register( + (stack, tintIndex) -> tintIndex == 0 && stack.getItem() instanceof ColoredBundleItem bundle + ? bundle.color().getTextureDiffuseColor() + : 0xFFFFFFFF, + ResourceItemsME.COLORED_BUNDLES.toArray(Item[]::new) + ); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/ItemModelRenderStateClient.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/ItemModelRenderStateClient.java new file mode 100644 index 0000000000..559ebd8da1 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/ItemModelRenderStateClient.java @@ -0,0 +1,450 @@ +package net.sevenstars.middleearth.client; + +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.client.resources.model.ModelResourceLocation; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.neoforged.neoforge.client.event.ModelEvent; +import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; +import net.sevenstars.middleearth.datageneration.content.models.SimpleArtefactModels; +import net.sevenstars.middleearth.datageneration.content.models.SimpleBigItemModel; +import net.sevenstars.middleearth.datageneration.content.models.SimpleSpearModel; +import net.sevenstars.middleearth.item.DecorativeItemsME; +import net.sevenstars.middleearth.item.WeaponItemsME; +import net.sevenstars.middleearth.item.items.PipeItem; +import net.sevenstars.middleearth.item.items.weapons.CustomDaggerWeaponItem; +import net.sevenstars.middleearth.item.items.weapons.CustomLongswordWeaponItem; +import net.sevenstars.middleearth.item.items.weapons.artefacts.ArtefactCustomGlowingDaggerWeaponItem; +import net.sevenstars.middleearth.item.items.weapons.artefacts.ArtefactCustomGlowingLongswordWeaponItem; + +import java.util.Collections; +import java.util.EnumMap; +import java.util.IdentityHashMap; +import java.util.Map; + +public final class ItemModelRenderStateClient { + private static volatile Map DESCRIPTORS = Collections.emptyMap(); + private static volatile Map BAKED_MODELS = Collections.emptyMap(); + + private ItemModelRenderStateClient() { + } + + public static void registerAdditionalModels(ModelEvent.RegisterAdditional event) { + IdentityHashMap descriptors = buildDescriptors(); + DESCRIPTORS = Collections.unmodifiableMap(descriptors); + for (ModelDescriptor descriptor : descriptors.values()) { + descriptor.register(event); + } + } + + public static void cacheBakedModels(ModelEvent.BakingCompleted event) { + IdentityHashMap bakedModels = new IdentityHashMap<>(); + BakedModel missingModel = event.getModelManager().getMissingModel(); + for (Map.Entry entry : DESCRIPTORS.entrySet()) { + bakedModels.put(entry.getKey(), entry.getValue().bake(event.getModels(), missingModel)); + } + BAKED_MODELS = Collections.unmodifiableMap(bakedModels); + } + + public static BakedModel resolve( + BakedModel original, + ItemStack stack, + ItemDisplayContext displayContext, + Level level, + LivingEntity entity + ) { + BakedModels models = BAKED_MODELS.get(stack.getItem()); + if (models == null) { + return original; + } + + boolean flat = isFlat(displayContext); + return switch (models.kind) { + case FLAT_ITEM -> flat ? models.orElse(ModelRole.INVENTORY, original) : original; + case BIG_ITEM -> flat + ? models.orElse(ModelRole.INVENTORY, original) + : isUsing(stack, entity) && models.has(ModelRole.USING_HAND) + ? models.get(ModelRole.USING_HAND) + : original; + case PIPE -> flat + ? models.orElse(ModelRole.INVENTORY, original) + : isUsing(stack, entity) + ? models.orElse(ModelRole.USING_HAND, original) + : original; + case BIG_BOW -> resolveBigBow(original, models, stack, entity, flat); + case ARTEFACT_DAGGER -> resolveArtefactDagger(original, models, stack, level, entity); + case ARTEFACT_SIMPLE -> isBroken(stack) + ? models.orElse(ModelRole.BROKEN_HAND, original) + : original; + case ARTEFACT_DUAL -> resolveDualArtefact(original, models, stack, level, entity, flat); + case EXPLICIT_HAND -> flat + ? models.orElse(ModelRole.INVENTORY, original) + : models.orElse(ModelRole.HAND, original); + case EXPLICIT_USING_HAND -> flat + ? models.orElse(ModelRole.INVENTORY, original) + : isUsing(stack, entity) + ? models.orElse( + ModelRole.USING_HAND, + models.orElse(ModelRole.HAND, original) + ) + : models.orElse(ModelRole.HAND, original); + }; + } + + private static BakedModel resolveBigBow( + BakedModel original, + BakedModels models, + ItemStack stack, + LivingEntity entity, + boolean flat + ) { + if (!flat) { + return original; + } + if (!isUsing(stack, entity)) { + return models.orElse(ModelRole.INVENTORY, original); + } + + float pull = (float) (stack.getUseDuration(entity) - entity.getUseItemRemainingTicks()) / 20.0F; + if (pull >= 0.9F) { + return models.orElse(ModelRole.PULLING_2_INVENTORY, original); + } + if (pull >= 0.65F) { + return models.orElse(ModelRole.PULLING_1_INVENTORY, original); + } + return models.orElse(ModelRole.PULLING_0_INVENTORY, original); + } + + private static BakedModel resolveArtefactDagger( + BakedModel original, + BakedModels models, + ItemStack stack, + Level level, + LivingEntity entity + ) { + if (CustomDaggerWeaponItem.canSneakAttack(stack)) { + return models.orElse(ModelRole.STRIKE_HAND, original); + } + if (isBroken(stack)) { + return models.orElse(ModelRole.BROKEN_HAND, original); + } + if (models.has(ModelRole.GLOWING_HAND) && isGlowing(stack.getItem(), level, entity)) { + return models.get(ModelRole.GLOWING_HAND); + } + return original; + } + + private static BakedModel resolveDualArtefact( + BakedModel original, + BakedModels models, + ItemStack stack, + Level level, + LivingEntity entity, + boolean flat + ) { + boolean using = isUsing(stack, entity); + if (isBroken(stack)) { + if (flat) { + return models.orElse( + ModelRole.BROKEN_INVENTORY, + models.orElse(ModelRole.INVENTORY, original) + ); + } + return using + ? models.orElse( + ModelRole.BROKEN_USING_HAND, + models.orElse(ModelRole.BROKEN_HAND, original) + ) + : models.orElse(ModelRole.BROKEN_HAND, original); + } + if (models.has(ModelRole.GLOWING_HAND) && isGlowing(stack.getItem(), level, entity)) { + if (flat) { + return models.orElse( + ModelRole.GLOWING_INVENTORY, + models.orElse(ModelRole.INVENTORY, original) + ); + } + return using + ? models.orElse(ModelRole.GLOWING_USING_HAND, models.get(ModelRole.GLOWING_HAND)) + : models.get(ModelRole.GLOWING_HAND); + } + if (flat) { + return models.orElse(ModelRole.INVENTORY, original); + } + return using ? models.orElse(ModelRole.USING_HAND, original) : original; + } + + private static boolean isFlat(ItemDisplayContext displayContext) { + return displayContext == ItemDisplayContext.GUI + || displayContext == ItemDisplayContext.GROUND + || displayContext == ItemDisplayContext.FIXED; + } + + private static boolean isUsing(ItemStack stack, LivingEntity entity) { + return entity != null && entity.isUsingItem() && entity.getUseItem() == stack; + } + + private static boolean isBroken(ItemStack stack) { + return stack.isDamageableItem() && stack.getDamageValue() >= stack.getMaxDamage() - 1; + } + + private static boolean isGlowing(Item item, Level level, LivingEntity entity) { + if (item instanceof ArtefactCustomGlowingLongswordWeaponItem) { + return ArtefactCustomGlowingLongswordWeaponItem.shouldBeGlowing(level, entity); + } + if (item instanceof ArtefactCustomGlowingDaggerWeaponItem) { + return ArtefactCustomGlowingDaggerWeaponItem.shouldBeGlowing(level, entity); + } + return false; + } + + private static IdentityHashMap buildDescriptors() { + IdentityHashMap descriptors = new IdentityHashMap<>(); + + for (Item item : SimpleBigItemModel.items) { + EnumMap models = itemModels(item, ModelRole.INVENTORY); + if (item instanceof CustomLongswordWeaponItem) { + models.put(ModelRole.USING_HAND, itemModel(item, "_blocking")); + } + put(descriptors, item, new ModelDescriptor(ModelKind.BIG_ITEM, models)); + } + for (Item item : SimpleBigItemModel.bigBows) { + EnumMap models = itemModels( + item, + ModelRole.INVENTORY, + ModelRole.PULLING_0, + ModelRole.PULLING_1, + ModelRole.PULLING_2, + ModelRole.PULLING_0_INVENTORY, + ModelRole.PULLING_1_INVENTORY, + ModelRole.PULLING_2_INVENTORY + ); + put(descriptors, item, new ModelDescriptor(ModelKind.BIG_BOW, models)); + } + for (Item item : SimpleBigItemModel.genericItems) { + EnumMap models = itemModels(item, ModelRole.INVENTORY); + ModelKind kind = ModelKind.FLAT_ITEM; + if (item instanceof PipeItem) { + ResourceLocation id = BuiltInRegistries.ITEM.getKey(item); + models.put( + ModelRole.USING_HAND, + standalone(MiddleEarth.of("item/smoking_" + id.getPath())) + ); + kind = ModelKind.PIPE; + } + put(descriptors, item, new ModelDescriptor(kind, models)); + } + for (Item item : SimpleSpearModel.items) { + put( + descriptors, + item, + new ModelDescriptor(ModelKind.FLAT_ITEM, itemModels(item, ModelRole.INVENTORY)) + ); + } + for (SimpleArtefactModels.Artefact artefact : SimpleArtefactModels.artefacts) { + put(descriptors, artefact.artefact(), artefactDescriptor(artefact)); + } + + put( + descriptors, + WeaponItemsME.TROLL_MACE, + new ModelDescriptor( + ModelKind.FLAT_ITEM, + explicitModels(ModelRole.INVENTORY, MiddleEarth.of("item/troll_mace_inventory")) + ) + ); + put( + descriptors, + ModDecorativeBlocks.CANDLE_HOLDER.asItem(), + new ModelDescriptor( + ModelKind.EXPLICIT_HAND, + explicitModels( + ModelRole.INVENTORY, MiddleEarth.of("item/candle_holder"), + ModelRole.HAND, MiddleEarth.of("block/candle_holder") + ) + ) + ); + put( + descriptors, + DecorativeItemsME.WATERING_CAN, + new ModelDescriptor( + ModelKind.EXPLICIT_USING_HAND, + explicitModels( + ModelRole.INVENTORY, MiddleEarth.of("item/watering_can"), + ModelRole.HAND, MiddleEarth.of("block/watering_can"), + ModelRole.USING_HAND, MiddleEarth.of("block/watering_can_sprinkling") + ) + ) + ); + return descriptors; + } + + private static ModelDescriptor artefactDescriptor(SimpleArtefactModels.Artefact artefact) { + Item item = artefact.artefact(); + if (item instanceof CustomDaggerWeaponItem) { + EnumMap models = itemModels( + item, + ModelRole.BROKEN_HAND, + ModelRole.STRIKE_HAND + ); + if (item instanceof ArtefactCustomGlowingDaggerWeaponItem) { + models.put(ModelRole.GLOWING_HAND, itemModel(item, "_glowing")); + } + return new ModelDescriptor(ModelKind.ARTEFACT_DAGGER, models); + } + + if (artefact.dualModel()) { + EnumMap models = itemModels( + item, + ModelRole.INVENTORY, + ModelRole.USING_HAND, + ModelRole.BROKEN_HAND, + ModelRole.BROKEN_INVENTORY, + ModelRole.BROKEN_USING_HAND + ); + if (item instanceof ArtefactCustomGlowingLongswordWeaponItem) { + models.put(ModelRole.GLOWING_HAND, itemModel(item, "_glowing")); + models.put(ModelRole.GLOWING_INVENTORY, itemModel(item, "_glowing_inventory")); + models.put(ModelRole.GLOWING_USING_HAND, itemModel(item, "_glowing_blocking")); + } + return new ModelDescriptor(ModelKind.ARTEFACT_DUAL, models); + } + + return new ModelDescriptor( + ModelKind.ARTEFACT_SIMPLE, + itemModels(item, ModelRole.BROKEN_HAND) + ); + } + + private static EnumMap itemModels(Item item, ModelRole... roles) { + EnumMap models = new EnumMap<>(ModelRole.class); + for (ModelRole role : roles) { + models.put(role, itemModel(item, role.suffix)); + } + return models; + } + + private static EnumMap explicitModels(Object... roleAndIds) { + EnumMap models = new EnumMap<>(ModelRole.class); + for (int index = 0; index < roleAndIds.length; index += 2) { + models.put( + (ModelRole) roleAndIds[index], + standalone((ResourceLocation) roleAndIds[index + 1]) + ); + } + return models; + } + + private static ModelResourceLocation itemModel(Item item, String suffix) { + return standalone(BuiltInRegistries.ITEM.getKey(item).withPrefix("item/").withSuffix(suffix)); + } + + private static ModelResourceLocation standalone(ResourceLocation id) { + return ModelResourceLocation.standalone(id); + } + + private static void put( + IdentityHashMap descriptors, + Item item, + ModelDescriptor descriptor + ) { + if (descriptors.put(item, descriptor) != null) { + throw new IllegalStateException("Duplicate item render descriptor for " + BuiltInRegistries.ITEM.getKey(item)); + } + } + + private enum ModelKind { + FLAT_ITEM, + BIG_ITEM, + PIPE, + BIG_BOW, + ARTEFACT_DAGGER, + ARTEFACT_SIMPLE, + ARTEFACT_DUAL, + EXPLICIT_HAND, + EXPLICIT_USING_HAND + } + + private enum ModelRole { + INVENTORY("_inventory"), + HAND(""), + USING_HAND("_blocking"), + BROKEN_HAND("_broken"), + BROKEN_INVENTORY("_broken_inventory"), + BROKEN_USING_HAND("_broken_blocking"), + GLOWING_HAND("_glowing"), + GLOWING_INVENTORY("_glowing_inventory"), + GLOWING_USING_HAND("_glowing_blocking"), + STRIKE_HAND("_strike"), + PULLING_0("_pulling_0"), + PULLING_1("_pulling_1"), + PULLING_2("_pulling_2"), + PULLING_0_INVENTORY("_pulling_0_inventory"), + PULLING_1_INVENTORY("_pulling_1_inventory"), + PULLING_2_INVENTORY("_pulling_2_inventory"); + + private final String suffix; + + ModelRole(String suffix) { + this.suffix = suffix; + } + } + + private record ModelDescriptor( + ModelKind kind, + Map models + ) { + private ModelDescriptor { + models = Collections.unmodifiableMap(new EnumMap<>(models)); + } + + private void register(ModelEvent.RegisterAdditional event) { + for (ModelResourceLocation location : models.values()) { + event.register(location); + } + } + + private BakedModels bake( + Map availableModels, + BakedModel missingModel + ) { + BakedModel[] baked = new BakedModel[ModelRole.values().length]; + for (Map.Entry entry : models.entrySet()) { + BakedModel model = availableModels.get(entry.getValue()); + if (model != null && model != missingModel) { + baked[entry.getKey().ordinal()] = model; + } + } + return new BakedModels(kind, baked); + } + } + + private static final class BakedModels { + private final ModelKind kind; + private final BakedModel[] models; + + private BakedModels(ModelKind kind, BakedModel[] models) { + this.kind = kind; + this.models = models; + } + + private boolean has(ModelRole role) { + return models[role.ordinal()] != null; + } + + private BakedModel get(ModelRole role) { + return models[role.ordinal()]; + } + + private BakedModel orElse(ModelRole role, BakedModel fallback) { + BakedModel model = models[role.ordinal()]; + return model != null ? model : fallback; + } + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/MEModelLoader.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/MEModelLoader.java index f35378e7ec..b8d72578cc 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/MEModelLoader.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/MEModelLoader.java @@ -1,45 +1,31 @@ package net.sevenstars.middleearth.client; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.block.BlockState; -import net.minecraft.client.item.ItemAsset; -import net.minecraft.client.render.TexturedRenderLayers; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.model.BakedSimpleModel; -import net.minecraft.client.render.model.BlockStateModel; -import net.minecraft.client.render.model.ModelBaker; -import net.minecraft.client.render.model.UnbakedModel; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.util.Identifier; +import net.minecraft.client.renderer.Sheets; +import net.minecraft.client.resources.model.Material; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; -import java.util.Map; +public final class MEModelLoader { + public static final Material KITE_SHIELD_BASE; + public static final Material KITE_SHIELD_BASE_NO_PATTERN; -@Environment(EnvType.CLIENT) -public class MEModelLoader extends ModelBaker { - public static final SpriteIdentifier KITE_SHIELD_BASE; - public static final SpriteIdentifier KITE_SHIELD_BASE_NO_PATTERN; + public static final Material HEATER_SHIELD_BASE; + public static final Material HEATER_SHIELD_BASE_NO_PATTERN; - public static final SpriteIdentifier HEATER_SHIELD_BASE; - public static final SpriteIdentifier HEATER_SHIELD_BASE_NO_PATTERN; + public static final Material ROUND_SHIELD_BASE; + public static final Material ROUND_SHIELD_BASE_NO_PATTERN; - public static final SpriteIdentifier ROUND_SHIELD_BASE; - public static final SpriteIdentifier ROUND_SHIELD_BASE_NO_PATTERN; - - public MEModelLoader(LoadedEntityModels entityModels, Map blockModels, Map itemModels, Map simpleModels, BakedSimpleModel missingModel) { - super(entityModels, blockModels, itemModels, simpleModels, missingModel); + private MEModelLoader() { } static { - KITE_SHIELD_BASE = new SpriteIdentifier(TexturedRenderLayers.SHIELD_PATTERNS_ATLAS_TEXTURE, Identifier.of(MiddleEarth.MOD_ID, "entity/kite_shield_base")); - KITE_SHIELD_BASE_NO_PATTERN = new SpriteIdentifier(TexturedRenderLayers.SHIELD_PATTERNS_ATLAS_TEXTURE, Identifier.of(MiddleEarth.MOD_ID, "entity/kite_shield_base_nopattern")); + KITE_SHIELD_BASE = new Material(Sheets.SHIELD_SHEET, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "entity/kite_shield_base")); + KITE_SHIELD_BASE_NO_PATTERN = new Material(Sheets.SHIELD_SHEET, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "entity/kite_shield_base_nopattern")); - HEATER_SHIELD_BASE = new SpriteIdentifier(TexturedRenderLayers.SHIELD_PATTERNS_ATLAS_TEXTURE, Identifier.of(MiddleEarth.MOD_ID, "entity/heater_shield_base")); - HEATER_SHIELD_BASE_NO_PATTERN = new SpriteIdentifier(TexturedRenderLayers.SHIELD_PATTERNS_ATLAS_TEXTURE, Identifier.of(MiddleEarth.MOD_ID, "entity/heater_shield_base_nopattern")); + HEATER_SHIELD_BASE = new Material(Sheets.SHIELD_SHEET, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "entity/heater_shield_base")); + HEATER_SHIELD_BASE_NO_PATTERN = new Material(Sheets.SHIELD_SHEET, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "entity/heater_shield_base_nopattern")); - ROUND_SHIELD_BASE = new SpriteIdentifier(TexturedRenderLayers.SHIELD_PATTERNS_ATLAS_TEXTURE, Identifier.of(MiddleEarth.MOD_ID, "entity/round_shield_base")); - ROUND_SHIELD_BASE_NO_PATTERN = new SpriteIdentifier(TexturedRenderLayers.SHIELD_PATTERNS_ATLAS_TEXTURE, Identifier.of(MiddleEarth.MOD_ID, "entity/round_shield_base_nopattern")); + ROUND_SHIELD_BASE = new Material(Sheets.SHIELD_SHEET, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "entity/round_shield_base")); + ROUND_SHIELD_BASE_NO_PATTERN = new Material(Sheets.SHIELD_SHEET, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "entity/round_shield_base_nopattern")); } - } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/MaterialAtlasClientEvents.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/MaterialAtlasClientEvents.java new file mode 100644 index 0000000000..03407eaee5 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/MaterialAtlasClientEvents.java @@ -0,0 +1,25 @@ +package net.sevenstars.middleearth.client; + +import net.minecraft.resources.ResourceLocation; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.client.event.RegisterMaterialAtlasesEvent; +import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.middleearth.registries.AtlasesME; + +@EventBusSubscriber(modid = MiddleEarth.NEOFORGE_MOD_ID, value = Dist.CLIENT) +public final class MaterialAtlasClientEvents { + private MaterialAtlasClientEvents() { + } + + @SubscribeEvent + private static void registerMaterialAtlases(RegisterMaterialAtlasesEvent event) { + event.register( + ModTexturedRenderLayers.CHARACTER_ATLAS_TEXTURES, + AtlasesME.CHARACTER_TEXTURES + ); + ResourceLocation sprites = MiddleEarth.of("sprites"); + event.register(sprites, sprites); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/MiddleEarthDimensionEffects.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/MiddleEarthDimensionEffects.java new file mode 100644 index 0000000000..8986ce4e26 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/MiddleEarthDimensionEffects.java @@ -0,0 +1,24 @@ +package net.sevenstars.middleearth.client; + +import net.minecraft.client.renderer.DimensionSpecialEffects; +import net.minecraft.world.phys.Vec3; + +public final class MiddleEarthDimensionEffects extends DimensionSpecialEffects { + public MiddleEarthDimensionEffects() { + super(300.0F, true, SkyType.NORMAL, false, false); + } + + @Override + public Vec3 getBrightnessDependentFogColor(Vec3 fogColor, float brightness) { + return fogColor.multiply( + brightness * 0.94F + 0.06F, + brightness * 0.94F + 0.06F, + brightness * 0.91F + 0.09F + ); + } + + @Override + public boolean isFoggyAt(int x, int z) { + return false; + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/ModTexturedRenderLayers.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/ModTexturedRenderLayers.java index ae4ac84a4a..ec8884125a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/ModTexturedRenderLayers.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/ModTexturedRenderLayers.java @@ -1,70 +1,70 @@ package net.sevenstars.middleearth.client; -import net.minecraft.block.entity.BannerPattern; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.TexturedRenderLayers; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.util.Identifier; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.Sheets; +import net.minecraft.client.resources.model.Material; +import net.minecraft.core.Holder; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.entity.BannerPattern; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.registries.AtlasesME; import java.util.HashMap; import java.util.Map; -public class ModTexturedRenderLayers extends TexturedRenderLayers { - public static final SpriteIdentifier HEATER_SHIELD_BASE; - public static final SpriteIdentifier KITE_SHIELD_BASE; - public static final SpriteIdentifier ROUND_SHIELD_BASE; +public class ModTexturedRenderLayers extends Sheets { + public static final Material HEATER_SHIELD_BASE; + public static final Material KITE_SHIELD_BASE; + public static final Material ROUND_SHIELD_BASE; - private static final Map HEATER_SHIELD_PATTERN_TEXTURES; - private static final Map KITE_SHIELD_PATTERN_TEXTURES; - private static final Map ROUND_SHIELD_PATTERN_TEXTURES; + private static final Map HEATER_SHIELD_PATTERN_TEXTURES; + private static final Map KITE_SHIELD_PATTERN_TEXTURES; + private static final Map ROUND_SHIELD_PATTERN_TEXTURES; - public static final Identifier CHARACTER_ATLAS_TEXTURES = AtlasesME.getAtlasPath(AtlasesME.CHARACTER_TEXTURES); - public static final RenderLayer CHARACTER_TEXTURES_RENDER_LAYER; - public static final RenderLayer CHARACTER_TEXTURES_EMISSIVE_RENDER_LAYER; + public static final ResourceLocation CHARACTER_ATLAS_TEXTURES = AtlasesME.getAtlasPath(AtlasesME.CHARACTER_TEXTURES); + public static final RenderType CHARACTER_TEXTURES_RENDER_LAYER; + public static final RenderType CHARACTER_TEXTURES_EMISSIVE_RENDER_LAYER; static { - CHARACTER_TEXTURES_RENDER_LAYER = RenderLayer.getEntityCutoutNoCull(CHARACTER_ATLAS_TEXTURES); - CHARACTER_TEXTURES_EMISSIVE_RENDER_LAYER = RenderLayer.getEntityTranslucentEmissive(CHARACTER_ATLAS_TEXTURES); + CHARACTER_TEXTURES_RENDER_LAYER = RenderType.entityCutoutNoCull(CHARACTER_ATLAS_TEXTURES); + CHARACTER_TEXTURES_EMISSIVE_RENDER_LAYER = RenderType.entityTranslucentEmissive(CHARACTER_ATLAS_TEXTURES); - HEATER_SHIELD_BASE = new SpriteIdentifier(SHIELD_PATTERNS_ATLAS_TEXTURE, MiddleEarth.ofVanillaPath("entity", "heater_shield", "base" )); - KITE_SHIELD_BASE = new SpriteIdentifier(SHIELD_PATTERNS_ATLAS_TEXTURE, MiddleEarth.ofVanillaPath("entity", "kite_shield", "base" )); - ROUND_SHIELD_BASE = new SpriteIdentifier(SHIELD_PATTERNS_ATLAS_TEXTURE, MiddleEarth.ofVanillaPath("entity", "round_shield", "base" )); + HEATER_SHIELD_BASE = new Material(SHIELD_SHEET, MiddleEarth.ofVanillaPath("entity", "heater_shield", "base" )); + KITE_SHIELD_BASE = new Material(SHIELD_SHEET, MiddleEarth.ofVanillaPath("entity", "kite_shield", "base" )); + ROUND_SHIELD_BASE = new Material(SHIELD_SHEET, MiddleEarth.ofVanillaPath("entity", "round_shield", "base" )); HEATER_SHIELD_PATTERN_TEXTURES = new HashMap<>(); KITE_SHIELD_PATTERN_TEXTURES = new HashMap<>(); ROUND_SHIELD_PATTERN_TEXTURES = new HashMap<>(); } - public static RenderLayer getCharacterTexturesRenderLayer() { + public static RenderType getCharacterTexturesRenderLayer() { return CHARACTER_TEXTURES_RENDER_LAYER; } - public static RenderLayer getCharacterTexturesEmissiveRenderLayer() { + public static RenderType getCharacterTexturesEmissiveRenderLayer() { return CHARACTER_TEXTURES_EMISSIVE_RENDER_LAYER; } - public static SpriteIdentifier getHeaterShieldPatternTextureId(RegistryEntry pattern) { + public static Material getHeaterShieldPatternTextureId(Holder pattern) { return HEATER_SHIELD_PATTERN_TEXTURES.computeIfAbsent((pattern.value()).assetId(), (id) -> { - Identifier identifier = id.withPrefixedPath("entity/heater_shield/"); - return new SpriteIdentifier(SHIELD_PATTERNS_ATLAS_TEXTURE, identifier); + ResourceLocation identifier = id.withPrefix("entity/heater_shield/"); + return new Material(SHIELD_SHEET, identifier); }); } - public static SpriteIdentifier getKiteShieldPatternTextureId(RegistryEntry pattern) { + public static Material getKiteShieldPatternTextureId(Holder pattern) { return KITE_SHIELD_PATTERN_TEXTURES.computeIfAbsent((pattern.value()).assetId(), (id) -> { - Identifier identifier = id.withPrefixedPath("entity/kite_shield/"); - return new SpriteIdentifier(SHIELD_PATTERNS_ATLAS_TEXTURE, identifier); + ResourceLocation identifier = id.withPrefix("entity/kite_shield/"); + return new Material(SHIELD_SHEET, identifier); }); } - public static SpriteIdentifier getRoundShieldPatternTextureId(RegistryEntry pattern) { + public static Material getRoundShieldPatternTextureId(Holder pattern) { return ROUND_SHIELD_PATTERN_TEXTURES.computeIfAbsent((pattern.value()).assetId(), (id) -> { - Identifier identifier = id.withPrefixedPath("entity/round_shield/"); - return new SpriteIdentifier(SHIELD_PATTERNS_ATLAS_TEXTURE, identifier); + ResourceLocation identifier = id.withPrefix("entity/round_shield/"); + return new Material(SHIELD_SHEET, identifier); }); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/RenderUtil.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/RenderUtil.java index 20e7faeeb1..ba16506a7f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/RenderUtil.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/RenderUtil.java @@ -1,43 +1,40 @@ package net.sevenstars.middleearth.client; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.resources.ResourceLocation; -@Environment(EnvType.CLIENT) public final class RenderUtil { private RenderUtil() { } - public static void renderCutoutTexture(EntityModel model, MatrixStack matrices, - VertexConsumerProvider vertexConsumers, Identifier texture, + public static void renderCutoutTexture(EntityModel model, PoseStack matrices, + MultiBufferSource vertexConsumers, ResourceLocation texture, int light, int overlay) { - renderModel(model, matrices, vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(texture)), light, overlay); + renderModel(model, matrices, vertexConsumers.getBuffer(RenderType.entityCutoutNoCull(texture)), light, overlay); } - public static void renderEmissiveTexture(EntityModel model, MatrixStack matrices, - VertexConsumerProvider vertexConsumers, Identifier texture, + public static void renderEmissiveTexture(EntityModel model, PoseStack matrices, + MultiBufferSource vertexConsumers, ResourceLocation texture, int light, int overlay) { - renderModel(model, matrices, vertexConsumers.getBuffer(RenderLayer.getEntityTranslucentEmissive(texture)), light, overlay); + renderModel(model, matrices, vertexConsumers.getBuffer(RenderType.entityTranslucentEmissive(texture)), light, overlay); } - public static void renderAtlasTexture(SpriteAtlasTexture atlas, EntityModel model, MatrixStack matrices, - VertexConsumer vertexConsumer, Identifier textureId, int light, int overlay) { - Sprite sprite = atlas.getSprite(textureId); + public static void renderAtlasTexture(TextureAtlas atlas, EntityModel model, PoseStack matrices, + VertexConsumer vertexConsumer, ResourceLocation textureId, int light, int overlay) { + TextureAtlasSprite sprite = atlas.getSprite(textureId); if(sprite != null) { - VertexConsumer textureSpecificVertexConsumer = sprite.getTextureSpecificVertexConsumer(vertexConsumer); + VertexConsumer textureSpecificVertexConsumer = sprite.wrap(vertexConsumer); renderModel(model, matrices, textureSpecificVertexConsumer, light, overlay); } } - public static void renderModel(EntityModel model, MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay) { - model.render(matrices, vertexConsumer, light, overlay); + public static void renderModel(EntityModel model, PoseStack matrices, VertexConsumer vertexConsumer, int light, int overlay) { + model.renderToBuffer(matrices, vertexConsumer, light, overlay); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/CustomBootsModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/CustomBootsModel.java index 77892cfbac..8f5ec8542a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/CustomBootsModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/CustomBootsModel.java @@ -1,55 +1,60 @@ package net.sevenstars.middleearth.client.model.equipment; import net.minecraft.client.model.*; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.render.entity.model.EntityModelPartNames; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.entity.LivingEntity; - -public class CustomBootsModel extends BipedEntityModel { +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.world.entity.LivingEntity; + +public class CustomBootsModel extends HumanoidModel { public CustomBootsModel(ModelPart root) { - super(root, RenderLayer::getArmorCutoutNoCull); + super(root, RenderType::armorCutoutNoCull); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData rightLeg = modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition rightLeg = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - rightLeg.addChild("rightBoot", ModelPartBuilder.create() - .uv(0, 48).cuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.9F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - rightLeg.addChild("rightInnerBoot", ModelPartBuilder.create() - .uv(0, 16).cuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.7F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + rightLeg.addOrReplaceChild("rightBoot", CubeListBuilder.create() + .texOffs(0, 48).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.9F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + rightLeg.addOrReplaceChild("rightInnerBoot", CubeListBuilder.create() + .texOffs(0, 16).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.7F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData leftLeg = modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition leftLeg = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - leftLeg.addChild("leftBoot", ModelPartBuilder.create() - .uv(16, 48).mirrored().cuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.9F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - leftLeg.addChild("leftInnerBoot", ModelPartBuilder.create() - .uv(0, 32).mirrored().cuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.7F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + leftLeg.addOrReplaceChild("leftBoot", CubeListBuilder.create() + .texOffs(16, 48).mirror().addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.9F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); + leftLeg.addOrReplaceChild("leftInnerBoot", CubeListBuilder.create() + .texOffs(0, 32).mirror().addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.7F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/CustomChestplateModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/CustomChestplateModel.java index 2c53d0e3fc..d8554bbe5f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/CustomChestplateModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/CustomChestplateModel.java @@ -1,50 +1,55 @@ package net.sevenstars.middleearth.client.model.equipment; import net.minecraft.client.model.*; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.render.entity.model.EntityModelPartNames; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.entity.LivingEntity; - -public class CustomChestplateModel extends BipedEntityModel { +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.world.entity.LivingEntity; + +public class CustomChestplateModel extends HumanoidModel { public CustomChestplateModel(ModelPart root) { - super(root, RenderLayer::getArmorCutoutNoCull); + super(root, RenderType::armorCutoutNoCull); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create() - .uv(16, 32).cuboid(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, new Dilation(0.8F)), - ModelTransform.origin(0.0F, -23.0F, 0.0F)); - - body.addChild("innerChest", ModelPartBuilder.create() - .uv(16, 16).cuboid(-4.0F, -0.0F, -2.068F, 8.0F, 12.0F, 4.0F, new Dilation(0.5F)), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create() - .uv(32, 48).cuboid(-3.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.9F)) - .uv(40, 16).cuboid(-3.0F, -2.3F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.6F)), - ModelTransform.origin(-5.0F, -21.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create() - .uv(48, 48).mirrored().cuboid(-1.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.9F)).mirrored(false) - .uv(40, 32).mirrored().cuboid(-1.0F, -2.3F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.6F)).mirrored(false), - ModelTransform.origin(5.0F, -21.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create() - .uv(0, 16).cuboid(-2.0F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.5F)), - ModelTransform.origin(-1.9F, -11.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create() - .uv(0, 32).mirrored().cuboid(-2.0F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.5F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create() + .texOffs(16, 32).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.8F)), + PartPose.offset(0.0F, -23.0F, 0.0F)); + + body.addOrReplaceChild("innerChest", CubeListBuilder.create() + .texOffs(16, 16).addBox(-4.0F, -0.0F, -2.068F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.5F)), + PartPose.offset(0.0F, -0.0F, 0.0F)); + + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create() + .texOffs(32, 48).addBox(-3.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.9F)) + .texOffs(40, 16).addBox(-3.0F, -2.3F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.6F)), + PartPose.offset(-5.0F, -21.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create() + .texOffs(48, 48).mirror().addBox(-1.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.9F)).mirror(false) + .texOffs(40, 32).mirror().addBox(-1.0F, -2.3F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.6F)).mirror(false), + PartPose.offset(5.0F, -21.0F, 0.0F)); + + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create() + .texOffs(0, 16).addBox(-2.0F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.5F)), + PartPose.offset(-1.9F, -11.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create() + .texOffs(0, 32).mirror().addBox(-2.0F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.5F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(modelData, 64, 64); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/CustomHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/CustomHelmetModel.java index 5504ec4b83..067c9adea2 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/CustomHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/CustomHelmetModel.java @@ -1,53 +1,58 @@ package net.sevenstars.middleearth.client.model.equipment; import net.minecraft.client.model.*; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.render.entity.model.EntityModelPartNames; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.entity.LivingEntity; - -public class CustomHelmetModel extends BipedEntityModel { +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.world.entity.LivingEntity; + +public class CustomHelmetModel extends HumanoidModel { public CustomHelmetModel(ModelPart root) { - super(root, RenderLayer::getArmorCutoutNoCull); + super(root, RenderType::armorCutoutNoCull); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create() - .uv(0, 0).cuboid(-4.0F, -8.2F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, -23.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create() - .uv(32, 0).cuboid(-4.0F, -8.2F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.9F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - body.addChild("chestHeadExtension", ModelPartBuilder.create() - .uv(16, 32).cuboid(-4.0F, -1.0F, -2.0F, 8.0F, 12.0F, 4.0F, new Dilation(0.82F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData rightArm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - rightArm.addChild("rightArmHeadExtension", ModelPartBuilder.create() - .uv(32, 48).cuboid(-3.0F, -3.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.92F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData leftArm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - leftArm.addChild("leftArmHeadExtension", ModelPartBuilder.create() - .uv(48, 48).mirrored().cuboid(-1.0F, -3.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.92F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create() + .texOffs(0, 0).addBox(-4.0F, -8.2F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, -23.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create() + .texOffs(32, 0).addBox(-4.0F, -8.2F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.9F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + body.addOrReplaceChild("chestHeadExtension", CubeListBuilder.create() + .texOffs(16, 32).addBox(-4.0F, -1.0F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.82F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition rightArm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + rightArm.addOrReplaceChild("rightArmHeadExtension", CubeListBuilder.create() + .texOffs(32, 48).addBox(-3.0F, -3.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.92F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition leftArm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + leftArm.addOrReplaceChild("leftArmHeadExtension", CubeListBuilder.create() + .texOffs(48, 48).mirror().addBox(-1.0F, -3.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.92F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(modelData, 64, 64); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/CustomLeggingsModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/CustomLeggingsModel.java index 0fcef84a44..1047c54ecd 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/CustomLeggingsModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/CustomLeggingsModel.java @@ -1,44 +1,49 @@ package net.sevenstars.middleearth.client.model.equipment; import net.minecraft.client.model.*; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.render.entity.model.EntityModelPartNames; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.entity.LivingEntity; - -public class CustomLeggingsModel extends BipedEntityModel { +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.world.entity.LivingEntity; + +public class CustomLeggingsModel extends HumanoidModel { public CustomLeggingsModel(ModelPart root) { - super(root, RenderLayer::getArmorCutoutNoCull); + super(root, RenderType::armorCutoutNoCull); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - body.addChild("waist", ModelPartBuilder.create() - .uv(16, 16).cuboid(-4.0F, -0.0F, -2.1F, 8.0F, 12.0F, 4.0F, new Dilation(0.3F)), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create() - .uv(0, 16).cuboid(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.3F)), - ModelTransform.origin(-1.9F, -11.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create() - .uv(0, 32).mirrored().cuboid(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.3F)).mirrored(false), - ModelTransform.origin(1.9F, -11.0F, 0.0F)); - - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("waist", CubeListBuilder.create() + .texOffs(16, 16).addBox(-4.0F, -0.0F, -2.1F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.3F)), + PartPose.offset(0.0F, -0.0F, 0.0F)); + + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create() + .texOffs(0, 16).addBox(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.3F)), + PartPose.offset(-1.9F, -11.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create() + .texOffs(0, 32).mirror().addBox(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.3F)).mirror(false), + PartPose.offset(1.9F, -11.0F, 0.0F)); + + return LayerDefinition.create(modelData, 64, 64); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/BlackCastellanChestplateModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/BlackCastellanChestplateModel.java index 06b0f974d6..2fe2f52200 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/BlackCastellanChestplateModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/BlackCastellanChestplateModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.chest; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class BlackCastellanChestplateModel extends ChestplateAddonModel { @@ -9,45 +16,45 @@ public BlackCastellanChestplateModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - body.addChild("chest_extension", ModelPartBuilder.create() - .uv(42, 39).cuboid(-4.5F, -1.125F, -2.3F, 9.0F, 12.0F, 0.0F, new Dilation(0.51F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("chest_extension", CubeListBuilder.create() + .texOffs(42, 39).addBox(-4.5F, -1.125F, -2.3F, 9.0F, 12.0F, 0.0F, new CubeDeformation(0.51F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_halt", ModelPartBuilder.create() - .uv(0, 32).cuboid(-1.0F, -6.25F, -3.5F, 0.0F, 7.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_halt", CubeListBuilder.create() + .texOffs(0, 32).addBox(-1.0F, -6.25F, -3.5F, 0.0F, 7.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_halt", ModelPartBuilder.create() - .uv(0, 39).cuboid(11.0F, -6.5F, -3.5F, 0.0F, 7.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.origin(-10.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_halt", CubeListBuilder.create() + .texOffs(0, 39).addBox(11.0F, -6.5F, -3.5F, 0.0F, 7.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offset(-10.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/ChestplateAddonModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/ChestplateAddonModel.java index 22ac5e6b9a..edaf48f741 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/ChestplateAddonModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/ChestplateAddonModel.java @@ -1,13 +1,12 @@ package net.sevenstars.middleearth.client.model.equipment.chest; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.entity.LivingEntity; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.world.entity.LivingEntity; -public class ChestplateAddonModel extends BipedEntityModel { +public class ChestplateAddonModel extends HumanoidModel { public ChestplateAddonModel(ModelPart root) { super(root); } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/DGMarauderChestplateModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/DGMarauderChestplateModel.java index 729338b249..127276448c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/DGMarauderChestplateModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/DGMarauderChestplateModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.chest; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class DGMarauderChestplateModel extends BlackCastellanChestplateModel { @@ -9,20 +16,20 @@ public DGMarauderChestplateModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); - ModelPartData body = modelData.getRoot().addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition body = modelData.getRoot().addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - body.addChild("spike_right", ModelPartBuilder.create() - .uv(36, 0).cuboid(-10.25F, -14.5F, 0.252F, 11.0F, 19.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(-1.8F, 1.0F, 0.75F, 0.0F, 0.6545F, -0.3491F)); + body.addOrReplaceChild("spike_right", CubeListBuilder.create() + .texOffs(36, 0).addBox(-10.25F, -14.5F, 0.252F, 11.0F, 19.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-1.8F, 1.0F, 0.75F, 0.0F, 0.6545F, -0.3491F)); - body.addChild("spike_left", ModelPartBuilder.create() - .uv(36, 0).mirrored().cuboid(-0.5F, -14.5F, 0.284F, 11.0F, 19.0F, 0.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(1.764F, 1.0F, 0.5F, 0.0F, -0.6545F, 0.3491F)); + body.addOrReplaceChild("spike_left", CubeListBuilder.create() + .texOffs(36, 0).mirror().addBox(-0.5F, -14.5F, 0.284F, 11.0F, 19.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(1.764F, 1.0F, 0.5F, 0.0F, -0.6545F, 0.3491F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/DGStalkerChestplateModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/DGStalkerChestplateModel.java index ea5c65f494..bba6cee4ab 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/DGStalkerChestplateModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/DGStalkerChestplateModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.chest; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class DGStalkerChestplateModel extends ChestplateAddonModel { @@ -9,35 +16,35 @@ public DGStalkerChestplateModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - body.addChild("spike_right", ModelPartBuilder.create() - .uv(36, 0).cuboid(-10.25F, -14.5F, 0.252F, 11.0F, 19.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(-1.8F, 1.0F, 0.75F, 0.0F, 0.6545F, -0.3491F)); + body.addOrReplaceChild("spike_right", CubeListBuilder.create() + .texOffs(36, 0).addBox(-10.25F, -14.5F, 0.252F, 11.0F, 19.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-1.8F, 1.0F, 0.75F, 0.0F, 0.6545F, -0.3491F)); - body.addChild("spike_left", ModelPartBuilder.create() - .uv(36, 0).mirrored().cuboid(-0.5F, -14.5F, 0.284F, 11.0F, 19.0F, 0.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(1.764F, 1.0F, 0.5F, 0.0F, -0.6545F, 0.3491F)); + body.addOrReplaceChild("spike_left", CubeListBuilder.create() + .texOffs(36, 0).mirror().addBox(-0.5F, -14.5F, 0.284F, 11.0F, 19.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(1.764F, 1.0F, 0.5F, 0.0F, -0.6545F, 0.3491F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/GoblinChestplateModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/GoblinChestplateModel.java index 30fc77178a..05cc7ec264 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/GoblinChestplateModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/GoblinChestplateModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.chest; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class GoblinChestplateModel extends ChestplateAddonModel { @@ -9,32 +16,32 @@ public GoblinChestplateModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_addon", ModelPartBuilder.create() - .uv(1, 0).cuboid(-7.0F, -6.0F, 0.0F, 7.0F, 17.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_addon", CubeListBuilder.create() + .texOffs(1, 0).addBox(-7.0F, -6.0F, 0.0F, 7.0F, 17.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_addon", ModelPartBuilder.create(). - uv(18, 0).cuboid(0.0F, -6.0F, 0.0F, 7.0F, 17.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_addon", CubeListBuilder.create(). + texOffs(18, 0).addBox(0.0F, -6.0F, 0.0F, 7.0F, 17.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/HaltChestplateModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/HaltChestplateModel.java index c3d92507f0..2913232a8a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/HaltChestplateModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/HaltChestplateModel.java @@ -1,8 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.chest; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; -import net.minecraft.entity.LivingEntity; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class HaltChestplateModel extends ChestplateAddonModel { @@ -10,39 +16,39 @@ public HaltChestplateModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_halt", ModelPartBuilder.create() - .uv(0, 50).cuboid(-1.0F, -6.25F, -3.5F, 0.0F, 7.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_halt", CubeListBuilder.create() + .texOffs(0, 50).addBox(-1.0F, -6.25F, -3.5F, 0.0F, 7.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_halt", ModelPartBuilder.create() - .uv(17, 50).cuboid(11.0F, -6.25F, -3.5F, 0.0F, 7.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.origin(-10.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_halt", CubeListBuilder.create() + .texOffs(17, 50).addBox(11.0F, -6.25F, -3.5F, 0.0F, 7.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offset(-10.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/HobgoblinPlateChestplateModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/HobgoblinPlateChestplateModel.java index 710f000233..5ec648ae35 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/HobgoblinPlateChestplateModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/HobgoblinPlateChestplateModel.java @@ -1,8 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.chest; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; -import net.minecraft.entity.LivingEntity; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class HobgoblinPlateChestplateModel extends ChestplateAddonModel { @@ -10,24 +16,24 @@ public HobgoblinPlateChestplateModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_arm_spike", ModelPartBuilder.create().uv(0, 45).cuboid(0.0F, 14.3F, 0.0F, 4.0F, 19.0F, 0.0F, new Dilation(0.0F)), ModelTransform.origin(-5.0F, -21.0F, 0.0F)); - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_arm_spike", ModelPartBuilder.create().uv(8, 45).mirrored().cuboid(-4.0F, 14.3F, 0.0F, 4.0F, 19.0F, 0.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(5.0F, -21.0F, 0.0F)); + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_arm_spike", CubeListBuilder.create().texOffs(0, 45).addBox(0.0F, 14.3F, 0.0F, 4.0F, 19.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(-5.0F, -21.0F, 0.0F)); + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_arm_spike", CubeListBuilder.create().texOffs(8, 45).mirror().addBox(-4.0F, 14.3F, 0.0F, 4.0F, 19.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(5.0F, -21.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/MordorBNChestplateModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/MordorBNChestplateModel.java index 41fbd76a78..7208ec00ed 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/MordorBNChestplateModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/MordorBNChestplateModel.java @@ -1,8 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.chest; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; -import net.minecraft.entity.LivingEntity; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class MordorBNChestplateModel extends HaltChestplateModel { @@ -10,16 +16,16 @@ public MordorBNChestplateModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); - ModelPartData body = modelData.getRoot().addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition body = modelData.getRoot().addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - body.addChild("chest_addon", ModelPartBuilder.create() - .uv(0, 41).cuboid(-4.5F, -1.0F, -2.3F, 9.0F, 12.0F, 4.0F, new Dilation(0.51F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("chest_addon", CubeListBuilder.create() + .texOffs(0, 41).addBox(-4.5F, -1.0F, -2.3F, 9.0F, 12.0F, 4.0F, new CubeDeformation(0.51F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/CloakCapeModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/CloakCapeModel.java index 00485fa430..bc9b149195 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/CloakCapeModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/CloakCapeModel.java @@ -1,12 +1,9 @@ package net.sevenstars.middleearth.client.model.equipment.chest.backAttachments; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.client.model.equipment.chest.ChestplateAddonModel; -import net.minecraft.client.model.ModelPart; -import net.sevenstars.middleearth.client.renderer.ArmedEntityRenderStateAccess; -import net.sevenstars.middleearth.client.renderer.BipedEntityRenderStateAccess; import net.sevenstars.middleearth.utils.ToRad; public class CloakCapeModel extends ChestplateAddonModel { @@ -20,30 +17,22 @@ public CloakCapeModel(ModelPart root) { } @Override - public void setAngles(BipedEntityRenderState bipedEntityRenderState) { - BipedEntityRenderStateAccess renderStateAccess = ((BipedEntityRenderStateAccess)bipedEntityRenderState); - if(renderStateAccess != null) { - this.cape.traverse().forEach(ModelPart::resetTransform); - Vec3d currentVelocity = renderStateAccess.getVelocity(); - if(currentVelocity == null) currentVelocity = new Vec3d(0, 0, 0); - - double sqrVel = currentVelocity.length(); - double speed = (sqrVel * 0.65f) + Math.sqrt(Math.abs(bipedEntityRenderState.limbSwingAmplitude)) * 0.35f; - double degree; - - if (bipedEntityRenderState.isInSneakingPose) { - degree = 5f + (speed * (MAX_ANGLE_CLOAK / 2)); - } else { - degree = (MAX_ANGLE_CLOAK * speed); - } - degree = Math.max(0.0F, degree); - degree = Math.min(MAX_ANGLE_CLOAK, degree); - - double result = renderStateAccess.getVelocity().dotProduct(currentVelocity); + public void setupAnim(LivingEntity entity, float limbAngle, float limbDistance, + float animationProgress, float headYaw, float headPitch) { + this.cape.getAllParts().forEach(ModelPart::resetPose); + Vec3 velocity = entity.getDeltaMovement(); + double speed = (velocity.length() * 0.65F) + Math.sqrt(Math.abs(limbDistance)) * 0.35F; + double degree; + + if (entity.isCrouching()) { + degree = 5.0F + (speed * (MAX_ANGLE_CLOAK / 2.0F)); + } else { + degree = MAX_ANGLE_CLOAK * speed; + } - if(result > 0) { - this.cape.pitch = ToRad.ex(degree); - } + degree = Math.max(0.0F, Math.min(MAX_ANGLE_CLOAK, degree)); + if (entity.getLookAngle().dot(velocity) > 0.0D) { + this.cape.xRot = ToRad.ex(degree); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeMediumModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeMediumModel.java index ee6100cc60..ff9b2363f6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeMediumModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeMediumModel.java @@ -2,57 +2,64 @@ import net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.CloakCapeModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class CapeMediumModel extends CloakCapeModel { public CapeMediumModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - body.addChild("cape_shoulder", ModelPartBuilder.create().uv(0, 16).cuboid(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(0.0F, 23.0F, 0.016F)); - - ModelPartData cape = body.addChild("cape", ModelPartBuilder.create() - .uv(53, 32).mirrored().cuboid(-6.5F, -1.0F, -1F, 13.0F, 13.0F, 5.0F, new Dilation(0.2F)).mirrored(false) - .uv(53, 94).mirrored().cuboid(-6.5F, -1.0F, -1F, 13.0F, 13.0F, 5.0F, new Dilation(0.19F)).mirrored(false), - ModelTransform.origin(0.0F, 1.0F, 0.0F)); - - cape.addChild("cape_low", ModelPartBuilder.create() - .uv(53, 50).mirrored().cuboid(-6.5F, -0.8F, -1F, 13.0F, 10.0F, 5.0F, new Dilation(0.2F)).mirrored(false) - .uv(53, 112).mirrored().cuboid(-6.5F, -0.8F, -1F, 13.0F, 10.0F, 5.0F, new Dilation(0.19F)).mirrored(false), - ModelTransform.origin(-0.0F, 13.1558F, 0.0F)); - - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_arm_shoulder_cape", ModelPartBuilder.create().uv(24, 16).cuboid(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(-0.0F, -0.0F, 0.0F)); - - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_arm_shoulder_cape", ModelPartBuilder.create().uv(40, 16).mirrored().cuboid(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)).mirrored(false), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); - - ModelPartData right_leg = modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_leg.addChild("right_leg", ModelPartBuilder.create().uv(72, 16).cuboid(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData left_leg = modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_leg.addChild("left_leg", ModelPartBuilder.create().uv(56, 16).mirrored().cuboid(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - return TexturedModelData.of(modelData, 128, 128); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("cape_shoulder", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(0.0F, 23.0F, 0.016F)); + + PartDefinition cape = body.addOrReplaceChild("cape", CubeListBuilder.create() + .texOffs(53, 32).mirror().addBox(-6.5F, -1.0F, -1F, 13.0F, 13.0F, 5.0F, new CubeDeformation(0.2F)).mirror(false) + .texOffs(53, 94).mirror().addBox(-6.5F, -1.0F, -1F, 13.0F, 13.0F, 5.0F, new CubeDeformation(0.19F)).mirror(false), + PartPose.offset(0.0F, 1.0F, 0.0F)); + + cape.addOrReplaceChild("cape_low", CubeListBuilder.create() + .texOffs(53, 50).mirror().addBox(-6.5F, -0.8F, -1F, 13.0F, 10.0F, 5.0F, new CubeDeformation(0.2F)).mirror(false) + .texOffs(53, 112).mirror().addBox(-6.5F, -0.8F, -1F, 13.0F, 10.0F, 5.0F, new CubeDeformation(0.19F)).mirror(false), + PartPose.offset(-0.0F, 13.1558F, 0.0F)); + + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_arm_shoulder_cape", CubeListBuilder.create().texOffs(24, 16).addBox(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(-0.0F, -0.0F, 0.0F)); + + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_arm_shoulder_cape", CubeListBuilder.create().texOffs(40, 16).mirror().addBox(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)).mirror(false), + PartPose.offset(0.0F, -0.0F, 0.0F)); + + PartDefinition right_leg = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_leg.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(72, 16).addBox(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition left_leg = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_leg.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(56, 16).mirror().addBox(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeSlimModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeSlimModel.java index b59d5515a5..8b2e25ff05 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeSlimModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeSlimModel.java @@ -2,7 +2,14 @@ import net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.CloakCapeModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class CapeSlimModel extends CloakCapeModel { @@ -10,50 +17,50 @@ public CapeSlimModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - body.addChild("cape_shoulder", ModelPartBuilder.create().uv(0, 16).cuboid(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(0.0F, 23.0F, 0.016F)); - - ModelPartData cape = body.addChild("cape", ModelPartBuilder.create() - .uv(92, 32).mirrored().cuboid(-5.5F, -3.0F, -1F, 11.0F, 13.0F, 5.0F, new Dilation(0.2F)).mirrored(false) - .uv(92, 94).mirrored().cuboid(-5.5F, -3.0F, -1F, 11.0F, 13.0F, 5.0F, new Dilation(0.19F)).mirrored(false), - ModelTransform.origin(0.0F, 3.0F, 0.0F)); - - cape.addChild("cape_low", ModelPartBuilder.create() - .uv(92, 50).mirrored().cuboid(-5.5F, -2.8F, -1F, 11.0F, 13.0F, 5.0F, new Dilation(0.2F)).mirrored(false) - .uv(92, 112).mirrored().cuboid(-5.5F, -2.8F, -1F, 11.0F, 13.0F, 5.0F, new Dilation(0.19F)).mirrored(false), - ModelTransform.origin(0.0F, 13.1558F, 0.0F)); - - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_arm_shoulder_cape", ModelPartBuilder.create().uv(24, 16).cuboid(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(-0.0F, -0.0F, 0.0F)); - - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_arm_shoulder_cape", ModelPartBuilder.create().uv(40, 16).mirrored().cuboid(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)).mirrored(false), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); - - ModelPartData right_leg = modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_leg.addChild("right_leg", ModelPartBuilder.create().uv(72, 16).cuboid(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData left_leg = modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_leg.addChild("left_leg", ModelPartBuilder.create().uv(56, 16).mirrored().cuboid(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - return TexturedModelData.of(modelData, 128, 128); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("cape_shoulder", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(0.0F, 23.0F, 0.016F)); + + PartDefinition cape = body.addOrReplaceChild("cape", CubeListBuilder.create() + .texOffs(92, 32).mirror().addBox(-5.5F, -3.0F, -1F, 11.0F, 13.0F, 5.0F, new CubeDeformation(0.2F)).mirror(false) + .texOffs(92, 94).mirror().addBox(-5.5F, -3.0F, -1F, 11.0F, 13.0F, 5.0F, new CubeDeformation(0.19F)).mirror(false), + PartPose.offset(0.0F, 3.0F, 0.0F)); + + cape.addOrReplaceChild("cape_low", CubeListBuilder.create() + .texOffs(92, 50).mirror().addBox(-5.5F, -2.8F, -1F, 11.0F, 13.0F, 5.0F, new CubeDeformation(0.2F)).mirror(false) + .texOffs(92, 112).mirror().addBox(-5.5F, -2.8F, -1F, 11.0F, 13.0F, 5.0F, new CubeDeformation(0.19F)).mirror(false), + PartPose.offset(0.0F, 13.1558F, 0.0F)); + + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_arm_shoulder_cape", CubeListBuilder.create().texOffs(24, 16).addBox(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(-0.0F, -0.0F, 0.0F)); + + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_arm_shoulder_cape", CubeListBuilder.create().texOffs(40, 16).mirror().addBox(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)).mirror(false), + PartPose.offset(0.0F, -0.0F, 0.0F)); + + PartDefinition right_leg = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_leg.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(72, 16).addBox(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition left_leg = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_leg.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(56, 16).mirror().addBox(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeSurcoatModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeSurcoatModel.java index e792fc2b96..4ad8edb041 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeSurcoatModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeSurcoatModel.java @@ -1,9 +1,16 @@ package net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.armored; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; import net.sevenstars.middleearth.client.model.equipment.chest.ChestplateAddonModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.world.entity.LivingEntity; public class CapeSurcoatModel extends ChestplateAddonModel { @@ -11,43 +18,45 @@ public CapeSurcoatModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - body.addChild("cape_shoulder", ModelPartBuilder.create().uv(0, 16).cuboid(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(0.0F, 23.0F, 0.016F)); - - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_arm_shoulder_cape", ModelPartBuilder.create().uv(24, 16).cuboid(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(-0.0F, -0.0F, 0.0F)); - - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_arm_shoulder_cape", ModelPartBuilder.create().uv(40, 16).mirrored().cuboid(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)).mirrored(false), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); - - ModelPartData right_leg = modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_leg.addChild("right_leg", ModelPartBuilder.create().uv(72, 16).cuboid(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData left_leg = modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_leg.addChild("left_leg", ModelPartBuilder.create().uv(56, 16).mirrored().cuboid(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - return TexturedModelData.of(modelData, 128, 128); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("cape_shoulder", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(0.0F, 23.0F, 0.016F)); + + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_arm_shoulder_cape", CubeListBuilder.create().texOffs(24, 16).addBox(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(-0.0F, -0.0F, 0.0F)); + + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_arm_shoulder_cape", CubeListBuilder.create().texOffs(40, 16).mirror().addBox(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)).mirror(false), + PartPose.offset(0.0F, -0.0F, 0.0F)); + + PartDefinition right_leg = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_leg.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(72, 16).addBox(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition left_leg = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_leg.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(56, 16).mirror().addBox(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(modelData, 128, 128); } @Override - public void setAngles(BipedEntityRenderState bipedEntityRenderState) {} + public void setupAnim(LivingEntity entity, float limbAngle, float limbDistance, + float animationProgress, float headYaw, float headPitch) { + } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeWideModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeWideModel.java index 79b5e162ce..22b2dd2857 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeWideModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeWideModel.java @@ -2,7 +2,14 @@ import net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.CloakCapeModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class CapeWideModel extends CloakCapeModel { @@ -10,50 +17,50 @@ public CapeWideModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - body.addChild("cape_shoulder", ModelPartBuilder.create().uv(0, 16).cuboid(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(0.0F, 23.0F, 0.016F)); - - ModelPartData cape = body.addChild("cape", ModelPartBuilder.create() - .uv(0, 32).mirrored().cuboid(-9F, -1.0F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.4F)).mirrored(false) - .uv(0, 94).mirrored().cuboid(-9F, -1.0F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.39F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0f, 0.0f)); - - cape.addChild("cape_low", ModelPartBuilder.create() - .uv(0, 51).mirrored().cuboid(-9F, -0.8F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.4F)).mirrored(false) - .uv(0, 113).mirrored().cuboid(-9F, -0.8F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.39F)).mirrored(false), - ModelTransform.origin(0.0f, 13.3158f, 0.0f)); - - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_arm_shoulder_cape", ModelPartBuilder.create().uv(24, 16).cuboid(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.91F)), - ModelTransform.origin(-0.0F, -0.0F, 0.0F)); - - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_arm_shoulder_cape", ModelPartBuilder.create().uv(40, 16).mirrored().cuboid(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.91F)).mirrored(false), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); - - ModelPartData right_leg = modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_leg.addChild("right_leg", ModelPartBuilder.create().uv(72, 16).cuboid(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData left_leg = modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_leg.addChild("left_leg", ModelPartBuilder.create().uv(56, 16).mirrored().cuboid(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - return TexturedModelData.of(modelData, 128, 128); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("cape_shoulder", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(0.0F, 23.0F, 0.016F)); + + PartDefinition cape = body.addOrReplaceChild("cape", CubeListBuilder.create() + .texOffs(0, 32).mirror().addBox(-9F, -1.0F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.4F)).mirror(false) + .texOffs(0, 94).mirror().addBox(-9F, -1.0F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.39F)).mirror(false), + PartPose.offset(0.0F, 0.0f, 0.0f)); + + cape.addOrReplaceChild("cape_low", CubeListBuilder.create() + .texOffs(0, 51).mirror().addBox(-9F, -0.8F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.4F)).mirror(false) + .texOffs(0, 113).mirror().addBox(-9F, -0.8F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.39F)).mirror(false), + PartPose.offset(0.0f, 13.3158f, 0.0f)); + + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_arm_shoulder_cape", CubeListBuilder.create().texOffs(24, 16).addBox(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.91F)), + PartPose.offset(-0.0F, -0.0F, 0.0F)); + + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_arm_shoulder_cape", CubeListBuilder.create().texOffs(40, 16).mirror().addBox(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.91F)).mirror(false), + PartPose.offset(0.0F, -0.0F, 0.0F)); + + PartDefinition right_leg = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_leg.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(72, 16).addBox(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition left_leg = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_leg.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(56, 16).mirror().addBox(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeWidePauldronModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeWidePauldronModel.java index a55dd79c96..872f2660ba 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeWidePauldronModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/CapeWidePauldronModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.armored; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.CloakCapeModel; public class CapeWidePauldronModel extends CloakCapeModel { @@ -10,55 +17,55 @@ public CapeWidePauldronModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - body.addChild("cape_shoulder", ModelPartBuilder.create().uv(0, 16).cuboid(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(0.0F, 23.0F, 0.016F)); + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("cape_shoulder", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(0.0F, 23.0F, 0.016F)); - ModelPartData cape = body.addChild("cape", ModelPartBuilder.create() - .uv(0, 32).mirrored().cuboid(-9F, -1.0F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.4F)).mirrored(false) - .uv(0, 94).mirrored().cuboid(-9F, -1.0F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.39F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0f, 0.0f)); + PartDefinition cape = body.addOrReplaceChild("cape", CubeListBuilder.create() + .texOffs(0, 32).mirror().addBox(-9F, -1.0F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.4F)).mirror(false) + .texOffs(0, 94).mirror().addBox(-9F, -1.0F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.39F)).mirror(false), + PartPose.offset(0.0F, 0.0f, 0.0f)); - cape.addChild("cape_low", ModelPartBuilder.create() - .uv(0, 51).mirrored().cuboid(-9F, -0.9F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.4F)).mirrored(false) - .uv(0, 113).mirrored().cuboid(-9F, -0.9F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.39F)).mirrored(false), - ModelTransform.origin(0.0f, 13.3158f, 0.0f)); + cape.addOrReplaceChild("cape_low", CubeListBuilder.create() + .texOffs(0, 51).mirror().addBox(-9F, -0.9F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.4F)).mirror(false) + .texOffs(0, 113).mirror().addBox(-9F, -0.9F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.39F)).mirror(false), + PartPose.offset(0.0f, 13.3158f, 0.0f)); - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_arm_shoulder_cape", ModelPartBuilder.create().uv(24, 16).cuboid(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(-0.0F, -0.0F, 0.0F)); - right_arm.addChild("right_pauldron", ModelPartBuilder.create().uv(0, 81).cuboid(-3.0F, -2.0F, -1.92F, 4.0F, 12.0F, 4.0F, new Dilation(1.4F)), - ModelTransform.origin(-0.58F, -1.0F, 0.0F)); + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_arm_shoulder_cape", CubeListBuilder.create().texOffs(24, 16).addBox(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(-0.0F, -0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_pauldron", CubeListBuilder.create().texOffs(0, 81).addBox(-3.0F, -2.0F, -1.92F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.4F)), + PartPose.offset(-0.58F, -1.0F, 0.0F)); - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_arm_shoulder_cape", ModelPartBuilder.create().uv(40, 16).mirrored().cuboid(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)).mirrored(false), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); - left_arm.addChild("left_pauldron", ModelPartBuilder.create().uv(16, 81).mirrored().cuboid(-1.0F, -2.0F, -1.92F, 4.0F, 12.0F, 4.0F, new Dilation(1.4F)).mirrored(false), - ModelTransform.origin(0.5F, -1.0F, 0.0F)); + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_arm_shoulder_cape", CubeListBuilder.create().texOffs(40, 16).mirror().addBox(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)).mirror(false), + PartPose.offset(0.0F, -0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_pauldron", CubeListBuilder.create().texOffs(16, 81).mirror().addBox(-1.0F, -2.0F, -1.92F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.4F)).mirror(false), + PartPose.offset(0.5F, -1.0F, 0.0F)); - ModelPartData right_leg = modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_leg.addChild("right_leg", ModelPartBuilder.create().uv(72, 16).cuboid(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition right_leg = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_leg.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(72, 16).addBox(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData left_leg = modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_leg.addChild("left_leg", ModelPartBuilder.create().uv(56, 16).mirrored().cuboid(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition left_leg = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_leg.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(56, 16).mirror().addBox(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/FurCapeModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/FurCapeModel.java index 534114cf5e..c72d133b0c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/FurCapeModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/FurCapeModel.java @@ -2,7 +2,14 @@ import net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.CloakCapeModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class FurCapeModel extends CloakCapeModel { @@ -10,54 +17,54 @@ public FurCapeModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - body.addChild("cape_shoulder", ModelPartBuilder.create().uv(0, 16).cuboid(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(0.0F, 23.0F, 0.016F)); - - body.addChild("fur", ModelPartBuilder.create().uv(76, 68).cuboid(-9.49F, -2.0F, -3.75F, 19.0F, 5.0F, 7.0F, new Dilation(0.6F)) - .uv(24, 66).cuboid(-9.5F, -2.0F, -3.75F, 19.0F, 7.0F, 7.0F, new Dilation(0.3F)), - ModelTransform.origin(0.0F, 0.0f, 0.0f)); - - ModelPartData cape = body.addChild("cape", ModelPartBuilder.create() - .uv(0, 32).mirrored().cuboid(-9F, 0.2F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.4F)).mirrored(false) - .uv(0, 94).mirrored().cuboid(-9F, 0.2F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.39F)).mirrored(false), - ModelTransform.origin(0.0F, 1.0f, 0.0f)); - - cape.addChild("cape_low", ModelPartBuilder.create() - .uv(0, 51).mirrored().cuboid(-9F, 0.2F, -3F, 18.0F, 9.0F, 6.0F, new Dilation(0.4F)).mirrored(false) - .uv(0, 113).mirrored().cuboid(-9F, 0.2F, -3F, 18.0F, 9.0F, 6.0F, new Dilation(0.39F)).mirrored(false), - ModelTransform.origin(0.0f, 13.3158f, 0.0f)); - - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_arm_shoulder_cape", ModelPartBuilder.create(). - uv(24, 16).cuboid(-3.5F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.8F)), - ModelTransform.origin(-0.0F, -0.0F, 0.0F)); - - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_arm_shoulder_cape", ModelPartBuilder.create() - .uv(40, 16).mirrored().cuboid(-0.5F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.8F)).mirrored(false), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); - - ModelPartData right_leg = modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_leg.addChild("right_leg", ModelPartBuilder.create().uv(72, 16).cuboid(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData left_leg = modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_leg.addChild("left_leg", ModelPartBuilder.create().uv(56, 16).mirrored().cuboid(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - return TexturedModelData.of(modelData, 128, 128); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("cape_shoulder", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(0.0F, 23.0F, 0.016F)); + + body.addOrReplaceChild("fur", CubeListBuilder.create().texOffs(76, 68).addBox(-9.49F, -2.0F, -3.75F, 19.0F, 5.0F, 7.0F, new CubeDeformation(0.6F)) + .texOffs(24, 66).addBox(-9.5F, -2.0F, -3.75F, 19.0F, 7.0F, 7.0F, new CubeDeformation(0.3F)), + PartPose.offset(0.0F, 0.0f, 0.0f)); + + PartDefinition cape = body.addOrReplaceChild("cape", CubeListBuilder.create() + .texOffs(0, 32).mirror().addBox(-9F, 0.2F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.4F)).mirror(false) + .texOffs(0, 94).mirror().addBox(-9F, 0.2F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.39F)).mirror(false), + PartPose.offset(0.0F, 1.0f, 0.0f)); + + cape.addOrReplaceChild("cape_low", CubeListBuilder.create() + .texOffs(0, 51).mirror().addBox(-9F, 0.2F, -3F, 18.0F, 9.0F, 6.0F, new CubeDeformation(0.4F)).mirror(false) + .texOffs(0, 113).mirror().addBox(-9F, 0.2F, -3F, 18.0F, 9.0F, 6.0F, new CubeDeformation(0.39F)).mirror(false), + PartPose.offset(0.0f, 13.3158f, 0.0f)); + + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_arm_shoulder_cape", CubeListBuilder.create(). + texOffs(24, 16).addBox(-3.5F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.8F)), + PartPose.offset(-0.0F, -0.0F, 0.0F)); + + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_arm_shoulder_cape", CubeListBuilder.create() + .texOffs(40, 16).mirror().addBox(-0.5F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.8F)).mirror(false), + PartPose.offset(0.0F, -0.0F, 0.0F)); + + PartDefinition right_leg = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + right_leg.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(72, 16).addBox(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition left_leg = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + left_leg.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(56, 16).mirror().addBox(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/FurSurcoatModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/FurSurcoatModel.java index 63c1631508..b942d04058 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/FurSurcoatModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/FurSurcoatModel.java @@ -1,9 +1,16 @@ package net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.armored; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; import net.sevenstars.middleearth.client.model.equipment.chest.ChestplateAddonModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.world.entity.LivingEntity; public class FurSurcoatModel extends ChestplateAddonModel { @@ -11,51 +18,52 @@ public FurSurcoatModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - body.addChild("cape_shoulder", ModelPartBuilder.create().uv(0, 16).cuboid(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(0.0F, 23.0F, 0.016F)); - - body.addChild("fur", ModelPartBuilder.create().uv(76, 68).cuboid(-9.49F, -2.0F, -3.75F, 19.0F, 5.0F, 7.0F, new Dilation(0.6F)) - .uv(24, 66).cuboid(-9.5F, -2.0F, -3.75F, 19.0F, 7.0F, 7.0F, new Dilation(0.3F)), - ModelTransform.origin(0.0F, 0.0f, 0.0f)); - - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_arm_shoulder_cape", ModelPartBuilder.create(). - uv(24, 16).cuboid(-3.5F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.8F)), - ModelTransform.origin(-0.0F, -0.0F, 0.0F)); - - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_arm_shoulder_cape", ModelPartBuilder.create() - .uv(40, 16).mirrored().cuboid(-0.5F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.8F)).mirrored(false), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); - - ModelPartData right_leg = modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_leg.addChild("right_leg", ModelPartBuilder.create().uv(72, 16).cuboid(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData left_leg = modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_leg.addChild("left_leg", ModelPartBuilder.create().uv(56, 16).mirrored().cuboid(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - return TexturedModelData.of(modelData, 128, 128); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("cape_shoulder", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(0.0F, 23.0F, 0.016F)); + + body.addOrReplaceChild("fur", CubeListBuilder.create().texOffs(76, 68).addBox(-9.49F, -2.0F, -3.75F, 19.0F, 5.0F, 7.0F, new CubeDeformation(0.6F)) + .texOffs(24, 66).addBox(-9.5F, -2.0F, -3.75F, 19.0F, 7.0F, 7.0F, new CubeDeformation(0.3F)), + PartPose.offset(0.0F, 0.0f, 0.0f)); + + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_arm_shoulder_cape", CubeListBuilder.create(). + texOffs(24, 16).addBox(-3.5F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.8F)), + PartPose.offset(-0.0F, -0.0F, 0.0F)); + + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_arm_shoulder_cape", CubeListBuilder.create() + .texOffs(40, 16).mirror().addBox(-0.5F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.8F)).mirror(false), + PartPose.offset(0.0F, -0.0F, 0.0F)); + + PartDefinition right_leg = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_leg.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(72, 16).addBox(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition left_leg = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_leg.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(56, 16).mirror().addBox(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(modelData, 128, 128); } @Override - public void setAngles(BipedEntityRenderState bipedEntityRenderState) { - super.setAngles(bipedEntityRenderState); + public void setupAnim(LivingEntity entity, float limbAngle, float limbDistance, + float animationProgress, float headYaw, float headPitch) { + super.setupAnim(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/NazgulRobesModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/NazgulRobesModel.java index a2686c436f..1474a2d115 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/NazgulRobesModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/NazgulRobesModel.java @@ -2,7 +2,14 @@ import net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.CloakCapeModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class NazgulRobesModel extends CloakCapeModel { @@ -10,57 +17,57 @@ public NazgulRobesModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - body.addChild("cape_shoulder", ModelPartBuilder.create().uv(0, 16).cuboid(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(0.0F, 23.0F, 0.016F)); + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("cape_shoulder", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(0.0F, 23.0F, 0.016F)); - body.addChild("fur", ModelPartBuilder.create().uv(24, 66).cuboid(-9.5F, -2.0F, -3.75F, 19.0F, 7.0F, 7.0F, new Dilation(0.3F)), - ModelTransform.origin(0.0F, 0.0f, 0.0f)); + body.addOrReplaceChild("fur", CubeListBuilder.create().texOffs(24, 66).addBox(-9.5F, -2.0F, -3.75F, 19.0F, 7.0F, 7.0F, new CubeDeformation(0.3F)), + PartPose.offset(0.0F, 0.0f, 0.0f)); - ModelPartData cape = body.addChild("cape", ModelPartBuilder.create() - .uv(53, 32).mirrored().cuboid(-6.5F, 0.0F, -2F, 13.0F, 13.0F, 5.0F, new Dilation(0.2F)).mirrored(false) - .uv(53, 94).mirrored().cuboid(-6.5F, 0.0F, -2F, 13.0F, 13.0F, 5.0F, new Dilation(0.19F)).mirrored(false) - .uv(0, 32).mirrored().cuboid(-9F, 0.0F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.4F)).mirrored(false) - .uv(0, 94).mirrored().cuboid(-9F, 0.0F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.39F)).mirrored(false), - ModelTransform.origin(0.0F, 1.0F, 0.0F)); + PartDefinition cape = body.addOrReplaceChild("cape", CubeListBuilder.create() + .texOffs(53, 32).mirror().addBox(-6.5F, 0.0F, -2F, 13.0F, 13.0F, 5.0F, new CubeDeformation(0.2F)).mirror(false) + .texOffs(53, 94).mirror().addBox(-6.5F, 0.0F, -2F, 13.0F, 13.0F, 5.0F, new CubeDeformation(0.19F)).mirror(false) + .texOffs(0, 32).mirror().addBox(-9F, 0.0F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.4F)).mirror(false) + .texOffs(0, 94).mirror().addBox(-9F, 0.0F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.39F)).mirror(false), + PartPose.offset(0.0F, 1.0F, 0.0F)); - cape.addChild("cape_low", ModelPartBuilder.create() - .uv(53, 50).mirrored().cuboid(-6.5F, 0.2F, -2F, 13.0F, 9.0F, 5.0F, new Dilation(0.2F)).mirrored(false) - .uv(53, 112).mirrored().cuboid(-6.5F, 0.2F, -2F, 13.0F, 9.0F, 5.0F, new Dilation(0.19F)).mirrored(false) - .uv(0, 51).mirrored().cuboid(-9F, 0.2F, -3F, 18.0F, 9.0F, 6.0F, new Dilation(0.4F)).mirrored(false) - .uv(0, 113).mirrored().cuboid(-9F, 0.2F, -3F, 18.0F, 9.0F, 6.0F, new Dilation(0.39F)).mirrored(false), - ModelTransform.origin(-0.0F, 13.1558F, 0.0F)); + cape.addOrReplaceChild("cape_low", CubeListBuilder.create() + .texOffs(53, 50).mirror().addBox(-6.5F, 0.2F, -2F, 13.0F, 9.0F, 5.0F, new CubeDeformation(0.2F)).mirror(false) + .texOffs(53, 112).mirror().addBox(-6.5F, 0.2F, -2F, 13.0F, 9.0F, 5.0F, new CubeDeformation(0.19F)).mirror(false) + .texOffs(0, 51).mirror().addBox(-9F, 0.2F, -3F, 18.0F, 9.0F, 6.0F, new CubeDeformation(0.4F)).mirror(false) + .texOffs(0, 113).mirror().addBox(-9F, 0.2F, -3F, 18.0F, 9.0F, 6.0F, new CubeDeformation(0.39F)).mirror(false), + PartPose.offset(-0.0F, 13.1558F, 0.0F)); - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_arm_shoulder_cape", ModelPartBuilder.create().uv(24, 16).cuboid(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(-0.0F, -0.0F, 0.0F)); + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_arm_shoulder_cape", CubeListBuilder.create().texOffs(24, 16).addBox(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(-0.0F, -0.0F, 0.0F)); - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_arm_shoulder_cape", ModelPartBuilder.create().uv(40, 16).mirrored().cuboid(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)).mirrored(false), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_arm_shoulder_cape", CubeListBuilder.create().texOffs(40, 16).mirror().addBox(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)).mirror(false), + PartPose.offset(0.0F, -0.0F, 0.0F)); - ModelPartData right_leg = modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_leg.addChild("right_leg", ModelPartBuilder.create().uv(72, 16).cuboid(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition right_leg = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_leg.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(72, 16).addBox(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData left_leg = modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_leg.addChild("left_leg", ModelPartBuilder.create().uv(56, 16).mirrored().cuboid(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(1.1F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition left_leg = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_leg.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(56, 16).mirror().addBox(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.1F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/SkullSpikesModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/SkullSpikesModel.java index ccb918a4c3..002f223a83 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/SkullSpikesModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/armored/SkullSpikesModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.armored; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.chest.ChestplateAddonModel; import net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.CloakCapeModel; @@ -11,72 +18,72 @@ public SkullSpikesModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData spears = body.addChild("spears", ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 4.0F, -0.5F)); - - ModelPartData rightspear = spears.addChild("right_spear_0", ModelPartBuilder.create(), - ModelTransform.of(-1.5F, 7.0F, 2.7F, -0.1745F, 0.0F, -0.3491F)); - rightspear.addChild("skull_right_0", ModelPartBuilder.create().uv(40, 0).cuboid(-3.0F, -41.0F, -3.0F, 6.0F, 7.0F, 6.0F, new Dilation(0.0F)) - .uv(40, 13).cuboid(-3.0F, -41.0F, -3.0F, 6.0F, 10.0F, 6.0F, new Dilation(0.2F)), - ModelTransform.origin(0.0F, 10.0F, -0.2F)); - rightspear.addChild("skull_right_1", ModelPartBuilder.create().uv(40, 0).cuboid(-3.0F, -3.5F, -3.0F, 6.0F, 7.0F, 6.0F, new Dilation(0.0F)) - .uv(40, 13).cuboid(-3.0F, -3.5F, -3.0F, 6.0F, 10.0F, 6.0F, new Dilation(0.2F)), - ModelTransform.of(0.0F, -18.5F, -0.2F, 0.0F, 0.5236F, 0.0F)); - rightspear.addChild("cloth_right", ModelPartBuilder.create().uv(24, 0).cuboid(-1.0F, -1.5F, 0.0F, 2.0F, 13.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(-0.3181F, -14.5411F, 1.0122F, 0.1745F, 0.0F, 0.3491F)); - - ModelPartData spears2 = rightspear.addChild("right_spear_1", ModelPartBuilder.create(), - ModelTransform.origin(-2.5F, -0.5F, -3.7F)); - spears2.addChild("right_spear_2", ModelPartBuilder.create().uv(16, 0).mirrored().cuboid(1.4329F, -23.6652F, 2.6678F, 2.0F, 31.0F, 2.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(0.0F, -10.0F, 0.0F, 0.0F, 0.0F, 0.0F)); - - ModelPartData leftspear = spears.addChild("left_spear_0", ModelPartBuilder.create(), - ModelTransform.of(1.5F, 7.0F, 2.7F, -0.1745F, 0.0F, 0.3491F)); - leftspear.addChild("skull_left_0", ModelPartBuilder.create().uv(40, 0).cuboid(-3.0F, -3.5F, -3.0F, 6.0F, 7.0F, 6.0F, new Dilation(0.0F)) - .uv(40, 13).cuboid(-3.0F, -3.5F, -3.0F, 6.0F, 10.0F, 6.0F, new Dilation(0.2F)), - ModelTransform.of(0.0F, -27.5F, -0.2F, 0.0F, 0.5236F, 0.0F)); - leftspear.addChild("rib_left", ModelPartBuilder.create().uv(39, 51).cuboid(-4.0F, -5.4F, -2.0F, 8.0F, 9.0F, 4.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, -18.5F, -0.2F)); - leftspear.addChild("cloth_left", ModelPartBuilder.create().uv(24, 0).mirrored().cuboid(-1.0F, -1.5F, 0.0F, 2.0F, 13.0F, 0.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(0.6819F, -19.5411F, 1.0122F, 0.1745F, 0.0F, -0.3491F)); - - ModelPartData spears6 = leftspear.addChild("left_spear_1", ModelPartBuilder.create(), - ModelTransform.origin(-2.5F, -0.5F, -3.7F)); - spears6.addChild("left_spear_2", ModelPartBuilder.create().uv(8, 0).mirrored().cuboid(1.4329F, -23.6652F, 2.6678F, 2.0F, 31.0F, 2.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(0.0F, -10.0F, 0.0F, 0.0F, 0.0F, 0.0F)); - - ModelPartData centrespear = spears.addChild("center_spear_0", ModelPartBuilder.create(), - ModelTransform.of(0.0F, 3.0F, 2.7F, -0.1309F, 0.0F, 0.0F)); - centrespear.addChild("skull_center", ModelPartBuilder.create().uv(40, 0).cuboid(-3.0F, -41.0F, -3.0F, 6.0F, 7.0F, 6.0F, new Dilation(0.0F)) - .uv(40, 13).cuboid(-3.0F, -41.0F, -3.0F, 6.0F, 10.0F, 6.0F, new Dilation(0.2F)), - ModelTransform.origin(0.0F, 10.0F, -0.2F)); - centrespear.addChild("rib_center", ModelPartBuilder.create().uv(36, 38).cuboid(-5.0F, -5.4F, -1.0F, 10.0F, 9.0F, 4.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, -18.5F, -0.2F)); - - ModelPartData spears3 = centrespear.addChild("center_spear_1", ModelPartBuilder.create(), - ModelTransform.origin(-2.5F, -0.5F, -3.7F)); - spears3.addChild("center_spear_2", ModelPartBuilder.create().uv(0, 0).mirrored().cuboid(1.4329F, -23.6652F, 2.6678F, 2.0F, 35.0F, 2.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(0.0F, -10.0F, 0.0F, 0.0F, 0.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition spears = body.addOrReplaceChild("spears", CubeListBuilder.create(), + PartPose.offset(0.0F, 4.0F, -0.5F)); + + PartDefinition rightspear = spears.addOrReplaceChild("right_spear_0", CubeListBuilder.create(), + PartPose.offsetAndRotation(-1.5F, 7.0F, 2.7F, -0.1745F, 0.0F, -0.3491F)); + rightspear.addOrReplaceChild("skull_right_0", CubeListBuilder.create().texOffs(40, 0).addBox(-3.0F, -41.0F, -3.0F, 6.0F, 7.0F, 6.0F, new CubeDeformation(0.0F)) + .texOffs(40, 13).addBox(-3.0F, -41.0F, -3.0F, 6.0F, 10.0F, 6.0F, new CubeDeformation(0.2F)), + PartPose.offset(0.0F, 10.0F, -0.2F)); + rightspear.addOrReplaceChild("skull_right_1", CubeListBuilder.create().texOffs(40, 0).addBox(-3.0F, -3.5F, -3.0F, 6.0F, 7.0F, 6.0F, new CubeDeformation(0.0F)) + .texOffs(40, 13).addBox(-3.0F, -3.5F, -3.0F, 6.0F, 10.0F, 6.0F, new CubeDeformation(0.2F)), + PartPose.offsetAndRotation(0.0F, -18.5F, -0.2F, 0.0F, 0.5236F, 0.0F)); + rightspear.addOrReplaceChild("cloth_right", CubeListBuilder.create().texOffs(24, 0).addBox(-1.0F, -1.5F, 0.0F, 2.0F, 13.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-0.3181F, -14.5411F, 1.0122F, 0.1745F, 0.0F, 0.3491F)); + + PartDefinition spears2 = rightspear.addOrReplaceChild("right_spear_1", CubeListBuilder.create(), + PartPose.offset(-2.5F, -0.5F, -3.7F)); + spears2.addOrReplaceChild("right_spear_2", CubeListBuilder.create().texOffs(16, 0).mirror().addBox(1.4329F, -23.6652F, 2.6678F, 2.0F, 31.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(0.0F, -10.0F, 0.0F, 0.0F, 0.0F, 0.0F)); + + PartDefinition leftspear = spears.addOrReplaceChild("left_spear_0", CubeListBuilder.create(), + PartPose.offsetAndRotation(1.5F, 7.0F, 2.7F, -0.1745F, 0.0F, 0.3491F)); + leftspear.addOrReplaceChild("skull_left_0", CubeListBuilder.create().texOffs(40, 0).addBox(-3.0F, -3.5F, -3.0F, 6.0F, 7.0F, 6.0F, new CubeDeformation(0.0F)) + .texOffs(40, 13).addBox(-3.0F, -3.5F, -3.0F, 6.0F, 10.0F, 6.0F, new CubeDeformation(0.2F)), + PartPose.offsetAndRotation(0.0F, -27.5F, -0.2F, 0.0F, 0.5236F, 0.0F)); + leftspear.addOrReplaceChild("rib_left", CubeListBuilder.create().texOffs(39, 51).addBox(-4.0F, -5.4F, -2.0F, 8.0F, 9.0F, 4.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, -18.5F, -0.2F)); + leftspear.addOrReplaceChild("cloth_left", CubeListBuilder.create().texOffs(24, 0).mirror().addBox(-1.0F, -1.5F, 0.0F, 2.0F, 13.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(0.6819F, -19.5411F, 1.0122F, 0.1745F, 0.0F, -0.3491F)); + + PartDefinition spears6 = leftspear.addOrReplaceChild("left_spear_1", CubeListBuilder.create(), + PartPose.offset(-2.5F, -0.5F, -3.7F)); + spears6.addOrReplaceChild("left_spear_2", CubeListBuilder.create().texOffs(8, 0).mirror().addBox(1.4329F, -23.6652F, 2.6678F, 2.0F, 31.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(0.0F, -10.0F, 0.0F, 0.0F, 0.0F, 0.0F)); + + PartDefinition centrespear = spears.addOrReplaceChild("center_spear_0", CubeListBuilder.create(), + PartPose.offsetAndRotation(0.0F, 3.0F, 2.7F, -0.1309F, 0.0F, 0.0F)); + centrespear.addOrReplaceChild("skull_center", CubeListBuilder.create().texOffs(40, 0).addBox(-3.0F, -41.0F, -3.0F, 6.0F, 7.0F, 6.0F, new CubeDeformation(0.0F)) + .texOffs(40, 13).addBox(-3.0F, -41.0F, -3.0F, 6.0F, 10.0F, 6.0F, new CubeDeformation(0.2F)), + PartPose.offset(0.0F, 10.0F, -0.2F)); + centrespear.addOrReplaceChild("rib_center", CubeListBuilder.create().texOffs(36, 38).addBox(-5.0F, -5.4F, -1.0F, 10.0F, 9.0F, 4.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, -18.5F, -0.2F)); + + PartDefinition spears3 = centrespear.addOrReplaceChild("center_spear_1", CubeListBuilder.create(), + PartPose.offset(-2.5F, -0.5F, -3.7F)); + spears3.addOrReplaceChild("center_spear_2", CubeListBuilder.create().texOffs(0, 0).mirror().addBox(1.4329F, -23.6652F, 2.6678F, 2.0F, 35.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(0.0F, -10.0F, 0.0F, 0.0F, 0.0F, 0.0F)); + + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(modelData, 64, 64); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeMediumModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeMediumModel.java index 283fbbbb39..15ad7ea724 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeMediumModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeMediumModel.java @@ -2,7 +2,14 @@ import net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.CloakCapeModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class UnarmoredCapeMediumModel extends CloakCapeModel { @@ -10,50 +17,50 @@ public UnarmoredCapeMediumModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - body.addChild("cape_shoulder", ModelPartBuilder.create().uv(0, 16).cuboid(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 23.0F, 0.016F)); - - ModelPartData cape = body.addChild("cape", ModelPartBuilder.create() - .uv(53, 32).mirrored().cuboid(-6.5F, -0.5F, -1F, 13.0F, 13.0F, 5.0F, new Dilation(0.2F)).mirrored(false) - .uv(53, 94).mirrored().cuboid(-6.5F, -0.5F, -1F, 13.0F, 13.0F, 5.0F, new Dilation(0.19F)).mirrored(false), - ModelTransform.origin(0.0F, 1.0F, 0.0F)); - - cape.addChild("cape_low", ModelPartBuilder.create() - .uv(53, 50).mirrored().cuboid(-6.5F, -0.3F, -1F, 13.0F, 10.0F, 5.0F, new Dilation(0.2F)).mirrored(false) - .uv(53, 112).mirrored().cuboid(-6.5F, -0.3F, -1F, 13.0F, 10.0F, 5.0F, new Dilation(0.19F)).mirrored(false), - ModelTransform.origin(-0.0F, 13.1558F, 0.0F)); - - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_arm_shoulder_cape", ModelPartBuilder.create().uv(24, 16).cuboid(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)), - ModelTransform.origin(-0.0F, -0.0F, 0.0F)); - - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_arm_shoulder_cape", ModelPartBuilder.create().uv(40, 16).mirrored().cuboid(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)).mirrored(false), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); - - ModelPartData right_leg = modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_leg.addChild("right_leg", ModelPartBuilder.create().uv(72, 16).cuboid(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData left_leg = modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_leg.addChild("left_leg", ModelPartBuilder.create().uv(56, 16).mirrored().cuboid(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - return TexturedModelData.of(modelData, 128, 128); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("cape_shoulder", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 23.0F, 0.016F)); + + PartDefinition cape = body.addOrReplaceChild("cape", CubeListBuilder.create() + .texOffs(53, 32).mirror().addBox(-6.5F, -0.5F, -1F, 13.0F, 13.0F, 5.0F, new CubeDeformation(0.2F)).mirror(false) + .texOffs(53, 94).mirror().addBox(-6.5F, -0.5F, -1F, 13.0F, 13.0F, 5.0F, new CubeDeformation(0.19F)).mirror(false), + PartPose.offset(0.0F, 1.0F, 0.0F)); + + cape.addOrReplaceChild("cape_low", CubeListBuilder.create() + .texOffs(53, 50).mirror().addBox(-6.5F, -0.3F, -1F, 13.0F, 10.0F, 5.0F, new CubeDeformation(0.2F)).mirror(false) + .texOffs(53, 112).mirror().addBox(-6.5F, -0.3F, -1F, 13.0F, 10.0F, 5.0F, new CubeDeformation(0.19F)).mirror(false), + PartPose.offset(-0.0F, 13.1558F, 0.0F)); + + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_arm_shoulder_cape", CubeListBuilder.create().texOffs(24, 16).addBox(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)), + PartPose.offset(-0.0F, -0.0F, 0.0F)); + + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_arm_shoulder_cape", CubeListBuilder.create().texOffs(40, 16).mirror().addBox(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)).mirror(false), + PartPose.offset(0.0F, -0.0F, 0.0F)); + + PartDefinition right_leg = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_leg.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(72, 16).addBox(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition left_leg = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_leg.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(56, 16).mirror().addBox(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeSlimModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeSlimModel.java index 8a6ad475fb..cf47545a9d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeSlimModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeSlimModel.java @@ -2,7 +2,14 @@ import net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.CloakCapeModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class UnarmoredCapeSlimModel extends CloakCapeModel { @@ -10,50 +17,50 @@ public UnarmoredCapeSlimModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - body.addChild("cape_shoulder", ModelPartBuilder.create().uv(0, 16).cuboid(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 23.0F, 0.016F)); - - ModelPartData cape = body.addChild("cape", ModelPartBuilder.create() - .uv(92, 32).mirrored().cuboid(-5.5F, -4.5F, -1F, 11.0F, 13.0F, 5.0F, new Dilation(0.2F)).mirrored(false) - .uv(92, 94).mirrored().cuboid(-5.5F, -4.5F, -1F, 11.0F, 13.0F, 5.0F, new Dilation(0.19F)).mirrored(false), - ModelTransform.origin(0.0F, 4.0F, 0.0F)); - - cape.addChild("cape_low", ModelPartBuilder.create() - .uv(92, 50).mirrored().cuboid(-5.5F, -4.3F, -1F, 11.0F, 13.0F, 5.0F, new Dilation(0.2F)).mirrored(false) - .uv(92, 112).mirrored().cuboid(-5.5F, -4.3F, -1F, 11.0F, 13.0F, 5.0F, new Dilation(0.19F)).mirrored(false), - ModelTransform.origin(0.0F, 13.1558F, 0.0F)); - - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_arm_shoulder_cape", ModelPartBuilder.create().uv(24, 16).cuboid(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)), - ModelTransform.origin(-0.0F, -0.0F, 0.0F)); - - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_arm_shoulder_cape", ModelPartBuilder.create().uv(40, 16).mirrored().cuboid(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)).mirrored(false), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); - - ModelPartData right_leg = modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_leg.addChild("right_leg", ModelPartBuilder.create().uv(72, 16).cuboid(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData left_leg = modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_leg.addChild("left_leg", ModelPartBuilder.create().uv(56, 16).mirrored().cuboid(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - return TexturedModelData.of(modelData, 128, 128); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("cape_shoulder", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 23.0F, 0.016F)); + + PartDefinition cape = body.addOrReplaceChild("cape", CubeListBuilder.create() + .texOffs(92, 32).mirror().addBox(-5.5F, -4.5F, -1F, 11.0F, 13.0F, 5.0F, new CubeDeformation(0.2F)).mirror(false) + .texOffs(92, 94).mirror().addBox(-5.5F, -4.5F, -1F, 11.0F, 13.0F, 5.0F, new CubeDeformation(0.19F)).mirror(false), + PartPose.offset(0.0F, 4.0F, 0.0F)); + + cape.addOrReplaceChild("cape_low", CubeListBuilder.create() + .texOffs(92, 50).mirror().addBox(-5.5F, -4.3F, -1F, 11.0F, 13.0F, 5.0F, new CubeDeformation(0.2F)).mirror(false) + .texOffs(92, 112).mirror().addBox(-5.5F, -4.3F, -1F, 11.0F, 13.0F, 5.0F, new CubeDeformation(0.19F)).mirror(false), + PartPose.offset(0.0F, 13.1558F, 0.0F)); + + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_arm_shoulder_cape", CubeListBuilder.create().texOffs(24, 16).addBox(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)), + PartPose.offset(-0.0F, -0.0F, 0.0F)); + + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_arm_shoulder_cape", CubeListBuilder.create().texOffs(40, 16).mirror().addBox(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)).mirror(false), + PartPose.offset(0.0F, -0.0F, 0.0F)); + + PartDefinition right_leg = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_leg.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(72, 16).addBox(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition left_leg = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_leg.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(56, 16).mirror().addBox(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeSurcoatModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeSurcoatModel.java index 4af9565adb..b5735adf64 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeSurcoatModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeSurcoatModel.java @@ -1,9 +1,16 @@ package net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.unarmored; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; import net.sevenstars.middleearth.client.model.equipment.chest.ChestplateAddonModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.world.entity.LivingEntity; public class UnarmoredCapeSurcoatModel extends ChestplateAddonModel { @@ -11,43 +18,45 @@ public UnarmoredCapeSurcoatModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - body.addChild("cape_shoulder", ModelPartBuilder.create().uv(0, 16).cuboid(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 23.0F, 0.016F)); - - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_arm_shoulder_cape", ModelPartBuilder.create().uv(24, 16).cuboid(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)), - ModelTransform.origin(-0.0F, -0.0F, 0.0F)); - - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_arm_shoulder_cape", ModelPartBuilder.create().uv(40, 16).mirrored().cuboid(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)).mirrored(false), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); - - ModelPartData right_leg = modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_leg.addChild("right_leg", ModelPartBuilder.create().uv(72, 16).cuboid(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData left_leg = modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_leg.addChild("left_leg", ModelPartBuilder.create().uv(56, 16).mirrored().cuboid(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - return TexturedModelData.of(modelData, 128, 128); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("cape_shoulder", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 23.0F, 0.016F)); + + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_arm_shoulder_cape", CubeListBuilder.create().texOffs(24, 16).addBox(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)), + PartPose.offset(-0.0F, -0.0F, 0.0F)); + + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_arm_shoulder_cape", CubeListBuilder.create().texOffs(40, 16).mirror().addBox(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)).mirror(false), + PartPose.offset(0.0F, -0.0F, 0.0F)); + + PartDefinition right_leg = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_leg.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(72, 16).addBox(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition left_leg = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_leg.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(56, 16).mirror().addBox(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(modelData, 128, 128); } @Override - public void setAngles(BipedEntityRenderState bipedEntityRenderState) {} + public void setupAnim(LivingEntity entity, float limbAngle, float limbDistance, + float animationProgress, float headYaw, float headPitch) { + } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeWideModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeWideModel.java index ad84599a1d..4c771c30e5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeWideModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeWideModel.java @@ -2,7 +2,14 @@ import net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.CloakCapeModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class UnarmoredCapeWideModel extends CloakCapeModel { @@ -10,46 +17,46 @@ public UnarmoredCapeWideModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - body.addChild("cape_shoulder", ModelPartBuilder.create().uv(0, 16).cuboid(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 23.0F, 0.016F)); + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("cape_shoulder", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 23.0F, 0.016F)); - ModelPartData cape = body.addChild("cape", ModelPartBuilder.create() - .uv(0, 32).mirrored().cuboid(-9F, -0.5F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.4F)).mirrored(false) - .uv(0, 94).mirrored().cuboid(-9F, -0.5F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.39F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0f, 0.0f)); + PartDefinition cape = body.addOrReplaceChild("cape", CubeListBuilder.create() + .texOffs(0, 32).mirror().addBox(-9F, -0.5F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.4F)).mirror(false) + .texOffs(0, 94).mirror().addBox(-9F, -0.5F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.39F)).mirror(false), + PartPose.offset(0.0F, 0.0f, 0.0f)); - cape.addChild("cape_low", ModelPartBuilder.create() - .uv(0, 51).mirrored().cuboid(-9F, -0.3F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.4F)).mirrored(false) - .uv(0, 113).mirrored().cuboid(-9F, -0.3F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.39F)).mirrored(false), - ModelTransform.origin(0.0f, 13.3158f, 0.0f)); + cape.addOrReplaceChild("cape_low", CubeListBuilder.create() + .texOffs(0, 51).mirror().addBox(-9F, -0.3F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.4F)).mirror(false) + .texOffs(0, 113).mirror().addBox(-9F, -0.3F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.39F)).mirror(false), + PartPose.offset(0.0f, 13.3158f, 0.0f)); - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_arm_shoulder_cape", ModelPartBuilder.create().uv(24, 16).cuboid(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.35F)), - ModelTransform.origin(-0.0F, -0.0F, 0.0F)); + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_arm_shoulder_cape", CubeListBuilder.create().texOffs(24, 16).addBox(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.35F)), + PartPose.offset(-0.0F, -0.0F, 0.0F)); - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_arm_shoulder_cape", ModelPartBuilder.create().uv(40, 16).mirrored().cuboid(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.35F)).mirrored(false), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_arm_shoulder_cape", CubeListBuilder.create().texOffs(40, 16).mirror().addBox(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.35F)).mirror(false), + PartPose.offset(0.0F, -0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeWidePauldronModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeWidePauldronModel.java index f44a3927f9..11505945b4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeWidePauldronModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredCapeWidePauldronModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.unarmored; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.CloakCapeModel; public class UnarmoredCapeWidePauldronModel extends CloakCapeModel { @@ -10,51 +17,51 @@ public UnarmoredCapeWidePauldronModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - body.addChild("cape_shoulder", ModelPartBuilder.create().uv(0, 16).cuboid(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 23.0F, 0.016F)); + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("cape_shoulder", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 23.0F, 0.016F)); - ModelPartData cape = body.addChild("cape", ModelPartBuilder.create() - .uv(0, 32).mirrored().cuboid(-9F, -0.5F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.4F)).mirrored(false) - .uv(0, 94).mirrored().cuboid(-9F, -0.5F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.39F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0f, 0.0f)); + PartDefinition cape = body.addOrReplaceChild("cape", CubeListBuilder.create() + .texOffs(0, 32).mirror().addBox(-9F, -0.5F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.4F)).mirror(false) + .texOffs(0, 94).mirror().addBox(-9F, -0.5F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.39F)).mirror(false), + PartPose.offset(0.0F, 0.0f, 0.0f)); - cape.addChild("cape_low", ModelPartBuilder.create() - .uv(0, 51).mirrored().cuboid(-9F, -0.3F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.4F)).mirrored(false) - .uv(0, 113).mirrored().cuboid(-9F, -0.3F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.39F)).mirrored(false), - ModelTransform.origin(0.0f, 13.3158f, 0.0f)); + cape.addOrReplaceChild("cape_low", CubeListBuilder.create() + .texOffs(0, 51).mirror().addBox(-9F, -0.3F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.4F)).mirror(false) + .texOffs(0, 113).mirror().addBox(-9F, -0.3F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.39F)).mirror(false), + PartPose.offset(0.0f, 13.3158f, 0.0f)); - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_arm_shoulder_cape", ModelPartBuilder.create().uv(24, 16).cuboid(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)), - ModelTransform.origin(-0.0F, -0.0F, 0.0F)); - right_arm.addChild("right_pauldron", ModelPartBuilder.create().uv(0, 81).cuboid(-3.0F, -2.0F, -1.92F, 4.0F, 12.0F, 4.0F, new Dilation(1.4F)), - ModelTransform.origin(-0.58F, -1.0F, 0.0F)); + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_arm_shoulder_cape", CubeListBuilder.create().texOffs(24, 16).addBox(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)), + PartPose.offset(-0.0F, -0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_pauldron", CubeListBuilder.create().texOffs(0, 81).addBox(-3.0F, -2.0F, -1.92F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.4F)), + PartPose.offset(-0.58F, -1.0F, 0.0F)); - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_arm_shoulder_cape", ModelPartBuilder.create().uv(40, 16).mirrored().cuboid(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)).mirrored(false), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); - left_arm.addChild("left_pauldron", ModelPartBuilder.create().uv(16, 81).mirrored().cuboid(-1.0F, -2.0F, -1.92F, 4.0F, 12.0F, 4.0F, new Dilation(1.4F)).mirrored(false), - ModelTransform.origin(0.5F, -1.0F, 0.0F)); + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_arm_shoulder_cape", CubeListBuilder.create().texOffs(40, 16).mirror().addBox(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)).mirror(false), + PartPose.offset(0.0F, -0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_pauldron", CubeListBuilder.create().texOffs(16, 81).mirror().addBox(-1.0F, -2.0F, -1.92F, 4.0F, 12.0F, 4.0F, new CubeDeformation(1.4F)).mirror(false), + PartPose.offset(0.5F, -1.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredFurCapeModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredFurCapeModel.java index 94998973be..d54c872b5b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredFurCapeModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredFurCapeModel.java @@ -2,7 +2,14 @@ import net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.CloakCapeModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class UnarmoredFurCapeModel extends CloakCapeModel { @@ -10,54 +17,54 @@ public UnarmoredFurCapeModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - body.addChild("cape_shoulder", ModelPartBuilder.create().uv(0, 16).cuboid(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 23.0F, 0.016F)); - - body.addChild("fur", ModelPartBuilder.create() - .uv(76, 68).cuboid(-9.49F, -2.0F, -3.75F, 19.0F, 5.0F, 7.0F, new Dilation(0.3F)) - .uv(24, 66).cuboid(-9.5F, -2.0F, -3.75F, 19.0F, 7.0F, 7.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, 0.0f, 0.0f)); - - ModelPartData cape = body.addChild("cape", ModelPartBuilder.create() - .uv(0, 32).mirrored().cuboid(-9F, 0.5F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.4F)).mirrored(false) - .uv(0, 94).mirrored().cuboid(-9F, 0.5F, -3F, 18.0F, 13.0F, 6.0F, new Dilation(0.39F)).mirrored(false), - ModelTransform.origin(0.0F, 1.0f, 0.0f)); - - cape.addChild("cape_low", ModelPartBuilder.create() - .uv(0, 51).mirrored().cuboid(-9F, 0.7F, -3F, 18.0F, 9.0F, 6.0F, new Dilation(0.4F)).mirrored(false) - .uv(0, 113).mirrored().cuboid(-9F, 0.7F, -3F, 18.0F, 9.0F, 6.0F, new Dilation(0.39F)).mirrored(false), - ModelTransform.origin(0.0f, 13.3158f, 0.0f)); - - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_arm_shoulder_cape", ModelPartBuilder.create().uv(24, 16).cuboid(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.25F)), - ModelTransform.origin(-0.0F, -0.0F, 0.0F)); - - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_arm_shoulder_cape", ModelPartBuilder.create().uv(40, 16).mirrored().cuboid(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.25F)).mirrored(false), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); - - ModelPartData right_leg = modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_leg.addChild("right_leg", ModelPartBuilder.create().uv(72, 16).cuboid(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData left_leg = modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_leg.addChild("left_leg", ModelPartBuilder.create().uv(56, 16).mirrored().cuboid(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - return TexturedModelData.of(modelData, 128, 128); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("cape_shoulder", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 23.0F, 0.016F)); + + body.addOrReplaceChild("fur", CubeListBuilder.create() + .texOffs(76, 68).addBox(-9.49F, -2.0F, -3.75F, 19.0F, 5.0F, 7.0F, new CubeDeformation(0.3F)) + .texOffs(24, 66).addBox(-9.5F, -2.0F, -3.75F, 19.0F, 7.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0f, 0.0f)); + + PartDefinition cape = body.addOrReplaceChild("cape", CubeListBuilder.create() + .texOffs(0, 32).mirror().addBox(-9F, 0.5F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.4F)).mirror(false) + .texOffs(0, 94).mirror().addBox(-9F, 0.5F, -3F, 18.0F, 13.0F, 6.0F, new CubeDeformation(0.39F)).mirror(false), + PartPose.offset(0.0F, 1.0f, 0.0f)); + + cape.addOrReplaceChild("cape_low", CubeListBuilder.create() + .texOffs(0, 51).mirror().addBox(-9F, 0.7F, -3F, 18.0F, 9.0F, 6.0F, new CubeDeformation(0.4F)).mirror(false) + .texOffs(0, 113).mirror().addBox(-9F, 0.7F, -3F, 18.0F, 9.0F, 6.0F, new CubeDeformation(0.39F)).mirror(false), + PartPose.offset(0.0f, 13.3158f, 0.0f)); + + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_arm_shoulder_cape", CubeListBuilder.create().texOffs(24, 16).addBox(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), + PartPose.offset(-0.0F, -0.0F, 0.0F)); + + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_arm_shoulder_cape", CubeListBuilder.create().texOffs(40, 16).mirror().addBox(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)).mirror(false), + PartPose.offset(0.0F, -0.0F, 0.0F)); + + PartDefinition right_leg = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_leg.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(72, 16).addBox(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition left_leg = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_leg.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(56, 16).mirror().addBox(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredFurSurcoatModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredFurSurcoatModel.java index 26e88e0a0a..77340add6f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredFurSurcoatModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/chest/backAttachments/unarmored/UnarmoredFurSurcoatModel.java @@ -1,9 +1,16 @@ package net.sevenstars.middleearth.client.model.equipment.chest.backAttachments.unarmored; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; import net.sevenstars.middleearth.client.model.equipment.chest.ChestplateAddonModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.world.entity.LivingEntity; public class UnarmoredFurSurcoatModel extends ChestplateAddonModel { @@ -11,50 +18,51 @@ public UnarmoredFurSurcoatModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData body = modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - body.addChild("cape_shoulder", ModelPartBuilder.create().uv(0, 16).cuboid(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 23.0F, 0.016F)); - - body.addChild("fur", ModelPartBuilder.create() - .uv(76, 68).cuboid(-9.49F, -2.0F, -3.75F, 19.0F, 5.0F, 7.0F, new Dilation(0.3F)) - .uv(24, 66).cuboid(-9.5F, -2.0F, -3.75F, 19.0F, 7.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0f, 0.0f)); - - ModelPartData right_arm = modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_arm.addChild("right_arm_shoulder_cape", ModelPartBuilder.create().uv(24, 16).cuboid(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.25F)), - ModelTransform.origin(-0.0F, -0.0F, 0.0F)); - - ModelPartData left_arm = modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_arm.addChild("left_arm_shoulder_cape", ModelPartBuilder.create().uv(40, 16).mirrored().cuboid(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.25F)).mirrored(false), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); - - ModelPartData right_leg = modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - right_leg.addChild("right_leg", ModelPartBuilder.create().uv(72, 16).cuboid(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData left_leg = modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - left_leg.addChild("left_leg", ModelPartBuilder.create().uv(56, 16).mirrored().cuboid(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.55F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - return TexturedModelData.of(modelData, 128, 128); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition body = modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + body.addOrReplaceChild("cape_shoulder", CubeListBuilder.create().texOffs(0, 16).addBox(-4.0F, -23.5F, -2.0F, 8.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 23.0F, 0.016F)); + + body.addOrReplaceChild("fur", CubeListBuilder.create() + .texOffs(76, 68).addBox(-9.49F, -2.0F, -3.75F, 19.0F, 5.0F, 7.0F, new CubeDeformation(0.3F)) + .texOffs(24, 66).addBox(-9.5F, -2.0F, -3.75F, 19.0F, 7.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0f, 0.0f)); + + PartDefinition right_arm = modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_arm.addOrReplaceChild("right_arm_shoulder_cape", CubeListBuilder.create().texOffs(24, 16).addBox(-4.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)), + PartPose.offset(-0.0F, -0.0F, 0.0F)); + + PartDefinition left_arm = modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_arm.addOrReplaceChild("left_arm_shoulder_cape", CubeListBuilder.create().texOffs(40, 16).mirror().addBox(0.0F, -2.5F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.25F)).mirror(false), + PartPose.offset(0.0F, -0.0F, 0.0F)); + + PartDefinition right_leg = modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + right_leg.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(72, 16).addBox(-2.1F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition left_leg = modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + left_leg.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(56, 16).mirror().addBox(-1.968F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.55F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(modelData, 128, 128); } @Override - public void setAngles(BipedEntityRenderState bipedEntityRenderState) { - super.setAngles(bipedEntityRenderState); + public void setupAnim(LivingEntity entity, float limbAngle, float limbDistance, + float animationProgress, float headYaw, float headPitch) { + super.setupAnim(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/CloakHoodModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/CloakHoodModel.java index 89d543eb6b..cac878f712 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/CloakHoodModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/CloakHoodModel.java @@ -1,7 +1,7 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmetAttachments; +import net.minecraft.client.model.geom.ModelPart; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; -import net.minecraft.client.model.ModelPart; public class CloakHoodModel extends HelmetAddonModel { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/FurHoodDownModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/FurHoodDownModel.java index f6b6fbf26a..6553db777d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/FurHoodDownModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/FurHoodDownModel.java @@ -2,7 +2,14 @@ import net.sevenstars.middleearth.client.model.equipment.head.helmetAttachments.CloakHoodModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class FurHoodDownModel extends CloakHoodModel { @@ -10,39 +17,39 @@ public FurHoodDownModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - ModelPartData hat = head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition hat = modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData hood = hat.addChild("helmetAttachment", ModelPartBuilder.create().uv(0, 73).cuboid(-4.0F, -9.0F, -4.376F, 8.0F, 5.0F, 2.0F, new Dilation(0.1F)), ModelTransform.origin(0.0F, -0.0F, 0.0F)); + PartDefinition hood = hat.addOrReplaceChild("helmetAttachment", CubeListBuilder.create().texOffs(0, 73).addBox(-4.0F, -9.0F, -4.376F, 8.0F, 5.0F, 2.0F, new CubeDeformation(0.1F)), PartPose.offset(0.0F, -0.0F, 0.0F)); - ModelPartData furHood = hood.addChild("fur_hood", ModelPartBuilder.create(), ModelTransform.of(0.0F, -6.5F, -3.5F, 1.5708F, 0.0F, 0.0F)); + PartDefinition furHood = hood.addOrReplaceChild("fur_hood", CubeListBuilder.create(), PartPose.offsetAndRotation(0.0F, -6.5F, -3.5F, 1.5708F, 0.0F, 0.0F)); - ModelPartData down = furHood.addChild("down", ModelPartBuilder.create().uv(96, 0).cuboid(-4.0F, -6.0F, 0.75F, 8.0F, 8.0F, 8.0F, new Dilation(1.3F)) - .uv(64, 0).cuboid(-4.0F, -5.91F, 0.75F, 8.0F, 8.0F, 8.0F, new Dilation(1.0F)), ModelTransform.of(0.0F, 0.0F, -6.0F, -1.1345F, 0.0F, 0.0F)); + PartDefinition down = furHood.addOrReplaceChild("down", CubeListBuilder.create().texOffs(96, 0).addBox(-4.0F, -6.0F, 0.75F, 8.0F, 8.0F, 8.0F, new CubeDeformation(1.3F)) + .texOffs(64, 0).addBox(-4.0F, -5.91F, 0.75F, 8.0F, 8.0F, 8.0F, new CubeDeformation(1.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, -6.0F, -1.1345F, 0.0F, 0.0F)); - ModelPartData hoodDown = down.addChild("hood_down", ModelPartBuilder.create(), ModelTransform.of(-0.144F, 4.2857F, -1.716F, -1.5708F, 0.0F, 0.0F)); + PartDefinition hoodDown = down.addOrReplaceChild("hood_down", CubeListBuilder.create(), PartPose.offsetAndRotation(-0.144F, 4.2857F, -1.716F, -1.5708F, 0.0F, 0.0F)); - hoodDown.addChild("top", ModelPartBuilder.create().uv(112, 29).cuboid(-2.872F, -11.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new Dilation(0.5F)) - .uv(112, 26).cuboid(-2.856F, -11.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new Dilation(0.6F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - hoodDown.addChild("bottom", ModelPartBuilder.create().uv(112, 20).cuboid(-2.75F, -2.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new Dilation(0.5F)) - .uv(112, 23).cuboid(-2.718F, -2.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new Dilation(0.6F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - hoodDown.addChild("left", ModelPartBuilder.create().uv(100, 20).cuboid(3.6F, -11.2857F, -5.3F, 1.0F, 8.0F, 2.0F, new Dilation(0.5F)) - .uv(94, 20).cuboid(3.6F, -11.2857F, -5.3F, 1.0F, 8.0F, 2.0F, new Dilation(0.6F)), ModelTransform.origin(0.25F, 0.0F, 0.0F)); - hoodDown.addChild("right", ModelPartBuilder.create().uv(100, 20).mirrored().cuboid(-4.35F, -11.2857F, -5.3F, 1.0F, 8.0F, 2.0F, new Dilation(0.5F)).mirrored(false) - .uv(106, 20).cuboid(-4.35F, -11.2857F, -5.3F, 1.0F, 8.0F, 2.0F, new Dilation(0.6F)), ModelTransform.origin(-0.25F, 0.0F, 0.0F)); + hoodDown.addOrReplaceChild("top", CubeListBuilder.create().texOffs(112, 29).addBox(-2.872F, -11.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.5F)) + .texOffs(112, 26).addBox(-2.856F, -11.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.6F)), PartPose.offset(0.0F, 0.0F, 0.0F)); + hoodDown.addOrReplaceChild("bottom", CubeListBuilder.create().texOffs(112, 20).addBox(-2.75F, -2.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.5F)) + .texOffs(112, 23).addBox(-2.718F, -2.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.6F)), PartPose.offset(0.0F, 0.0F, 0.0F)); + hoodDown.addOrReplaceChild("left", CubeListBuilder.create().texOffs(100, 20).addBox(3.6F, -11.2857F, -5.3F, 1.0F, 8.0F, 2.0F, new CubeDeformation(0.5F)) + .texOffs(94, 20).addBox(3.6F, -11.2857F, -5.3F, 1.0F, 8.0F, 2.0F, new CubeDeformation(0.6F)), PartPose.offset(0.25F, 0.0F, 0.0F)); + hoodDown.addOrReplaceChild("right", CubeListBuilder.create().texOffs(100, 20).mirror().addBox(-4.35F, -11.2857F, -5.3F, 1.0F, 8.0F, 2.0F, new CubeDeformation(0.5F)).mirror(false) + .texOffs(106, 20).addBox(-4.35F, -11.2857F, -5.3F, 1.0F, 8.0F, 2.0F, new CubeDeformation(0.6F)), PartPose.offset(-0.25F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/FurHoodModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/FurHoodModel.java index 1283a495f0..3e78bfedbc 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/FurHoodModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/FurHoodModel.java @@ -2,7 +2,14 @@ import net.sevenstars.middleearth.client.model.equipment.head.helmetAttachments.CloakHoodModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class FurHoodModel extends CloakHoodModel { @@ -10,43 +17,43 @@ public FurHoodModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - ModelPartData hat = head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition hat = modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - hat.addChild("fur_hood", ModelPartBuilder.create() - .uv(32, 0).cuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(1.3F)) - .uv(0, 0).cuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(1.0F)), ModelTransform.of(0.0F, 0.0F, -0.0F, -0.0F, 0.0F, 0.0F)); + hat.addOrReplaceChild("fur_hood", CubeListBuilder.create() + .texOffs(32, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(1.3F)) + .texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(1.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, -0.0F, -0.0F, 0.0F, 0.0F)); - ModelPartData hood = hat.addChild("helmetAttachment", ModelPartBuilder.create(), ModelTransform.of(-0.14F, 2.65F, -0.0F, -0.0F, 0.0F, 0.0F)); + PartDefinition hood = hat.addOrReplaceChild("helmetAttachment", CubeListBuilder.create(), PartPose.offsetAndRotation(-0.14F, 2.65F, -0.0F, -0.0F, 0.0F, 0.0F)); - hood.addChild("top", ModelPartBuilder.create() - .uv(112, 29).cuboid(-2.872F, -11.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new Dilation(0.6F)) - .uv(112, 26).cuboid(-2.856F, -11.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new Dilation(0.7F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + hood.addOrReplaceChild("top", CubeListBuilder.create() + .texOffs(112, 29).addBox(-2.872F, -11.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.6F)) + .texOffs(112, 26).addBox(-2.856F, -11.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.7F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - hood.addChild("bottom", ModelPartBuilder.create() - .uv(112, 20).cuboid(-2.75F, -2.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new Dilation(0.6F)) - .uv(112, 23).cuboid(-2.718F, -2.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new Dilation(0.7F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + hood.addOrReplaceChild("bottom", CubeListBuilder.create() + .texOffs(112, 20).addBox(-2.75F, -2.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.6F)) + .texOffs(112, 23).addBox(-2.718F, -2.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.7F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - hood.addChild("left", ModelPartBuilder.create() - .uv(100, 20).cuboid(3.6F, -11.2857F, -5.3F, 1.0F, 10.0F, 2.0F, new Dilation(0.6F)) - .uv(94, 20).cuboid(3.6F, -11.2857F, -5.3F, 1.0F, 10.0F, 2.0F, new Dilation(0.69F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + hood.addOrReplaceChild("left", CubeListBuilder.create() + .texOffs(100, 20).addBox(3.6F, -11.2857F, -5.3F, 1.0F, 10.0F, 2.0F, new CubeDeformation(0.6F)) + .texOffs(94, 20).addBox(3.6F, -11.2857F, -5.3F, 1.0F, 10.0F, 2.0F, new CubeDeformation(0.69F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - hood.addChild("right", ModelPartBuilder.create() - .uv(100, 20).mirrored().cuboid(-4.35F, -11.2857F, -5.3F, 1.0F, 10.0F, 2.0F, new Dilation(0.6F)).mirrored(false) - .uv(106, 20).cuboid(-4.35F, -11.2857F, -5.3F, 1.0F, 10.0F, 2.0F, new Dilation(0.69F)), ModelTransform.origin(-0.0F, 0.0F, 0.0F)); + hood.addOrReplaceChild("right", CubeListBuilder.create() + .texOffs(100, 20).mirror().addBox(-4.35F, -11.2857F, -5.3F, 1.0F, 10.0F, 2.0F, new CubeDeformation(0.6F)).mirror(false) + .texOffs(106, 20).addBox(-4.35F, -11.2857F, -5.3F, 1.0F, 10.0F, 2.0F, new CubeDeformation(0.69F)), PartPose.offset(-0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/HelmetSkullModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/HelmetSkullModel.java index 58073ffe0e..d6ffa2afec 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/HelmetSkullModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/HelmetSkullModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmetAttachments.armored; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class HelmetSkullModel extends HelmetAddonModel { @@ -10,27 +17,27 @@ public HelmetSkullModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("skull", ModelPartBuilder.create().uv(0, 0).cuboid(-3.0F, -40.0F, -3.0F, 6.0F, 7.0F, 6.0F, new Dilation(0.0F)) - .uv(0, 13).cuboid(-3.0F, -39.25F, -3.0F, 6.0F, 7.0F, 6.0F, new Dilation(0.2F)) - .uv(0, 26).cuboid(-3.0F, -39.25F, -3.0F, 6.0F, 9.0F, 6.0F, new Dilation(0.4F)) - .uv(36, 53).cuboid(-0.5F, -41.25F, -0.5F, 1.0F, 10.0F, 1.0F, new Dilation(0.0F)) - .uv(40, 60).cuboid(-5.0F, -37.55F, -1.0F, 10.0F, 2.0F, 2.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 23.0F, 0.0F)); + head.addOrReplaceChild("skull", CubeListBuilder.create().texOffs(0, 0).addBox(-3.0F, -40.0F, -3.0F, 6.0F, 7.0F, 6.0F, new CubeDeformation(0.0F)) + .texOffs(0, 13).addBox(-3.0F, -39.25F, -3.0F, 6.0F, 7.0F, 6.0F, new CubeDeformation(0.2F)) + .texOffs(0, 26).addBox(-3.0F, -39.25F, -3.0F, 6.0F, 9.0F, 6.0F, new CubeDeformation(0.4F)) + .texOffs(36, 53).addBox(-0.5F, -41.25F, -0.5F, 1.0F, 10.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(40, 60).addBox(-5.0F, -37.55F, -1.0F, 10.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 23.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/HoodModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/HoodModel.java index 266b96ab08..484d66abf5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/HoodModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/HoodModel.java @@ -2,7 +2,14 @@ import net.sevenstars.middleearth.client.model.equipment.head.helmetAttachments.CloakHoodModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class HoodModel extends CloakHoodModel { @@ -10,27 +17,27 @@ public HoodModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - ModelPartData hat = head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition hat = modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - hat.addChild("helmetAttachment", ModelPartBuilder.create() - .uv(0, 0).cuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(1.0F)) - .uv(32, 0).cuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(1.3F)), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); + hat.addOrReplaceChild("helmetAttachment", CubeListBuilder.create() + .texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(1.0F)) + .texOffs(32, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(1.3F)), + PartPose.offset(0.0F, -0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/NazgulHoodModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/NazgulHoodModel.java index c54f5e5b6c..451291ace7 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/NazgulHoodModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/NazgulHoodModel.java @@ -2,7 +2,14 @@ import net.sevenstars.middleearth.client.model.equipment.head.helmetAttachments.CloakHoodModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class NazgulHoodModel extends CloakHoodModel { @@ -10,28 +17,28 @@ public NazgulHoodModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - ModelPartData hat = head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition hat = modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - hat.addChild("helmetAttachment", ModelPartBuilder.create() - .uv(0, 73).cuboid(-4.0F, -8.0F, -4.6F, 8.0F, 8.0F, 2.0F, new Dilation(0.1F)) - .uv(0, 0).cuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(1.0F)) - .uv(32, 0).cuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(1.3F)) - .uv(96, 80).cuboid(-4.0F, 1.0F, -4.0F, 8.0F, 6.0F, 8.0F, new Dilation(1.3F)), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); + hat.addOrReplaceChild("helmetAttachment", CubeListBuilder.create() + .texOffs(0, 73).addBox(-4.0F, -8.0F, -4.6F, 8.0F, 8.0F, 2.0F, new CubeDeformation(0.1F)) + .texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(1.0F)) + .texOffs(32, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(1.3F)) + .texOffs(96, 80).addBox(-4.0F, 1.0F, -4.0F, 8.0F, 6.0F, 8.0F, new CubeDeformation(1.3F)), + PartPose.offset(0.0F, -0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/TallHoodModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/TallHoodModel.java index f38e519284..4c2d24c173 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/TallHoodModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/armored/TallHoodModel.java @@ -2,7 +2,14 @@ import net.sevenstars.middleearth.client.model.equipment.head.helmetAttachments.CloakHoodModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class TallHoodModel extends CloakHoodModel { @@ -10,27 +17,27 @@ public TallHoodModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - ModelPartData hat = head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition hat = modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - hat.addChild("helmetAttachment", ModelPartBuilder.create() - .uv(0, 0).cuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(1.0F)) - .uv(32, 0).cuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(1.3F)) - .uv(96, 80).cuboid(-4.0F, 1.0F, -4.0F, 8.0F, 6.0F, 8.0F, new Dilation(1.3F)), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); + hat.addOrReplaceChild("helmetAttachment", CubeListBuilder.create() + .texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(1.0F)) + .texOffs(32, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(1.3F)) + .texOffs(96, 80).addBox(-4.0F, 1.0F, -4.0F, 8.0F, 6.0F, 8.0F, new CubeDeformation(1.3F)), + PartPose.offset(0.0F, -0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/unarmored/UnarmoredFurHoodDownModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/unarmored/UnarmoredFurHoodDownModel.java index 25b3be39b2..5df423fd85 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/unarmored/UnarmoredFurHoodDownModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/unarmored/UnarmoredFurHoodDownModel.java @@ -2,7 +2,14 @@ import net.sevenstars.middleearth.client.model.equipment.head.helmetAttachments.CloakHoodModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class UnarmoredFurHoodDownModel extends CloakHoodModel { @@ -10,38 +17,38 @@ public UnarmoredFurHoodDownModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - ModelPartData hat = head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition hat = modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData hood = hat.addChild("helmetAttachment", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -1.0F, 0.016F)); + PartDefinition hood = hat.addOrReplaceChild("helmetAttachment", CubeListBuilder.create(), PartPose.offset(0.0F, -1.0F, 0.016F)); - ModelPartData furHood = hood.addChild("fur_hood", ModelPartBuilder.create(), ModelTransform.of(0.0F, -4.5F, -3.5F, 1.5708F, 0.0F, 0.0F)); + PartDefinition furHood = hood.addOrReplaceChild("fur_hood", CubeListBuilder.create(), PartPose.offsetAndRotation(0.0F, -4.5F, -3.5F, 1.5708F, 0.0F, 0.0F)); - ModelPartData down = furHood.addChild("down", ModelPartBuilder.create().uv(96, 0).cuboid(-4.0F, -6.0F, 0.75F, 8.0F, 8.0F, 8.0F, new Dilation(1.3F)) - .uv(64, 0).cuboid(-4.0F, -5.91F, 0.75F, 8.0F, 8.0F, 8.0F, new Dilation(1.0F)), ModelTransform.of(0.0F, 0.0F, -6.0F, -1.1345F, 0.0F, 0.0F)); + PartDefinition down = furHood.addOrReplaceChild("down", CubeListBuilder.create().texOffs(96, 0).addBox(-4.0F, -6.0F, 0.75F, 8.0F, 8.0F, 8.0F, new CubeDeformation(1.3F)) + .texOffs(64, 0).addBox(-4.0F, -5.91F, 0.75F, 8.0F, 8.0F, 8.0F, new CubeDeformation(1.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, -6.0F, -1.1345F, 0.0F, 0.0F)); - ModelPartData hoodDown = down.addChild("hood_down", ModelPartBuilder.create(), ModelTransform.of(-0.144F, 4.2857F, -1.716F, -1.5708F, 0.0F, 0.0F)); + PartDefinition hoodDown = down.addOrReplaceChild("hood_down", CubeListBuilder.create(), PartPose.offsetAndRotation(-0.144F, 4.2857F, -1.716F, -1.5708F, 0.0F, 0.0F)); - hoodDown.addChild("top", ModelPartBuilder.create().uv(112, 29).cuboid(-2.872F, -11.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new Dilation(0.5F)) - .uv(112, 26).cuboid(-2.856F, -11.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new Dilation(0.6F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - hoodDown.addChild("bottom", ModelPartBuilder.create().uv(112, 20).cuboid(-2.75F, -2.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new Dilation(0.5F)) - .uv(112, 23).cuboid(-2.718F, -2.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new Dilation(0.6F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - hoodDown.addChild("left", ModelPartBuilder.create().uv(100, 20).cuboid(3.6F, -11.2857F, -5.3F, 1.0F, 8.0F, 2.0F, new Dilation(0.5F)) - .uv(94, 20).cuboid(3.6F, -11.2857F, -5.3F, 1.0F, 8.0F, 2.0F, new Dilation(0.6F)), ModelTransform.origin(0.25F, 0.0F, 0.0F)); - hoodDown.addChild("right", ModelPartBuilder.create().uv(100, 20).mirrored().cuboid(-4.35F, -11.2857F, -5.3F, 1.0F, 8.0F, 2.0F, new Dilation(0.5F)).mirrored(false) - .uv(106, 20).cuboid(-4.35F, -11.2857F, -5.3F, 1.0F, 8.0F, 2.0F, new Dilation(0.6F)), ModelTransform.origin(-0.25F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + hoodDown.addOrReplaceChild("top", CubeListBuilder.create().texOffs(112, 29).addBox(-2.872F, -11.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.5F)) + .texOffs(112, 26).addBox(-2.856F, -11.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.6F)), PartPose.offset(0.0F, 0.0F, 0.0F)); + hoodDown.addOrReplaceChild("bottom", CubeListBuilder.create().texOffs(112, 20).addBox(-2.75F, -2.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.5F)) + .texOffs(112, 23).addBox(-2.718F, -2.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.6F)), PartPose.offset(0.0F, 0.0F, 0.0F)); + hoodDown.addOrReplaceChild("left", CubeListBuilder.create().texOffs(100, 20).addBox(3.6F, -11.2857F, -5.3F, 1.0F, 8.0F, 2.0F, new CubeDeformation(0.5F)) + .texOffs(94, 20).addBox(3.6F, -11.2857F, -5.3F, 1.0F, 8.0F, 2.0F, new CubeDeformation(0.6F)), PartPose.offset(0.25F, 0.0F, 0.0F)); + hoodDown.addOrReplaceChild("right", CubeListBuilder.create().texOffs(100, 20).mirror().addBox(-4.35F, -11.2857F, -5.3F, 1.0F, 8.0F, 2.0F, new CubeDeformation(0.5F)).mirror(false) + .texOffs(106, 20).addBox(-4.35F, -11.2857F, -5.3F, 1.0F, 8.0F, 2.0F, new CubeDeformation(0.6F)), PartPose.offset(-0.25F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/unarmored/UnarmoredFurHoodModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/unarmored/UnarmoredFurHoodModel.java index 536ec7a3bd..81a6b40c39 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/unarmored/UnarmoredFurHoodModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/unarmored/UnarmoredFurHoodModel.java @@ -2,7 +2,14 @@ import net.sevenstars.middleearth.client.model.equipment.head.helmetAttachments.CloakHoodModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class UnarmoredFurHoodModel extends CloakHoodModel { @@ -10,44 +17,44 @@ public UnarmoredFurHoodModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - ModelPartData hat = head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition hat = modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - hat.addChild("fur_hood", ModelPartBuilder.create() - .uv(0, 73).cuboid(-4.0F, -8.0F, -4.45F, 8.0F, 5.0F, 2.0F, new Dilation(0.1F)) - .uv(32, 0).cuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.9F)) - .uv(0, 0).cuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.6F)), ModelTransform.of(0.0F, 0.0F, -0.0F, -0.0F, 0.0F, 0.0F)); + hat.addOrReplaceChild("fur_hood", CubeListBuilder.create() + .texOffs(0, 73).addBox(-4.0F, -8.0F, -4.45F, 8.0F, 5.0F, 2.0F, new CubeDeformation(0.1F)) + .texOffs(32, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.9F)) + .texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.6F)), PartPose.offsetAndRotation(0.0F, 0.0F, -0.0F, -0.0F, 0.0F, 0.0F)); - ModelPartData hood = hat.addChild("helmetAttachment", ModelPartBuilder.create(), ModelTransform.of(-0.14F, 2.65F, -0.0F, -0.0F, 0.0F, 0.0F)); + PartDefinition hood = hat.addOrReplaceChild("helmetAttachment", CubeListBuilder.create(), PartPose.offsetAndRotation(-0.14F, 2.65F, -0.0F, -0.0F, 0.0F, 0.0F)); - hood.addChild("top", ModelPartBuilder.create() - .uv(112, 29).cuboid(-2.872F, -11.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new Dilation(0.5F)) - .uv(112, 26).cuboid(-2.856F, -11.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new Dilation(0.6F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + hood.addOrReplaceChild("top", CubeListBuilder.create() + .texOffs(112, 29).addBox(-2.872F, -11.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.5F)) + .texOffs(112, 26).addBox(-2.856F, -11.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.6F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - hood.addChild("bottom", ModelPartBuilder.create() - .uv(112, 20).cuboid(-2.75F, -2.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new Dilation(0.5F)) - .uv(112, 23).cuboid(-2.718F, -2.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new Dilation(0.6F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + hood.addOrReplaceChild("bottom", CubeListBuilder.create() + .texOffs(112, 20).addBox(-2.75F, -2.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.5F)) + .texOffs(112, 23).addBox(-2.718F, -2.2857F, -5.3F, 6.0F, 1.0F, 2.0F, new CubeDeformation(0.6F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - hood.addChild("left", ModelPartBuilder.create() - .uv(100, 20).cuboid(3.6F, -11.2857F, -5.3F, 1.0F, 10.0F, 2.0F, new Dilation(0.5F)) - .uv(94, 20).cuboid(3.6F, -11.2857F, -5.3F, 1.0F, 10.0F, 2.0F, new Dilation(0.59F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + hood.addOrReplaceChild("left", CubeListBuilder.create() + .texOffs(100, 20).addBox(3.6F, -11.2857F, -5.3F, 1.0F, 10.0F, 2.0F, new CubeDeformation(0.5F)) + .texOffs(94, 20).addBox(3.6F, -11.2857F, -5.3F, 1.0F, 10.0F, 2.0F, new CubeDeformation(0.59F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - hood.addChild("right", ModelPartBuilder.create() - .uv(100, 20).mirrored().cuboid(-4.35F, -11.2857F, -5.3F, 1.0F, 10.0F, 2.0F, new Dilation(0.5F)).mirrored(false) - .uv(106, 20).cuboid(-4.35F, -11.2857F, -5.3F, 1.0F, 10.0F, 2.0F, new Dilation(0.59F)), ModelTransform.origin(-0.0F, 0.0F, 0.0F)); + hood.addOrReplaceChild("right", CubeListBuilder.create() + .texOffs(100, 20).mirror().addBox(-4.35F, -11.2857F, -5.3F, 1.0F, 10.0F, 2.0F, new CubeDeformation(0.5F)).mirror(false) + .texOffs(106, 20).addBox(-4.35F, -11.2857F, -5.3F, 1.0F, 10.0F, 2.0F, new CubeDeformation(0.59F)), PartPose.offset(-0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/unarmored/UnarmoredHoodModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/unarmored/UnarmoredHoodModel.java index 5dc6767078..969bd6b140 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/unarmored/UnarmoredHoodModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/unarmored/UnarmoredHoodModel.java @@ -2,7 +2,14 @@ import net.sevenstars.middleearth.client.model.equipment.head.helmetAttachments.CloakHoodModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class UnarmoredHoodModel extends CloakHoodModel { @@ -10,27 +17,27 @@ public UnarmoredHoodModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - ModelPartData hat = head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition hat = modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - hat.addChild("helmetAttachment", ModelPartBuilder.create() - .uv(0, 73).cuboid(-4.0F, -8.0F, -4.45F, 8.0F, 5.0F, 2.0F, new Dilation(0.1F)) - .uv(0, 0).cuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.6F)) - .uv(32, 0).cuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.9F)), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); + hat.addOrReplaceChild("helmetAttachment", CubeListBuilder.create() + .texOffs(0, 73).addBox(-4.0F, -8.0F, -4.45F, 8.0F, 5.0F, 2.0F, new CubeDeformation(0.1F)) + .texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.6F)) + .texOffs(32, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.9F)), + PartPose.offset(0.0F, -0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/unarmored/UnarmoredTallHoodModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/unarmored/UnarmoredTallHoodModel.java index 5f1fa0f642..cc33df4c35 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/unarmored/UnarmoredTallHoodModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmetAttachments/unarmored/UnarmoredTallHoodModel.java @@ -2,7 +2,14 @@ import net.sevenstars.middleearth.client.model.equipment.head.helmetAttachments.CloakHoodModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class UnarmoredTallHoodModel extends CloakHoodModel { @@ -10,28 +17,28 @@ public UnarmoredTallHoodModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - ModelPartData hat = head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition hat = modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - hat.addChild("helmetAttachment", ModelPartBuilder.create() - .uv(0, 73).cuboid(-4.0F, -8.0F, -4.45F, 8.0F, 5.0F, 2.0F, new Dilation(0.1F)) - .uv(0, 0).cuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.6F)) - .uv(32, 0).cuboid(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.9F)) - .uv(96, 80).cuboid(-4.0F, 1.0F, -4.0F, 8.0F, 6.0F, 8.0F, new Dilation(0.9F)), - ModelTransform.origin(0.0F, -0.0F, 0.0F)); + hat.addOrReplaceChild("helmetAttachment", CubeListBuilder.create() + .texOffs(0, 73).addBox(-4.0F, -8.0F, -4.45F, 8.0F, 5.0F, 2.0F, new CubeDeformation(0.1F)) + .texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.6F)) + .texOffs(32, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.9F)) + .texOffs(96, 80).addBox(-4.0F, 1.0F, -4.0F, 8.0F, 6.0F, 8.0F, new CubeDeformation(0.9F)), + PartPose.offset(0.0F, -0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/BaggyHatModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/BaggyHatModel.java index d2886befc0..32dddae350 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/BaggyHatModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/BaggyHatModel.java @@ -1,7 +1,13 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets; -import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class BaggyHatModel extends HelmetAddonModel { @@ -9,23 +15,24 @@ public BaggyHatModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData baggy_hat = head.addChild("baggy_hat", ModelPartBuilder.create().uv(0, 0) - .cuboid(-5.0F, -10.5F, -3.0F, 7.0F, 3.0F, 6.0F, - new Dilation(0.6F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + head.addOrReplaceChild("baggy_hat", CubeListBuilder.create().texOffs(0, 0) + .addBox(-5.0F, -10.5F, -3.0F, 7.0F, 3.0F, 6.0F, new CubeDeformation(0.6F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + return LayerDefinition.create(modelData, 64, 64); } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/ChaperonModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/ChaperonModel.java index fcfcb12a21..862cd64acd 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/ChaperonModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/ChaperonModel.java @@ -1,7 +1,13 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets; -import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class ChaperonModel extends HelmetAddonModel { @@ -9,23 +15,24 @@ public ChaperonModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData chaperon = head.addChild("chaperon", ModelPartBuilder.create().uv(2, 2) - .cuboid(-1.0F, -3.5F, -3.0F, 2.0F, 9.0F, 6.0F, - new Dilation(0.0F)), ModelTransform.origin(5.0F, -5.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + head.addOrReplaceChild("chaperon", CubeListBuilder.create().texOffs(2, 2) + .addBox(-1.0F, -3.5F, -3.0F, 2.0F, 9.0F, 6.0F, new CubeDeformation(0.0F)), + PartPose.offset(5.0F, -5.0F, 0.0F)); + + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + return LayerDefinition.create(modelData, 64, 64); } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/CookingPotHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/CookingPotHelmetModel.java index e2c443ee6f..95747a177f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/CookingPotHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/CookingPotHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class CookingPotHelmetModel extends HelmetAddonModel { @@ -9,36 +16,36 @@ public CookingPotHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - protected static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + protected static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("Hat2", ModelPartBuilder.create() - .uv(0, 0).cuboid(-3.5F, -33.75F, -3.5F, 7.0F, 2.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 23.0F, 0.0F)); + head.addOrReplaceChild("Hat2", CubeListBuilder.create() + .texOffs(0, 0).addBox(-3.5F, -33.75F, -3.5F, 7.0F, 2.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 23.0F, 0.0F)); - head.addChild("handle2_r1", ModelPartBuilder.create() - .uv(1, -1).cuboid(0.0F, 0.75F, -1.0F, 0.0F, 3.0F, 3.0F, new Dilation(0.0F)), - ModelTransform.of(5.0F, -6.3F, -0.4F, 0.0F, 0.0F, -0.3491F)); + head.addOrReplaceChild("handle2_r1", CubeListBuilder.create() + .texOffs(1, -1).addBox(0.0F, 0.75F, -1.0F, 0.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(5.0F, -6.3F, -0.4F, 0.0F, 0.0F, -0.3491F)); - head.addChild("handle1_r1", ModelPartBuilder.create() - .uv(1, -1).cuboid(0.0F, 0.75F, -1.0F, 0.0F, 3.0F, 3.0F, new Dilation(0.0F)), - ModelTransform.of(-4.9F, -6.3F, -0.4F, 0.0F, 0.0F, 0.3491F)); + head.addOrReplaceChild("handle1_r1", CubeListBuilder.create() + .texOffs(1, -1).addBox(0.0F, 0.75F, -1.0F, 0.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-4.9F, -6.3F, -0.4F, 0.0F, 0.0F, 0.3491F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/EggHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/EggHelmetModel.java index 347167f858..4889d6202c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/EggHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/EggHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class EggHelmetModel extends HelmetAddonModel { @@ -9,29 +16,29 @@ public EggHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - protected static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + protected static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("addons", ModelPartBuilder.create() - .uv(0, 10).cuboid(-1.5F, -12.25F, -1.5F, 3.0F, 2.0F, 3.0F, new Dilation(0.0F)) - .uv(0, 0).cuboid(-3.5F, -10.75F, -3.5F, 7.0F, 2.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("addons", CubeListBuilder.create() + .texOffs(0, 10).addBox(-1.5F, -12.25F, -1.5F, 3.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(0, 0).addBox(-3.5F, -10.75F, -3.5F, 7.0F, 2.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/FlapHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/FlapHelmetModel.java index 87014b9315..5865ad350d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/FlapHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/FlapHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class FlapHelmetModel extends HelmetAddonModel { @@ -9,29 +16,29 @@ public FlapHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("flaps", ModelPartBuilder.create() - .uv(0, 0).cuboid(-4.0F, 0.90F, -4.0F, 8.0F, 9.0F, 3.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("flaps", CubeListBuilder.create() + .texOffs(0, 0).addBox(-4.0F, 0.90F, -4.0F, 8.0F, 9.0F, 3.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/GlassesWearableModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/GlassesWearableModel.java index fd67b2b9c4..d55cdc78dc 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/GlassesWearableModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/GlassesWearableModel.java @@ -1,7 +1,13 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets; -import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class GlassesWearableModel extends HelmetAddonModel { @@ -9,24 +15,26 @@ public GlassesWearableModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData googles = head.addChild("googles", ModelPartBuilder.create().uv(0, 0) - .cuboid(-3.0F, -5.125F, -5.0F, 2.0F, 2.0F, 1.0F, new Dilation(0.3F)) - .uv(0, 0).cuboid(1.0F, -5.0F, -5.0F, 2.0F, 2.0F, 1.0F, - new Dilation(0.3F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + head.addOrReplaceChild("googles", CubeListBuilder.create().texOffs(0, 0) + .addBox(-3.0F, -5.125F, -5.0F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.3F)) + .texOffs(0, 0).addBox(1.0F, -5.0F, -5.0F, 2.0F, 2.0F, 1.0F, + new CubeDeformation(0.3F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + return LayerDefinition.create(modelData, 64, 64); } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/HatHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/HatHelmetModel.java index 06112dd060..3cb17fe2e7 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/HatHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/HatHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class HatHelmetModel extends HelmetAddonModel { @@ -9,28 +16,28 @@ public HatHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("brim", ModelPartBuilder.create() - .uv(-6, 0).cuboid(-8.0F, -4.15F, -8.0F, 16.0F, 0.0F, 16.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("brim", CubeListBuilder.create() + .texOffs(-6, 0).addBox(-8.0F, -4.15F, -8.0F, 16.0F, 0.0F, 16.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/HelmetAddonModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/HelmetAddonModel.java index 489ae4f62e..9a0a72394e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/HelmetAddonModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/HelmetAddonModel.java @@ -1,13 +1,12 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.entity.LivingEntity; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.world.entity.LivingEntity; -public class HelmetAddonModel extends BipedEntityModel { +public class HelmetAddonModel extends HumanoidModel { public HelmetAddonModel(ModelPart root) { super(root); } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/KettleHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/KettleHelmetModel.java index a9b5b25903..febe3f1656 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/KettleHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/KettleHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class KettleHelmetModel extends HelmetAddonModel { @@ -9,28 +16,28 @@ public KettleHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("kettle", ModelPartBuilder.create() - .uv(0, 0).cuboid(-7.0F, -5.384F, -7.0F, 14.0F, 1.0F, 14.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("kettle", CubeListBuilder.create() + .texOffs(0, 0).addBox(-7.0F, -5.384F, -7.0F, 14.0F, 1.0F, 14.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/MonocleModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/MonocleModel.java index 38d1e0c37e..632c8b977d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/MonocleModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/MonocleModel.java @@ -1,7 +1,13 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets; -import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class MonocleModel extends HelmetAddonModel { @@ -9,27 +15,28 @@ public MonocleModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData addon_monocle = head.addChild("addon_monocle", ModelPartBuilder.create().uv(36, 31) - .cuboid(-3.25F, -4.5F, -6.75F, 2.0F, 2.0F, 1.0F, - new Dilation(0.3F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData monocle = head.addChild("monocle", ModelPartBuilder.create().uv(32, 23) - .cuboid(1.0F, -1.0F, -4.0F, 5.0F, 2.0F, 5.0F, - new Dilation(0.0F)), ModelTransform.of(-5.0F, -3.0F, 0.0F, 0.0F, 0.5236F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + head.addOrReplaceChild("addon_monocle", CubeListBuilder.create().texOffs(36, 31) + .addBox(-3.25F, -4.5F, -6.75F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.3F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + head.addOrReplaceChild("monocle", CubeListBuilder.create().texOffs(32, 23) + .addBox(1.0F, -1.0F, -4.0F, 5.0F, 2.0F, 5.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-5.0F, -3.0F, 0.0F, 0.0F, 0.5236F, 0.0F)); + + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + return LayerDefinition.create(modelData, 64, 64); } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/SalletHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/SalletHelmetModel.java index 235c11fc65..bb146963e3 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/SalletHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/SalletHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class SalletHelmetModel extends HelmetAddonModel { @@ -9,24 +16,24 @@ public SalletHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("sallet", ModelPartBuilder.create() - .uv(0, 0).cuboid(-4.0F, -2.95F, 4.654F, 8.0F, 1.0F, 2.0F, new Dilation(0.22F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("sallet", CubeListBuilder.create() + .texOffs(0, 0).addBox(-4.0F, -2.95F, 4.654F, 8.0F, 1.0F, 2.0F, new CubeDeformation(0.22F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/WingedHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/WingedHelmetModel.java index 30b5728217..20308b5df5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/WingedHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/WingedHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class WingedHelmetModel extends HelmetAddonModel { @@ -9,36 +16,36 @@ public WingedHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - protected static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + protected static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData addon = head.addChild("addon", ModelPartBuilder.create() - .uv(0, 0).cuboid(-1.0F, -10.65F, -1.0F, 2.0F, 2.0F, 2.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition addon = head.addOrReplaceChild("addon", CubeListBuilder.create() + .texOffs(0, 0).addBox(-1.0F, -10.65F, -1.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - addon.addChild("wing_right", ModelPartBuilder.create() - .uv(0, 0).mirrored().cuboid(0.0F, -9.25F, -1.0F, 0.0F, 12.0F, 8.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(-5.0F, -6.0F, 0.0F, 0.0117F, -0.3229F, 0.0047F)); + addon.addOrReplaceChild("wing_right", CubeListBuilder.create() + .texOffs(0, 0).mirror().addBox(0.0F, -9.25F, -1.0F, 0.0F, 12.0F, 8.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(-5.0F, -6.0F, 0.0F, 0.0117F, -0.3229F, 0.0047F)); - addon.addChild("wing_left", ModelPartBuilder.create() - .uv(0, 0).cuboid(0.0F, -9.25F, -1.0F, 0.0F, 12.0F, 8.0F, new Dilation(0.0F)), - ModelTransform.of(5.0F, -6.0F, 0.0F, 0.0117F, 0.3229F, -0.0047F)); + addon.addOrReplaceChild("wing_left", CubeListBuilder.create() + .texOffs(0, 0).addBox(0.0F, -9.25F, -1.0F, 0.0F, 12.0F, 8.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(5.0F, -6.0F, 0.0F, 0.0117F, 0.3229F, -0.0047F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/WizardHatModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/WizardHatModel.java index 2b05478d46..05b6c1b60c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/WizardHatModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/WizardHatModel.java @@ -1,8 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; -import net.minecraft.entity.LivingEntity; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class WizardHatModel extends HelmetAddonModel { @@ -10,39 +16,39 @@ public WizardHatModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData wizard = head.addChild("wizard", ModelPartBuilder.create() - .uv(0, 47).cuboid(-8.0F, -5.15F, -8.0F, 16.0F, 1.0F, 16.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, 0.9F, -1.0F, -0.1745F, 0.0F, 0.0F)); + PartDefinition wizard = head.addOrReplaceChild("wizard", CubeListBuilder.create() + .texOffs(0, 47).addBox(-8.0F, -5.15F, -8.0F, 16.0F, 1.0F, 16.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 0.9F, -1.0F, -0.1745F, 0.0F, 0.0F)); - ModelPartData bone = wizard.addChild("bone", ModelPartBuilder.create() - .uv(0, 0).cuboid(-4.0F, -9.25F, -4.0F, 8.0F, 4.0F, 8.0F, new Dilation(0.7F)) - .uv(32, 0).cuboid(-4.0F, -9.25F, -4.0F, 8.0F, 4.0F, 8.0F, new Dilation(1.0F)), - ModelTransform.of(0.0F, -0.325F, 0.2F, 0.0436F, 0.0F, 0.0F)); + PartDefinition bone = wizard.addOrReplaceChild("bone", CubeListBuilder.create() + .texOffs(0, 0).addBox(-4.0F, -9.25F, -4.0F, 8.0F, 4.0F, 8.0F, new CubeDeformation(0.7F)) + .texOffs(32, 0).addBox(-4.0F, -9.25F, -4.0F, 8.0F, 4.0F, 8.0F, new CubeDeformation(1.0F)), + PartPose.offsetAndRotation(0.0F, -0.325F, 0.2F, 0.0436F, 0.0F, 0.0F)); - ModelPartData hat = bone.addChild("hat", ModelPartBuilder.create(), - ModelTransform.of(0.0F, 1.6F, -0.4F, -0.0175F, 0.0F, 0.0F)); + PartDefinition hat = bone.addOrReplaceChild("hat", CubeListBuilder.create(), + PartPose.offsetAndRotation(0.0F, 1.6F, -0.4F, -0.0175F, 0.0F, 0.0F)); - hat.addChild("wizard_0", ModelPartBuilder.create() - .uv(24, 1).mirrored().cuboid(2.0F, -9.7386F, -2.2615F, 0.0F, 10.0F, 11.0F, new Dilation(0.0F)).mirrored(false) - .uv(46, 12).cuboid(0.0F, -4.7386F, -2.2615F, 4.0F, 5.0F, 4.0F, new Dilation(0.5F)), - ModelTransform.of(-2.0F, -13.0143F, 1.5539F, -0.5672F, 0.0F, 0.0F)); - hat.addChild("wizard_1", ModelPartBuilder.create() - .uv(0, 12).cuboid(-3.0F, -4.75F, -3.0F, 6.0F, 4.0F, 6.0F, new Dilation(0.5F)), - ModelTransform.of(0.0F, -9.5F, 0.0F, -0.0873F, 0.0F, 0.0F)); + hat.addOrReplaceChild("wizard_0", CubeListBuilder.create() + .texOffs(24, 1).mirror().addBox(2.0F, -9.7386F, -2.2615F, 0.0F, 10.0F, 11.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(46, 12).addBox(0.0F, -4.7386F, -2.2615F, 4.0F, 5.0F, 4.0F, new CubeDeformation(0.5F)), + PartPose.offsetAndRotation(-2.0F, -13.0143F, 1.5539F, -0.5672F, 0.0F, 0.0F)); + hat.addOrReplaceChild("wizard_1", CubeListBuilder.create() + .texOffs(0, 12).addBox(-3.0F, -4.75F, -3.0F, 6.0F, 4.0F, 6.0F, new CubeDeformation(0.5F)), + PartPose.offsetAndRotation(0.0F, -9.5F, 0.0F, -0.0873F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/dwarves/DwarvenMinerHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/dwarves/DwarvenMinerHelmetModel.java index 957d0acb6b..418a9a79cf 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/dwarves/DwarvenMinerHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/dwarves/DwarvenMinerHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.dwarves; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class DwarvenMinerHelmetModel extends HelmetAddonModel { @@ -10,52 +17,52 @@ public DwarvenMinerHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - head.addChild("flaps", ModelPartBuilder.create() - .uv(0, 20).cuboid(-4.0F, 1.55F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.9F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData right_candle = head.addChild("right_candle", ModelPartBuilder.create() - .uv(0, 0).cuboid(-1.0F, -1.25F, 1.0F, 2.0F, 2.0F, 4.0F, new Dilation(0.0F)) - .uv(20, 12).cuboid(-1.0F, -1.25F, 5.0F, 2.0F, 2.0F, 1.0F, new Dilation(0.1F)) - .uv(0, 14).cuboid(-1.0F, -1.25F, -3.0F, 2.0F, 1.0F, 4.0F, new Dilation(0.0F)) - .uv(8, 0).cuboid(-2.0F, -1.25F, -4.0F, 4.0F, 0.0F, 4.0F, new Dilation(0.0F)) - .uv(0, 22).cuboid(-1.0F, -5.25F, -3.0F, 2.0F, 4.0F, 2.0F, new Dilation(0.0F)), - ModelTransform.origin(-5.5F, -4.5F, -4.5F)); - right_candle.addChild("flame_right_0", ModelPartBuilder.create() - .uv(0, 21).cuboid(0.0F, 0.75F, -0.5F, 0.0F, 1.0F, 1.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, -7.0F, -2.0F, 0.0F, 0.7854F, 0.0F)); - right_candle.addChild("flame_right_1", ModelPartBuilder.create() - .uv(0, 21).cuboid(0.0F, 0.75F, -0.5F, 0.0F, 1.0F, 1.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, -7.0F, -2.0F, 0.0F, -0.7854F, 0.0F)); - - ModelPartData left_candle = head.addChild("left_candle", ModelPartBuilder.create() - .uv(0, 0).mirrored().cuboid(-1.0F, -1.25F, 1.0F, 2.0F, 2.0F, 4.0F, new Dilation(0.0F)).mirrored(false) - .uv(20, 12).mirrored().cuboid(-1.0F, -1.25F, 5.0F, 2.0F, 2.0F, 1.0F, new Dilation(0.1F)).mirrored(false) - .uv(0, 14).mirrored().cuboid(-1.0F, -1.25F, -3.0F, 2.0F, 1.0F, 4.0F, new Dilation(0.0F)).mirrored(false) - .uv(8, 0).mirrored().cuboid(-2.0F, -1.25F, -4.0F, 4.0F, 0.0F, 4.0F, new Dilation(0.0F)).mirrored(false) - .uv(0, 22).mirrored().cuboid(-1.0F, -5.25F, -3.0F, 2.0F, 4.0F, 2.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.origin(5.5F, -4.5F, -4.5F)); - left_candle.addChild("flame_left_0", ModelPartBuilder.create() - .uv(0, 21).mirrored().cuboid(0.0F, 0.75F, -0.5F, 0.0F, 1.0F, 1.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(0.0F, -7.0F, -2.0F, 0.0F, -0.7854F, 0.0F)); - left_candle.addChild("flame_left_1", ModelPartBuilder.create() - .uv(0, 21).mirrored().cuboid(0.0F, 0.75F, -0.5F, 0.0F, 1.0F, 1.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(0.0F, -7.0F, -2.0F, 0.0F, 0.7854F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + + head.addOrReplaceChild("flaps", CubeListBuilder.create() + .texOffs(0, 20).addBox(-4.0F, 1.55F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.9F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition right_candle = head.addOrReplaceChild("right_candle", CubeListBuilder.create() + .texOffs(0, 0).addBox(-1.0F, -1.25F, 1.0F, 2.0F, 2.0F, 4.0F, new CubeDeformation(0.0F)) + .texOffs(20, 12).addBox(-1.0F, -1.25F, 5.0F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.1F)) + .texOffs(0, 14).addBox(-1.0F, -1.25F, -3.0F, 2.0F, 1.0F, 4.0F, new CubeDeformation(0.0F)) + .texOffs(8, 0).addBox(-2.0F, -1.25F, -4.0F, 4.0F, 0.0F, 4.0F, new CubeDeformation(0.0F)) + .texOffs(0, 22).addBox(-1.0F, -5.25F, -3.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), + PartPose.offset(-5.5F, -4.5F, -4.5F)); + right_candle.addOrReplaceChild("flame_right_0", CubeListBuilder.create() + .texOffs(0, 21).addBox(0.0F, 0.75F, -0.5F, 0.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, -7.0F, -2.0F, 0.0F, 0.7854F, 0.0F)); + right_candle.addOrReplaceChild("flame_right_1", CubeListBuilder.create() + .texOffs(0, 21).addBox(0.0F, 0.75F, -0.5F, 0.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, -7.0F, -2.0F, 0.0F, -0.7854F, 0.0F)); + + PartDefinition left_candle = head.addOrReplaceChild("left_candle", CubeListBuilder.create() + .texOffs(0, 0).mirror().addBox(-1.0F, -1.25F, 1.0F, 2.0F, 2.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(20, 12).mirror().addBox(-1.0F, -1.25F, 5.0F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.1F)).mirror(false) + .texOffs(0, 14).mirror().addBox(-1.0F, -1.25F, -3.0F, 2.0F, 1.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(8, 0).mirror().addBox(-2.0F, -1.25F, -4.0F, 4.0F, 0.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(0, 22).mirror().addBox(-1.0F, -5.25F, -3.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offset(5.5F, -4.5F, -4.5F)); + left_candle.addOrReplaceChild("flame_left_0", CubeListBuilder.create() + .texOffs(0, 21).mirror().addBox(0.0F, 0.75F, -0.5F, 0.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(0.0F, -7.0F, -2.0F, 0.0F, -0.7854F, 0.0F)); + left_candle.addOrReplaceChild("flame_left_1", CubeListBuilder.create() + .texOffs(0, 21).mirror().addBox(0.0F, 0.75F, -0.5F, 0.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(0.0F, -7.0F, -2.0F, 0.0F, 0.7854F, 0.0F)); + + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/dwarves/EreborHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/dwarves/EreborHelmetModel.java index c6fd377ae7..0ccf25cefd 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/dwarves/EreborHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/dwarves/EreborHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.dwarves; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class EreborHelmetModel extends HelmetAddonModel { @@ -10,28 +17,28 @@ public EreborHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("addon_eye", ModelPartBuilder.create() - .uv(46, 63).cuboid(-4.5F, -3.55F, -4.5F, 9.0F, 1.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("addon_eye", CubeListBuilder.create() + .texOffs(46, 63).addBox(-4.5F, -3.55F, -4.5F, 9.0F, 1.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/dwarves/EreborHornsHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/dwarves/EreborHornsHelmetModel.java index 1155c83483..e305c43466 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/dwarves/EreborHornsHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/dwarves/EreborHornsHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.dwarves; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class EreborHornsHelmetModel extends HelmetAddonModel { @@ -10,52 +17,52 @@ public EreborHornsHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ModelPartData addon_horns = head.addChild("addon_horns", ModelPartBuilder.create(), - ModelTransform.origin(-11.0F, -8.0208F, -3.4645F)); - - ModelPartData right_addon_horn = addon_horns.addChild("right_addon_horn", ModelPartBuilder.create(), - ModelTransform.of(-1.0F, 3.0F, 0.0F, 0.7854F, 0.0F, 0.0F)); - - ModelPartData right_horn = right_addon_horn.addChild("right_horn", ModelPartBuilder.create(), - ModelTransform.origin(13.0F, -3.8284F, -0.4142F)); - - right_horn.addChild("right_horn_0", ModelPartBuilder.create() - .uv(21, 59).cuboid(-8.0F, 4.75F, -5.0F, 3.0F, 3.0F, 2.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, 0.0F, 0.0F, 0.7854F, 0.0F, 0.0F)); - right_horn.addChild("right_horn_1", ModelPartBuilder.create() - .uv(20, 50).cuboid(-8.0F, 4.75F, -5.0F, 4.0F, 3.0F, 3.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, 2.1213F, 2.1213F, 0.7854F, 0.0F, 0.0F)); - right_horn.addChild("right_horn_2", ModelPartBuilder.create() - .uv(1, 52).cuboid(-8.0F, 0.75F, -1.0F, 4.0F, 7.0F, 5.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, 2.8284F, 1.4142F, 0.7854F, 0.0F, 0.0F)); - - ModelPartData left_horn = right_addon_horn.addChild("left_horn", ModelPartBuilder.create(), - ModelTransform.origin(11.0F, -3.8284F, -0.4142F)); - - left_horn.addChild("left_horn_0", ModelPartBuilder.create() - .uv(21, 59).mirrored().cuboid(5.0F, 4.75F, -5.0F, 3.0F, 3.0F, 2.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(0.0F, 0.0F, 0.0F, 0.7854F, 0.0F, 0.0F)); - left_horn.addChild("left_horn_1", ModelPartBuilder.create() - .uv(20, 50).mirrored().cuboid(4.0F, 4.75F, -5.0F, 4.0F, 3.0F, 3.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(0.0F, 2.1213F, 2.1213F, 0.7854F, 0.0F, 0.0F)); - left_horn.addChild("left_horn_2", ModelPartBuilder.create() - .uv(1, 52).mirrored().cuboid(4.0F, 0.75F, -1.0F, 4.0F, 7.0F, 5.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(0.0F, 2.8284F, 1.4142F, 0.7854F, 0.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + + PartDefinition addon_horns = head.addOrReplaceChild("addon_horns", CubeListBuilder.create(), + PartPose.offset(-11.0F, -8.0208F, -3.4645F)); + + PartDefinition right_addon_horn = addon_horns.addOrReplaceChild("right_addon_horn", CubeListBuilder.create(), + PartPose.offsetAndRotation(-1.0F, 3.0F, 0.0F, 0.7854F, 0.0F, 0.0F)); + + PartDefinition right_horn = right_addon_horn.addOrReplaceChild("right_horn", CubeListBuilder.create(), + PartPose.offset(13.0F, -3.8284F, -0.4142F)); + + right_horn.addOrReplaceChild("right_horn_0", CubeListBuilder.create() + .texOffs(21, 59).addBox(-8.0F, 4.75F, -5.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.7854F, 0.0F, 0.0F)); + right_horn.addOrReplaceChild("right_horn_1", CubeListBuilder.create() + .texOffs(20, 50).addBox(-8.0F, 4.75F, -5.0F, 4.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 2.1213F, 2.1213F, 0.7854F, 0.0F, 0.0F)); + right_horn.addOrReplaceChild("right_horn_2", CubeListBuilder.create() + .texOffs(1, 52).addBox(-8.0F, 0.75F, -1.0F, 4.0F, 7.0F, 5.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 2.8284F, 1.4142F, 0.7854F, 0.0F, 0.0F)); + + PartDefinition left_horn = right_addon_horn.addOrReplaceChild("left_horn", CubeListBuilder.create(), + PartPose.offset(11.0F, -3.8284F, -0.4142F)); + + left_horn.addOrReplaceChild("left_horn_0", CubeListBuilder.create() + .texOffs(21, 59).mirror().addBox(5.0F, 4.75F, -5.0F, 3.0F, 3.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.7854F, 0.0F, 0.0F)); + left_horn.addOrReplaceChild("left_horn_1", CubeListBuilder.create() + .texOffs(20, 50).mirror().addBox(4.0F, 4.75F, -5.0F, 4.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(0.0F, 2.1213F, 2.1213F, 0.7854F, 0.0F, 0.0F)); + left_horn.addOrReplaceChild("left_horn_2", CubeListBuilder.create() + .texOffs(1, 52).mirror().addBox(4.0F, 0.75F, -1.0F, 4.0F, 7.0F, 5.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(0.0F, 2.8284F, 1.4142F, 0.7854F, 0.0F, 0.0F)); + + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/dwarves/EreborWingsHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/dwarves/EreborWingsHelmetModel.java index 68d7540567..34d77ec062 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/dwarves/EreborWingsHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/dwarves/EreborWingsHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.dwarves; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class EreborWingsHelmetModel extends EreborHelmetModel { @@ -10,27 +17,27 @@ public EreborWingsHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("left_wing", ModelPartBuilder.create() - .uv(32, 0).mirrored().cuboid(-5.9415F, -3.25F, -6.3165F, 15.0F, 8.0F, 1.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(0.0F, -6.7624F, 4.6083F, 1.1849F, -0.9521F, -1.1082F)); - head.addChild("right_wing", ModelPartBuilder.create() - .uv(32, 0).cuboid(-9.0585F, -3.25F, -6.3165F, 15.0F, 8.0F, 1.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, -6.7624F, 4.6083F, 1.1849F, 0.9521F, 1.1082F)); + head.addOrReplaceChild("left_wing", CubeListBuilder.create() + .texOffs(32, 0).mirror().addBox(-5.9415F, -3.25F, -6.3165F, 15.0F, 8.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(0.0F, -6.7624F, 4.6083F, 1.1849F, -0.9521F, -1.1082F)); + head.addOrReplaceChild("right_wing", CubeListBuilder.create() + .texOffs(32, 0).addBox(-9.0585F, -3.25F, -6.3165F, 15.0F, 8.0F, 1.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, -6.7624F, 4.6083F, 1.1849F, 0.9521F, 1.1082F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/EgladilSentinelHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/EgladilSentinelHelmetModel.java index 6009c78ff3..a14b826a9a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/EgladilSentinelHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/EgladilSentinelHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.elves; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class EgladilSentinelHelmetModel extends LorienHelmetModel { @@ -10,16 +17,16 @@ public EgladilSentinelHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("lower_extension", ModelPartBuilder.create() - .uv(0, 11).cuboid(-4.0F, 0.85F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("lower_extension", CubeListBuilder.create() + .texOffs(0, 11).addBox(-4.0F, 0.85F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/LorienHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/LorienHelmetModel.java index 2000e75393..c2f1ff8ebe 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/LorienHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/LorienHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.elves; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class LorienHelmetModel extends HelmetAddonModel { @@ -10,32 +17,32 @@ public LorienHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("large_crest", ModelPartBuilder.create() - .uv(1, 15).cuboid(0.0F, -17.25F, -7.0F, 0.0F, 13.0F, 14.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("large_crest", CubeListBuilder.create() + .texOffs(1, 15).addBox(0.0F, -17.25F, -7.0F, 0.0F, 13.0F, 14.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("central_spine", ModelPartBuilder.create() - .uv(0, 45).cuboid(-5.0F, 2.0F, -0.75F, 1.0F, 10.0F, 9.0F, new Dilation(0.1F)), - ModelTransform.of(4.5F, -2.25F, -7.0F, 1.5708F, 0.0F, 0.0F)); + head.addOrReplaceChild("central_spine", CubeListBuilder.create() + .texOffs(0, 45).addBox(-5.0F, 2.0F, -0.75F, 1.0F, 10.0F, 9.0F, new CubeDeformation(0.1F)), + PartPose.offsetAndRotation(4.5F, -2.25F, -7.0F, 1.5708F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/ErynGalenWatchwardenHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/ErynGalenWatchwardenHelmetModel.java index d24c94f37c..d414e8a04a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/ErynGalenWatchwardenHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/ErynGalenWatchwardenHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.elves.woodlandrealm; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class ErynGalenWatchwardenHelmetModel extends HelmetAddonModel { @@ -11,44 +18,44 @@ public ErynGalenWatchwardenHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData addon = head.addChild("addon", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition addon = head.addOrReplaceChild("addon", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData centralSpine = addon.addChild("central_spine", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition centralSpine = addon.addOrReplaceChild("central_spine", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData cube_r1 = centralSpine.addChild("cube_r1", ModelPartBuilder.create().uv(0, 45) - .cuboid(-5.0F, 2.0F, 0.0F, 1.0F, 10.0F, 9.0F, new Dilation(0.1F)), - ModelTransform.of(4.5F, -2.25F, -7.0F, 1.5708F, 0.0F, 0.0F)); + PartDefinition cube_r1 = centralSpine.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 45) + .addBox(-5.0F, 2.0F, 0.0F, 1.0F, 10.0F, 9.0F, new CubeDeformation(0.1F)), + PartPose.offsetAndRotation(4.5F, -2.25F, -7.0F, 1.5708F, 0.0F, 0.0F)); - ModelPartData fin = addon.addChild("fin", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition fin = addon.addOrReplaceChild("fin", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData fin_1 = fin.addChild("fin_1", ModelPartBuilder.create().uv(0, 0) - .cuboid(-11.0F, -2.0F + Y_OFFSET, -4.0F, 21.0F, 0.0F, 11.0F, new Dilation(0.0F)), - ModelTransform.of(0.5F, -6.25F, -0.388F, 0.6021F, 0.0F, 0.0F)); + PartDefinition fin_1 = fin.addOrReplaceChild("fin_1", CubeListBuilder.create().texOffs(0, 0) + .addBox(-11.0F, -2.0F + Y_OFFSET, -4.0F, 21.0F, 0.0F, 11.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.5F, -6.25F, -0.388F, 0.6021F, 0.0F, 0.0F)); - ModelPartData Crest = addon.addChild("crest", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition Crest = addon.addOrReplaceChild("crest", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData crest_r1 = Crest.addChild("crest_left", ModelPartBuilder.create().uv(46, 51). - cuboid(-3.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(2.654F, -14.0819F, -1.4803F, -0.4363F, -0.6109F, 0.2094F)); + PartDefinition crest_r1 = Crest.addOrReplaceChild("crest_left", CubeListBuilder.create().texOffs(46, 51). + addBox(-3.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(2.654F, -14.0819F, -1.4803F, -0.4363F, -0.6109F, 0.2094F)); - ModelPartData crest_r2 = Crest.addChild("crest_right", ModelPartBuilder.create().uv(46, 51).mirrored() - .cuboid(-5.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(-3.404F, -13.8899F, -0.9163F, -0.4363F, 0.6109F, -0.2094F)); + PartDefinition crest_r2 = Crest.addOrReplaceChild("crest_right", CubeListBuilder.create().texOffs(46, 51).mirror() + .addBox(-5.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(-3.404F, -13.8899F, -0.9163F, -0.4363F, 0.6109F, -0.2094F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/SilvanLordHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/SilvanLordHelmetModel.java index 2d2582e3b8..3f43ab6ea2 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/SilvanLordHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/SilvanLordHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.elves.woodlandrealm; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class SilvanLordHelmetModel extends HelmetAddonModel { @@ -11,41 +18,41 @@ public SilvanLordHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData addon = head.addChild("addon", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 1.75F, -0.25F)); + PartDefinition addon = head.addOrReplaceChild("addon", CubeListBuilder.create(), PartPose.offset(0.0F, 1.75F, -0.25F)); - addon.addChild("central_spine", ModelPartBuilder.create().uv(0, 45).cuboid(-5.0F, 2.0F + Y_OFFSET, 0.0F, 1.0F, 10.0F, 9.0F, - new Dilation(0.1F)), ModelTransform.of(4.5F, -3.25F, -7.5F, 1.5708F, 0.0F, 0.0F)); + addon.addOrReplaceChild("central_spine", CubeListBuilder.create().texOffs(0, 45).addBox(-5.0F, 2.0F + Y_OFFSET, 0.0F, 1.0F, 10.0F, 9.0F, + new CubeDeformation(0.1F)), PartPose.offsetAndRotation(4.5F, -3.25F, -7.5F, 1.5708F, 0.0F, 0.0F)); - ModelPartData crest = addon.addChild("crest", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -0.5F, 1.08F)); + PartDefinition crest = addon.addOrReplaceChild("crest", CubeListBuilder.create(), PartPose.offset(0.0F, -0.5F, 1.08F)); - ModelPartData crest_left = crest.addChild("crest_left", ModelPartBuilder.create().uv(46, 51) - .cuboid(-3.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(2.654F, -15.0819F, -2.0603F, -0.4363F, -0.6109F, 0.2094F)); + PartDefinition crest_left = crest.addOrReplaceChild("crest_left", CubeListBuilder.create().texOffs(46, 51) + .addBox(-3.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(2.654F, -15.0819F, -2.0603F, -0.4363F, -0.6109F, 0.2094F)); - ModelPartData crest_right = crest.addChild("crest_right", ModelPartBuilder.create().uv(46, 51) - .mirrored().cuboid(-5.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(-3.404F, -14.8899F, -1.4963F, -0.4363F, 0.6109F, -0.2094F)); + PartDefinition crest_right = crest.addOrReplaceChild("crest_right", CubeListBuilder.create().texOffs(46, 51) + .mirror().addBox(-5.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(-3.404F, -14.8899F, -1.4963F, -0.4363F, 0.6109F, -0.2094F)); - ModelPartData fin = addon.addChild("fin", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -0.5F, 1.08F)); + PartDefinition fin = addon.addOrReplaceChild("fin", CubeListBuilder.create(), PartPose.offset(0.0F, -0.5F, 1.08F)); - ModelPartData fin_1 = fin.addChild("fin_1", ModelPartBuilder.create().uv(0, 0) - .cuboid(-11.0F, -2.0F + Y_OFFSET, -3.75F, 21.0F, 0.0F, 11.0F, new Dilation(0.0F)), - ModelTransform.of(0.5F, -7.25F, -0.968F, 0.6021F, 0.0F, 0.0F)); + PartDefinition fin_1 = fin.addOrReplaceChild("fin_1", CubeListBuilder.create().texOffs(0, 0) + .addBox(-11.0F, -2.0F + Y_OFFSET, -3.75F, 21.0F, 0.0F, 11.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.5F, -7.25F, -0.968F, 0.6021F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WardenGladeHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WardenGladeHelmetModel.java index 14e4202e6e..7ac674912b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WardenGladeHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WardenGladeHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.elves.woodlandrealm; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class WardenGladeHelmetModel extends HelmetAddonModel { @@ -11,42 +18,42 @@ public WardenGladeHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData addon = head.addChild("addon", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 1.75F, -0.25F)); + PartDefinition addon = head.addOrReplaceChild("addon", CubeListBuilder.create(), PartPose.offset(0.0F, 1.75F, -0.25F)); - addon.addChild("central_spine", ModelPartBuilder.create().uv(0, 45).cuboid(-5.0F, 2.0F + Y_OFFSET, 0.0F, 1.0F, 10.0F, 9.0F, - new Dilation(0.1F)), ModelTransform.of(4.5F, -3.25F, -7.5F, 1.5708F, 0.0F, 0.0F)); + addon.addOrReplaceChild("central_spine", CubeListBuilder.create().texOffs(0, 45).addBox(-5.0F, 2.0F + Y_OFFSET, 0.0F, 1.0F, 10.0F, 9.0F, + new CubeDeformation(0.1F)), PartPose.offsetAndRotation(4.5F, -3.25F, -7.5F, 1.5708F, 0.0F, 0.0F)); - ModelPartData crest = addon.addChild("crest", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -0.5F, 1.08F)); + PartDefinition crest = addon.addOrReplaceChild("crest", CubeListBuilder.create(), PartPose.offset(0.0F, -0.5F, 1.08F)); - crest.addChild("crest_left", ModelPartBuilder.create().uv(46, 51).cuboid(-3.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, - new Dilation(0.0F)), ModelTransform.of(2.654F, -15.0819F, -2.0603F, -0.4363F, -0.6109F, 0.2094F)); + crest.addOrReplaceChild("crest_left", CubeListBuilder.create().texOffs(46, 51).addBox(-3.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, + new CubeDeformation(0.0F)), PartPose.offsetAndRotation(2.654F, -15.0819F, -2.0603F, -0.4363F, -0.6109F, 0.2094F)); - crest.addChild("crest_right", ModelPartBuilder.create().uv(46, 51).mirrored().cuboid(-5.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, - new Dilation(0.0F)).mirrored(false), ModelTransform.of(-3.404F, -14.8899F, -1.4963F, -0.4363F, 0.6109F, -0.2094F)); + crest.addOrReplaceChild("crest_right", CubeListBuilder.create().texOffs(46, 51).mirror().addBox(-5.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, + new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-3.404F, -14.8899F, -1.4963F, -0.4363F, 0.6109F, -0.2094F)); - addon.addChild("lower_extension", ModelPartBuilder.create().uv(0, 11) - .cuboid(-4.0F, -11.5F + Y_OFFSET, -3.8F, 8.0F, 8.0F, 8.0F, new Dilation(0.55F)) - .uv(32, 11).cuboid(-4.0F, -10.0F + Y_OFFSET, -4.5F, 8.0F, 8.0F, 8.0F, - new Dilation(0.9F)), ModelTransform.origin(0.0F, 9.8F, 0.0F)); + addon.addOrReplaceChild("lower_extension", CubeListBuilder.create().texOffs(0, 11) + .addBox(-4.0F, -11.5F + Y_OFFSET, -3.8F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.55F)) + .texOffs(32, 11).addBox(-4.0F, -10.0F + Y_OFFSET, -4.5F, 8.0F, 8.0F, 8.0F, + new CubeDeformation(0.9F)), PartPose.offset(0.0F, 9.8F, 0.0F)); - addon.addChild("addon_eye", ModelPartBuilder.create() - .uv(46, 63).cuboid(-4.5F, -4.3F + Y_OFFSET, -4.475F, 9.0F, 1.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + addon.addOrReplaceChild("addon_eye", CubeListBuilder.create() + .texOffs(46, 63).addBox(-4.5F, -4.3F + Y_OFFSET, -4.475F, 9.0F, 1.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WarriorOfTheNightshadeHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WarriorOfTheNightshadeHelmetModel.java index 32e2b3fef6..536f79eeee 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WarriorOfTheNightshadeHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WarriorOfTheNightshadeHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.elves.woodlandrealm; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class WarriorOfTheNightshadeHelmetModel extends HelmetAddonModel { @@ -10,28 +17,28 @@ public WarriorOfTheNightshadeHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData addon = head.addChild("addon", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition addon = head.addOrReplaceChild("addon", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData centralSpine = addon.addChild("central_spine", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition centralSpine = addon.addOrReplaceChild("central_spine", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData cube_r1 = centralSpine.addChild("cube_r1", ModelPartBuilder.create().uv(0, 45) - .cuboid(-5.0F, 2.0F, 0.0F, 1.0F, 10.0F, 9.0F, new Dilation(0.1F)), - ModelTransform.of(4.5F, -2.25F, -7.0F, 1.5708F, 0.0F, 0.0F)); + PartDefinition cube_r1 = centralSpine.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 45) + .addBox(-5.0F, 2.0F, 0.0F, 1.0F, 10.0F, 9.0F, new CubeDeformation(0.1F)), + PartPose.offsetAndRotation(4.5F, -2.25F, -7.0F, 1.5708F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmCommanderHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmCommanderHelmetModel.java index fd4adaa8a0..96c887e18d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmCommanderHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmCommanderHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.elves.woodlandrealm; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class WoodlandRealmCommanderHelmetModel extends HelmetAddonModel { @@ -11,38 +18,38 @@ public WoodlandRealmCommanderHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData addon = head.addChild("addon", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition addon = head.addOrReplaceChild("addon", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData centralSpine = addon.addChild("central_spine", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition centralSpine = addon.addOrReplaceChild("central_spine", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData cube_r1 = centralSpine.addChild("cube_r1", ModelPartBuilder.create().uv(0, 45) - .cuboid(-5.0F, 2.0F, 0.0F, 1.0F, 10.0F, 9.0F, new Dilation(0.1F)), - ModelTransform.of(4.5F, -2.25F, -7.0F, 1.5708F, 0.0F, 0.0F)); + PartDefinition cube_r1 = centralSpine.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 45) + .addBox(-5.0F, 2.0F, 0.0F, 1.0F, 10.0F, 9.0F, new CubeDeformation(0.1F)), + PartPose.offsetAndRotation(4.5F, -2.25F, -7.0F, 1.5708F, 0.0F, 0.0F)); - ModelPartData Crest = addon.addChild("crest", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition Crest = addon.addOrReplaceChild("crest", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData crest_r1 = Crest.addChild("crest_left", ModelPartBuilder.create().uv(46, 51). - cuboid(-3.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(2.654F, -14.0819F, -1.4803F, -0.4363F, -0.6109F, 0.2094F)); + PartDefinition crest_r1 = Crest.addOrReplaceChild("crest_left", CubeListBuilder.create().texOffs(46, 51). + addBox(-3.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(2.654F, -14.0819F, -1.4803F, -0.4363F, -0.6109F, 0.2094F)); - ModelPartData crest_r2 = Crest.addChild("crest_right", ModelPartBuilder.create().uv(46, 51).mirrored() - .cuboid(-5.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(-3.404F, -13.8899F, -0.9163F, -0.4363F, 0.6109F, -0.2094F)); + PartDefinition crest_r2 = Crest.addOrReplaceChild("crest_right", CubeListBuilder.create().texOffs(46, 51).mirror() + .addBox(-5.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(-3.404F, -13.8899F, -0.9163F, -0.4363F, 0.6109F, -0.2094F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmCrownModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmCrownModel.java index 23ba8a0fbc..e13406b1d2 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmCrownModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmCrownModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.elves.woodlandrealm; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class WoodlandRealmCrownModel extends HelmetAddonModel { @@ -15,34 +22,34 @@ public WoodlandRealmCrownModel(ModelPart root) { this.crown = addon.getChild("crown"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData addon = head.addChild("addon", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 1.75F, -0.25F)); + PartDefinition addon = head.addOrReplaceChild("addon", CubeListBuilder.create(), PartPose.offset(0.0F, 1.75F, -0.25F)); - ModelPartData crown = addon.addChild("crown", ModelPartBuilder.create().uv(41, 28) - .cuboid(-1.9077F, -8.5F, 3.3333F, 4.0F, 15.0F, 0.0F, - new Dilation(0.0F)), ModelTransform.of(-0.0909F, -11.0F, 2.4137F, -0.3491F, 0.0F, 0.0F)); + PartDefinition crown = addon.addOrReplaceChild("crown", CubeListBuilder.create().texOffs(41, 28) + .addBox(-1.9077F, -8.5F, 3.3333F, 4.0F, 15.0F, 0.0F, + new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-0.0909F, -11.0F, 2.4137F, -0.3491F, 0.0F, 0.0F)); - ModelPartData crown_side_right = crown.addChild("crown_side_right", ModelPartBuilder.create().uv(26, 28) - .cuboid(-4.0F, -7.5F, 0.0F, 7.0F, 15.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(-3.9077F, -1.0F, 1.3333F, 0.0F, -0.7418F, 0.0F)); + PartDefinition crown_side_right = crown.addOrReplaceChild("crown_side_right", CubeListBuilder.create().texOffs(26, 28) + .addBox(-4.0F, -7.5F, 0.0F, 7.0F, 15.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-3.9077F, -1.0F, 1.3333F, 0.0F, -0.7418F, 0.0F)); - ModelPartData crown_side_left = crown.addChild("crown_side_left", ModelPartBuilder.create().uv(50, 28) - .mirrored().cuboid(-3.0F, -7.5F, 0.0F, 7.0F, 15.0F, 0.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(4.1154F, -1.0F, 1.3335F, 0.0F, 0.7418F, 0.0F)); + PartDefinition crown_side_left = crown.addOrReplaceChild("crown_side_left", CubeListBuilder.create().texOffs(50, 28) + .mirror().addBox(-3.0F, -7.5F, 0.0F, 7.0F, 15.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(4.1154F, -1.0F, 1.3335F, 0.0F, 0.7418F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmRangerHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmRangerHelmetModel.java index 083896323f..1d0a25d7f0 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmRangerHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmRangerHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.elves.woodlandrealm; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class WoodlandRealmRangerHelmetModel extends HelmetAddonModel { @@ -10,28 +17,28 @@ public WoodlandRealmRangerHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData addon = head.addChild("addon", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition addon = head.addOrReplaceChild("addon", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData centralSpine = addon.addChild("central_spine", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition centralSpine = addon.addOrReplaceChild("central_spine", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData cube_r1 = centralSpine.addChild("cube_r1", ModelPartBuilder.create().uv(0, 45) - .cuboid(-5.0F, 2.0F, 0.0F, 1.0F, 10.0F, 9.0F, new Dilation(0.1F)), - ModelTransform.of(4.5F, -2.25F, -7.0F, 1.5708F, 0.0F, 0.0F)); + PartDefinition cube_r1 = centralSpine.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 45) + .addBox(-5.0F, 2.0F, 0.0F, 1.0F, 10.0F, 9.0F, new CubeDeformation(0.1F)), + PartPose.offsetAndRotation(4.5F, -2.25F, -7.0F, 1.5708F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmRoyalGuardHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmRoyalGuardHelmetModel.java index 4e2dfb1ff6..2cfe85ec26 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmRoyalGuardHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmRoyalGuardHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.elves.woodlandrealm; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class WoodlandRealmRoyalGuardHelmetModel extends HelmetAddonModel { @@ -11,43 +18,43 @@ public WoodlandRealmRoyalGuardHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData addon = head.addChild("addon", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition addon = head.addOrReplaceChild("addon", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData centralSpine = addon.addChild("central_spine", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition centralSpine = addon.addOrReplaceChild("central_spine", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData cube_r1 = centralSpine.addChild("cube_r1", ModelPartBuilder.create().uv(0, 45) - .cuboid(-5.0F, 2.0F, 0.0F, 1.0F, 10.0F, 9.0F, new Dilation(0.1F)), - ModelTransform.of(4.5F, -2.25F, -7.0F, 1.5708F, 0.0F, 0.0F)); + PartDefinition cube_r1 = centralSpine.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 45) + .addBox(-5.0F, 2.0F, 0.0F, 1.0F, 10.0F, 9.0F, new CubeDeformation(0.1F)), + PartPose.offsetAndRotation(4.5F, -2.25F, -7.0F, 1.5708F, 0.0F, 0.0F)); - ModelPartData fin = addon.addChild("fin", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition fin = addon.addOrReplaceChild("fin", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData fin1 = fin.addChild("fin_1", ModelPartBuilder.create().uv(0, 0) - .cuboid(-11.0F, -2.0F + Y_OFFSET, -4.0F, 21.0F, 0.0F, 11.0F, new Dilation(0.0F)), - ModelTransform.of(0.5F, -6.25F, -0.388F, 0.6021F, 0.0F, 0.0F)); + PartDefinition fin1 = fin.addOrReplaceChild("fin_1", CubeListBuilder.create().texOffs(0, 0) + .addBox(-11.0F, -2.0F + Y_OFFSET, -4.0F, 21.0F, 0.0F, 11.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.5F, -6.25F, -0.388F, 0.6021F, 0.0F, 0.0F)); - ModelPartData lowerExtension = addon.addChild("lower_extension", ModelPartBuilder.create().uv(0, 11) - .cuboid(-4.0F, -13.8F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.5F)).uv(32, 11) - .cuboid(-4.0F, -10.0F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.9F)), ModelTransform.origin(0.0F, 10.8F, 0.0F)); + PartDefinition lowerExtension = addon.addOrReplaceChild("lower_extension", CubeListBuilder.create().texOffs(0, 11) + .addBox(-4.0F, -13.8F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.5F)).texOffs(32, 11) + .addBox(-4.0F, -10.0F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.9F)), PartPose.offset(0.0F, 10.8F, 0.0F)); - head.addChild("addon_eye", ModelPartBuilder.create() - .uv(46, 63).cuboid(-4.5F, -3.55F, -4.475F, 9.0F, 1.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("addon_eye", CubeListBuilder.create() + .texOffs(46, 63).addBox(-4.5F, -3.55F, -4.475F, 9.0F, 1.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmSoldierHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmSoldierHelmetModel.java index f821fbd609..3c60f63f49 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmSoldierHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/elves/woodlandrealm/WoodlandRealmSoldierHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.elves.woodlandrealm; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class WoodlandRealmSoldierHelmetModel extends HelmetAddonModel { @@ -11,38 +18,38 @@ public WoodlandRealmSoldierHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData addon = head.addChild("addon", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition addon = head.addOrReplaceChild("addon", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData centralSpine = addon.addChild("central_spine", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition centralSpine = addon.addOrReplaceChild("central_spine", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData cube_r1 = centralSpine.addChild("cube_r1", ModelPartBuilder.create().uv(0, 45) - .cuboid(-5.0F, 2.0F, 0.0F, 1.0F, 10.0F, 9.0F, new Dilation(0.1F)), - ModelTransform.of(4.5F, -2.25F, -7.0F, 1.5708F, 0.0F, 0.0F)); + PartDefinition cube_r1 = centralSpine.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 45) + .addBox(-5.0F, 2.0F, 0.0F, 1.0F, 10.0F, 9.0F, new CubeDeformation(0.1F)), + PartPose.offsetAndRotation(4.5F, -2.25F, -7.0F, 1.5708F, 0.0F, 0.0F)); - ModelPartData Crest = addon.addChild("crest", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition Crest = addon.addOrReplaceChild("crest", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData crest_r1 = Crest.addChild("crest_left", ModelPartBuilder.create().uv(46, 51). - cuboid(-3.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(2.654F, -14.0819F, -1.4803F, -0.4363F, -0.6109F, 0.2094F)); + PartDefinition crest_r1 = Crest.addOrReplaceChild("crest_left", CubeListBuilder.create().texOffs(46, 51). + addBox(-3.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(2.654F, -14.0819F, -1.4803F, -0.4363F, -0.6109F, 0.2094F)); - ModelPartData crest_r2 = Crest.addChild("crest_right", ModelPartBuilder.create().uv(46, 51).mirrored() - .cuboid(-5.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(-3.404F, -13.8899F, -0.9163F, -0.4363F, 0.6109F, -0.2094F)); + PartDefinition crest_r2 = Crest.addOrReplaceChild("crest_right", CubeListBuilder.create().texOffs(46, 51).mirror() + .addBox(-5.0F, -6.0F + Y_OFFSET, 0.0F, 9.0F, 12.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(-3.404F, -13.8899F, -0.9163F, -0.4363F, 0.6109F, -0.2094F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/dale/DaleFeatherHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/dale/DaleFeatherHelmetModel.java index 4f1b66b0c6..7c7f8ad678 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/dale/DaleFeatherHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/dale/DaleFeatherHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.humans.dale; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class DaleFeatherHelmetModel extends DaleHelmetModel { @@ -9,65 +16,65 @@ public DaleFeatherHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData modelPartData = modelData.getRoot(); - - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - head.addChild("spike", ModelPartBuilder.create() - .uv(0, 0).cuboid(-0.5F, -0.75F, -0.5F, 1.0F, 3.0F, 1.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, -10.5F, 0.0F, 0.0F, -0.7854F, 0.0F)); - - ModelPartData feather_duster = head.addChild("feather_duster", ModelPartBuilder.create(), - ModelTransform.origin(0.0F, -11.0F, 0.0F)); - - ModelPartData plumes = feather_duster.addChild("plumes", ModelPartBuilder.create(), - ModelTransform.of(0.0F, 0.0F, 0.0F, -0.1309F, 0.0F, 0.0F)); - - ModelPartData plume_0 = plumes.addChild("plumes_0", ModelPartBuilder.create() - .uv(0, 51).cuboid(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, 0.0F, 0.0F, -2.1369F, -0.5338F, 1.8835F)); - plume_0.addChild("plume_0", ModelPartBuilder.create() - .uv(0, 45).cuboid(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, -6.0F, 0.0F, 0.0F, 0.0F, 0.5236F)); - - ModelPartData plume_1 = plumes.addChild("plumes_1", ModelPartBuilder.create() - .uv(14, 51).cuboid(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, 0.0F, 0.0F, -0.3841F, -0.761F, 0.4898F)); - plume_1.addChild("plume_1", ModelPartBuilder.create() - .uv(14, 45).cuboid(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, -6.0F, 0.0F, 0.0F, 0.0F, 0.5236F)); - - ModelPartData plume_2 = plumes.addChild("plumes_2", ModelPartBuilder.create() - .uv(28, 51).cuboid(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, 0.0F, 0.0F, -2.8254F, -0.5049F, 2.4806F)); - plume_2.addChild("plume_2", ModelPartBuilder.create() - .uv(28, 45).cuboid(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, -6.0F, 0.0F, 0.0F, 0.0F, 0.5236F)); - - ModelPartData plume_3 = plumes.addChild("plumes_3", ModelPartBuilder.create() - .uv(42, 51).cuboid(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, 0.0F, 0.0F, -2.7925F, 0.5672F, 3.1416F)); - plume_3.addChild("plume_3", ModelPartBuilder.create() - .uv(42, 45).cuboid(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, -6.0F, 0.0F, 0.0F, 0.0F, 0.5236F)); - - ModelPartData plume_4 = plumes.addChild("plumes_4", ModelPartBuilder.create() - .uv(42, 39).cuboid(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, 0.0F, 0.0F, -1.7964F, -0.9478F, 1.7551F)); - plume_4.addChild("plume_4", ModelPartBuilder.create() - .uv(42, 33).cuboid(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, -6.0F, 0.0F, 0.0F, 0.0F, 0.5236F)); - - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition modelPartData = modelData.getRoot(); + + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + + head.addOrReplaceChild("spike", CubeListBuilder.create() + .texOffs(0, 0).addBox(-0.5F, -0.75F, -0.5F, 1.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, -10.5F, 0.0F, 0.0F, -0.7854F, 0.0F)); + + PartDefinition feather_duster = head.addOrReplaceChild("feather_duster", CubeListBuilder.create(), + PartPose.offset(0.0F, -11.0F, 0.0F)); + + PartDefinition plumes = feather_duster.addOrReplaceChild("plumes", CubeListBuilder.create(), + PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -0.1309F, 0.0F, 0.0F)); + + PartDefinition plume_0 = plumes.addOrReplaceChild("plumes_0", CubeListBuilder.create() + .texOffs(0, 51).addBox(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -2.1369F, -0.5338F, 1.8835F)); + plume_0.addOrReplaceChild("plume_0", CubeListBuilder.create() + .texOffs(0, 45).addBox(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, -6.0F, 0.0F, 0.0F, 0.0F, 0.5236F)); + + PartDefinition plume_1 = plumes.addOrReplaceChild("plumes_1", CubeListBuilder.create() + .texOffs(14, 51).addBox(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -0.3841F, -0.761F, 0.4898F)); + plume_1.addOrReplaceChild("plume_1", CubeListBuilder.create() + .texOffs(14, 45).addBox(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, -6.0F, 0.0F, 0.0F, 0.0F, 0.5236F)); + + PartDefinition plume_2 = plumes.addOrReplaceChild("plumes_2", CubeListBuilder.create() + .texOffs(28, 51).addBox(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -2.8254F, -0.5049F, 2.4806F)); + plume_2.addOrReplaceChild("plume_2", CubeListBuilder.create() + .texOffs(28, 45).addBox(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, -6.0F, 0.0F, 0.0F, 0.0F, 0.5236F)); + + PartDefinition plume_3 = plumes.addOrReplaceChild("plumes_3", CubeListBuilder.create() + .texOffs(42, 51).addBox(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -2.7925F, 0.5672F, 3.1416F)); + plume_3.addOrReplaceChild("plume_3", CubeListBuilder.create() + .texOffs(42, 45).addBox(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, -6.0F, 0.0F, 0.0F, 0.0F, 0.5236F)); + + PartDefinition plume_4 = plumes.addOrReplaceChild("plumes_4", CubeListBuilder.create() + .texOffs(42, 39).addBox(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -1.7964F, -0.9478F, 1.7551F)); + plume_4.addOrReplaceChild("plume_4", CubeListBuilder.create() + .texOffs(42, 33).addBox(0.0F, -5.25F, -3.0F, 0.0F, 6.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, -6.0F, 0.0F, 0.0F, 0.0F, 0.5236F)); + + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/dale/DaleHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/dale/DaleHelmetModel.java index bb8fdd20cc..36e337a2c4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/dale/DaleHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/dale/DaleHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.humans.dale; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class DaleHelmetModel extends HelmetAddonModel { @@ -10,29 +17,29 @@ public DaleHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("Addon", ModelPartBuilder.create() - .uv(0, 37).cuboid(-5.0F, -5.375F, -6.0F, 10.0F, 1.0F, 3.0F, new Dilation(0.0F)) - .uv(0, 29).cuboid(0.0F, -13.375F, -6.0F, 0.0F, 11.0F, 12.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("Addon", CubeListBuilder.create() + .texOffs(0, 37).addBox(-5.0F, -5.375F, -6.0F, 10.0F, 1.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(0, 29).addBox(0.0F, -13.375F, -6.0F, 0.0F, 11.0F, 12.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/dale/DaleSpikeFurHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/dale/DaleSpikeFurHelmetModel.java index 907873a46f..c9f5b43a6e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/dale/DaleSpikeFurHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/dale/DaleSpikeFurHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.humans.dale; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class DaleSpikeFurHelmetModel extends DaleSpikeHelmetModel { @@ -9,24 +16,24 @@ public DaleSpikeFurHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("fur", ModelPartBuilder.create() - .uv(0, 0).cuboid(-5.0F, -6.95F, -5.0F, 10.0F, 2.0F, 10.0F, new Dilation(0.2F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("fur", CubeListBuilder.create() + .texOffs(0, 0).addBox(-5.0F, -6.95F, -5.0F, 10.0F, 2.0F, 10.0F, new CubeDeformation(0.2F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/dale/DaleSpikeHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/dale/DaleSpikeHelmetModel.java index 4e2b668ad9..69850ee901 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/dale/DaleSpikeHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/dale/DaleSpikeHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.humans.dale; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class DaleSpikeHelmetModel extends HelmetAddonModel { @@ -10,31 +17,31 @@ public DaleSpikeHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData addon = head.addChild("addon", ModelPartBuilder.create() - .uv(37, 0).cuboid(-2.5F, -11.75F, -3.0F, 5.0F, 3.0F, 6.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - addon.addChild("tall_spike", ModelPartBuilder.create() - .uv(6, 0).cuboid(-0.5F, -3.75F, -0.5F, 1.0F, 8.0F, 1.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, -12.5F, 0.0F, 0.0F, -0.7854F, 0.0F)); + PartDefinition addon = head.addOrReplaceChild("addon", CubeListBuilder.create() + .texOffs(37, 0).addBox(-2.5F, -11.75F, -3.0F, 5.0F, 3.0F, 6.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + addon.addOrReplaceChild("tall_spike", CubeListBuilder.create() + .texOffs(6, 0).addBox(-0.5F, -3.75F, -0.5F, 1.0F, 8.0F, 1.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, -12.5F, 0.0F, 0.0F, -0.7854F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/gondor/CitadelGuardHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/gondor/CitadelGuardHelmetModel.java index 2deea58eb0..c5741d1926 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/gondor/CitadelGuardHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/gondor/CitadelGuardHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.humans.gondor; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.EggHelmetModel; public class CitadelGuardHelmetModel extends EggHelmetModel { @@ -10,18 +17,18 @@ public CitadelGuardHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); //+0.75 - ModelPartData head = modelData.getRoot().addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelData.getRoot().addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("side_left", ModelPartBuilder.create() - .uv(40, 32).cuboid(-0.5F, -9.75F, 0.284F, 6.0F, 15.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(5.0F, -6.0F, -2.5F, 0.0F, -1.3963F, 0.0F)); - head.addChild("side_right", ModelPartBuilder.create() - .uv(52, 32).cuboid(-5.25F, -9.75F, 0.252F, 6.0F, 15.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(-5.0F, -6.0F, -2.5F, 0.0F, 1.3963F, 0.0F)); + head.addOrReplaceChild("side_left", CubeListBuilder.create() + .texOffs(40, 32).addBox(-0.5F, -9.75F, 0.284F, 6.0F, 15.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(5.0F, -6.0F, -2.5F, 0.0F, -1.3963F, 0.0F)); + head.addOrReplaceChild("side_right", CubeListBuilder.create() + .texOffs(52, 32).addBox(-5.25F, -9.75F, 0.252F, 6.0F, 15.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-5.0F, -6.0F, -2.5F, 0.0F, 1.3963F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/gondor/FountainGuardHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/gondor/FountainGuardHelmetModel.java index 65abe8c8cb..dd71d9dac9 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/gondor/FountainGuardHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/gondor/FountainGuardHelmetModel.java @@ -1,7 +1,13 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.humans.gondor; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.EggHelmetModel; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; @@ -11,17 +17,17 @@ public FountainGuardHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); //+0.75 - modelData.getRoot().addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create() - .uv(29, 0).cuboid(-3.0F, -15.35F, -4.35F, 6.0F, 12.0F, 0.0F, new Dilation(0.5F)) - .uv(0, 15).mirrored().cuboid(-4.0F, -7.75F, -4.314F, 8.0F, 8.0F, 0.0F, new Dilation(0.0F)).mirrored(false) - .uv(50, 0).mirrored().cuboid(2.0F, -19.55F, 0.0F, 7.0F, 16.0F, 0.0F, new Dilation(0.0F)).mirrored(false) - .uv(50, 16).cuboid(-9.0F, -19.55F, 0.0F, 7.0F, 16.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelData.getRoot().addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create() + .texOffs(29, 0).addBox(-3.0F, -15.35F, -4.35F, 6.0F, 12.0F, 0.0F, new CubeDeformation(0.5F)) + .texOffs(0, 15).mirror().addBox(-4.0F, -7.75F, -4.314F, 8.0F, 8.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(50, 0).mirror().addBox(2.0F, -19.55F, 0.0F, 7.0F, 16.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(50, 16).addBox(-9.0F, -19.55F, 0.0F, 7.0F, 16.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/gondor/KingsGuardHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/gondor/KingsGuardHelmetModel.java index 2682d21fc2..9578f8bf1d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/gondor/KingsGuardHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/gondor/KingsGuardHelmetModel.java @@ -1,7 +1,13 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.humans.gondor; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.EggHelmetModel; public class KingsGuardHelmetModel extends EggHelmetModel { @@ -10,15 +16,15 @@ public KingsGuardHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); //+0.75 - modelData.getRoot().addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create() - .uv(50, 0).mirrored().cuboid(2.0F, -19.55F, 0.0F, 7.0F, 16.0F, 0.0F, new Dilation(0.0F)).mirrored(false) - .uv(50, 16).cuboid(-9.0F, -19.55F, 0.0F, 7.0F, 16.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelData.getRoot().addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create() + .texOffs(50, 0).mirror().addBox(2.0F, -19.55F, 0.0F, 7.0F, 16.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(50, 16).addBox(-9.0F, -19.55F, 0.0F, 7.0F, 16.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/hobbits/ShirriffHatModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/hobbits/ShirriffHatModel.java index b5d07d07ea..a50f3021af 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/hobbits/ShirriffHatModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/hobbits/ShirriffHatModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.humans.hobbits; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HatHelmetModel; public class ShirriffHatModel extends HatHelmetModel { @@ -10,25 +17,25 @@ public ShirriffHatModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData feathers = head.addChild("feathers", ModelPartBuilder.create(), - ModelTransform.of(3.9823F, -10.002F, 0.7141F, -0.0393F, 0.0F, 0.0F)); - feathers.addChild("duck_feather", ModelPartBuilder.create() - .uv(13, 32).cuboid(-0.3F, -3.85F, -6.5F, 0.0F, 8.0F, 10.0F, new Dilation(1.0F)), - ModelTransform.of(0.3037F, 1.402F, 1.6859F, 0.1327F, 0.0379F, 0.0433F)); + PartDefinition feathers = head.addOrReplaceChild("feathers", CubeListBuilder.create(), + PartPose.offsetAndRotation(3.9823F, -10.002F, 0.7141F, -0.0393F, 0.0F, 0.0F)); + feathers.addOrReplaceChild("duck_feather", CubeListBuilder.create() + .texOffs(13, 32).addBox(-0.3F, -3.85F, -6.5F, 0.0F, 8.0F, 10.0F, new CubeDeformation(1.0F)), + PartPose.offsetAndRotation(0.3037F, 1.402F, 1.6859F, 0.1327F, 0.0379F, 0.0433F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/rohan/HammerhandHelmModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/rohan/HammerhandHelmModel.java index bb10b550b2..5f20b0e27f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/rohan/HammerhandHelmModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/rohan/HammerhandHelmModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.humans.rohan; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class HammerhandHelmModel extends RohanHelmetModel { @@ -9,34 +16,34 @@ public HammerhandHelmModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData HornsR = head.addChild("horn_right_attachment", ModelPartBuilder.create() - .uv(0, 0).cuboid(-6.4F, -6.25F, -1.0F, 2.0F, 2.0F, 2.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - HornsR.addChild("horn_right", ModelPartBuilder.create() - .uv(50, 0).cuboid(-3.5F, -11.25F, 0.0F, 7.0F, 13.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(-5.5F, -5.0F, 0.0F, 0.0F, 0.0F, 0.1396F)); + PartDefinition HornsR = head.addOrReplaceChild("horn_right_attachment", CubeListBuilder.create() + .texOffs(0, 0).addBox(-6.4F, -6.25F, -1.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + HornsR.addOrReplaceChild("horn_right", CubeListBuilder.create() + .texOffs(50, 0).addBox(-3.5F, -11.25F, 0.0F, 7.0F, 13.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-5.5F, -5.0F, 0.0F, 0.0F, 0.0F, 0.1396F)); - ModelPartData HornsR2 = head.addChild("horn_left_attachment", ModelPartBuilder.create() - .uv(0, 0).cuboid(4.6F, -6.25F, -1.0F, 2.0F, 2.0F, 2.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); - HornsR2.addChild("horn_left", ModelPartBuilder.create() - .uv(50, 13).mirrored().cuboid(-3.5F, -11.25F, 0.0F, 7.0F, 13.0F, 0.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(5.7F, -5.0F, 0.0F, 0.0F, 0.0F, -0.1396F)); + PartDefinition HornsR2 = head.addOrReplaceChild("horn_left_attachment", CubeListBuilder.create() + .texOffs(0, 0).addBox(4.6F, -6.25F, -1.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); + HornsR2.addOrReplaceChild("horn_left", CubeListBuilder.create() + .texOffs(50, 13).mirror().addBox(-3.5F, -11.25F, 0.0F, 7.0F, 13.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(5.7F, -5.0F, 0.0F, 0.0F, 0.0F, -0.1396F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/rohan/RohanHairHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/rohan/RohanHairHelmetModel.java index c8e58dacf9..2a67a50fc0 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/rohan/RohanHairHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/rohan/RohanHairHelmetModel.java @@ -1,8 +1,15 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.humans.rohan; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.world.entity.LivingEntity; public class RohanHairHelmetModel extends RohanHelmetModel { private static final float MAX_ANGLE_HAIR = 75f; @@ -14,31 +21,32 @@ public RohanHairHelmetModel(ModelPart root) { hair = root.getChild("head").getChild("hair_bone").getChild("hair"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData hair_bone = head.addChild("hair_bone", ModelPartBuilder.create(), - ModelTransform.of(0.0F, -9.5F, 5.5F, 0.48F, 0.0F, 0.0F)); - hair_bone.addChild("hair", ModelPartBuilder.create() - .uv(0, 27).cuboid(-1.0F, -2.25F, 0.0F, 2.0F, 3.0F, 18.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, 1.0F, -1.0F, -2.0508F, 0.0F, 0.0F)); + PartDefinition hair_bone = head.addOrReplaceChild("hair_bone", CubeListBuilder.create(), + PartPose.offsetAndRotation(0.0F, -9.5F, 5.5F, 0.48F, 0.0F, 0.0F)); + hair_bone.addOrReplaceChild("hair", CubeListBuilder.create() + .texOffs(0, 27).addBox(-1.0F, -2.25F, 0.0F, 2.0F, 3.0F, 18.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 1.0F, -1.0F, -2.0508F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } @Override - public void setAngles(BipedEntityRenderState bipedEntityRenderState) { + public void setupAnim(LivingEntity entity, float limbAngle, float limbDistance, + float animationProgress, float headYaw, float headPitch) { /*Vec3d velocity = bipedEntityRenderState.positionOffset; double sqrVel = velocity.lengthSquared(); double speed = (sqrVel * 0.35f) + Math.sqrt(Math.abs(bipedEntityRenderState.limbFrequency)) * 0.4f; @@ -58,4 +66,4 @@ public void setAngles(BipedEntityRenderState bipedEntityRenderState) { this.hair.pitch = ToRad.ex(degree);*/ } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/rohan/RohanHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/rohan/RohanHelmetModel.java index 939aff063a..5f5e24c81d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/rohan/RohanHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/humans/rohan/RohanHelmetModel.java @@ -1,9 +1,15 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.humans.rohan; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class RohanHelmetModel extends HelmetAddonModel { @@ -11,28 +17,28 @@ public RohanHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("Addon", ModelPartBuilder.create() - .uv(30, 17).cuboid(0.0F, -14.75F, -9.5F, 0.0F, 11.0F, 17.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("Addon", CubeListBuilder.create() + .texOffs(30, 17).addBox(0.0F, -14.75F, -9.5F, 0.0F, 11.0F, 17.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/MandibleHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/MandibleHelmetModel.java index 57fa739542..e50c886f23 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/MandibleHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/MandibleHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class MandibleHelmetModel extends HelmetAddonModel { @@ -10,29 +17,29 @@ public MandibleHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("large_crest", ModelPartBuilder.create() - .uv(28, -18).cuboid(0.0F, -15.25F, -7.0F, 0.0F, 14.0F, 18.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("large_crest", CubeListBuilder.create() + .texOffs(28, -18).addBox(0.0F, -15.25F, -7.0F, 0.0F, 14.0F, 18.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("bottom_jaw", ModelPartBuilder.create() - .uv(0, 31).cuboid(-8.4497F, -9.75F, 2.0F, 6.0F, 10.0F, 6.0F, new Dilation(0.3F)), - ModelTransform.of(0.3498F, 4.5F, -8.9142F, 0.6603F, 0.6603F, 0.4439F)); + head.addOrReplaceChild("bottom_jaw", CubeListBuilder.create() + .texOffs(0, 31).addBox(-8.4497F, -9.75F, 2.0F, 6.0F, 10.0F, 6.0F, new CubeDeformation(0.3F)), + PartPose.offsetAndRotation(0.3498F, 4.5F, -8.9142F, 0.6603F, 0.6603F, 0.4439F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/OrcSpikeHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/OrcSpikeHelmetModel.java index 6947cd2839..37275c7d14 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/OrcSpikeHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/OrcSpikeHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class OrcSpikeHelmetModel extends HelmetAddonModel { @@ -10,27 +17,27 @@ public OrcSpikeHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("spike_0", ModelPartBuilder.create() - .uv(0, 59).cuboid(-2.5F, -2.75F, 0.0F, 5.0F, 5.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, -11.0F, 0.0F, 0.0F, -0.7854F, 0.0F)); - head.addChild("spike_1", ModelPartBuilder.create() - .uv(0, 54).cuboid(0.0F, -2.75F, -2.5F, 0.0F, 5.0F, 5.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, -11.0F, 0.0F, 0.0F, -0.7854F, 0.0F)); + head.addOrReplaceChild("spike_0", CubeListBuilder.create() + .texOffs(0, 59).addBox(-2.5F, -2.75F, 0.0F, 5.0F, 5.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, -11.0F, 0.0F, 0.0F, -0.7854F, 0.0F)); + head.addOrReplaceChild("spike_1", CubeListBuilder.create() + .texOffs(0, 54).addBox(0.0F, -2.75F, -2.5F, 0.0F, 5.0F, 5.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, -11.0F, 0.0F, 0.0F, -0.7854F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinKingCrownModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinKingCrownModel.java index 63b9ec845b..dc43b73c93 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinKingCrownModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinKingCrownModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.goblintown; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class GoblinKingCrownModel extends HelmetAddonModel { @@ -10,29 +17,29 @@ public GoblinKingCrownModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("Crown", ModelPartBuilder.create() - .uv(57, 18).cuboid(-0.5F, -14.25F, -5.0F, 1.0F, 8.0F, 1.0F, new Dilation(0.0F)) - .uv(57, 29).cuboid(4.0F, -12.25F, -1.0F, 1.0F, 6.0F, 1.0F, new Dilation(0.0F)) - .uv(57, 38).cuboid(-3.4F, -10.25F, -5.0F, 1.0F, 4.0F, 1.0F, new Dilation(0.0F)) - .uv(51, 29).cuboid(-5.0F, -12.25F, -1.0F, 1.0F, 6.0F, 1.0F, new Dilation(0.0F)) - .uv(51, 38).cuboid(2.4F, -10.25F, -5.0F, 1.0F, 4.0F, 1.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("Crown", CubeListBuilder.create() + .texOffs(57, 18).addBox(-0.5F, -14.25F, -5.0F, 1.0F, 8.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(57, 29).addBox(4.0F, -12.25F, -1.0F, 1.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(57, 38).addBox(-3.4F, -10.25F, -5.0F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(51, 29).addBox(-5.0F, -12.25F, -1.0F, 1.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(51, 38).addBox(2.4F, -10.25F, -5.0F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownBoneMandibleModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownBoneMandibleModel.java index a08df378e5..77bab12b64 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownBoneMandibleModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownBoneMandibleModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.goblintown; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class GoblinTownBoneMandibleModel extends HelmetAddonModel { @@ -10,31 +17,31 @@ public GoblinTownBoneMandibleModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("mandible_left", ModelPartBuilder.create() - .uv(2, 15).cuboid(0.0F, -8.25F, -6.0F, 0.0F, 9.0F, 6.0F, new Dilation(0.0F)), - ModelTransform.of(4.0F, 2.0F, -4.0F, 0.0F, -0.4363F, 0.0F)); - head.addChild("mandible_right", ModelPartBuilder.create() - .uv(2, 15).cuboid(0.0F, -8.25F, -6.0F, 0.0F, 9.0F, 6.0F, new Dilation(0.0F)), - ModelTransform.of(-4.0F, 2.0F, -4.0F, 0.0F, 0.4363F, 0.0F)); - head.addChild("bottom_jaw", ModelPartBuilder.create() - .uv(0, 36).cuboid(-8.4497F, -9.75F, 2.0F, 6.0F, 10.0F, 6.0F, new Dilation(0.3F)), - ModelTransform.of(0.3498F, 4.5F, -8.9142F, 0.6603F, 0.6603F, 0.4439F)); + head.addOrReplaceChild("mandible_left", CubeListBuilder.create() + .texOffs(2, 15).addBox(0.0F, -8.25F, -6.0F, 0.0F, 9.0F, 6.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(4.0F, 2.0F, -4.0F, 0.0F, -0.4363F, 0.0F)); + head.addOrReplaceChild("mandible_right", CubeListBuilder.create() + .texOffs(2, 15).addBox(0.0F, -8.25F, -6.0F, 0.0F, 9.0F, 6.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-4.0F, 2.0F, -4.0F, 0.0F, 0.4363F, 0.0F)); + head.addOrReplaceChild("bottom_jaw", CubeListBuilder.create() + .texOffs(0, 36).addBox(-8.4497F, -9.75F, 2.0F, 6.0F, 10.0F, 6.0F, new CubeDeformation(0.3F)), + PartPose.offsetAndRotation(0.3498F, 4.5F, -8.9142F, 0.6603F, 0.6603F, 0.4439F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownCrossbonesHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownCrossbonesHelmetModel.java index 63e3d84baa..3103baf57a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownCrossbonesHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownCrossbonesHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.goblintown; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.FlapHelmetModel; public class GoblinTownCrossbonesHelmetModel extends FlapHelmetModel { @@ -10,25 +17,25 @@ public GoblinTownCrossbonesHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("large_crest", ModelPartBuilder.create() - .uv(28, -18).cuboid(0.0F, -15.25F, -7.0F, 0.0F, 14.0F, 18.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("large_crest", CubeListBuilder.create() + .texOffs(28, -18).addBox(0.0F, -15.25F, -7.0F, 0.0F, 14.0F, 18.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownNasalHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownNasalHelmetModel.java index 8e5bc51d69..a76c0cbfcd 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownNasalHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownNasalHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.goblintown; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.FlapHelmetModel; public class GoblinTownNasalHelmetModel extends FlapHelmetModel { @@ -10,29 +17,29 @@ public GoblinTownNasalHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("nasal", ModelPartBuilder.create() - .uv(9, 9).cuboid(-0.5F, -10.25F, -5.5F, 1.0F, 12.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("nasal", CubeListBuilder.create() + .texOffs(9, 9).addBox(-0.5F, -10.25F, -5.5F, 1.0F, 12.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("eye_cover", ModelPartBuilder.create() - .uv(11, 60).cuboid(-4.5F, -4.55F, -4.5F, 9.0F, 2.0F, 2.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("eye_cover", CubeListBuilder.create() + .texOffs(11, 60).addBox(-4.5F, -4.55F, -4.5F, 9.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownSkullHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownSkullHelmetModel.java index cd3b9774b3..94453fd032 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownSkullHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownSkullHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.goblintown; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.FlapHelmetModel; public class GoblinTownSkullHelmetModel extends FlapHelmetModel { @@ -10,25 +17,25 @@ public GoblinTownSkullHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("bottom_jaw", ModelPartBuilder.create() - .uv(0, 31).cuboid(-8.4497F, -9.75F, 2.0F, 6.0F, 10.0F, 6.0F, new Dilation(0.3F)), - ModelTransform.of(0.3498F, 4.5F, -8.9142F, 0.6603F, 0.6603F, 0.4439F)); + head.addOrReplaceChild("bottom_jaw", CubeListBuilder.create() + .texOffs(0, 31).addBox(-8.4497F, -9.75F, 2.0F, 6.0F, 10.0F, 6.0F, new CubeDeformation(0.3F)), + PartPose.offsetAndRotation(0.3498F, 4.5F, -8.9142F, 0.6603F, 0.6603F, 0.4439F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownTunnelerHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownTunnelerHelmetModel.java index d6ea5f4230..9427c3de7e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownTunnelerHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/GoblinTownTunnelerHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.goblintown; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.FlapHelmetModel; public class GoblinTownTunnelerHelmetModel extends FlapHelmetModel { @@ -10,39 +17,39 @@ public GoblinTownTunnelerHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData Candle = head.addChild("candle", ModelPartBuilder.create() - .uv(0, 22).mirrored().cuboid(-2.6F, -13.05F, -1.6F, 2.0F, 4.0F, 2.0F, new Dilation(0.0F)).mirrored(false) - .uv(0, 22).mirrored().cuboid(0.4F, -12.05F, 0.5F, 2.0F, 3.0F, 2.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.origin(0.0F, 0.3F, 0.0F)); + PartDefinition Candle = head.addOrReplaceChild("candle", CubeListBuilder.create() + .texOffs(0, 22).mirror().addBox(-2.6F, -13.05F, -1.6F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(0, 22).mirror().addBox(0.4F, -12.05F, 0.5F, 2.0F, 3.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offset(0.0F, 0.3F, 0.0F)); - Candle.addChild("flame_0", ModelPartBuilder.create() - .uv(0, 21).mirrored().cuboid(0.0F, 0.75F, -0.5F, 0.0F, 1.0F, 1.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(1.4F, -13.8F, 1.5F, 0.0F, 0.7854F, 0.0F)); - Candle.addChild("flame_1", ModelPartBuilder.create() - .uv(0, 21).mirrored().cuboid(0.0F, 0.75F, -0.5F, 0.0F, 1.0F, 1.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(1.4F, -13.8F, 1.5F, 0.0F, -0.7854F, 0.0F)); - Candle.addChild("flame_2", ModelPartBuilder.create() - .uv(0, 21).mirrored().cuboid(0.0F, 0.75F, -0.5F, 0.0F, 1.0F, 1.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(-1.6F, -14.8F, -0.6F, 0.0F, -0.7854F, 0.0F)); - Candle.addChild("flame_3", ModelPartBuilder.create() - .uv(0, 21).mirrored().cuboid(0.0F, 0.75F, -0.5F, 0.0F, 1.0F, 1.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(-1.6F, -14.8F, -0.6F, 0.0F, 0.7854F, 0.0F)); + Candle.addOrReplaceChild("flame_0", CubeListBuilder.create() + .texOffs(0, 21).mirror().addBox(0.0F, 0.75F, -0.5F, 0.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(1.4F, -13.8F, 1.5F, 0.0F, 0.7854F, 0.0F)); + Candle.addOrReplaceChild("flame_1", CubeListBuilder.create() + .texOffs(0, 21).mirror().addBox(0.0F, 0.75F, -0.5F, 0.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(1.4F, -13.8F, 1.5F, 0.0F, -0.7854F, 0.0F)); + Candle.addOrReplaceChild("flame_2", CubeListBuilder.create() + .texOffs(0, 21).mirror().addBox(0.0F, 0.75F, -0.5F, 0.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(-1.6F, -14.8F, -0.6F, 0.0F, -0.7854F, 0.0F)); + Candle.addOrReplaceChild("flame_3", CubeListBuilder.create() + .texOffs(0, 21).mirror().addBox(0.0F, 0.75F, -0.5F, 0.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(-1.6F, -14.8F, -0.6F, 0.0F, 0.7854F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/SkulkerGuardHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/SkulkerGuardHelmetModel.java index 45d3e0c120..2f3b958ed4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/SkulkerGuardHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/goblintown/SkulkerGuardHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.goblintown; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.EggHelmetModel; public class SkulkerGuardHelmetModel extends EggHelmetModel { @@ -10,22 +17,22 @@ public SkulkerGuardHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData head = modelData.getRoot().addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition head = modelData.getRoot().addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("large_crest", ModelPartBuilder.create() - .uv(28, -18).cuboid(0.0F, -15.25F, -7.0F, 0.0F, 14.0F, 18.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("large_crest", CubeListBuilder.create() + .texOffs(28, -18).addBox(0.0F, -15.25F, -7.0F, 0.0F, 14.0F, 18.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("mandible_left", ModelPartBuilder.create() - .uv(2, 15).cuboid(0.0F, -8.25F, -6.0F, 0.0F, 9.0F, 6.0F, new Dilation(0.0F)), - ModelTransform.of(4.0F, 2.0F, -4.0F, 0.0F, -0.4363F, 0.0F)); - head.addChild("mandible_right", ModelPartBuilder.create() - .uv(2, 15).cuboid(0.0F, -8.25F, -6.0F, 0.0F, 9.0F, 6.0F, new Dilation(0.0F)), - ModelTransform.of(-4.0F, 2.0F, -4.0F, 0.0F, 0.4363F, 0.0F)); + head.addOrReplaceChild("mandible_left", CubeListBuilder.create() + .texOffs(2, 15).addBox(0.0F, -8.25F, -6.0F, 0.0F, 9.0F, 6.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(4.0F, 2.0F, -4.0F, 0.0F, -0.4363F, 0.0F)); + head.addOrReplaceChild("mandible_right", CubeListBuilder.create() + .texOffs(2, 15).addBox(0.0F, -8.25F, -6.0F, 0.0F, 9.0F, 6.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-4.0F, 2.0F, -4.0F, 0.0F, 0.4363F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinCaptainHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinCaptainHelmetModel.java index 152f21c79d..078a96abdd 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinCaptainHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinCaptainHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.hobgoblins; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class HobgoblinCaptainHelmetModel extends HelmetAddonModel { @@ -10,32 +17,32 @@ public HobgoblinCaptainHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData crest = head.addChild("crest", ModelPartBuilder.create(), - ModelTransform.origin(-1.5F, -11.5976F, -4.4512F)); + PartDefinition crest = head.addOrReplaceChild("crest", CubeListBuilder.create(), + PartPose.offset(-1.5F, -11.5976F, -4.4512F)); - crest.addChild("crest_left", ModelPartBuilder.create() - .uv(38, 53).mirrored().cuboid(-4.0F, -4.75F, 0.0F, 8.0F, 11.0F, 0.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(5.2366F, 0.5132F, 0.3928F, 0.0F, -0.3491F, 0.0F)); + crest.addOrReplaceChild("crest_left", CubeListBuilder.create() + .texOffs(38, 53).mirror().addBox(-4.0F, -4.75F, 0.0F, 8.0F, 11.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(5.2366F, 0.5132F, 0.3928F, 0.0F, -0.3491F, 0.0F)); - crest.addChild("crest_right", ModelPartBuilder.create() - .uv(38, 53).cuboid(-5.0F, -3.25F, 0.0F, 8.0F, 11.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(-1.3312F, -0.9868F, 0.0562F, 0.0F, 0.3491F, 0.0F)); + crest.addOrReplaceChild("crest_right", CubeListBuilder.create() + .texOffs(38, 53).addBox(-5.0F, -3.25F, 0.0F, 8.0F, 11.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-1.3312F, -0.9868F, 0.0562F, 0.0F, 0.3491F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinCrestHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinCrestHelmetModel.java index 1bcda075be..d4ac253ddd 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinCrestHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinCrestHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.hobgoblins; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class HobgoblinCrestHelmetModel extends HelmetAddonModel { @@ -10,32 +17,32 @@ public HobgoblinCrestHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData addons = head.addChild("addons", ModelPartBuilder.create(), - ModelTransform.origin(-1.5F, -11.5976F, -4.4512F)); + PartDefinition addons = head.addOrReplaceChild("addons", CubeListBuilder.create(), + PartPose.offset(-1.5F, -11.5976F, -4.4512F)); - addons.addChild("crest", ModelPartBuilder.create() - .uv(24, 10).cuboid(1.0F, -10.58F, -0.5F, 0.0F, 14.0F, 20.0F, new Dilation(0.0F)), - ModelTransform.of(0.5F, 3.1132F, -2.3666F, 0.3054F, 0.0F, 0.0F)); + addons.addOrReplaceChild("crest", CubeListBuilder.create() + .texOffs(24, 10).addBox(1.0F, -10.58F, -0.5F, 0.0F, 14.0F, 20.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.5F, 3.1132F, -2.3666F, 0.3054F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinCrestedHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinCrestedHelmetModel.java index 5d2e83588f..36673c6b3e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinCrestedHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinCrestedHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.hobgoblins; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class HobgoblinCrestedHelmetModel extends HelmetAddonModel { @@ -10,34 +17,34 @@ public HobgoblinCrestedHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData crest = head.addChild("crest", ModelPartBuilder.create() - .uv(54, 49).cuboid(-0.5F, -3.1368F, -0.8666F, 4.0F, 14.0F, 1.0F, new Dilation(0.1F)), - ModelTransform.origin(-1.5F, -11.5976F, -4.4512F)); + PartDefinition crest = head.addOrReplaceChild("crest", CubeListBuilder.create() + .texOffs(54, 49).addBox(-0.5F, -3.1368F, -0.8666F, 4.0F, 14.0F, 1.0F, new CubeDeformation(0.1F)), + PartPose.offset(-1.5F, -11.5976F, -4.4512F)); - crest.addChild("crest_left", ModelPartBuilder.create() - .uv(38, 53).mirrored().cuboid(-4.0F, -4.75F, 0.0F, 8.0F, 11.0F, 0.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(5.2366F, 0.5132F, 0.3928F, 0.0F, -0.3491F, 0.0F)); + crest.addOrReplaceChild("crest_left", CubeListBuilder.create() + .texOffs(38, 53).mirror().addBox(-4.0F, -4.75F, 0.0F, 8.0F, 11.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(5.2366F, 0.5132F, 0.3928F, 0.0F, -0.3491F, 0.0F)); - crest.addChild("crest_right", ModelPartBuilder.create() - .uv(38, 53).cuboid(-5.0F, -3.25F, 0.0F, 8.0F, 11.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(-1.3312F, -0.9868F, 0.0562F, 0.0F, 0.3491F, 0.0F)); + crest.addOrReplaceChild("crest_right", CubeListBuilder.create() + .texOffs(38, 53).addBox(-5.0F, -3.25F, 0.0F, 8.0F, 11.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-1.3312F, -0.9868F, 0.0562F, 0.0F, 0.3491F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinLargeCrestHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinLargeCrestHelmetModel.java index beb80704a8..bfee3f6ac6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinLargeCrestHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinLargeCrestHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.hobgoblins; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class HobgoblinLargeCrestHelmetModel extends HelmetAddonModel { @@ -10,27 +17,27 @@ public HobgoblinLargeCrestHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("large_crest", ModelPartBuilder.create() - .uv(20, 12).mirrored().cuboid(-11.0F, -20.75F, 0.0F, 22.0F, 18.0F, 0.0F, new Dilation(0.0F)).mirrored(false) - .uv(28, 53).cuboid(-0.5F, -17.75F, -0.5F, 1.0F, 10.0F, 1.0F, new Dilation(0.0F)) - .uv(24, 44).cuboid(-9.5F, -7.75F, -0.5F, 19.0F, 1.0F, 1.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("large_crest", CubeListBuilder.create() + .texOffs(20, 12).mirror().addBox(-11.0F, -20.75F, 0.0F, 22.0F, 18.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(28, 53).addBox(-0.5F, -17.75F, -0.5F, 1.0F, 10.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(24, 44).addBox(-9.5F, -7.75F, -0.5F, 19.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinScreecherHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinScreecherHelmetModel.java index 3cae023f92..c924852b54 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinScreecherHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinScreecherHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.hobgoblins; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class HobgoblinScreecherHelmetModel extends HelmetAddonModel { @@ -10,25 +17,25 @@ public HobgoblinScreecherHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("screecher", ModelPartBuilder.create() - .uv(20, 12).mirrored().cuboid(-11.0F, -20.75F, 0.0F, 22.0F, 18.0F, 0.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("screecher", CubeListBuilder.create() + .texOffs(20, 12).mirror().addBox(-11.0F, -20.75F, 0.0F, 22.0F, 18.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinSeekerHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinSeekerHelmetModel.java index 117cb7299f..eab12cb5fc 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinSeekerHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinSeekerHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.hobgoblins; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.FlapHelmetModel; public class HobgoblinSeekerHelmetModel extends FlapHelmetModel { @@ -10,25 +17,25 @@ public HobgoblinSeekerHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("face", ModelPartBuilder.create() - .uv(28, 0).cuboid(-9.0F, -12.25F, -5.05F, 18.0F, 12.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("face", CubeListBuilder.create() + .texOffs(28, 0).addBox(-9.0F, -12.25F, -5.05F, 18.0F, 12.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinSmallHornHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinSmallHornHelmetModel.java index fa2af30b2e..c6da98f1c8 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinSmallHornHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/hobgoblins/HobgoblinSmallHornHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.hobgoblins; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class HobgoblinSmallHornHelmetModel extends HobgoblinCrestHelmetModel { @@ -10,25 +17,25 @@ public HobgoblinSmallHornHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("face", ModelPartBuilder.create() - .uv(28, 0).cuboid(-9.0F, -12.25F, -5.05F, 18.0F, 12.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("face", CubeListBuilder.create() + .texOffs(28, 0).addBox(-9.0F, -12.25F, -5.05F, 18.0F, 12.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukCommanderHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukCommanderHelmetModel.java index 673bf76789..dcd1a57f72 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukCommanderHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukCommanderHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.isengard; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class IsenUrukCommanderHelmetModel extends IsenUrukHelmetModel { @@ -10,15 +17,15 @@ public IsenUrukCommanderHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); - ModelPartData head = modelData.getRoot().addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelData.getRoot().addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("large_fan", ModelPartBuilder.create() - .uv(0, 17).cuboid(-13.0F, -6.75F, 0.0F, 26.0F, 12.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, -10.875F, 2.3F, -0.4363F, 0.0F, 0.0F)); + head.addOrReplaceChild("large_fan", CubeListBuilder.create() + .texOffs(0, 17).addBox(-13.0F, -6.75F, 0.0F, 26.0F, 12.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, -10.875F, 2.3F, -0.4363F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukCrestHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukCrestHelmetModel.java index d5a1603b23..77dccca85e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukCrestHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukCrestHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.isengard; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class IsenUrukCrestHelmetModel extends HelmetAddonModel { @@ -10,28 +17,28 @@ public IsenUrukCrestHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("sapper_addons", ModelPartBuilder.create() - .uv(3, -9).cuboid(0.0F, -12.25F, -6.0F, 0.0F, 10.0F, 9.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("sapper_addons", CubeListBuilder.create() + .texOffs(3, -9).addBox(0.0F, -12.25F, -6.0F, 0.0F, 10.0F, 9.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukHelmetModel.java index d1fc4e47cb..d3e6898e8f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.isengard; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class IsenUrukHelmetModel extends HelmetAddonModel { @@ -10,28 +17,28 @@ public IsenUrukHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("back_extension", ModelPartBuilder.create() - .uv(-6, 33).cuboid(-7.5F, -1.85F, -0.5F, 15.0F, 0.0F, 6.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("back_extension", CubeListBuilder.create() + .texOffs(-6, 33).addBox(-7.5F, -1.85F, -0.5F, 15.0F, 0.0F, 6.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukPlateHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukPlateHelmetModel.java index 39d9b0dc17..dbec6e69ef 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukPlateHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukPlateHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.isengard; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class IsenUrukPlateHelmetModel extends HelmetAddonModel { @@ -10,38 +17,38 @@ public IsenUrukPlateHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("fan", ModelPartBuilder.create() - .uv(36, 29).cuboid(-7.0F, -7.75F, 0.0F, 14.0F, 9.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, -15.0F, 4.0F, 2.5744F, 0.0F, 0.0F)); + head.addOrReplaceChild("fan", CubeListBuilder.create() + .texOffs(36, 29).addBox(-7.0F, -7.75F, 0.0F, 14.0F, 9.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, -15.0F, 4.0F, 2.5744F, 0.0F, 0.0F)); - ModelPartData side_spikes = head.addChild("side_spikes", ModelPartBuilder.create(), - ModelTransform.origin(6.75F, -1.65F, -1.0F)); + PartDefinition side_spikes = head.addOrReplaceChild("side_spikes", CubeListBuilder.create(), + PartPose.offset(6.75F, -1.65F, -1.0F)); - side_spikes.addChild("spikes_right", ModelPartBuilder.create() - .uv(43, 53).cuboid(-2.7F, 2.25F, -7.0F, 5.0F, 0.0F, 11.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.5672F)); - side_spikes.addChild("spikes_left", ModelPartBuilder.create() - .uv(43, 53).mirrored().cuboid(-2.3F, 2.25F, -7.0F, 5.0F, 0.0F, 11.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(-13.5F, 0.0F, 0.0F, 0.0F, 0.0F, -0.5672F)); + side_spikes.addOrReplaceChild("spikes_right", CubeListBuilder.create() + .texOffs(43, 53).addBox(-2.7F, 2.25F, -7.0F, 5.0F, 0.0F, 11.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.5672F)); + side_spikes.addOrReplaceChild("spikes_left", CubeListBuilder.create() + .texOffs(43, 53).mirror().addBox(-2.3F, 2.25F, -7.0F, 5.0F, 0.0F, 11.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(-13.5F, 0.0F, 0.0F, 0.0F, 0.0F, -0.5672F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukReinforcedHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukReinforcedHelmetModel.java index af010e8199..84549d5330 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukReinforcedHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukReinforcedHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.isengard; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class IsenUrukReinforcedHelmetModel extends IsenUrukCrestHelmetModel { @@ -9,30 +16,30 @@ public IsenUrukReinforcedHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); - ModelPartData head = modelData.getRoot().addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelData.getRoot().addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("flaps", ModelPartBuilder.create() - .uv(35, 3).cuboid(-4.0F, 0.75F, -4.0F, 8.0F, 5.0F, 5.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("flaps", CubeListBuilder.create() + .texOffs(35, 3).addBox(-4.0F, 0.75F, -4.0F, 8.0F, 5.0F, 5.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("snout", ModelPartBuilder.create() - .uv(0, 13).cuboid(-4.0F, -0.25F, -1.5F, 8.0F, 2.0F, 2.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, -2.8F, -4.5F, 0.5236F, 0.0F, 0.0F)); + head.addOrReplaceChild("snout", CubeListBuilder.create() + .texOffs(0, 13).addBox(-4.0F, -0.25F, -1.5F, 8.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, -2.8F, -4.5F, 0.5236F, 0.0F, 0.0F)); - ModelPartData helmet_sides = head.addChild("helmet_sides", ModelPartBuilder.create(), - ModelTransform.origin(0.0F, -1.0F, 0.0F)); + PartDefinition helmet_sides = head.addOrReplaceChild("helmet_sides", CubeListBuilder.create(), + PartPose.offset(0.0F, -1.0F, 0.0F)); - helmet_sides.addChild("side_right", ModelPartBuilder.create() - .uv(15, 53).mirrored().cuboid(-2.3F, 2.25F, -7.0F, 5.0F, 0.0F, 11.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(-6.75F, -1.65F, 1.0F, 0.0F, 0.0F, -0.5672F)); + helmet_sides.addOrReplaceChild("side_right", CubeListBuilder.create() + .texOffs(15, 53).mirror().addBox(-2.3F, 2.25F, -7.0F, 5.0F, 0.0F, 11.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(-6.75F, -1.65F, 1.0F, 0.0F, 0.0F, -0.5672F)); - helmet_sides.addChild("side_left", ModelPartBuilder.create() - .uv(15, 53).cuboid(-2.7F, 2.25F, -7.0F, 5.0F, 0.0F, 11.0F, new Dilation(0.0F)), - ModelTransform.of(6.75F, -1.65F, 1.0F, 0.0F, 0.0F, 0.5672F)); + helmet_sides.addOrReplaceChild("side_left", CubeListBuilder.create() + .texOffs(15, 53).addBox(-2.7F, 2.25F, -7.0F, 5.0F, 0.0F, 11.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(6.75F, -1.65F, 1.0F, 0.0F, 0.0F, 0.5672F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukSapperHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukSapperHelmetModel.java index 8d09a544bf..ea4634898b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukSapperHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukSapperHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.isengard; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class IsenUrukSapperHelmetModel extends IsenUrukHelmetModel { @@ -9,16 +16,16 @@ public IsenUrukSapperHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); - ModelPartData head = modelData.getRoot().addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelData.getRoot().addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("sapper_addons", ModelPartBuilder.create() - .uv(-6, 42).cuboid(-6.5F, -3.025F, -6.5F, 13.0F, 0.0F, 6.0F, new Dilation(0.0F)) - .uv(3, -9).cuboid(0.0F, -12.25F, -6.0F, 0.0F, 10.0F, 9.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("sapper_addons", CubeListBuilder.create() + .texOffs(-6, 42).addBox(-6.5F, -3.025F, -6.5F, 13.0F, 0.0F, 6.0F, new CubeDeformation(0.0F)) + .texOffs(3, -9).addBox(0.0F, -12.25F, -6.0F, 0.0F, 10.0F, 9.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukScoutHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukScoutHelmetModel.java index 468675441e..8df76a9dec 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukScoutHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukScoutHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.isengard; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class IsenUrukScoutHelmetModel extends IsenUrukCrestHelmetModel { @@ -9,15 +16,15 @@ public IsenUrukScoutHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); - ModelPartData head = modelData.getRoot().addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelData.getRoot().addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("flaps", ModelPartBuilder.create() - .uv(35, 3).cuboid(-4.0F, 0.75F, -4.0F, 8.0F, 5.0F, 5.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("flaps", CubeListBuilder.create() + .texOffs(35, 3).addBox(-4.0F, 0.75F, -4.0F, 8.0F, 5.0F, 5.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukSoldierHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukSoldierHelmetModel.java index df35c1ee2b..bab576c7f6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukSoldierHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/IsenUrukSoldierHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.isengard; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class IsenUrukSoldierHelmetModel extends IsenUrukCrestHelmetModel { @@ -9,21 +16,21 @@ public IsenUrukSoldierHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); - ModelPartData head = modelData.getRoot().addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelData.getRoot().addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData side_spikes = head.addChild("side_spikes", ModelPartBuilder.create(), - ModelTransform.origin(6.75F, -1.65F, -1.0F)); + PartDefinition side_spikes = head.addOrReplaceChild("side_spikes", CubeListBuilder.create(), + PartPose.offset(6.75F, -1.65F, -1.0F)); - side_spikes.addChild("spikes_right", ModelPartBuilder.create() - .uv(43, 53).cuboid(-2.7F, 2.25F, -7.0F, 5.0F, 0.0F, 11.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.5672F)); - side_spikes.addChild("spikes_left", ModelPartBuilder.create() - .uv(43, 53).mirrored().cuboid(-2.3F, 2.25F, -7.0F, 5.0F, 0.0F, 11.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(-13.5F, 0.0F, 0.0F, 0.0F, 0.0F, -0.5672F)); + side_spikes.addOrReplaceChild("spikes_right", CubeListBuilder.create() + .texOffs(43, 53).addBox(-2.7F, 2.25F, -7.0F, 5.0F, 0.0F, 11.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.5672F)); + side_spikes.addOrReplaceChild("spikes_left", CubeListBuilder.create() + .texOffs(43, 53).mirror().addBox(-2.3F, 2.25F, -7.0F, 5.0F, 0.0F, 11.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(-13.5F, 0.0F, 0.0F, 0.0F, 0.0F, -0.5672F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/OrthancCommanderHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/OrthancCommanderHelmetModel.java index 84032a2b65..db767e230a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/OrthancCommanderHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/OrthancCommanderHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.isengard; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class OrthancCommanderHelmetModel extends OrthancGuardHelmetModel { @@ -9,16 +16,16 @@ public OrthancCommanderHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); - ModelPartData head = modelData.getRoot().addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelData.getRoot().addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("addons_commander", ModelPartBuilder.create() - .uv(1, 16).cuboid(-11.0F, -18.625F, -0.7F, 22.0F, 12.0F, 1.0F, new Dilation(0.0F)) - .uv(-9, 30).cuboid(-7.5F, -1.85F, -1.0F, 15.0F, 0.0F, 9.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("addons_commander", CubeListBuilder.create() + .texOffs(1, 16).addBox(-11.0F, -18.625F, -0.7F, 22.0F, 12.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(-9, 30).addBox(-7.5F, -1.85F, -1.0F, 15.0F, 0.0F, 9.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/OrthancGuardHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/OrthancGuardHelmetModel.java index 73ee9e824f..d4795f5cdf 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/OrthancGuardHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/isengard/OrthancGuardHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.isengard; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class OrthancGuardHelmetModel extends HelmetAddonModel { @@ -10,30 +17,30 @@ public OrthancGuardHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("addons", ModelPartBuilder.create() - .uv(0, 0).cuboid(-3.5F, -10.75F, -3.5F, 7.0F, 2.0F, 7.0F, new Dilation(0.0F)) - .uv(0, 10).cuboid(-1.5F, -12.25F, -1.5F, 3.0F, 2.0F, 3.0F, new Dilation(0.0F)) - .uv(46, 63).cuboid(-4.5F, -3.55F, -4.475F, 9.0F, 1.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("addons", CubeListBuilder.create() + .texOffs(0, 0).addBox(-3.5F, -10.75F, -3.5F, 7.0F, 2.0F, 7.0F, new CubeDeformation(0.0F)) + .texOffs(0, 10).addBox(-1.5F, -12.25F, -1.5F, 3.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(46, 63).addBox(-4.5F, -3.55F, -4.475F, 9.0F, 1.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/MordorBNHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/MordorBNHelmetModel.java index b8a8bd8397..fc1f0a8865 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/MordorBNHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/MordorBNHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.mordor; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class MordorBNHelmetModel extends HelmetAddonModel { @@ -13,35 +20,35 @@ public MordorBNHelmetModel(ModelPart root) { addons = root.getChild("head").getChild("addons"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData addons = head.addChild("addons", ModelPartBuilder.create(). - uv(0, 0).cuboid(-3.5F, -11.75F, -3.5F, 7.0F, 2.0F, 7.0F, new Dilation(0.0F)) - .uv(0, 10).cuboid(-1.5F, -13.25F, -0.5F, 3.0F, 2.0F, 3.0F, new Dilation(0.0F)) - .uv(40, 3).cuboid(0.0F, -17.10F, -6.1F, 0.0F, 17.0F, 12.0F, new Dilation(0.0F)) - .uv(46, 63).cuboid(-4.5F, -3.55F, -4.475F, 9.0F, 1.0F, 0.0F, new Dilation(0.0F)) - .uv(0, 15).cuboid(-4.0F, -9.25F, -4.0F, 8.0F, 9.0F, 8.0F, new Dilation(0.5F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition addons = head.addOrReplaceChild("addons", CubeListBuilder.create(). + texOffs(0, 0).addBox(-3.5F, -11.75F, -3.5F, 7.0F, 2.0F, 7.0F, new CubeDeformation(0.0F)) + .texOffs(0, 10).addBox(-1.5F, -13.25F, -0.5F, 3.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(40, 3).addBox(0.0F, -17.10F, -6.1F, 0.0F, 17.0F, 12.0F, new CubeDeformation(0.0F)) + .texOffs(46, 63).addBox(-4.5F, -3.55F, -4.475F, 9.0F, 1.0F, 0.0F, new CubeDeformation(0.0F)) + .texOffs(0, 15).addBox(-4.0F, -9.25F, -4.0F, 8.0F, 9.0F, 8.0F, new CubeDeformation(0.5F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - addons.addChild("side_left", ModelPartBuilder.create() - .uv(40, 0).mirrored().cuboid(-0.5F, -9.75F, 0.284F, 6.0F, 15.0F, 0.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(4.814F, -7.0F, -1.5F, 0.0F, -0.6545F, 0.0F)); + addons.addOrReplaceChild("side_left", CubeListBuilder.create() + .texOffs(40, 0).mirror().addBox(-0.5F, -9.75F, 0.284F, 6.0F, 15.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(4.814F, -7.0F, -1.5F, 0.0F, -0.6545F, 0.0F)); - addons.addChild("side_right", ModelPartBuilder.create() - .uv(52, 0).cuboid(-5.25F, -9.75F, 0.252F, 6.0F, 15.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(-5.0F, -7.0F, -1.25F, 0.0F, 0.6545F, 0.0F)); + addons.addOrReplaceChild("side_right", CubeListBuilder.create() + .texOffs(52, 0).addBox(-5.25F, -9.75F, 0.252F, 6.0F, 15.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-5.0F, -7.0F, -1.25F, 0.0F, 0.6545F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/MordorSnoutHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/MordorSnoutHelmetModel.java index 28f2463e16..5041409ee5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/MordorSnoutHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/MordorSnoutHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.mordor; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class MordorSnoutHelmetModel extends HelmetAddonModel { @@ -10,37 +17,37 @@ public MordorSnoutHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData snout = head.addChild("snout", ModelPartBuilder.create(), + PartDefinition snout = head.addOrReplaceChild("snout", CubeListBuilder.create(), //edit -0.75 for height, nothing else - ModelTransform.of(0.0F, -0.75F, -2.59F, 1.1345F, 0.0F, 0.0F)); - snout.addChild("snout_cube", ModelPartBuilder.create() - .uv(0, 16).cuboid(-3.5F, -3.5F, -7.5F, 7.0F, 7.0F, 12.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.7854F)); + PartPose.offsetAndRotation(0.0F, -0.75F, -2.59F, 1.1345F, 0.0F, 0.0F)); + snout.addOrReplaceChild("snout_cube", CubeListBuilder.create() + .texOffs(0, 16).addBox(-3.5F, -3.5F, -7.5F, 7.0F, 7.0F, 12.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.7854F)); - head.addChild("side_extension_left", ModelPartBuilder.create() - .uv(18, 0).cuboid(0.0F, -2.25F, 1.0F, 1.0F, 6.0F, 4.0F, new Dilation(0.5F)), - ModelTransform.of(-4.0F, -6.0F, 0.2F, 0.0F, -0.4363F, 0.0F)); + head.addOrReplaceChild("side_extension_left", CubeListBuilder.create() + .texOffs(18, 0).addBox(0.0F, -2.25F, 1.0F, 1.0F, 6.0F, 4.0F, new CubeDeformation(0.5F)), + PartPose.offsetAndRotation(-4.0F, -6.0F, 0.2F, 0.0F, -0.4363F, 0.0F)); - head.addChild("side_extension_right", ModelPartBuilder.create() - .uv(29, 0).cuboid(-1.0F, -2.25F, 1.0F, 1.0F, 6.0F, 4.0F, new Dilation(0.5F)), - ModelTransform.of(4.0F, -6.0F, 0.2F, 0.0F, 0.4363F, 0.0F)); + head.addOrReplaceChild("side_extension_right", CubeListBuilder.create() + .texOffs(29, 0).addBox(-1.0F, -2.25F, 1.0F, 1.0F, 6.0F, 4.0F, new CubeDeformation(0.5F)), + PartPose.offsetAndRotation(4.0F, -6.0F, 0.2F, 0.0F, 0.4363F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/MordorSpikyHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/MordorSpikyHelmetModel.java index 75ebb6be3b..b193d4234b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/MordorSpikyHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/MordorSpikyHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.mordor; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class MordorSpikyHelmetModel extends HelmetAddonModel { @@ -10,28 +17,28 @@ public MordorSpikyHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - protected static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + protected static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("spikes", ModelPartBuilder.create() - .uv(34, -2).cuboid(0.0F, -14.65F, -8.5F, 0.0F, 12.0F, 15.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("spikes", CubeListBuilder.create() + .texOffs(34, -2).addBox(0.0F, -14.65F, -8.5F, 0.0F, 12.0F, 15.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/BlackCastellanHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/BlackCastellanHelmetModel.java index 45dcaa228e..9c91c9d35b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/BlackCastellanHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/BlackCastellanHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.mordor.dolguldur; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class BlackCastellanHelmetModel extends HelmetAddonModel { @@ -10,48 +17,48 @@ public BlackCastellanHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("addon_eye", ModelPartBuilder.create() - .uv(6, 0).cuboid(-4.5F, -3.55F, -4.475F, 9.0F, 1.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("addon_eye", CubeListBuilder.create() + .texOffs(6, 0).addBox(-4.5F, -3.55F, -4.475F, 9.0F, 1.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("horn_left", ModelPartBuilder.create() - .uv(0, -8).mirrored().cuboid(0.0F, -14.25F, -9.0F, 0.0F, 10.0F, 10.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(3.0F, 1.0F, -5.0F, -0.4363F, -0.6981F, 0.0F)); + head.addOrReplaceChild("horn_left", CubeListBuilder.create() + .texOffs(0, -8).mirror().addBox(0.0F, -14.25F, -9.0F, 0.0F, 10.0F, 10.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(3.0F, 1.0F, -5.0F, -0.4363F, -0.6981F, 0.0F)); - head.addChild("horn_right", ModelPartBuilder.create() - .uv(0, -8).cuboid(0.0F, -14.25F, -9.0F, 0.0F, 10.0F, 10.0F, new Dilation(0.0F)), - ModelTransform.of(-3.0F, 1.0F, -5.0F, -0.4363F, 0.6981F, 0.0F)); + head.addOrReplaceChild("horn_right", CubeListBuilder.create() + .texOffs(0, -8).addBox(0.0F, -14.25F, -9.0F, 0.0F, 10.0F, 10.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-3.0F, 1.0F, -5.0F, -0.4363F, 0.6981F, 0.0F)); - ModelPartData addons = head.addChild("fin", ModelPartBuilder.create() - .uv(0, 0).cuboid(0.0F, -13.0F, -6.0F, 0.0F, 11.0F, 12.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition addons = head.addOrReplaceChild("fin", CubeListBuilder.create() + .texOffs(0, 0).addBox(0.0F, -13.0F, -6.0F, 0.0F, 11.0F, 12.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - addons.addChild("side_right", ModelPartBuilder.create() - .uv(24, 15).cuboid(-5.25F, -9.75F, 0.252F, 6.0F, 15.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(-5.0F, -7.0F, -1.25F, 0.0F, 0.6545F, 0.0F)); + addons.addOrReplaceChild("side_right", CubeListBuilder.create() + .texOffs(24, 15).addBox(-5.25F, -9.75F, 0.252F, 6.0F, 15.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-5.0F, -7.0F, -1.25F, 0.0F, 0.6545F, 0.0F)); - addons.addChild("side_left", ModelPartBuilder.create() - .uv(24, 0).mirrored().cuboid(-0.5F, -9.75F, 0.284F, 6.0F, 15.0F, 0.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(4.814F, -7.0F, -1.5F, 0.0F, -0.6545F, 0.0F)); + addons.addOrReplaceChild("side_left", CubeListBuilder.create() + .texOffs(24, 0).mirror().addBox(-0.5F, -9.75F, 0.284F, 6.0F, 15.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(4.814F, -7.0F, -1.5F, 0.0F, -0.6545F, 0.0F)); - addons.addChild("lower_extension", ModelPartBuilder.create() - .uv(0, 23).cuboid(-4.0F, 0.90F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + addons.addOrReplaceChild("lower_extension", CubeListBuilder.create() + .texOffs(0, 23).addBox(-4.0F, 0.90F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/BlackReaverHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/BlackReaverHelmetModel.java index 98fc8a6dab..71374213cf 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/BlackReaverHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/BlackReaverHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.mordor.dolguldur; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class BlackReaverHelmetModel extends HelmetAddonModel { @@ -10,28 +17,28 @@ public BlackReaverHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("horn_left", ModelPartBuilder.create() - .uv(0, -8).mirrored().cuboid(0.0F, -14.25F, -9.0F, 0.0F, 10.0F, 10.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(3.0F, 1.0F, -5.0F, -0.4363F, -0.6981F, 0.0F)); + head.addOrReplaceChild("horn_left", CubeListBuilder.create() + .texOffs(0, -8).mirror().addBox(0.0F, -14.25F, -9.0F, 0.0F, 10.0F, 10.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(3.0F, 1.0F, -5.0F, -0.4363F, -0.6981F, 0.0F)); - head.addChild("horn_right", ModelPartBuilder.create() - .uv(0, -8).cuboid(0.0F, -14.25F, -9.0F, 0.0F, 10.0F, 10.0F, new Dilation(0.0F)), - ModelTransform.of(-3.0F, 1.0F, -5.0F, -0.4363F, 0.6981F, 0.0F)); + head.addOrReplaceChild("horn_right", CubeListBuilder.create() + .texOffs(0, -8).addBox(0.0F, -14.25F, -9.0F, 0.0F, 10.0F, 10.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-3.0F, 1.0F, -5.0F, -0.4363F, 0.6981F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/DGHunterHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/DGHunterHelmetModel.java index a331f61a6d..53821b7a50 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/DGHunterHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/DGHunterHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.mordor.dolguldur; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class DGHunterHelmetModel extends HelmetAddonModel { @@ -10,36 +17,36 @@ public DGHunterHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("addon_eye", ModelPartBuilder.create() - .uv(6, 0).cuboid(-4.5F, -3.55F, -4.475F, 9.0F, 1.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("addon_eye", CubeListBuilder.create() + .texOffs(6, 0).addBox(-4.5F, -3.55F, -4.475F, 9.0F, 1.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData addons = head.addChild("fin", ModelPartBuilder.create() - .uv(0, 0).cuboid(0.0F, -13.0F, -6.0F, 0.0F, 11.0F, 12.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition addons = head.addOrReplaceChild("fin", CubeListBuilder.create() + .texOffs(0, 0).addBox(0.0F, -13.0F, -6.0F, 0.0F, 11.0F, 12.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - addons.addChild("side_right", ModelPartBuilder.create() - .uv(24, 15).cuboid(-5.25F, -9.75F, 0.252F, 6.0F, 15.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(-5.0F, -7.0F, -1.25F, 0.0F, 0.6545F, 0.0F)); + addons.addOrReplaceChild("side_right", CubeListBuilder.create() + .texOffs(24, 15).addBox(-5.25F, -9.75F, 0.252F, 6.0F, 15.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-5.0F, -7.0F, -1.25F, 0.0F, 0.6545F, 0.0F)); - addons.addChild("side_left", ModelPartBuilder.create() - .uv(24, 0).mirrored().cuboid(-0.5F, -9.75F, 0.284F, 6.0F, 15.0F, 0.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(4.814F, -7.0F, -1.5F, 0.0F, -0.6545F, 0.0F)); + addons.addOrReplaceChild("side_left", CubeListBuilder.create() + .texOffs(24, 0).mirror().addBox(-0.5F, -9.75F, 0.284F, 6.0F, 15.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(4.814F, -7.0F, -1.5F, 0.0F, -0.6545F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/DGMarauderHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/DGMarauderHelmetModel.java index 6d081f6fd7..eb8950688b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/DGMarauderHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/DGMarauderHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.mordor.dolguldur; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class DGMarauderHelmetModel extends HelmetAddonModel { @@ -10,36 +17,36 @@ public DGMarauderHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("horn_left", ModelPartBuilder.create() - .uv(0, -8).mirrored().cuboid(0.0F, -14.25F, -9.0F, 0.0F, 10.0F, 10.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(3.0F, 1.0F, -5.0F, -0.4363F, -0.6981F, 0.0F)); + head.addOrReplaceChild("horn_left", CubeListBuilder.create() + .texOffs(0, -8).mirror().addBox(0.0F, -14.25F, -9.0F, 0.0F, 10.0F, 10.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(3.0F, 1.0F, -5.0F, -0.4363F, -0.6981F, 0.0F)); - head.addChild("horn_right", ModelPartBuilder.create() - .uv(0, -8).cuboid(0.0F, -14.25F, -9.0F, 0.0F, 10.0F, 10.0F, new Dilation(0.0F)), - ModelTransform.of(-3.0F, 1.0F, -5.0F, -0.4363F, 0.6981F, 0.0F)); + head.addOrReplaceChild("horn_right", CubeListBuilder.create() + .texOffs(0, -8).addBox(0.0F, -14.25F, -9.0F, 0.0F, 10.0F, 10.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-3.0F, 1.0F, -5.0F, -0.4363F, 0.6981F, 0.0F)); - head.addChild("side_right", ModelPartBuilder.create() - .uv(24, 15).cuboid(-5.25F, -9.75F, 0.252F, 6.0F, 15.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(-5.0F, -7.0F, -1.25F, 0.0F, 0.6545F, 0.0F)); + head.addOrReplaceChild("side_right", CubeListBuilder.create() + .texOffs(24, 15).addBox(-5.25F, -9.75F, 0.252F, 6.0F, 15.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(-5.0F, -7.0F, -1.25F, 0.0F, 0.6545F, 0.0F)); - head.addChild("side_left", ModelPartBuilder.create() - .uv(24, 0).mirrored().cuboid(-0.5F, -9.75F, 0.284F, 6.0F, 15.0F, 0.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.of(4.814F, -7.0F, -1.5F, 0.0F, -0.6545F, 0.0F)); + head.addOrReplaceChild("side_left", CubeListBuilder.create() + .texOffs(24, 0).mirror().addBox(-0.5F, -9.75F, 0.284F, 6.0F, 15.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offsetAndRotation(4.814F, -7.0F, -1.5F, 0.0F, -0.6545F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/DGRaiderHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/DGRaiderHelmetModel.java index 37d0994e42..7dcc702b86 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/DGRaiderHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/DGRaiderHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.mordor.dolguldur; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; import net.sevenstars.middleearth.client.model.equipment.head.helmets.KettleHelmetModel; @@ -11,36 +18,36 @@ public DGRaiderHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("addon_eye", ModelPartBuilder.create() - .uv(6, 0).cuboid(-4.5F, -3.55F, -4.475F, 9.0F, 1.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("addon_eye", CubeListBuilder.create() + .texOffs(6, 0).addBox(-4.5F, -3.55F, -4.475F, 9.0F, 1.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData addons = head.addChild("fin", ModelPartBuilder.create() - .uv(0, 0).cuboid(0.0F, -13.0F, -6.0F, 0.0F, 11.0F, 12.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition addons = head.addOrReplaceChild("fin", CubeListBuilder.create() + .texOffs(0, 0).addBox(0.0F, -13.0F, -6.0F, 0.0F, 11.0F, 12.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - addons.addChild("lower_extension", ModelPartBuilder.create() - .uv(0, 23).cuboid(-4.0F, 0.90F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + addons.addOrReplaceChild("lower_extension", CubeListBuilder.create() + .texOffs(0, 23).addBox(-4.0F, 0.90F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - addons.addChild("kettle", ModelPartBuilder.create() - .uv(0, 39).cuboid(-7.0F, -8.15F, -7.0F, 14.0F, 1.0F, 14.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 2.766F, 0.0F)); + addons.addOrReplaceChild("kettle", CubeListBuilder.create() + .texOffs(0, 39).addBox(-7.0F, -8.15F, -7.0F, 14.0F, 1.0F, 14.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 2.766F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/DGStalkerHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/DGStalkerHelmetModel.java index 1424c1ec87..5459c72fd2 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/DGStalkerHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/mordor/dolguldur/DGStalkerHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.mordor.dolguldur; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class DGStalkerHelmetModel extends HelmetAddonModel { @@ -10,32 +17,32 @@ public DGStalkerHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("addon_eye", ModelPartBuilder.create() - .uv(6, 0).cuboid(-4.5F, -3.55F, -4.475F, 9.0F, 1.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("addon_eye", CubeListBuilder.create() + .texOffs(6, 0).addBox(-4.5F, -3.55F, -4.475F, 9.0F, 1.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData addons = head.addChild("fin", ModelPartBuilder.create() - .uv(0, 0).cuboid(0.0F, -13.0F, -6.0F, 0.0F, 11.0F, 12.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition addons = head.addOrReplaceChild("fin", CubeListBuilder.create() + .texOffs(0, 0).addBox(0.0F, -13.0F, -6.0F, 0.0F, 11.0F, 12.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - addons.addChild("lower_extension", ModelPartBuilder.create() - .uv(0, 23).cuboid(-4.0F, 0.90F, -4.0F, 8.0F, 8.0F, 8.0F, new Dilation(0.55F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + addons.addOrReplaceChild("lower_extension", CubeListBuilder.create() + .texOffs(0, 23).addBox(-4.0F, 0.90F, -4.0F, 8.0F, 8.0F, 8.0F, new CubeDeformation(0.55F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaCaptainHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaCaptainHelmetModel.java index ef6ce4da29..799e6442c5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaCaptainHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaCaptainHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.moria; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class MoriaCaptainHelmetModel extends MoriaScreecherHelmetModel { @@ -10,18 +17,18 @@ public MoriaCaptainHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("side_spikes", ModelPartBuilder.create() - .uv(48, 13).cuboid(-4.0F, -3.25F, -1.0F, 8.0F, 10.0F, 0.0F, new Dilation(0.0F)) - .uv(47, 25).cuboid(-21.0F, -3.25F, -1.0F, 8.0F, 10.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(8.5F, -7.2F, -1.0F, -0.4363F, 0.0F, 0.0F)); + head.addOrReplaceChild("side_spikes", CubeListBuilder.create() + .texOffs(48, 13).addBox(-4.0F, -3.25F, -1.0F, 8.0F, 10.0F, 0.0F, new CubeDeformation(0.0F)) + .texOffs(47, 25).addBox(-21.0F, -3.25F, -1.0F, 8.0F, 10.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(8.5F, -7.2F, -1.0F, -0.4363F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaChargerHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaChargerHelmetModel.java index f43c254842..497ca33a9c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaChargerHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaChargerHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.moria; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class MoriaChargerHelmetModel extends HelmetAddonModel { @@ -10,29 +17,29 @@ public MoriaChargerHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("large_crest", ModelPartBuilder.create() - .uv(28, -18).cuboid(0.0F, -15.25F, -7.0F, 0.0F, 14.0F, 18.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("large_crest", CubeListBuilder.create() + .texOffs(28, -18).addBox(0.0F, -15.25F, -7.0F, 0.0F, 14.0F, 18.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("grate", ModelPartBuilder.create() - .uv(22, 40).cuboid(-3.0F, -10.25F, -3.0F, 6.0F, 11.0F, 6.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, 0.0F, -4.0F, 0.0F, 0.7854F, 0.0F)); + head.addOrReplaceChild("grate", CubeListBuilder.create() + .texOffs(22, 40).addBox(-3.0F, -10.25F, -3.0F, 6.0F, 11.0F, 6.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, 0.0F, -4.0F, 0.0F, 0.7854F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaChiefHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaChiefHelmetModel.java index c148d25c7d..5f7bebde36 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaChiefHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaChiefHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.moria; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class MoriaChiefHelmetModel extends HelmetAddonModel { @@ -10,52 +17,52 @@ public MoriaChiefHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("horizontal_crest", ModelPartBuilder.create() - .uv(31, 15).cuboid(-8.0F, -16.25F, 0.0F, 16.0F, 8.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("horizontal_crest", CubeListBuilder.create() + .texOffs(31, 15).addBox(-8.0F, -16.25F, 0.0F, 16.0F, 8.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("bottom_jaw", ModelPartBuilder.create() - .uv(0, 28).cuboid(-8.4497F, -9.75F, 2.0F, 6.0F, 10.0F, 6.0F, new Dilation(0.3F)), - ModelTransform.of(0.3498F, 4.5F, -8.9142F, 0.6603F, 0.6603F, 0.4439F)); + head.addOrReplaceChild("bottom_jaw", CubeListBuilder.create() + .texOffs(0, 28).addBox(-8.4497F, -9.75F, 2.0F, 6.0F, 10.0F, 6.0F, new CubeDeformation(0.3F)), + PartPose.offsetAndRotation(0.3498F, 4.5F, -8.9142F, 0.6603F, 0.6603F, 0.4439F)); - head.addChild("horns_right", ModelPartBuilder.create() - .uv(44, 32).cuboid(-7.0F, -10.25F, -4.0F, 3.0F, 5.0F, 7.0F, new Dilation(0.0F)) - .uv(47, 50).cuboid(-7.0F, -5.25F, 0.0F, 3.0F, 1.0F, 3.0F, new Dilation(0.0F)) - .uv(44, 55).mirrored().cuboid(-7.0F, -4.25F, -3.0F, 3.0F, 2.0F, 6.0F, new Dilation(0.0F)).mirrored(false) - .uv(49, 45).mirrored().cuboid(-9.0F, -4.25F, -3.0F, 2.0F, 2.0F, 2.0F, new Dilation(0.0F)).mirrored(false), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("horns_right", CubeListBuilder.create() + .texOffs(44, 32).addBox(-7.0F, -10.25F, -4.0F, 3.0F, 5.0F, 7.0F, new CubeDeformation(0.0F)) + .texOffs(47, 50).addBox(-7.0F, -5.25F, 0.0F, 3.0F, 1.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(44, 55).mirror().addBox(-7.0F, -4.25F, -3.0F, 3.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(49, 45).mirror().addBox(-9.0F, -4.25F, -3.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), + PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("horns_left", ModelPartBuilder.create() - .uv(44, 32).mirrored().cuboid(4.0F, -10.25F, -4.0F, 3.0F, 5.0F, 7.0F, new Dilation(0.0F)).mirrored(false) - .uv(47, 50).mirrored().cuboid(4.0F, -5.25F, 0.0F, 3.0F, 1.0F, 3.0F, new Dilation(0.0F)).mirrored(false) - .uv(44, 55).cuboid(4.0F, -4.25F, -3.0F, 3.0F, 2.0F, 6.0F, new Dilation(0.0F)) - .uv(49, 45).cuboid(7.0F, -4.25F, -3.0F, 2.0F, 2.0F, 2.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("horns_left", CubeListBuilder.create() + .texOffs(44, 32).mirror().addBox(4.0F, -10.25F, -4.0F, 3.0F, 5.0F, 7.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(47, 50).mirror().addBox(4.0F, -5.25F, 0.0F, 3.0F, 1.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(44, 55).addBox(4.0F, -4.25F, -3.0F, 3.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)) + .texOffs(49, 45).addBox(7.0F, -4.25F, -3.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("top_spike", ModelPartBuilder.create() - .uv(0, 59).cuboid(-2.5F, -2.75F, 0.0F, 5.0F, 5.0F, 0.0F, new Dilation(0.0F)) - .uv(0, 54).cuboid(0.0F, -2.75F, -2.5F, 0.0F, 5.0F, 5.0F, new Dilation(0.0F)), - ModelTransform.of(0.0F, -11.0F, 0.0F, 0.0F, -0.7854F, 0.0F)); + head.addOrReplaceChild("top_spike", CubeListBuilder.create() + .texOffs(0, 59).addBox(-2.5F, -2.75F, 0.0F, 5.0F, 5.0F, 0.0F, new CubeDeformation(0.0F)) + .texOffs(0, 54).addBox(0.0F, -2.75F, -2.5F, 0.0F, 5.0F, 5.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.0F, -11.0F, 0.0F, 0.0F, -0.7854F, 0.0F)); - head.addChild("eye_cover", ModelPartBuilder.create() - .uv(10, 60).cuboid(-4.5F, -4.55F, -4.5F, 9.0F, 2.0F, 2.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("eye_cover", CubeListBuilder.create() + .texOffs(10, 60).addBox(-4.5F, -4.55F, -4.5F, 9.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaNasalHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaNasalHelmetModel.java index 3e5c24f0e0..8583371693 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaNasalHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaNasalHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.moria; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.FlapHelmetModel; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; @@ -11,25 +18,25 @@ public MoriaNasalHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("nasal", ModelPartBuilder.create() - .uv(9, 9).cuboid(-0.5F, -10.25F, -5.5F, 1.0F, 12.0F, 7.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("nasal", CubeListBuilder.create() + .texOffs(9, 9).addBox(-0.5F, -10.25F, -5.5F, 1.0F, 12.0F, 7.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaScreecherHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaScreecherHelmetModel.java index 461c974a1c..b7f452a306 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaScreecherHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaScreecherHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.moria; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; public class MoriaScreecherHelmetModel extends HelmetAddonModel { @@ -10,37 +17,37 @@ public MoriaScreecherHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + return LayerDefinition.create(modelData, 64, 64); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("large_crest", ModelPartBuilder.create() - .uv(28, -18).cuboid(0.0F, -15.25F, -7.0F, 0.0F, 14.0F, 18.0F, new Dilation(0.0F)), - ModelTransform.origin(0.0F, 0.0F, 0.0F)); + head.addOrReplaceChild("large_crest", CubeListBuilder.create() + .texOffs(28, -18).addBox(0.0F, -15.25F, -7.0F, 0.0F, 14.0F, 18.0F, new CubeDeformation(0.0F)), + PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("upper_jaw", ModelPartBuilder.create() - .uv(0, 17).cuboid(-5.3268F, -7.5878F, -1.8578F, 6.0F, 8.0F, 6.0F, new Dilation(0.0F)), - ModelTransform.of(0.8268F, -5.3903F, -7.9422F, -0.5025F, 0.7273F, -0.357F)); + head.addOrReplaceChild("upper_jaw", CubeListBuilder.create() + .texOffs(0, 17).addBox(-5.3268F, -7.5878F, -1.8578F, 6.0F, 8.0F, 6.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(0.8268F, -5.3903F, -7.9422F, -0.5025F, 0.7273F, -0.357F)); - head.addChild("bottom_jaw", ModelPartBuilder.create() - .uv(0, 31).cuboid(-8.4497F, -9.75F, 2.0F, 6.0F, 10.0F, 6.0F, new Dilation(0.3F)), - ModelTransform.of(0.3498F, 4.5F, -8.9142F, 0.6603F, 0.6603F, 0.4439F)); + head.addOrReplaceChild("bottom_jaw", CubeListBuilder.create() + .texOffs(0, 31).addBox(-8.4497F, -9.75F, 2.0F, 6.0F, 10.0F, 6.0F, new CubeDeformation(0.3F)), + PartPose.offsetAndRotation(0.3498F, 4.5F, -8.9142F, 0.6603F, 0.6603F, 0.4439F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); return modelData; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaSnagaHelmetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaSnagaHelmetModel.java index e998fc6f25..0d4b82a10e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaSnagaHelmetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/equipment/head/helmets/orcs/moria/MoriaSnagaHelmetModel.java @@ -1,7 +1,14 @@ package net.sevenstars.middleearth.client.model.equipment.head.helmets.orcs.moria; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.client.model.equipment.head.helmets.FlapHelmetModel; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; @@ -11,26 +18,26 @@ public MoriaSnagaHelmetModel(ModelPart root) { super(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData head = modelPartData.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - head.addChild(EntityModelPartNames.HAT, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition head = modelPartData.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.HAT, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - head.addChild("side_spikes", ModelPartBuilder.create() - .uv(48, 13).cuboid(-4.0F, -3.25F, -1.0F, 8.0F, 10.0F, 0.0F, new Dilation(0.0F)) - .uv(47, 25).cuboid(-21.0F, -3.25F, -1.0F, 8.0F, 10.0F, 0.0F, new Dilation(0.0F)), - ModelTransform.of(8.5F, -7.2F, -1.0F, -0.4363F, 0.0F, 0.0F)); + head.addOrReplaceChild("side_spikes", CubeListBuilder.create() + .texOffs(48, 13).addBox(-4.0F, -3.25F, -1.0F, 8.0F, 10.0F, 0.0F, new CubeDeformation(0.0F)) + .texOffs(47, 25).addBox(-21.0F, -3.25F, -1.0F, 8.0F, 10.0F, 0.0F, new CubeDeformation(0.0F)), + PartPose.offsetAndRotation(8.5F, -7.2F, -1.0F, -0.4363F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_ARM, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_ARM, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.RIGHT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - modelPartData.addChild(EntityModelPartNames.LEFT_LEG, ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.RIGHT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + modelPartData.addOrReplaceChild(PartNames.LEFT_LEG, CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/hand/HeldBannerEntityModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/hand/HeldBannerEntityModel.java index 0bcf876546..85e62b1605 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/hand/HeldBannerEntityModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/hand/HeldBannerEntityModel.java @@ -1,9 +1,16 @@ package net.sevenstars.middleearth.client.model.hand; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; import net.minecraft.client.model.*; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.RenderType; public class HeldBannerEntityModel extends Model { @@ -12,27 +19,27 @@ public class HeldBannerEntityModel extends Model { private final ModelPart banner; public HeldBannerEntityModel(ModelPart root) { - super(root, RenderLayer::getEntitySolid); + super(RenderType::entitySolid); this.root = root; this.pole = root.getChild("pole"); this.banner = root.getChild("banner"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - modelPartData.addChild("pole", ModelPartBuilder.create() - .uv(44, 0).cuboid(-1.0F, -72.0F, -1.0F, 2.0F, 42.0F, 2.0F, new Dilation(0.0F)) - .uv(44, 12).cuboid(-1.0F, -30.0F, -1.0F, 2.0F, 30.0F, 2.0F, new Dilation(0.0F)) - .uv(0, 42).mirrored().cuboid(-10.0F, -74.0F, -1.0F, 20.0F, 2.0F, 2.0F, new Dilation(0.0F)), - ModelTransform.NONE); + modelPartData.addOrReplaceChild("pole", CubeListBuilder.create() + .texOffs(44, 0).addBox(-1.0F, -72.0F, -1.0F, 2.0F, 42.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(44, 12).addBox(-1.0F, -30.0F, -1.0F, 2.0F, 30.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(0, 42).mirror().addBox(-10.0F, -74.0F, -1.0F, 20.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), + PartPose.ZERO); - modelPartData.addChild("banner", ModelPartBuilder.create() - .uv(0, 0).cuboid(-10.0F, -74.0F, -2.0F, 20.0F, 40.0F, 1.0F, new Dilation(0.0F)), - ModelTransform.NONE); + modelPartData.addOrReplaceChild("banner", CubeListBuilder.create() + .texOffs(0, 0).addBox(-10.0F, -74.0F, -2.0F, 20.0F, 40.0F, 1.0F, new CubeDeformation(0.0F)), + PartPose.ZERO); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } public ModelPart getPole() { @@ -42,4 +49,9 @@ public ModelPart getPole() { public ModelPart getBanner() { return banner; } + + @Override + public void renderToBuffer(PoseStack matrices, VertexConsumer vertices, int light, int overlay, int color) { + this.root.render(matrices, vertices, light, overlay, color); + } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/hand/shields/HeaterShieldEntityModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/hand/shields/HeaterShieldEntityModel.java index eae995c3fd..e4829b4f2a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/hand/shields/HeaterShieldEntityModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/hand/shields/HeaterShieldEntityModel.java @@ -1,9 +1,16 @@ package net.sevenstars.middleearth.client.model.hand.shields; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; import net.minecraft.client.model.*; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.RenderType; public class HeaterShieldEntityModel extends Model { private final ModelPart root; @@ -11,25 +18,25 @@ public class HeaterShieldEntityModel extends Model { private final ModelPart handle; public HeaterShieldEntityModel(ModelPart root) { - super(root, RenderLayer::getEntitySolid); + super(RenderType::entitySolid); this.root = root; this.plate = root.getChild("plate"); this.handle = root.getChild("handle"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - modelPartData.addChild("plate", ModelPartBuilder.create().uv(0, 0).cuboid(-6.0F, -7.0F, -2.0F, 12.0F, 10.0F, 1.0F, new Dilation(0.0F)) - .uv(1, 11).cuboid(-5.0F, 3.0F, -2.0F, 10.0F, 2.0F, 1.0F, new Dilation(0.0F)) - .uv(2, 14).cuboid(-4.0F, 5.0F, -2.0F, 8.0F, 2.0F, 1.0F, new Dilation(0.0F)) - .uv(3, 17).mirrored().cuboid(-3.0F, 7.0F, -2.0F, 6.0F, 1.0F, 1.0F, new Dilation(0.0F)).mirrored(false) - .uv(5, 19).mirrored().cuboid(-2.0F, 8.0F, -2.0F, 4.0F, 1.0F, 1.0F, new Dilation(0.0F)).mirrored(false) - .uv(7, 21).mirrored().cuboid(-1.0F, 9.0F, -2.0F, 2.0F, 1.0F, 1.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.NONE); + modelPartData.addOrReplaceChild("plate", CubeListBuilder.create().texOffs(0, 0).addBox(-6.0F, -7.0F, -2.0F, 12.0F, 10.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(1, 11).addBox(-5.0F, 3.0F, -2.0F, 10.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(2, 14).addBox(-4.0F, 5.0F, -2.0F, 8.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(3, 17).mirror().addBox(-3.0F, 7.0F, -2.0F, 6.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(5, 19).mirror().addBox(-2.0F, 8.0F, -2.0F, 4.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(7, 21).mirror().addBox(-1.0F, 9.0F, -2.0F, 2.0F, 1.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.ZERO); - modelPartData.addChild("handle", ModelPartBuilder.create().uv(26, 0).mirrored().cuboid(-1.0F, -3.0F, -1.0F, 2.0F, 6.0F, 6.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.NONE); - return TexturedModelData.of(modelData, 64, 64); + modelPartData.addOrReplaceChild("handle", CubeListBuilder.create().texOffs(26, 0).mirror().addBox(-1.0F, -3.0F, -1.0F, 2.0F, 6.0F, 6.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.ZERO); + return LayerDefinition.create(modelData, 64, 64); } public ModelPart getHandle() { @@ -39,4 +46,9 @@ public ModelPart getHandle() { public ModelPart getPlate() { return plate; } -} \ No newline at end of file + + @Override + public void renderToBuffer(PoseStack matrices, VertexConsumer vertices, int light, int overlay, int color) { + this.root.render(matrices, vertices, light, overlay, color); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/hand/shields/KiteShieldEntityModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/hand/shields/KiteShieldEntityModel.java index b535281729..183f0b0aeb 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/hand/shields/KiteShieldEntityModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/hand/shields/KiteShieldEntityModel.java @@ -1,9 +1,16 @@ package net.sevenstars.middleearth.client.model.hand.shields; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; import net.minecraft.client.model.*; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.RenderType; public class KiteShieldEntityModel extends Model { private final ModelPart root; @@ -11,30 +18,30 @@ public class KiteShieldEntityModel extends Model { private final ModelPart handle; public KiteShieldEntityModel(ModelPart root) { - super(root, RenderLayer::getEntitySolid); + super(RenderType::entitySolid); this.root = root; this.plate = root.getChild("plate"); this.handle = root.getChild("handle"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - modelPartData.addChild("handle", ModelPartBuilder.create().uv(38, 0).cuboid(-1.0F, -3.0F, -1.0F, 2.0F, 6.0F, 6.0F, new Dilation(0.0F)), ModelTransform.NONE); + modelPartData.addOrReplaceChild("handle", CubeListBuilder.create().texOffs(38, 0).addBox(-1.0F, -3.0F, -1.0F, 2.0F, 6.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.ZERO); - modelPartData.addChild("plate", ModelPartBuilder.create().uv(14, 0).cuboid(-2.0F, -8.0F, -2.0F, 4.0F, 19.0F, 1.0F, new Dilation(0.0F)) - .uv(24, 1).cuboid(2.0F, -7.0F, -2.0F, 2.0F, 13.0F, 1.0F, new Dilation(0.0F)) - .uv(8, 1).cuboid(-4.0F, -7.0F, -2.0F, 2.0F, 13.0F, 1.0F, new Dilation(0.0F)) - .uv(30, 2).cuboid(4.0F, -6.0F, -2.0F, 1.0F, 9.0F, 1.0F, new Dilation(0.0F)) - .uv(4, 2).cuboid(-5.0F, -6.0F, -2.0F, 1.0F, 9.0F, 1.0F, new Dilation(0.0F)) - .uv(34, 4).cuboid(5.0F, -4.0F, -2.0F, 1.0F, 4.0F, 1.0F, new Dilation(0.0F)) - .uv(0, 4).cuboid(-6.0F, -4.0F, -2.0F, 1.0F, 4.0F, 1.0F, new Dilation(0.0F)) - .uv(24, 15).cuboid(2.0F, 6.0F, -2.0F, 1.0F, 3.0F, 1.0F, new Dilation(0.0F)) - .uv(10, 15).cuboid(-3.0F, 6.0F, -2.0F, 1.0F, 3.0F, 1.0F, new Dilation(0.0F)) - .uv(15, 20).cuboid(-1.0F, 11.0F, -2.0F, 2.0F, 2.0F, 1.0F, new Dilation(0.0F)), ModelTransform.NONE); + modelPartData.addOrReplaceChild("plate", CubeListBuilder.create().texOffs(14, 0).addBox(-2.0F, -8.0F, -2.0F, 4.0F, 19.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(24, 1).addBox(2.0F, -7.0F, -2.0F, 2.0F, 13.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(8, 1).addBox(-4.0F, -7.0F, -2.0F, 2.0F, 13.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(30, 2).addBox(4.0F, -6.0F, -2.0F, 1.0F, 9.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(4, 2).addBox(-5.0F, -6.0F, -2.0F, 1.0F, 9.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(34, 4).addBox(5.0F, -4.0F, -2.0F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(0, 4).addBox(-6.0F, -4.0F, -2.0F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(24, 15).addBox(2.0F, 6.0F, -2.0F, 1.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(10, 15).addBox(-3.0F, 6.0F, -2.0F, 1.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(15, 20).addBox(-1.0F, 11.0F, -2.0F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.ZERO); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } public ModelPart getHandle() { @@ -44,4 +51,9 @@ public ModelPart getHandle() { public ModelPart getPlate() { return plate; } + + @Override + public void renderToBuffer(PoseStack matrices, VertexConsumer vertices, int light, int overlay, int color) { + this.root.render(matrices, vertices, light, overlay, color); + } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/hand/shields/RoundShieldEntityModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/hand/shields/RoundShieldEntityModel.java index 545a90549a..dd8fde07a2 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/hand/shields/RoundShieldEntityModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/model/hand/shields/RoundShieldEntityModel.java @@ -1,9 +1,16 @@ package net.sevenstars.middleearth.client.model.hand.shields; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; import net.minecraft.client.model.*; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.RenderType; public class RoundShieldEntityModel extends Model { private final ModelPart root; @@ -11,29 +18,29 @@ public class RoundShieldEntityModel extends Model { private final ModelPart handle; public RoundShieldEntityModel(ModelPart root) { - super(root, RenderLayer::getEntitySolid); + super(RenderType::entitySolid); this.root = root; this.plate = root.getChild("plate"); this.handle = root.getChild("handle"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - modelPartData.addChild("handle", ModelPartBuilder.create().uv(17, 17).cuboid(-1.0F, -3.0F, -1.0F, 2.0F, 6.0F, 6.0F, new Dilation(0.0F)), ModelTransform.NONE); + modelPartData.addOrReplaceChild("handle", CubeListBuilder.create().texOffs(17, 17).addBox(-1.0F, -3.0F, -1.0F, 2.0F, 6.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.ZERO); - modelPartData.addChild("plate", ModelPartBuilder.create().uv(0, 6).cuboid(-8.0F, -2.0F, -2.0F, 1.0F, 4.0F, 1.0F, new Dilation(0.0F)) - .uv(46, 6).cuboid(7.0F, -2.0F, -2.0F, 1.0F, 4.0F, 1.0F, new Dilation(0.0F)) - .uv(4, 4).cuboid(-7.0F, -4.0F, -2.0F, 1.0F, 8.0F, 1.0F, new Dilation(0.0F)) - .uv(42, 4).cuboid(6.0F, -4.0F, -2.0F, 1.0F, 8.0F, 1.0F, new Dilation(0.0F)) - .uv(8, 2).cuboid(-6.0F, -6.0F, -2.0F, 2.0F, 12.0F, 1.0F, new Dilation(0.0F)) - .uv(36, 2).cuboid(4.0F, -6.0F, -2.0F, 2.0F, 12.0F, 1.0F, new Dilation(0.0F)) - .uv(14, 1).cuboid(-4.0F, -7.0F, -2.0F, 2.0F, 14.0F, 1.0F, new Dilation(0.0F)) - .uv(30, 1).cuboid(2.0F, -7.0F, -2.0F, 2.0F, 14.0F, 1.0F, new Dilation(0.0F)) - .uv(20, 0).cuboid(-2.0F, -8.0F, -2.0F, 4.0F, 16.0F, 1.0F, new Dilation(0.0F)), ModelTransform.NONE); + modelPartData.addOrReplaceChild("plate", CubeListBuilder.create().texOffs(0, 6).addBox(-8.0F, -2.0F, -2.0F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(46, 6).addBox(7.0F, -2.0F, -2.0F, 1.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(4, 4).addBox(-7.0F, -4.0F, -2.0F, 1.0F, 8.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(42, 4).addBox(6.0F, -4.0F, -2.0F, 1.0F, 8.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(8, 2).addBox(-6.0F, -6.0F, -2.0F, 2.0F, 12.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(36, 2).addBox(4.0F, -6.0F, -2.0F, 2.0F, 12.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(14, 1).addBox(-4.0F, -7.0F, -2.0F, 2.0F, 14.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(30, 1).addBox(2.0F, -7.0F, -2.0F, 2.0F, 14.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(20, 0).addBox(-2.0F, -8.0F, -2.0F, 4.0F, 16.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.ZERO); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } public ModelPart getHandle() { @@ -43,4 +50,9 @@ public ModelPart getHandle() { public ModelPart getPlate() { return plate; } -} \ No newline at end of file + + @Override + public void renderToBuffer(PoseStack matrices, VertexConsumer vertices, int light, int overlay, int color) { + this.root.render(matrices, vertices, light, overlay, color); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/ArmedEntityRenderStateAccess.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/ArmedEntityRenderStateAccess.java deleted file mode 100644 index 7f31a28878..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/ArmedEntityRenderStateAccess.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sevenstars.middleearth.client.renderer; - -import net.minecraft.item.ItemStack; - -public interface ArmedEntityRenderStateAccess { - ItemStack getMainHandStack(); - ItemStack getOffHandStack(); - boolean isRestrained(); - void setMainHandStack(ItemStack mainHandStack); - void setOffHandStack(ItemStack mainHandStack); - void setRestrained(boolean restrained); -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/BipedEntityRenderStateAccess.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/BipedEntityRenderStateAccess.java deleted file mode 100644 index 1c4fe7946b..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/BipedEntityRenderStateAccess.java +++ /dev/null @@ -1,12 +0,0 @@ -package net.sevenstars.middleearth.client.renderer; - -import net.minecraft.util.math.Vec3d; - -public interface BipedEntityRenderStateAccess { - float getTickProgress(); - Vec3d getPreviousVelocity(); - Vec3d getVelocity(); - void setTickProgress(float tickProgress); - void setPreviousVelocity(Vec3d velocity); - void setVelocity(Vec3d velocity); -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/ModBuiltInModelItemRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/ModBuiltInModelItemRenderer.java index 302e308829..e3a618e379 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/ModBuiltInModelItemRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/ModBuiltInModelItemRenderer.java @@ -1,9 +1,21 @@ package net.sevenstars.middleearth.client.renderer; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.model.ModelBaker; -import net.minecraft.item.ItemDisplayContext; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.Sheets; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.resources.model.Material; +import net.minecraft.client.resources.model.ModelBakery; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.BannerPatternLayers; import net.sevenstars.middleearth.MiddleEarthClient; import net.sevenstars.middleearth.client.MEModelLoader; import net.sevenstars.middleearth.client.ModTexturedRenderLayers; @@ -14,127 +26,133 @@ import net.sevenstars.middleearth.item.WeaponItemsME; import net.sevenstars.middleearth.item.items.HeldBannerItem; import net.sevenstars.middleearth.item.items.shields.CustomBannerShieldItem; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.TexturedRenderLayers; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.BannerPatternsComponent; -import net.minecraft.item.ItemStack; -import net.minecraft.util.DyeColor; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions; +import net.neoforged.neoforge.client.extensions.common.RegisterClientExtensionsEvent; import java.util.Objects; -@Environment(EnvType.CLIENT) -public class ModBuiltInModelItemRenderer { +public class ModBuiltInModelItemRenderer extends BlockEntityWithoutLevelRenderer { - private HeaterShieldEntityModel heaterShieldEntityModel; - private KiteShieldEntityModel kiteShieldEntityModel; - private RoundShieldEntityModel roundShieldEntityModel; - - private HeldBannerEntityModel heldBannerEntityModel; + private final HeaterShieldEntityModel heaterShieldEntityModel; + private final KiteShieldEntityModel kiteShieldEntityModel; + private final RoundShieldEntityModel roundShieldEntityModel; + private final HeldBannerEntityModel heldBannerEntityModel; public ModBuiltInModelItemRenderer() { + super(Minecraft.getInstance().getBlockEntityRenderDispatcher(), Minecraft.getInstance().getEntityModels()); + EntityModelSet models = Minecraft.getInstance().getEntityModels(); + this.heaterShieldEntityModel = new HeaterShieldEntityModel(models.bakeLayer(MiddleEarthClient.HEATER_SHIELD_LAYER)); + this.kiteShieldEntityModel = new KiteShieldEntityModel(models.bakeLayer(MiddleEarthClient.KITE_SHIELD_LAYER)); + this.roundShieldEntityModel = new RoundShieldEntityModel(models.bakeLayer(MiddleEarthClient.ROUND_SHIELD_LAYER)); + this.heldBannerEntityModel = new HeldBannerEntityModel(models.bakeLayer(MiddleEarthClient.HELD_BANNER_LAYER)); } - public void render(ItemStack stack, ItemDisplayContext mode, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) { - this.heaterShieldEntityModel = new HeaterShieldEntityModel(MinecraftClient.getInstance().getLoadedEntityModels().getModelPart(MiddleEarthClient.HEATER_SHIELD_LAYER)); - this.kiteShieldEntityModel = new KiteShieldEntityModel(MinecraftClient.getInstance().getLoadedEntityModels().getModelPart(MiddleEarthClient.KITE_SHIELD_LAYER)); - this.roundShieldEntityModel = new RoundShieldEntityModel(MinecraftClient.getInstance().getLoadedEntityModels().getModelPart(MiddleEarthClient.ROUND_SHIELD_LAYER)); - this.heldBannerEntityModel = new HeldBannerEntityModel(MinecraftClient.getInstance().getLoadedEntityModels().getModelPart(MiddleEarthClient.HELD_BANNER_LAYER)); + public static void register(RegisterClientExtensionsEvent event, Item... items) { + event.registerItem(new IClientItemExtensions() { + private ModBuiltInModelItemRenderer renderer; + + @Override + public BlockEntityWithoutLevelRenderer getCustomRenderer() { + if (this.renderer == null) { + this.renderer = new ModBuiltInModelItemRenderer(); + } + return this.renderer; + } + }, items); + } + @Override + public void renderByItem(ItemStack stack, ItemDisplayContext mode, PoseStack matrices, + MultiBufferSource vertexConsumers, int light, int overlay) { if (stack.getItem() instanceof CustomBannerShieldItem) { - BannerPatternsComponent bannerPatternsComponent = (BannerPatternsComponent)stack.getOrDefault(DataComponentTypes.BANNER_PATTERNS, BannerPatternsComponent.DEFAULT); - DyeColor dyeColor2 = (DyeColor)stack.get(DataComponentTypes.BASE_COLOR); + BannerPatternLayers bannerPatternsComponent = (BannerPatternLayers)stack.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY); + DyeColor dyeColor2 = (DyeColor)stack.get(DataComponents.BASE_COLOR); boolean bl = !bannerPatternsComponent.layers().isEmpty() || dyeColor2 != null; - matrices.push(); + matrices.pushPose(); matrices.scale(1.0F, -1.0F, -1.0F); - if (stack.isOf(WeaponItemsME.HEATER_SHIELD)){ - SpriteIdentifier spriteIdentifier = bl ? MEModelLoader.HEATER_SHIELD_BASE : MEModelLoader.HEATER_SHIELD_BASE_NO_PATTERN; - VertexConsumer vertexConsumer = spriteIdentifier.getSprite().getTextureSpecificVertexConsumer(ItemRenderer.getItemGlintConsumer(vertexConsumers, this.heaterShieldEntityModel.getLayer(spriteIdentifier.getAtlasId()), true, stack.hasGlint())); + if (stack.is(WeaponItemsME.HEATER_SHIELD)){ + Material spriteIdentifier = bl ? MEModelLoader.HEATER_SHIELD_BASE : MEModelLoader.HEATER_SHIELD_BASE_NO_PATTERN; + VertexConsumer vertexConsumer = spriteIdentifier.sprite().wrap(ItemRenderer.getFoilBuffer(vertexConsumers, this.heaterShieldEntityModel.renderType(spriteIdentifier.atlasLocation()), true, stack.hasFoil())); this.heaterShieldEntityModel.getHandle().render(matrices, vertexConsumer, light, overlay); if (bl) { - renderCanvas(matrices, vertexConsumers, light, overlay, this.heaterShieldEntityModel.getPlate(), spriteIdentifier, false, (DyeColor) Objects.requireNonNullElse(dyeColor2, DyeColor.WHITE), bannerPatternsComponent, stack.hasGlint(), stack, false); + renderCanvas(matrices, vertexConsumers, light, overlay, this.heaterShieldEntityModel.getPlate(), spriteIdentifier, false, (DyeColor) Objects.requireNonNullElse(dyeColor2, DyeColor.WHITE), bannerPatternsComponent, stack.hasFoil(), stack); } else { this.heaterShieldEntityModel.getPlate().render(matrices, vertexConsumer, light, overlay); } - matrices.pop(); - } else if (stack.isOf(WeaponItemsME.KITE_SHIELD)){ - SpriteIdentifier spriteIdentifier = bl ? MEModelLoader.KITE_SHIELD_BASE : MEModelLoader.KITE_SHIELD_BASE_NO_PATTERN; - VertexConsumer vertexConsumer = spriteIdentifier.getSprite().getTextureSpecificVertexConsumer(ItemRenderer.getItemGlintConsumer(vertexConsumers, this.kiteShieldEntityModel.getLayer(spriteIdentifier.getAtlasId()), true, stack.hasGlint())); + matrices.popPose(); + } else if (stack.is(WeaponItemsME.KITE_SHIELD)){ + Material spriteIdentifier = bl ? MEModelLoader.KITE_SHIELD_BASE : MEModelLoader.KITE_SHIELD_BASE_NO_PATTERN; + VertexConsumer vertexConsumer = spriteIdentifier.sprite().wrap(ItemRenderer.getFoilBuffer(vertexConsumers, this.kiteShieldEntityModel.renderType(spriteIdentifier.atlasLocation()), true, stack.hasFoil())); this.kiteShieldEntityModel.getHandle().render(matrices, vertexConsumer, light, overlay); if (bl) { - renderCanvas(matrices, vertexConsumers, light, overlay, this.kiteShieldEntityModel.getPlate(), spriteIdentifier, false, (DyeColor) Objects.requireNonNullElse(dyeColor2, DyeColor.WHITE), bannerPatternsComponent, stack.hasGlint(), stack, false); + renderCanvas(matrices, vertexConsumers, light, overlay, this.kiteShieldEntityModel.getPlate(), spriteIdentifier, false, (DyeColor) Objects.requireNonNullElse(dyeColor2, DyeColor.WHITE), bannerPatternsComponent, stack.hasFoil(), stack); } else { this.kiteShieldEntityModel.getPlate().render(matrices, vertexConsumer, light, overlay); } - matrices.pop(); - } else if (stack.isOf(WeaponItemsME.ROUND_SHIELD)){ - SpriteIdentifier spriteIdentifier = bl ? MEModelLoader.ROUND_SHIELD_BASE : MEModelLoader.ROUND_SHIELD_BASE_NO_PATTERN; - VertexConsumer vertexConsumer = spriteIdentifier.getSprite().getTextureSpecificVertexConsumer(ItemRenderer.getItemGlintConsumer(vertexConsumers, this.roundShieldEntityModel.getLayer(spriteIdentifier.getAtlasId()), true, stack.hasGlint())); + matrices.popPose(); + } else if (stack.is(WeaponItemsME.ROUND_SHIELD)){ + Material spriteIdentifier = bl ? MEModelLoader.ROUND_SHIELD_BASE : MEModelLoader.ROUND_SHIELD_BASE_NO_PATTERN; + VertexConsumer vertexConsumer = spriteIdentifier.sprite().wrap(ItemRenderer.getFoilBuffer(vertexConsumers, this.roundShieldEntityModel.renderType(spriteIdentifier.atlasLocation()), true, stack.hasFoil())); this.roundShieldEntityModel.getHandle().render(matrices, vertexConsumer, light, overlay); if (bl) { - renderCanvas(matrices, vertexConsumers, light, overlay, this.roundShieldEntityModel.getPlate(), spriteIdentifier, false, (DyeColor) Objects.requireNonNullElse(dyeColor2, DyeColor.WHITE), bannerPatternsComponent, stack.hasGlint(), stack, false); + renderCanvas(matrices, vertexConsumers, light, overlay, this.roundShieldEntityModel.getPlate(), spriteIdentifier, false, (DyeColor) Objects.requireNonNullElse(dyeColor2, DyeColor.WHITE), bannerPatternsComponent, stack.hasFoil(), stack); } else { this.roundShieldEntityModel.getPlate().render(matrices, vertexConsumer, light, overlay); } - matrices.pop(); + matrices.popPose(); } } if (stack.getItem() instanceof HeldBannerItem){ - BannerPatternsComponent bannerPatternsComponent = (BannerPatternsComponent)stack.getOrDefault(DataComponentTypes.BANNER_PATTERNS, BannerPatternsComponent.DEFAULT); - DyeColor dyeColor2 = (DyeColor)stack.get(DataComponentTypes.BASE_COLOR); + BannerPatternLayers bannerPatternsComponent = (BannerPatternLayers)stack.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY); + DyeColor dyeColor2 = (DyeColor)stack.get(DataComponents.BASE_COLOR); boolean bl = !bannerPatternsComponent.layers().isEmpty() || dyeColor2 != null; - matrices.push(); + matrices.pushPose(); matrices.scale(1.0F, -1.0F, -1.0F); - if (stack.isOf(WeaponItemsME.HELD_BANNER)){ - SpriteIdentifier spriteIdentifier = ModelBaker.BANNER_BASE; - VertexConsumer vertexConsumer = spriteIdentifier.getSprite().getTextureSpecificVertexConsumer(ItemRenderer.getItemGlintConsumer(vertexConsumers, this.heldBannerEntityModel.getLayer(spriteIdentifier.getAtlasId()), true, stack.hasGlint())); + if (stack.is(WeaponItemsME.HELD_BANNER)){ + Material spriteIdentifier = ModelBakery.BANNER_BASE; + VertexConsumer vertexConsumer = spriteIdentifier.sprite().wrap(ItemRenderer.getFoilBuffer(vertexConsumers, this.heldBannerEntityModel.renderType(spriteIdentifier.atlasLocation()), true, stack.hasFoil())); this.heldBannerEntityModel.getPole().render(matrices, vertexConsumer, light, overlay); if (bl) { - renderCanvas(matrices, vertexConsumers, light, overlay, this.heldBannerEntityModel.getBanner(), spriteIdentifier, false, (DyeColor) Objects.requireNonNullElse(dyeColor2, DyeColor.WHITE), bannerPatternsComponent, stack.hasGlint(), stack, false); + renderCanvas(matrices, vertexConsumers, light, overlay, this.heldBannerEntityModel.getBanner(), spriteIdentifier, false, (DyeColor) Objects.requireNonNullElse(dyeColor2, DyeColor.WHITE), bannerPatternsComponent, stack.hasFoil(), stack); } else { this.heldBannerEntityModel.getBanner().render(matrices, vertexConsumer, light, overlay); } - matrices.pop(); + matrices.popPose(); } } } - public static void renderCanvas(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, ModelPart canvas, SpriteIdentifier baseSprite, boolean isBanner, DyeColor color, BannerPatternsComponent patterns, boolean glint, ItemStack stack, boolean solid) { - canvas.render(matrices, baseSprite.getVertexConsumer(vertexConsumers, RenderLayer::getEntitySolid, solid, glint), light, overlay); - if (stack.isOf(WeaponItemsME.HEATER_SHIELD)){ - renderLayer(matrices, vertexConsumers, light, overlay, canvas, isBanner ? TexturedRenderLayers.BANNER_BASE : ModTexturedRenderLayers.HEATER_SHIELD_BASE, color); - } else if (stack.isOf(WeaponItemsME.KITE_SHIELD)){ - renderLayer(matrices, vertexConsumers, light, overlay, canvas, isBanner ? TexturedRenderLayers.BANNER_BASE : ModTexturedRenderLayers.KITE_SHIELD_BASE, color); - }else if (stack.isOf(WeaponItemsME.ROUND_SHIELD)){ - renderLayer(matrices, vertexConsumers, light, overlay, canvas, isBanner ? TexturedRenderLayers.BANNER_BASE : ModTexturedRenderLayers.ROUND_SHIELD_BASE, color); - }else if (stack.isOf(WeaponItemsME.HELD_BANNER)){ - renderLayer(matrices, vertexConsumers, light, overlay, canvas, TexturedRenderLayers.BANNER_BASE, color); + public static void renderCanvas(PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay, ModelPart canvas, Material baseSprite, boolean isBanner, DyeColor color, BannerPatternLayers patterns, boolean glint, ItemStack stack) { + canvas.render(matrices, baseSprite.buffer(vertexConsumers, RenderType::entitySolid, glint), light, overlay); + if (stack.is(WeaponItemsME.HEATER_SHIELD)){ + renderLayer(matrices, vertexConsumers, light, overlay, canvas, isBanner ? Sheets.BANNER_BASE : ModTexturedRenderLayers.HEATER_SHIELD_BASE, color); + } else if (stack.is(WeaponItemsME.KITE_SHIELD)){ + renderLayer(matrices, vertexConsumers, light, overlay, canvas, isBanner ? Sheets.BANNER_BASE : ModTexturedRenderLayers.KITE_SHIELD_BASE, color); + }else if (stack.is(WeaponItemsME.ROUND_SHIELD)){ + renderLayer(matrices, vertexConsumers, light, overlay, canvas, isBanner ? Sheets.BANNER_BASE : ModTexturedRenderLayers.ROUND_SHIELD_BASE, color); + }else if (stack.is(WeaponItemsME.HELD_BANNER)){ + renderLayer(matrices, vertexConsumers, light, overlay, canvas, Sheets.BANNER_BASE, color); } for(int i = 0; i < 16 && i < patterns.layers().size(); ++i) { - BannerPatternsComponent.Layer layer = (BannerPatternsComponent.Layer)patterns.layers().get(i); - SpriteIdentifier spriteIdentifier = isBanner ? TexturedRenderLayers.getBannerPatternTextureId(layer.pattern()) : ModTexturedRenderLayers.getRoundShieldPatternTextureId(layer.pattern()); - if (stack.isOf(WeaponItemsME.HEATER_SHIELD)){ + BannerPatternLayers.Layer layer = (BannerPatternLayers.Layer)patterns.layers().get(i); + Material spriteIdentifier = isBanner ? Sheets.getBannerMaterial(layer.pattern()) : ModTexturedRenderLayers.getRoundShieldPatternTextureId(layer.pattern()); + if (stack.is(WeaponItemsME.HEATER_SHIELD)){ spriteIdentifier = ModTexturedRenderLayers.getHeaterShieldPatternTextureId(layer.pattern()); - } else if (stack.isOf(WeaponItemsME.KITE_SHIELD)){ + } else if (stack.is(WeaponItemsME.KITE_SHIELD)){ spriteIdentifier = ModTexturedRenderLayers.getKiteShieldPatternTextureId(layer.pattern()); - }else if (stack.isOf(WeaponItemsME.ROUND_SHIELD)){ + }else if (stack.is(WeaponItemsME.ROUND_SHIELD)){ spriteIdentifier = ModTexturedRenderLayers.getRoundShieldPatternTextureId(layer.pattern()); - } else if (stack.isOf(WeaponItemsME.HELD_BANNER)){ - spriteIdentifier = TexturedRenderLayers.getBannerPatternTextureId(layer.pattern()); + } else if (stack.is(WeaponItemsME.HELD_BANNER)){ + spriteIdentifier = Sheets.getBannerMaterial(layer.pattern()); } renderLayer(matrices, vertexConsumers, light, overlay, canvas, spriteIdentifier, layer.color()); } @@ -142,8 +160,8 @@ public static void renderCanvas(MatrixStack matrices, VertexConsumerProvider ver - private static void renderLayer(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, ModelPart canvas, SpriteIdentifier textureId, DyeColor color) { - int i = color.getEntityColor(); - canvas.render(matrices, textureId.getVertexConsumer(vertexConsumers, RenderLayer::getEntityNoOutline), light, overlay, i); + private static void renderLayer(PoseStack matrices, MultiBufferSource vertexConsumers, int light, int overlay, ModelPart canvas, Material textureId, DyeColor color) { + int i = color.getTextureDiffuseColor(); + canvas.render(matrices, textureId.buffer(vertexConsumers, RenderType::entityNoOutline), light, overlay, i); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/RenderResourceCache.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/RenderResourceCache.java new file mode 100644 index 0000000000..55e6a41820 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/RenderResourceCache.java @@ -0,0 +1,228 @@ +package net.sevenstars.middleearth.client.renderer; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.middleearth.item.dataComponents.SeasonDataComponent; +import net.sevenstars.middleearth.item.utils.armor.backAttachments.BackAttachmentsME; +import net.sevenstars.middleearth.item.utils.armor.helmetAttachments.HelmetAttachmentsME; +import net.sevenstars.middleearth.registries.AtlasesME; + +import java.util.EnumMap; +import java.util.IdentityHashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +public final class RenderResourceCache { + private static final int MAX_NPC_TEXTURES_PER_PREFIX = 1024; + private static final int MAX_ARMOR_VARIANT = 256; + private static final Map ARMOR_TEXTURES = new IdentityHashMap<>(); + private static final EnumMap NPC_TEXTURES = new EnumMap<>(NpcPrefix.class); + private static final EnumMap HELMET_ATTACHMENTS = + new EnumMap<>(HelmetAttachmentsME.class); + private static final EnumMap BACK_ATTACHMENTS = + new EnumMap<>(BackAttachmentsME.class); + private static final EnumMap CROWN_TEXTURES = + new EnumMap<>(SeasonDataComponent.Season.class); + private static final CrownTextures DEFAULT_CROWN = + crownTextures("textures/models/armor/woodland_realm_crown.png"); + + static { + for (NpcPrefix prefix : NpcPrefix.values()) { + NPC_TEXTURES.put(prefix, new PrefixCache(prefix.prefix)); + } + for (HelmetAttachmentsME attachment : HelmetAttachmentsME.values()) { + String path = "textures/models/helmet_attachment/" + attachment.getName(); + HELMET_ATTACHMENTS.put(attachment, new HelmetAttachmentTextures( + texturePair(path + ".png"), + texturePair(path + "_down.png"))); + } + for (BackAttachmentsME attachment : BackAttachmentsME.values()) { + BACK_ATTACHMENTS.put(attachment, + texturePair("textures/models/back_attachment/" + attachment.getName() + ".png")); + } + for (SeasonDataComponent.Season season : SeasonDataComponent.Season.values()) { + String suffix = switch (season) { + case SPRING -> "_spring"; + case SUMMER -> "_summer"; + case AUTUMN -> "_autumn"; + case WINTER -> "_winter"; + case DEAD -> ""; + }; + CROWN_TEXTURES.put(season, + suffix.isEmpty() + ? DEFAULT_CROWN + : crownTextures("textures/models/armor/woodland_realm_crown" + suffix + ".png")); + } + } + + private RenderResourceCache() { + } + + public static ResourceLocation npcTexture(ResourceLocation texture, NpcPrefix prefix) { + if (texture == null) { + return null; + } + return NPC_TEXTURES.get(prefix).getOrCreate(texture); + } + + public static void registerArmorItem(Item item, boolean cacheVariants) { + ArmorTextures current = ARMOR_TEXTURES.get(item); + if (current == null || cacheVariants && !current.hasVariants()) { + ARMOR_TEXTURES.put(item, createArmorTextures(item, cacheVariants)); + } + } + + public static ArmorTextures armor(Item item) { + ArmorTextures textures = ARMOR_TEXTURES.get(item); + if (textures == null) { + textures = createArmorTextures(item, false); + ARMOR_TEXTURES.put(item, textures); + } + return textures; + } + + public static TexturePair helmetAttachment(HelmetAttachmentsME attachment, boolean down) { + HelmetAttachmentTextures textures = HELMET_ATTACHMENTS.get(attachment); + return down ? textures.down : textures.up; + } + + public static TexturePair backAttachment(BackAttachmentsME attachment) { + return BACK_ATTACHMENTS.get(attachment); + } + + public static CrownTextures crown(SeasonDataComponent.Season season) { + return season == null ? DEFAULT_CROWN : CROWN_TEXTURES.get(season); + } + + private static ArmorTextures createArmorTextures(Item item, boolean cacheVariants) { + String itemPath = BuiltInRegistries.ITEM.getKey(item).getPath(); + String basePath = "textures/models/armor/" + itemPath + ".png"; + TexturePair base = texturePair(basePath); + TexturePair genericAddition = texturePair(replaceSuffix(basePath, ".png", "_addition.png")); + TexturePair helmetAddition = basePath.endsWith("_helmet.png") + ? texturePair(replaceSuffix(basePath, "_helmet.png", "_addition.png")) + : genericAddition; + TexturePair chestplateAddition = basePath.endsWith("_chestplate.png") + ? texturePair(replaceSuffix(basePath, "_chestplate.png", "_addition.png")) + : genericAddition; + TexturePair[] variants = null; + if (cacheVariants) { + variants = new TexturePair[MAX_ARMOR_VARIANT + 1]; + variants[0] = helmetAddition; + for (int variant = 1; variant <= MAX_ARMOR_VARIANT; variant++) { + variants[variant] = basePath.endsWith("_helmet.png") + ? texturePair(replaceSuffix(basePath, "_helmet.png", "_addition_" + variant + ".png")) + : genericAddition; + } + } + return new ArmorTextures(base, genericAddition, helmetAddition, chestplateAddition, variants); + } + + private static CrownTextures crownTextures(String path) { + return new CrownTextures(texturePair(path), texturePair(replaceSuffix(path, ".png", "_addition.png"))); + } + + private static TexturePair texturePair(String path) { + ResourceLocation base = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, path); + ResourceLocation overlay = ResourceLocation.fromNamespaceAndPath( + MiddleEarth.MOD_ID, replaceSuffix(path, ".png", "_overlay.png")); + return new TexturePair(base, overlay); + } + + private static String replaceSuffix(String value, String suffix, String replacement) { + return value.substring(0, value.length() - suffix.length()) + replacement; + } + + public enum NpcPrefix { + SKIN(AtlasesME.SKIN_PREFIX), + HAIR(AtlasesME.HAIR_PREFIX), + EYE(AtlasesME.EYE_PREFIX), + CLOTHES_BASE(AtlasesME.CLOTHES_BASE_PREFIX), + CLOTHES_OVER(AtlasesME.CLOTHES_OVER_PREFIX), + CLOTHES_EXTRA(AtlasesME.CLOTHES_EXTRA_PREFIX); + + private final ResourceLocation prefix; + + NpcPrefix(ResourceLocation prefix) { + this.prefix = prefix; + } + } + + public record TexturePair(ResourceLocation base, ResourceLocation overlay) { + } + + public record CrownTextures(TexturePair base, TexturePair addition) { + } + + public static final class ArmorTextures { + private final TexturePair base; + private final TexturePair genericAddition; + private final TexturePair helmetAddition; + private final TexturePair chestplateAddition; + private final TexturePair[] helmetVariants; + + private ArmorTextures(TexturePair base, TexturePair genericAddition, TexturePair helmetAddition, + TexturePair chestplateAddition, TexturePair[] helmetVariants) { + this.base = base; + this.genericAddition = genericAddition; + this.helmetAddition = helmetAddition; + this.chestplateAddition = chestplateAddition; + this.helmetVariants = helmetVariants; + } + + public TexturePair base() { + return this.base; + } + + public TexturePair genericAddition() { + return this.genericAddition; + } + + public TexturePair helmetAddition() { + return this.helmetAddition; + } + + public TexturePair chestplateAddition() { + return this.chestplateAddition; + } + + public TexturePair helmetVariantAddition(int variant) { + if (this.helmetVariants == null || variant <= 0 || variant > MAX_ARMOR_VARIANT) { + return this.helmetAddition; + } + return this.helmetVariants[variant]; + } + + private boolean hasVariants() { + return this.helmetVariants != null; + } + } + + private record HelmetAttachmentTextures(TexturePair up, TexturePair down) { + } + + private static final class PrefixCache extends LinkedHashMap { + private final String pathPrefix; + + private PrefixCache(ResourceLocation prefix) { + super(128, 0.75F, true); + this.pathPrefix = prefix.getPath() + "/"; + } + + private ResourceLocation getOrCreate(ResourceLocation texture) { + ResourceLocation cached = this.get(texture); + if (cached == null) { + cached = texture.withPrefix(this.pathPrefix); + this.put(texture, cached); + } + return cached; + } + + @Override + protected boolean removeEldestEntry(Map.Entry eldest) { + return this.size() > MAX_NPC_TEXTURES_PER_PREFIX; + } + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/ArmorRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/ArmorRenderer.java new file mode 100644 index 0000000000..10c57524af --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/ArmorRenderer.java @@ -0,0 +1,49 @@ +package net.sevenstars.middleearth.client.renderer.armor; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.model.Model; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache; + +import java.util.IdentityHashMap; +import java.util.Map; + +/** + * Full custom armor rendering is not exposed by NeoForge's item extensions in 1.21.1. + * Registrations are dispatched from the humanoid armor layer mixin. + */ +public interface ArmorRenderer { + Map RENDERERS = new IdentityHashMap<>(); + + void render(PoseStack matrices, MultiBufferSource vertexConsumers, ItemStack stack, + LivingEntity entity, EquipmentSlot slot, int light, + HumanoidModel contextModel); + + static void register(ArmorRenderer renderer, Item... items) { + for (Item item : items) { + RENDERERS.put(item, renderer); + RenderResourceCache.registerArmorItem(item, renderer instanceof HelmetVariantsRenderer); + } + } + + static ArmorRenderer get(Item item) { + return RENDERERS.get(item); + } + + static void renderPart(PoseStack matrices, MultiBufferSource vertexConsumers, int light, + ItemStack stack, Model model, ResourceLocation texture) { + VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer( + vertexConsumers, RenderType.armorCutoutNoCull(texture), stack.hasFoil()); + model.renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/BackAttachmentRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/BackAttachmentRenderer.java index 09eed3640d..99cf021bf1 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/BackAttachmentRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/BackAttachmentRenderer.java @@ -1,66 +1,73 @@ package net.sevenstars.middleearth.client.renderer.armor; -import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderer; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.component.type.DyedColorComponent; -import net.sevenstars.middleearth.MiddleEarth; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; import net.sevenstars.middleearth.client.model.equipment.chest.ChestplateAddonModel; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache; import net.sevenstars.middleearth.item.DataComponentTypesME; import net.sevenstars.middleearth.item.dataComponents.BackAttachmentDataComponent; import net.sevenstars.middleearth.item.utils.armor.ArmorModelsME; import net.sevenstars.middleearth.item.utils.armor.DyeablePiecesME; +import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.Model; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.ColorHelper; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.DyedItemColor; public class BackAttachmentRenderer implements ArmorRenderer { public BackAttachmentRenderer() { } - static void renderDyeableBackAttachment(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, ItemStack stack, Model model, Identifier texture, boolean chestplate) { - VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumers, RenderLayer.getArmorCutoutNoCull(texture), stack.hasGlint()); + static void renderDyeableBackAttachment(PoseStack matrices, MultiBufferSource vertexConsumers, int light, ItemStack stack, Model model, ResourceLocation texture, boolean chestplate) { + VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer(vertexConsumers, RenderType.armorCutoutNoCull(texture), stack.hasFoil()); int color; if (chestplate){ - color = ColorHelper.fullAlpha(stack.get(DataComponentTypesME.BACK_ATTACHMENT_DATA).backAttachmentColor()); + color = (0xFF000000 | (stack.get(DataComponentTypesME.BACK_ATTACHMENT_DATA).backAttachmentColor() & 0xFFFFFF)); } else { - color = DyedColorComponent.getColor(stack, DyedColorComponent.DEFAULT_COLOR); + color = DyedItemColor.getOrDefault(stack, DyedItemColor.LEATHER_COLOR); } - model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, color); + model.renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY, color); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, ItemStack stack, BipedEntityRenderState bipedEntityRenderState, EquipmentSlot slot, int light, BipedEntityModel contextModel) { + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, ItemStack stack, LivingEntity entity, EquipmentSlot slot, int light, HumanoidModel contextModel) { if (slot == EquipmentSlot.CHEST) { BackAttachmentDataComponent backAttachmentDataComponent = stack.get(DataComponentTypesME.BACK_ATTACHMENT_DATA); if (backAttachmentDataComponent != null) { - ChestplateAddonModel backAttachmentModel = ArmorModelsME.ModBackAttachmentPairedModels.valueOf(backAttachmentDataComponent.backAttachment().getName().toUpperCase()).getModel().getUnarmoredModel(); - contextModel.copyTransforms(backAttachmentModel); - backAttachmentModel.setVisible(false); + var attachment = backAttachmentDataComponent.backAttachment(); + var attachmentTextures = RenderResourceCache.backAttachment(attachment); + ChestplateAddonModel backAttachmentModel = ArmorModelsME.ModBackAttachmentPairedModels + .valueOf(attachment.name()).getModel().getUnarmoredModel(); + contextModel.copyPropertiesTo(backAttachmentModel); + backAttachmentModel.setAllVisible(false); backAttachmentModel.body.visible = true; backAttachmentModel.rightArm.visible = true; backAttachmentModel.leftArm.visible = true; backAttachmentModel.rightLeg.visible = true; backAttachmentModel.leftLeg.visible = true; - backAttachmentModel.setAngles(bipedEntityRenderState); + backAttachmentModel.setupAnim(entity, entity.walkAnimation.position(), entity.walkAnimation.speed(), entity.tickCount, contextModel.head.yRot, contextModel.head.xRot); if (DyeablePiecesME.dyeableBackAttachments.containsKey(backAttachmentDataComponent.getBackAttachment())) { - renderDyeableBackAttachment(matrices, vertexConsumers, light, stack, backAttachmentModel, Identifier.of(MiddleEarth.MOD_ID, "textures/models/back_attachment/" + backAttachmentDataComponent.backAttachment().getName() + ".png"), false); - if (DyeablePiecesME.dyeableBackAttachments.get(backAttachmentDataComponent.backAttachment())){ - ArmorRenderer.renderPart(matrices, vertexConsumers, light, stack, backAttachmentModel, Identifier.of(MiddleEarth.MOD_ID, "textures/models/back_attachment/" + backAttachmentDataComponent.backAttachment().getName() + "_overlay.png")); + renderDyeableBackAttachment( + matrices, vertexConsumers, light, stack, backAttachmentModel, + attachmentTextures.base(), false); + if (DyeablePiecesME.dyeableBackAttachments.get(attachment)){ + ArmorRenderer.renderPart( + matrices, vertexConsumers, light, stack, backAttachmentModel, + attachmentTextures.overlay()); } } else { - ArmorRenderer.renderPart(matrices, vertexConsumers, light, stack, backAttachmentModel, Identifier.of(MiddleEarth.MOD_ID, "textures/models/back_attachment/" + backAttachmentDataComponent.backAttachment().getName() + ".png")); + ArmorRenderer.renderPart( + matrices, vertexConsumers, light, stack, backAttachmentModel, + attachmentTextures.base()); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/BootsArmorRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/BootsArmorRenderer.java index 5a373f66a6..129ca1084c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/BootsArmorRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/BootsArmorRenderer.java @@ -1,41 +1,38 @@ package net.sevenstars.middleearth.client.renderer.armor; -import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderer; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.registry.tag.ItemTags; -import net.sevenstars.middleearth.MiddleEarth; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ItemStack; import net.sevenstars.middleearth.client.model.equipment.CustomBootsModel; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.Registries; -import net.minecraft.util.Identifier; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache; public class BootsArmorRenderer implements ArmorRenderer { - private final CustomBootsModel customBootsModel = new CustomBootsModel(CustomBootsModel.getTexturedModelData().createModel()); + private final CustomBootsModel customBootsModel = new CustomBootsModel(CustomBootsModel.getTexturedModelData().bakeRoot()); public BootsArmorRenderer() { } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, ItemStack stack, BipedEntityRenderState bipedEntityRenderState, EquipmentSlot slot, int light, BipedEntityModel contextModel) { + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, ItemStack stack, LivingEntity entity, EquipmentSlot slot, int light, HumanoidModel contextModel) { boolean dyeable = false; if (slot == EquipmentSlot.FEET) { - contextModel.copyTransforms(customBootsModel); - customBootsModel.setVisible(false); + contextModel.copyPropertiesTo(customBootsModel); + customBootsModel.setAllVisible(false); customBootsModel.rightLeg.visible = true; customBootsModel.leftLeg.visible = true; - if (stack.isIn(ItemTags.DYEABLE)) { + if (stack.is(ItemTags.DYEABLE)) { dyeable = true; } - String texture = "textures/models/armor/" + Registries.ITEM.getId(stack.getItem()).getPath() + ".png"; - ModArmorRenderer.renderArmor(matrices, vertexConsumers, light, stack, customBootsModel, Identifier.of(MiddleEarth.MOD_ID, texture), dyeable); + ModArmorRenderer.renderArmor(matrices, vertexConsumers, light, stack, customBootsModel, + RenderResourceCache.armor(stack.getItem()).base(), dyeable); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/ChestplateArmorRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/ChestplateArmorRenderer.java index da273bea86..aa825c376b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/ChestplateArmorRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/ChestplateArmorRenderer.java @@ -1,27 +1,24 @@ package net.sevenstars.middleearth.client.renderer.armor; -import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderer; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.registry.tag.ItemTags; -import net.sevenstars.middleearth.MiddleEarth; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ItemStack; import net.sevenstars.middleearth.client.model.equipment.CustomChestplateModel; import net.sevenstars.middleearth.client.model.equipment.chest.ChestplateAddonModel; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache; import net.sevenstars.middleearth.item.DataComponentTypesME; import net.sevenstars.middleearth.item.dataComponents.BackAttachmentDataComponent; import net.sevenstars.middleearth.item.items.armor.CustomChestplateItem; import net.sevenstars.middleearth.item.utils.armor.ArmorModelsME; import net.sevenstars.middleearth.item.utils.armor.DyeablePiecesME; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.Registries; -import net.minecraft.util.Identifier; public class ChestplateArmorRenderer implements ArmorRenderer { - private final CustomChestplateModel customChestplateModel = new CustomChestplateModel(CustomChestplateModel.getTexturedModelData().createModel());; + private final CustomChestplateModel customChestplateModel = new CustomChestplateModel(CustomChestplateModel.getTexturedModelData().bakeRoot());; private ChestplateAddonModel chestplateAddonModel; @@ -33,57 +30,61 @@ public ChestplateArmorRenderer(ChestplateAddonModel chestplateModel) { } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, ItemStack stack, BipedEntityRenderState bipedEntityRenderState, EquipmentSlot slot, int light, BipedEntityModel contextModel) { + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, ItemStack stack, LivingEntity entity, EquipmentSlot slot, int light, HumanoidModel contextModel) { boolean dyeable = false; if (slot == EquipmentSlot.CHEST) { - contextModel.copyTransforms(customChestplateModel); - customChestplateModel.setVisible(false); + contextModel.copyPropertiesTo(customChestplateModel); + customChestplateModel.setAllVisible(false); customChestplateModel.body.visible = true; customChestplateModel.rightArm.visible = true; customChestplateModel.leftArm.visible = true; customChestplateModel.rightLeg.visible = true; customChestplateModel.leftLeg.visible = true; - if (stack.isIn(ItemTags.DYEABLE)) { + if (stack.is(ItemTags.DYEABLE)) { dyeable = true; } - String texture = "textures/models/armor/" + Registries.ITEM.getId(stack.getItem()).getPath() + ".png"; - ModArmorRenderer.renderArmor(matrices, vertexConsumers, light, stack, customChestplateModel, Identifier.of(MiddleEarth.MOD_ID, texture), dyeable); + RenderResourceCache.ArmorTextures armorTextures = RenderResourceCache.armor(stack.getItem()); + ModArmorRenderer.renderArmor( + matrices, vertexConsumers, light, stack, customChestplateModel, armorTextures.base(), dyeable); if (this.chestplateAddonModel != null) { - contextModel.copyTransforms(this.chestplateAddonModel); - this.chestplateAddonModel.setVisible(false); + contextModel.copyPropertiesTo(this.chestplateAddonModel); + this.chestplateAddonModel.setAllVisible(false); this.chestplateAddonModel.body.visible = true; this.chestplateAddonModel.rightArm.visible = true; this.chestplateAddonModel.leftArm.visible = true; - if(texture.contains("_chestplate.png")){ - ModArmorRenderer.renderArmor(matrices, vertexConsumers, light, stack, this.chestplateAddonModel, Identifier.of(MiddleEarth.MOD_ID, texture.replaceAll("_chestplate.png", "_addition.png")), dyeable); - } else { - ModArmorRenderer.renderArmor(matrices, vertexConsumers, light, stack, this.chestplateAddonModel, Identifier.of(MiddleEarth.MOD_ID, texture.replaceAll(".png", "_addition.png")), dyeable); - } + ModArmorRenderer.renderArmor( + matrices, vertexConsumers, light, stack, this.chestplateAddonModel, + armorTextures.chestplateAddition(), dyeable); } BackAttachmentDataComponent capeDataComponent = stack.get(DataComponentTypesME.BACK_ATTACHMENT_DATA); if (capeDataComponent != null) { ChestplateAddonModel capeModel = ArmorModelsME.ModBackAttachmentPairedModels.valueOf(capeDataComponent.backAttachment().getName().toUpperCase()).getModel().getArmoredModel(); - contextModel.copyTransforms(capeModel); - capeModel.setVisible(false); + contextModel.copyPropertiesTo(capeModel); + capeModel.setAllVisible(false); capeModel.body.visible = true; capeModel.rightArm.visible = true; capeModel.leftArm.visible = true; capeModel.rightLeg.visible = true; capeModel.leftLeg.visible = true; - capeModel.setAngles(bipedEntityRenderState); + capeModel.setupAnim(entity, entity.walkAnimation.position(), entity.walkAnimation.speed(), entity.tickCount, contextModel.head.yRot, contextModel.head.xRot); + var attachment = capeDataComponent.backAttachment(); + var attachmentTextures = RenderResourceCache.backAttachment(attachment); if (DyeablePiecesME.dyeableBackAttachments.containsKey(capeDataComponent.getBackAttachment())) { - BackAttachmentRenderer.renderDyeableBackAttachment(matrices, vertexConsumers, light, stack, capeModel, Identifier.of(MiddleEarth.MOD_ID, "textures/models/back_attachment/" + capeDataComponent.backAttachment().getName() + ".png"), true); - if (DyeablePiecesME.dyeableBackAttachments.get(capeDataComponent.backAttachment()).booleanValue()){ - ArmorRenderer.renderPart(matrices, vertexConsumers, light, stack, capeModel, Identifier.of(MiddleEarth.MOD_ID, "textures/models/back_attachment/" + capeDataComponent.backAttachment().getName() + "_overlay.png")); + BackAttachmentRenderer.renderDyeableBackAttachment( + matrices, vertexConsumers, light, stack, capeModel, attachmentTextures.base(), true); + if (DyeablePiecesME.dyeableBackAttachments.get(attachment)){ + ArmorRenderer.renderPart( + matrices, vertexConsumers, light, stack, capeModel, attachmentTextures.overlay()); } } else { - ArmorRenderer.renderPart(matrices, vertexConsumers, light, stack, capeModel, Identifier.of(MiddleEarth.MOD_ID, "textures/models/back_attachment/" + capeDataComponent.backAttachment().getName() + ".png")); + ArmorRenderer.renderPart( + matrices, vertexConsumers, light, stack, capeModel, attachmentTextures.base()); }} } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/HelmetArmorRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/HelmetArmorRenderer.java index 61ad791e22..faae677482 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/HelmetArmorRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/HelmetArmorRenderer.java @@ -1,26 +1,24 @@ package net.sevenstars.middleearth.client.renderer.armor; -import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderer; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.registry.tag.ItemTags; -import net.sevenstars.middleearth.MiddleEarth; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ItemStack; import net.sevenstars.middleearth.client.model.equipment.CustomHelmetModel; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache; import net.sevenstars.middleearth.item.DataComponentTypesME; +import net.sevenstars.middleearth.item.EquipmentItemsME; import net.sevenstars.middleearth.item.dataComponents.HelmetAttachmentDataComponent; import net.sevenstars.middleearth.item.utils.armor.ArmorModelsME; import net.sevenstars.middleearth.item.utils.armor.DyeablePiecesME; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.Registries; -import net.minecraft.util.Identifier; public class HelmetArmorRenderer implements ArmorRenderer { - private final CustomHelmetModel customHelmetModel = new CustomHelmetModel(CustomHelmetModel.getTexturedModelData().createModel()); + private final CustomHelmetModel customHelmetModel = new CustomHelmetModel(CustomHelmetModel.getTexturedModelData().bakeRoot()); private HelmetAddonModel helmetAddonModel; public HelmetArmorRenderer() { @@ -32,62 +30,69 @@ public HelmetArmorRenderer(HelmetAddonModel helmetModel) { @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, ItemStack stack, BipedEntityRenderState bipedEntityRenderState, EquipmentSlot slot, int light, BipedEntityModel contextModel) { + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, ItemStack stack, LivingEntity entity, EquipmentSlot slot, int light, HumanoidModel contextModel) { boolean dyeable = false; if (slot == EquipmentSlot.HEAD) { - contextModel.copyTransforms(customHelmetModel); - customHelmetModel.setVisible(false); + contextModel.copyPropertiesTo(customHelmetModel); + customHelmetModel.setAllVisible(false); customHelmetModel.head.visible = true; customHelmetModel.hat.visible = true; customHelmetModel.body.visible = true; customHelmetModel.leftArm.visible = true; customHelmetModel.rightArm.visible = true; - if(stack.isIn(ItemTags.DYEABLE)) { + if(stack.is(ItemTags.DYEABLE)) { dyeable = true; } - String texture = "textures/models/armor/" + Registries.ITEM.getId(stack.getItem()).getPath() + ".png"; - ModArmorRenderer.renderArmor(matrices, vertexConsumers, light, stack, customHelmetModel, Identifier.of(MiddleEarth.MOD_ID, texture), dyeable); + RenderResourceCache.ArmorTextures armorTextures = RenderResourceCache.armor(stack.getItem()); + ModArmorRenderer.renderArmor( + matrices, vertexConsumers, light, stack, customHelmetModel, armorTextures.base(), dyeable); if (this.helmetAddonModel != null) { - contextModel.copyTransforms(this.helmetAddonModel); - this.helmetAddonModel.setVisible(false); + contextModel.copyPropertiesTo(this.helmetAddonModel); + this.helmetAddonModel.setAllVisible(false); this.helmetAddonModel.head.visible = true; - //this.helmetModel.setAngles(bipedEntityRenderState); - if(texture.contains("_helmet.png")){ - ModArmorRenderer.renderArmor(matrices, vertexConsumers, light, stack, this.helmetAddonModel, Identifier.of(MiddleEarth.MOD_ID, texture.replaceAll("_helmet.png", "_addition.png")), dyeable); - } else if(texture.contains("glass") || texture.contains("monocle")){ - ModArmorRenderer.renderTranslucentPiece(matrices, vertexConsumers, light, stack, this.helmetAddonModel, Identifier.of(MiddleEarth.MOD_ID, texture.replaceAll(".png", "_addition.png"))); + if (stack.is(EquipmentItemsME.GLASSES) || stack.is(EquipmentItemsME.DWARVEN_MONOCLE)) { + ModArmorRenderer.renderTranslucentPiece(matrices, vertexConsumers, light, stack, + this.helmetAddonModel, armorTextures.helmetAddition().base()); } else { - ModArmorRenderer.renderArmor(matrices, vertexConsumers, light, stack, this.helmetAddonModel, Identifier.of(MiddleEarth.MOD_ID, texture.replaceAll(".png", "_addition.png")), dyeable); + ModArmorRenderer.renderArmor(matrices, vertexConsumers, light, stack, this.helmetAddonModel, + armorTextures.helmetAddition(), dyeable); } } HelmetAttachmentDataComponent hoodDataComponent = stack.get(DataComponentTypesME.HELMET_ATTACHMENT_DATA); if(hoodDataComponent != null) { - Identifier textureHelmetAttachment; + var attachment = hoodDataComponent.helmetAttachment(); + var attachmentTextures = RenderResourceCache.helmetAttachment(attachment, hoodDataComponent.down()); HelmetAddonModel helmetAttachmentModel; if (hoodDataComponent.down()){ - textureHelmetAttachment = Identifier.of(MiddleEarth.MOD_ID, "textures/models/helmet_attachment/" + hoodDataComponent.helmetAttachment().getName().toLowerCase() + "_down.png"); - helmetAttachmentModel = ArmorModelsME.ModHelmetAttachmentPairedModels.valueOf(hoodDataComponent.helmetAttachment().getName().toUpperCase()).getModel().getArmoredDownModel(); + helmetAttachmentModel = ArmorModelsME.ModHelmetAttachmentPairedModels + .valueOf(attachment.name()).getModel().getArmoredDownModel(); } else { - textureHelmetAttachment = Identifier.of(MiddleEarth.MOD_ID, "textures/models/helmet_attachment/" + hoodDataComponent.helmetAttachment().getName().toLowerCase() + ".png"); - helmetAttachmentModel = ArmorModelsME.ModHelmetAttachmentPairedModels.valueOf(hoodDataComponent.helmetAttachment().getName().toUpperCase()).getModel().getArmoredModel(); + helmetAttachmentModel = ArmorModelsME.ModHelmetAttachmentPairedModels + .valueOf(attachment.name()).getModel().getArmoredModel(); } - contextModel.copyTransforms(helmetAttachmentModel); - helmetAttachmentModel.setVisible(false); + contextModel.copyPropertiesTo(helmetAttachmentModel); + helmetAttachmentModel.setAllVisible(false); helmetAttachmentModel.head.visible = true; helmetAttachmentModel.hat.visible = true; if (DyeablePiecesME.dyeableHelmetAttachments.containsKey(hoodDataComponent.getHelmetAttachment())) { - HelmetAttachmentRenderer.renderDyeableHelmetAttachment(matrices, vertexConsumers, light, stack, helmetAttachmentModel, textureHelmetAttachment, true); - if (DyeablePiecesME.dyeableHelmetAttachments.get(hoodDataComponent.helmetAttachment())){ - ModArmorRenderer.renderTranslucentPiece(matrices, vertexConsumers, light, stack, helmetAttachmentModel, Identifier.of(MiddleEarth.MOD_ID, textureHelmetAttachment.getPath().replaceAll(".png", "_overlay.png"))); + HelmetAttachmentRenderer.renderDyeableHelmetAttachment( + matrices, vertexConsumers, light, stack, helmetAttachmentModel, + attachmentTextures.base(), true); + if (DyeablePiecesME.dyeableHelmetAttachments.get(attachment)){ + ModArmorRenderer.renderTranslucentPiece( + matrices, vertexConsumers, light, stack, helmetAttachmentModel, + attachmentTextures.overlay()); } } else { - ModArmorRenderer.renderTranslucentPiece(matrices, vertexConsumers, light, stack, helmetAttachmentModel, textureHelmetAttachment); + ModArmorRenderer.renderTranslucentPiece( + matrices, vertexConsumers, light, stack, helmetAttachmentModel, + attachmentTextures.base()); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/HelmetAttachmentRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/HelmetAttachmentRenderer.java index 2085640a7b..be08a22b0e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/HelmetAttachmentRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/HelmetAttachmentRenderer.java @@ -1,70 +1,76 @@ package net.sevenstars.middleearth.client.renderer.armor; -import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderer; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.component.type.DyedColorComponent; -import net.sevenstars.middleearth.MiddleEarth; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache; import net.sevenstars.middleearth.item.DataComponentTypesME; import net.sevenstars.middleearth.item.dataComponents.HelmetAttachmentDataComponent; import net.sevenstars.middleearth.item.utils.armor.ArmorModelsME; import net.sevenstars.middleearth.item.utils.armor.DyeablePiecesME; +import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.Model; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.ColorHelper; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.DyedItemColor; public class HelmetAttachmentRenderer implements ArmorRenderer { public HelmetAttachmentRenderer() { } - static void renderDyeableHelmetAttachment(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, ItemStack stack, Model model, Identifier texture, boolean helmet) { - VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumers, RenderLayer.getArmorCutoutNoCull(texture), stack.hasGlint()); + static void renderDyeableHelmetAttachment(PoseStack matrices, MultiBufferSource vertexConsumers, int light, ItemStack stack, Model model, ResourceLocation texture, boolean helmet) { + VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer(vertexConsumers, RenderType.armorCutoutNoCull(texture), stack.hasFoil()); int color; if (helmet){ - color = ColorHelper.fullAlpha(stack.get(DataComponentTypesME.HELMET_ATTACHMENT_DATA).helmetAttachmentColor()); + color = (0xFF000000 | (stack.get(DataComponentTypesME.HELMET_ATTACHMENT_DATA).helmetAttachmentColor() & 0xFFFFFF)); } else { - color = DyedColorComponent.getColor(stack, DyedColorComponent.DEFAULT_COLOR); + color = DyedItemColor.getOrDefault(stack, DyedItemColor.LEATHER_COLOR); } - model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, color); + model.renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY, color); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, ItemStack stack, BipedEntityRenderState bipedEntityRenderState, EquipmentSlot slot, int light, BipedEntityModel contextModel) { + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, ItemStack stack, LivingEntity entity, EquipmentSlot slot, int light, HumanoidModel contextModel) { if (slot == EquipmentSlot.HEAD) { HelmetAttachmentDataComponent helmetAttachmentDataComponent = stack.get(DataComponentTypesME.HELMET_ATTACHMENT_DATA); if(helmetAttachmentDataComponent != null) { - Identifier texture; + var attachment = helmetAttachmentDataComponent.helmetAttachment(); + var attachmentTextures = + RenderResourceCache.helmetAttachment(attachment, helmetAttachmentDataComponent.down()); HelmetAddonModel helmetAttachmentModel; if (helmetAttachmentDataComponent.down()){ - texture = Identifier.of(MiddleEarth.MOD_ID, "textures/models/helmet_attachment/" + helmetAttachmentDataComponent.helmetAttachment().getName().toLowerCase() + "_down.png"); - helmetAttachmentModel = ArmorModelsME.ModHelmetAttachmentPairedModels.valueOf(helmetAttachmentDataComponent.helmetAttachment().getName().toUpperCase()).getModel().getUnarmoredDownModel(); + helmetAttachmentModel = ArmorModelsME.ModHelmetAttachmentPairedModels + .valueOf(attachment.name()).getModel().getUnarmoredDownModel(); } else { - texture = Identifier.of(MiddleEarth.MOD_ID, "textures/models/helmet_attachment/" + helmetAttachmentDataComponent.helmetAttachment().getName().toLowerCase() + ".png"); - helmetAttachmentModel = ArmorModelsME.ModHelmetAttachmentPairedModels.valueOf(helmetAttachmentDataComponent.helmetAttachment().getName().toUpperCase()).getModel().getUnarmoredModel(); + helmetAttachmentModel = ArmorModelsME.ModHelmetAttachmentPairedModels + .valueOf(attachment.name()).getModel().getUnarmoredModel(); } - contextModel.copyTransforms(helmetAttachmentModel); - helmetAttachmentModel.setVisible(false); + contextModel.copyPropertiesTo(helmetAttachmentModel); + helmetAttachmentModel.setAllVisible(false); helmetAttachmentModel.head.visible = true; helmetAttachmentModel.hat.visible = true; if (DyeablePiecesME.dyeableHelmetAttachments.containsKey(helmetAttachmentDataComponent.getHelmetAttachment())) { - renderDyeableHelmetAttachment(matrices, vertexConsumers, light, stack, helmetAttachmentModel, texture, false); - if (DyeablePiecesME.dyeableHelmetAttachments.get(helmetAttachmentDataComponent.helmetAttachment())){ - ModArmorRenderer.renderTranslucentPiece(matrices, vertexConsumers, light, stack, helmetAttachmentModel, Identifier.of(MiddleEarth.MOD_ID, texture.getPath().replaceAll(".png", "_overlay.png"))); + renderDyeableHelmetAttachment( + matrices, vertexConsumers, light, stack, helmetAttachmentModel, + attachmentTextures.base(), false); + if (DyeablePiecesME.dyeableHelmetAttachments.get(attachment)){ + ModArmorRenderer.renderTranslucentPiece( + matrices, vertexConsumers, light, stack, helmetAttachmentModel, + attachmentTextures.overlay()); } } else { - ModArmorRenderer.renderTranslucentPiece(matrices, vertexConsumers, light, stack, helmetAttachmentModel, texture); + ModArmorRenderer.renderTranslucentPiece( + matrices, vertexConsumers, light, stack, helmetAttachmentModel, + attachmentTextures.base()); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/HelmetVariantsRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/HelmetVariantsRenderer.java index 05c3a52208..d68988e9c1 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/HelmetVariantsRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/HelmetVariantsRenderer.java @@ -1,27 +1,23 @@ package net.sevenstars.middleearth.client.renderer.armor; -import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.Registries; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.util.Identifier; -import net.sevenstars.middleearth.MiddleEarth; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ItemStack; import net.sevenstars.middleearth.client.model.equipment.CustomHelmetModel; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache; import net.sevenstars.middleearth.item.DataComponentTypesME; import net.sevenstars.middleearth.item.dataComponents.ArmorVariantDataComponent; import net.sevenstars.middleearth.item.dataComponents.HelmetAttachmentDataComponent; -import net.sevenstars.middleearth.item.dataComponents.SeasonDataComponent; import net.sevenstars.middleearth.item.utils.armor.ArmorModelsME; import net.sevenstars.middleearth.item.utils.armor.DyeablePiecesME; public class HelmetVariantsRenderer implements ArmorRenderer { - private final CustomHelmetModel customHelmetModel = new CustomHelmetModel(CustomHelmetModel.getTexturedModelData().createModel()); + private final CustomHelmetModel customHelmetModel = new CustomHelmetModel(CustomHelmetModel.getTexturedModelData().bakeRoot()); private HelmetAddonModel helmetAddonModel; public HelmetVariantsRenderer(HelmetAddonModel helmetModel) { @@ -30,70 +26,69 @@ public HelmetVariantsRenderer(HelmetAddonModel helmetModel) { @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, ItemStack stack, BipedEntityRenderState bipedEntityRenderState, EquipmentSlot slot, int light, BipedEntityModel contextModel) { + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, ItemStack stack, LivingEntity entity, EquipmentSlot slot, int light, HumanoidModel contextModel) { boolean dyeable = false; if (slot == EquipmentSlot.HEAD) { - contextModel.copyTransforms(customHelmetModel); - customHelmetModel.setVisible(false); + contextModel.copyPropertiesTo(customHelmetModel); + customHelmetModel.setAllVisible(false); customHelmetModel.head.visible = true; customHelmetModel.hat.visible = true; customHelmetModel.body.visible = true; customHelmetModel.leftArm.visible = true; customHelmetModel.rightArm.visible = true; - if(stack.isIn(ItemTags.DYEABLE)) { + if(stack.is(ItemTags.DYEABLE)) { dyeable = true; } ArmorVariantDataComponent armorVariantDataComponent = stack.getComponents().get(DataComponentTypesME.ARMOR_VARIANT_DATA); int variant = 0; if(armorVariantDataComponent != null) variant = armorVariantDataComponent.id(); - String texture = "textures/models/armor/" + Registries.ITEM.getId(stack.getItem()).getPath() + ".png"; + RenderResourceCache.ArmorTextures armorTextures = RenderResourceCache.armor(stack.getItem()); - ModArmorRenderer.renderArmor(matrices, vertexConsumers, light, stack, customHelmetModel, Identifier.of(MiddleEarth.MOD_ID, texture), dyeable); + ModArmorRenderer.renderArmor( + matrices, vertexConsumers, light, stack, customHelmetModel, armorTextures.base(), dyeable); if (this.helmetAddonModel != null) { - contextModel.copyTransforms(this.helmetAddonModel); - this.helmetAddonModel.setVisible(false); + contextModel.copyPropertiesTo(this.helmetAddonModel); + this.helmetAddonModel.setAllVisible(false); this.helmetAddonModel.head.visible = true; - if(texture.contains("_helmet.png")){ - if(variant > 0) { - String newTex = texture.replaceAll("_helmet.png", "_addition_" + variant + ".png"); - ModArmorRenderer.renderArmor(matrices, vertexConsumers, light, stack, this.helmetAddonModel, - Identifier.of(MiddleEarth.MOD_ID, newTex), dyeable); - } else { - ModArmorRenderer.renderArmor(matrices, vertexConsumers, light, stack, this.helmetAddonModel, - Identifier.of(MiddleEarth.MOD_ID, texture.replaceAll("_helmet.png", "_addition.png")), dyeable); - } - } else { - ModArmorRenderer.renderArmor(matrices, vertexConsumers, light, stack, this.helmetAddonModel, Identifier.of(MiddleEarth.MOD_ID, texture.replaceAll(".png", "_addition.png")), dyeable); - } + ModArmorRenderer.renderArmor( + matrices, vertexConsumers, light, stack, this.helmetAddonModel, + armorTextures.helmetVariantAddition(variant), dyeable); } HelmetAttachmentDataComponent hoodDataComponent = stack.get(DataComponentTypesME.HELMET_ATTACHMENT_DATA); if(hoodDataComponent != null) { - Identifier textureHelmetAttachment; + var attachment = hoodDataComponent.helmetAttachment(); + var attachmentTextures = RenderResourceCache.helmetAttachment(attachment, hoodDataComponent.down()); HelmetAddonModel helmetAttachmentModel; if (hoodDataComponent.down()){ - textureHelmetAttachment = Identifier.of(MiddleEarth.MOD_ID, "textures/models/helmet_attachment/" + hoodDataComponent.helmetAttachment().getName().toLowerCase() + "_down.png"); - helmetAttachmentModel = ArmorModelsME.ModHelmetAttachmentPairedModels.valueOf(hoodDataComponent.helmetAttachment().getName().toUpperCase()).getModel().getArmoredDownModel(); + helmetAttachmentModel = ArmorModelsME.ModHelmetAttachmentPairedModels + .valueOf(attachment.name()).getModel().getArmoredDownModel(); } else { - textureHelmetAttachment = Identifier.of(MiddleEarth.MOD_ID, "textures/models/helmet_attachment/" + hoodDataComponent.helmetAttachment().getName().toLowerCase() + ".png"); - helmetAttachmentModel = ArmorModelsME.ModHelmetAttachmentPairedModels.valueOf(hoodDataComponent.helmetAttachment().getName().toUpperCase()).getModel().getArmoredModel(); + helmetAttachmentModel = ArmorModelsME.ModHelmetAttachmentPairedModels + .valueOf(attachment.name()).getModel().getArmoredModel(); } - contextModel.copyTransforms(helmetAttachmentModel); - helmetAttachmentModel.setVisible(false); + contextModel.copyPropertiesTo(helmetAttachmentModel); + helmetAttachmentModel.setAllVisible(false); helmetAttachmentModel.head.visible = true; helmetAttachmentModel.hat.visible = true; if (DyeablePiecesME.dyeableHelmetAttachments.containsKey(hoodDataComponent.getHelmetAttachment())) { - HelmetAttachmentRenderer.renderDyeableHelmetAttachment(matrices, vertexConsumers, light, stack, helmetAttachmentModel, textureHelmetAttachment, true); - if (DyeablePiecesME.dyeableHelmetAttachments.get(hoodDataComponent.helmetAttachment())){ - ModArmorRenderer.renderTranslucentPiece(matrices, vertexConsumers, light, stack, helmetAttachmentModel, Identifier.of(MiddleEarth.MOD_ID, textureHelmetAttachment.getPath().replaceAll(".png", "_overlay.png"))); + HelmetAttachmentRenderer.renderDyeableHelmetAttachment( + matrices, vertexConsumers, light, stack, helmetAttachmentModel, + attachmentTextures.base(), true); + if (DyeablePiecesME.dyeableHelmetAttachments.get(attachment)){ + ModArmorRenderer.renderTranslucentPiece( + matrices, vertexConsumers, light, stack, helmetAttachmentModel, + attachmentTextures.overlay()); } } else { - ModArmorRenderer.renderTranslucentPiece(matrices, vertexConsumers, light, stack, helmetAttachmentModel, textureHelmetAttachment); + ModArmorRenderer.renderTranslucentPiece( + matrices, vertexConsumers, light, stack, helmetAttachmentModel, + attachmentTextures.base()); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/LeggingsArmorRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/LeggingsArmorRenderer.java index 221715bf7b..702e0693c9 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/LeggingsArmorRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/LeggingsArmorRenderer.java @@ -1,43 +1,40 @@ package net.sevenstars.middleearth.client.renderer.armor; -import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderer; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.registry.tag.ItemTags; -import net.sevenstars.middleearth.MiddleEarth; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ItemStack; import net.sevenstars.middleearth.client.model.equipment.CustomLeggingsModel; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.Registries; -import net.minecraft.util.Identifier; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache; public class LeggingsArmorRenderer implements ArmorRenderer { - private final CustomLeggingsModel customLeggingsModel = new CustomLeggingsModel(CustomLeggingsModel.getTexturedModelData().createModel()); + private final CustomLeggingsModel customLeggingsModel = new CustomLeggingsModel(CustomLeggingsModel.getTexturedModelData().bakeRoot()); public LeggingsArmorRenderer() { } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, ItemStack stack, BipedEntityRenderState bipedEntityRenderState, EquipmentSlot slot, int light, BipedEntityModel contextModel) { + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, ItemStack stack, LivingEntity entity, EquipmentSlot slot, int light, HumanoidModel contextModel) { boolean dyeable = false; if (slot == EquipmentSlot.LEGS) { - contextModel.copyTransforms(customLeggingsModel); - customLeggingsModel.setVisible(false); + contextModel.copyPropertiesTo(customLeggingsModel); + customLeggingsModel.setAllVisible(false); customLeggingsModel.body.visible = true; customLeggingsModel.rightLeg.visible = true; customLeggingsModel.leftLeg.visible = true; - if (stack.isIn(ItemTags.DYEABLE)) { + if (stack.is(ItemTags.DYEABLE)) { dyeable = true; } - String texture = "textures/models/armor/" + Registries.ITEM.getId(stack.getItem()).getPath() + ".png"; - ModArmorRenderer.renderArmor(matrices, vertexConsumers, light, stack, customLeggingsModel, Identifier.of(MiddleEarth.MOD_ID, texture), dyeable); + ModArmorRenderer.renderArmor(matrices, vertexConsumers, light, stack, customLeggingsModel, + RenderResourceCache.armor(stack.getItem()).base(), dyeable); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/ModArmorRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/ModArmorRenderer.java index 20631171d4..d64bfa7459 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/ModArmorRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/ModArmorRenderer.java @@ -1,51 +1,53 @@ package net.sevenstars.middleearth.client.renderer.armor; -import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderer; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.component.type.DyedColorComponent; -import net.sevenstars.middleearth.MiddleEarth; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache.TexturePair; import net.sevenstars.middleearth.item.utils.armor.DyeablePiecesME; +import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.model.Model; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Identifier; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.DyedItemColor; public class ModArmorRenderer implements ArmorRenderer { public ModArmorRenderer() { } - static void renderArmor(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, ItemStack stack, Model model, Identifier texture, boolean dyeable){ + static void renderArmor(PoseStack matrices, MultiBufferSource vertexConsumers, int light, + ItemStack stack, Model model, TexturePair textures, boolean dyeable){ if(dyeable){ - renderDyeable(matrices, vertexConsumers, light, stack, model, texture); + renderDyeable(matrices, vertexConsumers, light, stack, model, textures.base()); if(DyeablePiecesME.dyeablePieces.get(stack.getItem())) { - ArmorRenderer.renderPart(matrices, vertexConsumers, light, stack, model, Identifier.of(MiddleEarth.MOD_ID, texture.getPath().replaceAll(".png", "_overlay.png"))); + ArmorRenderer.renderPart(matrices, vertexConsumers, light, stack, model, textures.overlay()); } } else { - ArmorRenderer.renderPart(matrices, vertexConsumers, light, stack, model, texture); + ArmorRenderer.renderPart(matrices, vertexConsumers, light, stack, model, textures.base()); } } - static void renderDyeable(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, ItemStack stack, Model model, Identifier texture) { - VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumers, RenderLayer.getArmorCutoutNoCull(texture), stack.hasGlint()); - int color = DyedColorComponent.getColor(stack, DyedColorComponent.DEFAULT_COLOR); - model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, color); + static void renderDyeable(PoseStack matrices, MultiBufferSource vertexConsumers, int light, ItemStack stack, + Model model, net.minecraft.resources.ResourceLocation texture) { + VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer(vertexConsumers, RenderType.armorCutoutNoCull(texture), stack.hasFoil()); + int color = DyedItemColor.getOrDefault(stack, DyedItemColor.LEATHER_COLOR); + model.renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY, color); } - static void renderTranslucentPiece(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, ItemStack stack, Model model, Identifier texture) { - VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumers, RenderLayer.getEntityTranslucent(texture), stack.hasGlint()); - model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, 0xFFFFFFFF); + static void renderTranslucentPiece(PoseStack matrices, MultiBufferSource vertexConsumers, int light, + ItemStack stack, Model model, + net.minecraft.resources.ResourceLocation texture) { + VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer(vertexConsumers, RenderType.entityTranslucent(texture), stack.hasFoil()); + model.renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, ItemStack stack, BipedEntityRenderState bipedEntityRenderState, EquipmentSlot slot, int light, BipedEntityModel contextModel) { + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, ItemStack stack, LivingEntity entity, EquipmentSlot slot, int light, HumanoidModel contextModel) { } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/WoodlandCrownRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/WoodlandCrownRenderer.java index 9c72271fd7..62a3a795cf 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/WoodlandCrownRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/armor/WoodlandCrownRenderer.java @@ -1,26 +1,23 @@ package net.sevenstars.middleearth.client.renderer.armor; -import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.util.Identifier; -import net.sevenstars.middleearth.MiddleEarth; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ItemStack; import net.sevenstars.middleearth.client.model.equipment.CustomHelmetModel; import net.sevenstars.middleearth.client.model.equipment.head.helmets.HelmetAddonModel; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache; import net.sevenstars.middleearth.item.DataComponentTypesME; import net.sevenstars.middleearth.item.dataComponents.SeasonDataComponent; import net.sevenstars.middleearth.item.dataComponents.HelmetAttachmentDataComponent; import net.sevenstars.middleearth.item.utils.armor.ArmorModelsME; import net.sevenstars.middleearth.item.utils.armor.DyeablePiecesME; -import net.sevenstars.middleearth.world.biomes.BiomeTagsME; public class WoodlandCrownRenderer implements ArmorRenderer { - private final CustomHelmetModel customHelmetModel = new CustomHelmetModel(CustomHelmetModel.getTexturedModelData().createModel()); + private final CustomHelmetModel customHelmetModel = new CustomHelmetModel(CustomHelmetModel.getTexturedModelData().bakeRoot()); private HelmetAddonModel helmetAddonModel; public WoodlandCrownRenderer(HelmetAddonModel helmetModel) { @@ -29,19 +26,19 @@ public WoodlandCrownRenderer(HelmetAddonModel helmetModel) { @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, ItemStack stack, BipedEntityRenderState bipedEntityRenderState, EquipmentSlot slot, int light, BipedEntityModel contextModel) { + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, ItemStack stack, LivingEntity entity, EquipmentSlot slot, int light, HumanoidModel contextModel) { boolean dyeable = false; if (slot == EquipmentSlot.HEAD) { - contextModel.copyTransforms(customHelmetModel); - customHelmetModel.setVisible(false); + contextModel.copyPropertiesTo(customHelmetModel); + customHelmetModel.setAllVisible(false); customHelmetModel.head.visible = true; customHelmetModel.hat.visible = true; customHelmetModel.body.visible = true; customHelmetModel.leftArm.visible = true; customHelmetModel.rightArm.visible = true; - if(stack.isIn(ItemTags.DYEABLE)) { + if(stack.is(ItemTags.DYEABLE)) { dyeable = true; } @@ -49,53 +46,50 @@ public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, SeasonDataComponent.Season season = null; if(biomeDataComponent != null) season = biomeDataComponent.season(); - String texture = "textures/models/armor/woodland_realm_crown"; + RenderResourceCache.CrownTextures crownTextures = RenderResourceCache.crown(season); - if(season != null) { - if(season.equals(SeasonDataComponent.Season.SPRING)) { - texture += "_spring"; - } else if(season.equals(SeasonDataComponent.Season.SUMMER)) { - texture += "_summer"; - } else if(season.equals(SeasonDataComponent.Season.AUTUMN)) { - texture += "_autumn"; - } else if(season.equals(SeasonDataComponent.Season.WINTER)) { - texture += "_winter"; - } - } - - texture += ".png"; - - ModArmorRenderer.renderArmor(matrices, vertexConsumers, light, stack, customHelmetModel, Identifier.of(MiddleEarth.MOD_ID, texture), dyeable); + ModArmorRenderer.renderArmor( + matrices, vertexConsumers, light, stack, customHelmetModel, + crownTextures.base(), dyeable); if (this.helmetAddonModel != null) { - contextModel.copyTransforms(this.helmetAddonModel); - this.helmetAddonModel.setVisible(false); + contextModel.copyPropertiesTo(this.helmetAddonModel); + this.helmetAddonModel.setAllVisible(false); this.helmetAddonModel.head.visible = true; - ModArmorRenderer.renderArmor(matrices, vertexConsumers, light, stack, this.helmetAddonModel, Identifier.of(MiddleEarth.MOD_ID, texture.replaceAll(".png", "_addition.png")), dyeable); + ModArmorRenderer.renderArmor( + matrices, vertexConsumers, light, stack, this.helmetAddonModel, + crownTextures.addition(), dyeable); } HelmetAttachmentDataComponent hoodDataComponent = stack.get(DataComponentTypesME.HELMET_ATTACHMENT_DATA); if(hoodDataComponent != null) { - Identifier textureHelmetAttachment; + var attachment = hoodDataComponent.helmetAttachment(); + var attachmentTextures = RenderResourceCache.helmetAttachment(attachment, hoodDataComponent.down()); HelmetAddonModel helmetAttachmentModel; if (hoodDataComponent.down()){ - textureHelmetAttachment = Identifier.of(MiddleEarth.MOD_ID, "textures/models/helmet_attachment/" + hoodDataComponent.helmetAttachment().getName().toLowerCase() + "_down.png"); - helmetAttachmentModel = ArmorModelsME.ModHelmetAttachmentPairedModels.valueOf(hoodDataComponent.helmetAttachment().getName().toUpperCase()).getModel().getArmoredDownModel(); + helmetAttachmentModel = ArmorModelsME.ModHelmetAttachmentPairedModels + .valueOf(attachment.name()).getModel().getArmoredDownModel(); } else { - textureHelmetAttachment = Identifier.of(MiddleEarth.MOD_ID, "textures/models/helmet_attachment/" + hoodDataComponent.helmetAttachment().getName().toLowerCase() + ".png"); - helmetAttachmentModel = ArmorModelsME.ModHelmetAttachmentPairedModels.valueOf(hoodDataComponent.helmetAttachment().getName().toUpperCase()).getModel().getArmoredModel(); + helmetAttachmentModel = ArmorModelsME.ModHelmetAttachmentPairedModels + .valueOf(attachment.name()).getModel().getArmoredModel(); } - contextModel.copyTransforms(helmetAttachmentModel); - helmetAttachmentModel.setVisible(false); + contextModel.copyPropertiesTo(helmetAttachmentModel); + helmetAttachmentModel.setAllVisible(false); helmetAttachmentModel.head.visible = true; helmetAttachmentModel.hat.visible = true; if (DyeablePiecesME.dyeableHelmetAttachments.containsKey(hoodDataComponent.getHelmetAttachment())) { - HelmetAttachmentRenderer.renderDyeableHelmetAttachment(matrices, vertexConsumers, light, stack, helmetAttachmentModel, textureHelmetAttachment, true); - if (DyeablePiecesME.dyeableHelmetAttachments.get(hoodDataComponent.helmetAttachment())){ - ModArmorRenderer.renderTranslucentPiece(matrices, vertexConsumers, light, stack, helmetAttachmentModel, Identifier.of(MiddleEarth.MOD_ID, textureHelmetAttachment.getPath().replaceAll(".png", "_overlay.png"))); + HelmetAttachmentRenderer.renderDyeableHelmetAttachment( + matrices, vertexConsumers, light, stack, helmetAttachmentModel, + attachmentTextures.base(), true); + if (DyeablePiecesME.dyeableHelmetAttachments.get(attachment)){ + ModArmorRenderer.renderTranslucentPiece( + matrices, vertexConsumers, light, stack, helmetAttachmentModel, + attachmentTextures.overlay()); } } else { - ModArmorRenderer.renderTranslucentPiece(matrices, vertexConsumers, light, stack, helmetAttachmentModel, textureHelmetAttachment); + ModArmorRenderer.renderTranslucentPiece( + matrices, vertexConsumers, light, stack, helmetAttachmentModel, + attachmentTextures.base()); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/handheld/HeaterShieldModelRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/handheld/HeaterShieldModelRenderer.java deleted file mode 100644 index e556021f69..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/handheld/HeaterShieldModelRenderer.java +++ /dev/null @@ -1,107 +0,0 @@ -package net.sevenstars.middleearth.client.renderer.handheld; - -import com.mojang.serialization.MapCodec; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.TexturedRenderLayers; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.render.item.model.special.SpecialModelRenderer; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.component.ComponentMap; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.BannerPatternsComponent; -import net.minecraft.item.ItemDisplayContext; -import net.minecraft.item.ItemStack; -import net.minecraft.util.DyeColor; -import net.sevenstars.middleearth.MiddleEarthClient; -import net.sevenstars.middleearth.client.MEModelLoader; -import net.sevenstars.middleearth.client.ModTexturedRenderLayers; -import net.sevenstars.middleearth.client.model.hand.shields.HeaterShieldEntityModel; -import org.jetbrains.annotations.Nullable; -import org.joml.Vector3f; - -import java.util.Objects; -import java.util.Set; - -public class HeaterShieldModelRenderer implements SpecialModelRenderer { - - private final HeaterShieldEntityModel model; - - public HeaterShieldModelRenderer(HeaterShieldEntityModel model) { - this.model = model; - } - - @Override - public void render(@Nullable ComponentMap data, ItemDisplayContext displayContext, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, boolean glint) { - BannerPatternsComponent bannerPatternsComponent = data != null ? data.getOrDefault(DataComponentTypes.BANNER_PATTERNS, BannerPatternsComponent.DEFAULT) : BannerPatternsComponent.DEFAULT; - DyeColor dyeColor = data != null ? data.get(DataComponentTypes.BASE_COLOR) : null; - boolean bl2 = !bannerPatternsComponent.layers().isEmpty() || dyeColor != null; - matrices.push(); - matrices.scale(1.0F, -1.0F, -1.0F); - SpriteIdentifier spriteIdentifier = bl2 ? MEModelLoader.HEATER_SHIELD_BASE : MEModelLoader.HEATER_SHIELD_BASE_NO_PATTERN; - VertexConsumer vertexConsumer = spriteIdentifier.getSprite().getTextureSpecificVertexConsumer(ItemRenderer.getItemGlintConsumer(vertexConsumers, this.model.getLayer(spriteIdentifier.getAtlasId()), displayContext == ItemDisplayContext.GUI, glint)); - this.model.getHandle().render(matrices, vertexConsumer, light, overlay); - if (bl2) { - renderCanvas(matrices, vertexConsumers, light, overlay, this.model.getPlate(), spriteIdentifier, false, (DyeColor)Objects.requireNonNullElse(dyeColor, DyeColor.WHITE), bannerPatternsComponent, glint, false); - } else { - this.model.getPlate().render(matrices, vertexConsumer, light, overlay); - } - - matrices.pop(); - } - - @Override - public void collectVertices(Set vertices) { - MatrixStack matrixStack = new MatrixStack(); - matrixStack.scale(1.0F, -1.0F, -1.0F); - this.model.getRootPart().collectVertices(matrixStack, vertices); - } - - public static void renderCanvas(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, ModelPart canvas, SpriteIdentifier baseSprite, boolean isBanner, DyeColor color, BannerPatternsComponent patterns, boolean glint, boolean solid) { - canvas.render(matrices, baseSprite.getVertexConsumer(vertexConsumers, RenderLayer::getEntitySolid, solid, glint), light, overlay); - renderLayer(matrices, vertexConsumers, light, overlay, canvas, ModTexturedRenderLayers.HEATER_SHIELD_BASE, color); - for(int i = 0; i < 16 && i < patterns.layers().size(); ++i) { - BannerPatternsComponent.Layer layer = patterns.layers().get(i); - SpriteIdentifier spriteIdentifier = ModTexturedRenderLayers.getHeaterShieldPatternTextureId(layer.pattern()); - - renderLayer(matrices, vertexConsumers, light, overlay, canvas, spriteIdentifier, layer.color()); - }} - - private static void renderLayer(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, ModelPart canvas, SpriteIdentifier textureId, DyeColor color) { - int i = color.getEntityColor(); - canvas.render(matrices, textureId.getVertexConsumer(vertexConsumers, RenderLayer::getEntityNoOutline), light, overlay, i); - } - - @Nullable - @Override - public ComponentMap getData(ItemStack stack) { - return stack.getImmutableComponents(); - } - - @Environment(EnvType.CLIENT) - public static record Unbaked() implements SpecialModelRenderer.Unbaked { - public static final HeaterShieldModelRenderer.Unbaked INSTANCE = new HeaterShieldModelRenderer.Unbaked(); - public static final MapCodec CODEC; - - public Unbaked() { - } - - public MapCodec getCodec() { - return CODEC; - } - - public SpecialModelRenderer bake(LoadedEntityModels entityModels) { - return new HeaterShieldModelRenderer(new HeaterShieldEntityModel(entityModels.getModelPart(MiddleEarthClient.HEATER_SHIELD_LAYER))); - } - - static { - CODEC = MapCodec.unit(INSTANCE); - } - } -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/handheld/HeldBannerModelRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/handheld/HeldBannerModelRenderer.java deleted file mode 100644 index cbe621a2bb..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/handheld/HeldBannerModelRenderer.java +++ /dev/null @@ -1,106 +0,0 @@ -package net.sevenstars.middleearth.client.renderer.handheld; - -import com.mojang.serialization.MapCodec; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.TexturedRenderLayers; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.render.item.model.special.SpecialModelRenderer; -import net.minecraft.client.render.model.ModelBaker; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.component.ComponentMap; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.BannerPatternsComponent; -import net.minecraft.item.ItemDisplayContext; -import net.minecraft.item.ItemStack; -import net.minecraft.util.DyeColor; -import net.sevenstars.middleearth.MiddleEarthClient; -import net.sevenstars.middleearth.client.model.hand.HeldBannerEntityModel; -import org.jetbrains.annotations.Nullable; -import org.joml.Vector3f; - -import java.util.Objects; -import java.util.Set; - -public class HeldBannerModelRenderer implements SpecialModelRenderer { - - private final HeldBannerEntityModel model; - - public HeldBannerModelRenderer(HeldBannerEntityModel model) { - this.model = model; - } - - @Override - public void render(@Nullable ComponentMap data, ItemDisplayContext displayContext, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, boolean glint) { - BannerPatternsComponent bannerPatternsComponent = data != null ? data.getOrDefault(DataComponentTypes.BANNER_PATTERNS, BannerPatternsComponent.DEFAULT) : BannerPatternsComponent.DEFAULT; - DyeColor dyeColor = data != null ? data.get(DataComponentTypes.BASE_COLOR) : null; - boolean bl2 = !bannerPatternsComponent.layers().isEmpty() || dyeColor != null; - matrices.push(); - matrices.scale(1.0F, -1.0F, -1.0F); - SpriteIdentifier spriteIdentifier = ModelBaker.BANNER_BASE; - VertexConsumer vertexConsumer = spriteIdentifier.getSprite().getTextureSpecificVertexConsumer(ItemRenderer.getItemGlintConsumer(vertexConsumers, this.model.getLayer(spriteIdentifier.getAtlasId()), displayContext == ItemDisplayContext.GUI, glint)); - this.model.getPole().render(matrices, vertexConsumer, light, overlay); - if (bl2) { - renderCanvas(matrices, vertexConsumers, light, overlay, this.model.getBanner(), spriteIdentifier, false, (DyeColor)Objects.requireNonNullElse(dyeColor, DyeColor.WHITE), bannerPatternsComponent, glint, false); - } else { - this.model.getBanner().render(matrices, vertexConsumer, light, overlay); - } - - matrices.pop(); - } - - @Override - public void collectVertices(Set vertices) { - MatrixStack matrixStack = new MatrixStack(); - matrixStack.scale(1.0F, -1.0F, -1.0F); - this.model.getRootPart().collectVertices(matrixStack, vertices); - } - - public static void renderCanvas(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, ModelPart canvas, SpriteIdentifier baseSprite, boolean isBanner, DyeColor color, BannerPatternsComponent patterns, boolean glint, boolean solid) { - canvas.render(matrices, baseSprite.getVertexConsumer(vertexConsumers, RenderLayer::getEntitySolid, solid, glint), light, overlay); - renderLayer(matrices, vertexConsumers, light, overlay, canvas, TexturedRenderLayers.BANNER_BASE, color); - for(int i = 0; i < 16 && i < patterns.layers().size(); ++i) { - BannerPatternsComponent.Layer layer = patterns.layers().get(i); - SpriteIdentifier spriteIdentifier = TexturedRenderLayers.getBannerPatternTextureId(layer.pattern()); - - renderLayer(matrices, vertexConsumers, light, overlay, canvas, spriteIdentifier, layer.color()); - }} - - private static void renderLayer(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, ModelPart canvas, SpriteIdentifier textureId, DyeColor color) { - int i = color.getEntityColor(); - canvas.render(matrices, textureId.getVertexConsumer(vertexConsumers, RenderLayer::getEntityNoOutline), light, overlay, i); - } - - @Nullable - @Override - public ComponentMap getData(ItemStack stack) { - return stack.getImmutableComponents(); - } - - @Environment(EnvType.CLIENT) - public static record Unbaked() implements SpecialModelRenderer.Unbaked { - public static final HeldBannerModelRenderer.Unbaked INSTANCE = new HeldBannerModelRenderer.Unbaked(); - public static final MapCodec CODEC; - - public Unbaked() { - } - - public MapCodec getCodec() { - return CODEC; - } - - public SpecialModelRenderer bake(LoadedEntityModels entityModels) { - return new HeldBannerModelRenderer(new HeldBannerEntityModel(entityModels.getModelPart(MiddleEarthClient.HELD_BANNER_LAYER))); - } - - static { - CODEC = MapCodec.unit(INSTANCE); - } - } -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/handheld/KiteShieldModelRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/handheld/KiteShieldModelRenderer.java deleted file mode 100644 index 38aec105e6..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/handheld/KiteShieldModelRenderer.java +++ /dev/null @@ -1,109 +0,0 @@ -package net.sevenstars.middleearth.client.renderer.handheld; - -import com.mojang.serialization.MapCodec; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.TexturedRenderLayers; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.render.item.model.special.SpecialModelRenderer; -import net.minecraft.client.render.model.ModelBaker; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.component.ComponentMap; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.BannerPatternsComponent; -import net.minecraft.item.ItemDisplayContext; -import net.minecraft.item.ItemStack; -import net.minecraft.util.DyeColor; -import net.sevenstars.middleearth.MiddleEarthClient; -import net.sevenstars.middleearth.client.MEModelLoader; -import net.sevenstars.middleearth.client.ModTexturedRenderLayers; -import net.sevenstars.middleearth.client.model.hand.HeldBannerEntityModel; -import net.sevenstars.middleearth.client.model.hand.shields.KiteShieldEntityModel; -import org.jetbrains.annotations.Nullable; -import org.joml.Vector3f; - -import java.util.Objects; -import java.util.Set; - -public class KiteShieldModelRenderer implements SpecialModelRenderer { - - private final KiteShieldEntityModel model; - - public KiteShieldModelRenderer(KiteShieldEntityModel model) { - this.model = model; - } - - @Override - public void render(@Nullable ComponentMap data, ItemDisplayContext displayContext, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, boolean glint) { - BannerPatternsComponent bannerPatternsComponent = data != null ? data.getOrDefault(DataComponentTypes.BANNER_PATTERNS, BannerPatternsComponent.DEFAULT) : BannerPatternsComponent.DEFAULT; - DyeColor dyeColor = data != null ? data.get(DataComponentTypes.BASE_COLOR) : null; - boolean bl2 = !bannerPatternsComponent.layers().isEmpty() || dyeColor != null; - matrices.push(); - matrices.scale(1.0F, -1.0F, -1.0F); - SpriteIdentifier spriteIdentifier = bl2 ? MEModelLoader.KITE_SHIELD_BASE : MEModelLoader.KITE_SHIELD_BASE_NO_PATTERN; - VertexConsumer vertexConsumer = spriteIdentifier.getSprite().getTextureSpecificVertexConsumer(ItemRenderer.getItemGlintConsumer(vertexConsumers, this.model.getLayer(spriteIdentifier.getAtlasId()), displayContext == ItemDisplayContext.GUI, glint)); - this.model.getHandle().render(matrices, vertexConsumer, light, overlay); - if (bl2) { - renderCanvas(matrices, vertexConsumers, light, overlay, this.model.getPlate(), spriteIdentifier, false, (DyeColor)Objects.requireNonNullElse(dyeColor, DyeColor.WHITE), bannerPatternsComponent, glint, false); - } else { - this.model.getPlate().render(matrices, vertexConsumer, light, overlay); - } - - matrices.pop(); - } - - @Override - public void collectVertices(Set vertices) { - MatrixStack matrixStack = new MatrixStack(); - matrixStack.scale(1.0F, -1.0F, -1.0F); - this.model.getRootPart().collectVertices(matrixStack, vertices); - } - - public static void renderCanvas(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, ModelPart canvas, SpriteIdentifier baseSprite, boolean isBanner, DyeColor color, BannerPatternsComponent patterns, boolean glint, boolean solid) { - canvas.render(matrices, baseSprite.getVertexConsumer(vertexConsumers, RenderLayer::getEntitySolid, solid, glint), light, overlay); - renderLayer(matrices, vertexConsumers, light, overlay, canvas, ModTexturedRenderLayers.KITE_SHIELD_BASE, color); - for(int i = 0; i < 16 && i < patterns.layers().size(); ++i) { - BannerPatternsComponent.Layer layer = patterns.layers().get(i); - SpriteIdentifier spriteIdentifier = ModTexturedRenderLayers.getKiteShieldPatternTextureId(layer.pattern()); - - renderLayer(matrices, vertexConsumers, light, overlay, canvas, spriteIdentifier, layer.color()); - }} - - private static void renderLayer(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, ModelPart canvas, SpriteIdentifier textureId, DyeColor color) { - int i = color.getEntityColor(); - canvas.render(matrices, textureId.getVertexConsumer(vertexConsumers, RenderLayer::getEntityNoOutline), light, overlay, i); - } - - @Nullable - @Override - public ComponentMap getData(ItemStack stack) { - return stack.getImmutableComponents(); - } - - @Environment(EnvType.CLIENT) - public static record Unbaked() implements SpecialModelRenderer.Unbaked { - public static final KiteShieldModelRenderer.Unbaked INSTANCE = new KiteShieldModelRenderer.Unbaked(); - public static final MapCodec CODEC; - - public Unbaked() { - } - - public MapCodec getCodec() { - return CODEC; - } - - public SpecialModelRenderer bake(LoadedEntityModels entityModels) { - return new KiteShieldModelRenderer(new KiteShieldEntityModel(entityModels.getModelPart(MiddleEarthClient.KITE_SHIELD_LAYER))); - } - - static { - CODEC = MapCodec.unit(INSTANCE); - } - } -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/handheld/RoundShieldModelRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/handheld/RoundShieldModelRenderer.java deleted file mode 100644 index 82857e5bb3..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/client/renderer/handheld/RoundShieldModelRenderer.java +++ /dev/null @@ -1,107 +0,0 @@ -package net.sevenstars.middleearth.client.renderer.handheld; - -import com.mojang.serialization.MapCodec; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.TexturedRenderLayers; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.render.item.model.special.SpecialModelRenderer; -import net.minecraft.client.util.SpriteIdentifier; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.component.ComponentMap; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.BannerPatternsComponent; -import net.minecraft.item.ItemDisplayContext; -import net.minecraft.item.ItemStack; -import net.minecraft.util.DyeColor; -import net.sevenstars.middleearth.MiddleEarthClient; -import net.sevenstars.middleearth.client.MEModelLoader; -import net.sevenstars.middleearth.client.ModTexturedRenderLayers; -import net.sevenstars.middleearth.client.model.hand.shields.RoundShieldEntityModel; -import org.jetbrains.annotations.Nullable; -import org.joml.Vector3f; - -import java.util.Objects; -import java.util.Set; - -public class RoundShieldModelRenderer implements SpecialModelRenderer { - - private final RoundShieldEntityModel model; - - public RoundShieldModelRenderer(RoundShieldEntityModel model) { - this.model = model; - } - - @Override - public void render(@Nullable ComponentMap data, ItemDisplayContext displayContext, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, boolean glint) { - BannerPatternsComponent bannerPatternsComponent = data != null ? data.getOrDefault(DataComponentTypes.BANNER_PATTERNS, BannerPatternsComponent.DEFAULT) : BannerPatternsComponent.DEFAULT; - DyeColor dyeColor = data != null ? data.get(DataComponentTypes.BASE_COLOR) : null; - boolean bl2 = !bannerPatternsComponent.layers().isEmpty() || dyeColor != null; - matrices.push(); - matrices.scale(1.0F, -1.0F, -1.0F); - SpriteIdentifier spriteIdentifier = bl2 ? MEModelLoader.ROUND_SHIELD_BASE : MEModelLoader.ROUND_SHIELD_BASE_NO_PATTERN; - VertexConsumer vertexConsumer = spriteIdentifier.getSprite().getTextureSpecificVertexConsumer(ItemRenderer.getItemGlintConsumer(vertexConsumers, this.model.getLayer(spriteIdentifier.getAtlasId()), displayContext == ItemDisplayContext.GUI, glint)); - this.model.getHandle().render(matrices, vertexConsumer, light, overlay); - if (bl2) { - renderCanvas(matrices, vertexConsumers, light, overlay, this.model.getPlate(), spriteIdentifier, false, (DyeColor)Objects.requireNonNullElse(dyeColor, DyeColor.WHITE), bannerPatternsComponent, glint, false); - } else { - this.model.getPlate().render(matrices, vertexConsumer, light, overlay); - } - - matrices.pop(); - } - - @Override - public void collectVertices(Set vertices) { - MatrixStack matrixStack = new MatrixStack(); - matrixStack.scale(1.0F, -1.0F, -1.0F); - this.model.getRootPart().collectVertices(matrixStack, vertices); - } - - public static void renderCanvas(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, ModelPart canvas, SpriteIdentifier baseSprite, boolean isBanner, DyeColor color, BannerPatternsComponent patterns, boolean glint, boolean solid) { - canvas.render(matrices, baseSprite.getVertexConsumer(vertexConsumers, RenderLayer::getEntitySolid, solid, glint), light, overlay); - renderLayer(matrices, vertexConsumers, light, overlay, canvas, ModTexturedRenderLayers.ROUND_SHIELD_BASE, color); - for(int i = 0; i < 16 && i < patterns.layers().size(); ++i) { - BannerPatternsComponent.Layer layer = patterns.layers().get(i); - SpriteIdentifier spriteIdentifier = ModTexturedRenderLayers.getRoundShieldPatternTextureId(layer.pattern()); - - renderLayer(matrices, vertexConsumers, light, overlay, canvas, spriteIdentifier, layer.color()); - }} - - private static void renderLayer(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, ModelPart canvas, SpriteIdentifier textureId, DyeColor color) { - int i = color.getEntityColor(); - canvas.render(matrices, textureId.getVertexConsumer(vertexConsumers, RenderLayer::getEntityNoOutline), light, overlay, i); - } - - @Nullable - @Override - public ComponentMap getData(ItemStack stack) { - return stack.getImmutableComponents(); - } - - @Environment(EnvType.CLIENT) - public static record Unbaked() implements SpecialModelRenderer.Unbaked { - public static final RoundShieldModelRenderer.Unbaked INSTANCE = new RoundShieldModelRenderer.Unbaked(); - public static final MapCodec CODEC; - - public Unbaked() { - } - - public MapCodec getCodec() { - return CODEC; - } - - public SpecialModelRenderer bake(LoadedEntityModels entityModels) { - return new RoundShieldModelRenderer(new RoundShieldEntityModel(entityModels.getModelPart(MiddleEarthClient.ROUND_SHIELD_LAYER))); - } - - static { - CODEC = MapCodec.unit(INSTANCE); - } - } -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/CommandUtils.java b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/CommandUtils.java index 73b0c2c90a..3cc352edbc 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/CommandUtils.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/CommandUtils.java @@ -2,39 +2,38 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.server.command.CommandManager; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.server.network.ServerPlayerEntity; - import java.util.List; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.Commands; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.server.level.ServerPlayer; -import static net.minecraft.server.command.CommandManager.argument; -import static net.minecraft.server.command.CommandManager.literal; +import static net.minecraft.commands.Commands.argument; +import static net.minecraft.commands.Commands.literal; public class CommandUtils { public static final String COMMAND_PLAYER_REPLACEMENT = "

"; - public static void sendAllCommands(ServerPlayerEntity player, List commands){ - CommandManager commandManager = player.getWorld().getServer().getCommandManager(); - ServerCommandSource commandSource = player.getWorld().getServer().getCommandSource(); + public static void sendAllCommands(ServerPlayer player, List commands){ + Commands commandManager = player.level().getServer().getCommands(); + CommandSourceStack commandSource = player.level().getServer().createCommandSourceStack(); for(String com : commands) { com = com.replace(COMMAND_PLAYER_REPLACEMENT, player.getName().getString()); - commandManager.executeWithPrefix(commandSource, com); + commandManager.performPrefixedCommand(commandSource, com); } } - public static void simpleCommand(CommandDispatcher dispatcher, String baseCommand, LiteralArgumentBuilder executes, String player, LiteralArgumentBuilder executes2) { + public static void simpleCommand(CommandDispatcher dispatcher, String baseCommand, LiteralArgumentBuilder executes, String player, LiteralArgumentBuilder executes2) { dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(baseCommand) .then(executes))); dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(baseCommand) - .then(argument(player, EntityArgumentType.player()) + .then(argument(player, EntityArgument.player()) .then(executes2)))); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/ModCommands.java b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/ModCommands.java index dc5b321566..a6c2d08d9a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/ModCommands.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/ModCommands.java @@ -1,22 +1,32 @@ package net.sevenstars.middleearth.commands; -import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.event.RegisterCommandsEvent; import net.sevenstars.middleearth.commands.custom.*; public class ModCommands { public static String BASE_COMMAND = "middle_earth"; + public static void register() { + NeoForge.EVENT_BUS.addListener(ModCommands::registerCommands); + } + + private static void registerCommands(RegisterCommandsEvent event) { + var dispatcher = event.getDispatcher(); + var buildContext = event.getBuildContext(); + var commandSelection = event.getCommandSelection(); + // PlayerFactionPayload Commands - CommandRegistrationCallback.EVENT.register(CommandFaction::register); - CommandRegistrationCallback.EVENT.register(CommandSpawn::register); - CommandRegistrationCallback.EVENT.register(CommandRace::register); + CommandFaction.register(dispatcher, buildContext, commandSelection); + CommandSpawn.register(dispatcher, buildContext, commandSelection); + CommandRace.register(dispatcher, buildContext, commandSelection); // Onboarding Commands - CommandRegistrationCallback.EVENT.register(CommandOnboarding::register); + CommandOnboarding.register(dispatcher, buildContext, commandSelection); //Misc commands - CommandRegistrationCallback.EVENT.register(CommandCustomEquipment::register); - CommandRegistrationCallback.EVENT.register(CommandInformation::register); - CommandRegistrationCallback.EVENT.register(CommandDimensionTeleport::register); + CommandCustomEquipment.register(dispatcher, buildContext, commandSelection); + CommandInformation.register(dispatcher, buildContext, commandSelection); + CommandDimensionTeleport.register(dispatcher, buildContext, commandSelection); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandCustomEquipment.java b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandCustomEquipment.java index e38926147e..488b93acd4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandCustomEquipment.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandCustomEquipment.java @@ -3,7 +3,13 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.context.CommandContext; -import net.minecraft.component.type.DyedColorComponent; +import net.minecraft.commands.CommandBuildContext; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.Commands; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.DyedItemColor; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.commands.ModCommands; import net.sevenstars.middleearth.commands.suggestions.AllBackAttachmentsSuggestionProvider; @@ -19,17 +25,10 @@ import net.sevenstars.middleearth.item.utils.armor.helmetAttachments.HelmetAttachmentsStatesME; import net.sevenstars.middleearth.item.utils.armor.helmetAttachments.HelmetAttachmentsME; import net.sevenstars.middleearth.utils.ModColors; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.item.ItemStack; -import net.minecraft.server.command.CommandManager; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.text.MutableText; -import net.minecraft.text.Text; - import java.util.Objects; -import static net.minecraft.server.command.CommandManager.argument; -import static net.minecraft.server.command.CommandManager.literal; +import static net.minecraft.commands.Commands.argument; +import static net.minecraft.commands.Commands.literal; public class CommandCustomEquipment { private static final String EQUIPMENT = "equipment"; @@ -38,10 +37,10 @@ public class CommandCustomEquipment { private static final String BACK_ATTACHMENT_VALUE = "back_attachment_value"; private static final String HELMENT_ATTACHMENT_VALUE = "helmet_attachment_value"; - public static void register(CommandDispatcher dispatcher, CommandRegistryAccess commandRegistryAccess, CommandManager.RegistrationEnvironment registrationEnvironment) { + public static void register(CommandDispatcher dispatcher, CommandBuildContext commandRegistryAccess, Commands.CommandSelection registrationEnvironment) { dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) + .requires(source -> source.hasPermission(2)) .then(literal(EQUIPMENT) .then(literal(BACK_ATTACHMENT) .then(argument(BACK_ATTACHMENT_VALUE, StringArgumentType.string()) @@ -49,7 +48,7 @@ public static void register(CommandDispatcher dispatcher, C .executes(CommandCustomEquipment::setBackAttachment))))); dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) + .requires(source -> source.hasPermission(2)) .then(literal(EQUIPMENT) .then(literal(HELMET_ATTACHMENT) .then(argument(HELMENT_ATTACHMENT_VALUE, StringArgumentType.string()) @@ -57,52 +56,52 @@ public static void register(CommandDispatcher dispatcher, C .executes(CommandCustomEquipment::setHelmetAttachment))))); } - private static int setBackAttachment(CommandContext context) { + private static int setBackAttachment(CommandContext context) { BackAttachmentsME backAttachment = BackAttachmentsME.valueOf(StringArgumentType.getString(context, BACK_ATTACHMENT_VALUE).toUpperCase()); - ItemStack handStack = Objects.requireNonNull(context.getSource().getPlayer()).getInventory().getSelectedStack(); + ItemStack handStack = Objects.requireNonNull(context.getSource().getPlayer()).getMainHandItem(); if (handStack.isEmpty()){ - MutableText sourceText = Text.translatable("command.%s.back_attachment.hand_empty".formatted(MiddleEarth.MOD_ID)); - context.getSource().sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.back_attachment.hand_empty".formatted(MiddleEarth.MOD_ID)); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); return 0; } if ((handStack.getItem() instanceof CustomChestplateItem || handStack.getItem() instanceof BackAttachmentItem)){ handStack.set(DataComponentTypesME.BACK_ATTACHMENT_DATA, BackAttachmentDataComponent.newBackAttachment(backAttachment)); - MutableText sourceText = Text.translatable("command.%s.back_attachment.success".formatted(MiddleEarth.MOD_ID)).append(Text.translatable("tooltip." + MiddleEarth.MOD_ID + "." + backAttachment.getName())); - context.getSource().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.back_attachment.success".formatted(MiddleEarth.MOD_ID)).append(Component.translatable("tooltip." + MiddleEarth.MOD_ID + "." + backAttachment.getName())); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); return 0; } else { - MutableText sourceText = Text.translatable("command.%s.back_attachment.wrong_item".formatted(MiddleEarth.MOD_ID)); - context.getSource().sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.back_attachment.wrong_item".formatted(MiddleEarth.MOD_ID)); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); return 0; } } - private static int setHelmetAttachment(CommandContext context) { + private static int setHelmetAttachment(CommandContext context) { HelmetAttachmentsME helmetAttachment = HelmetAttachmentsME.valueOf(StringArgumentType.getString(context, HELMENT_ATTACHMENT_VALUE).toUpperCase()); - ItemStack handStack = Objects.requireNonNull(context.getSource().getPlayer()).getInventory().getSelectedStack(); + ItemStack handStack = Objects.requireNonNull(context.getSource().getPlayer()).getMainHandItem(); if (handStack.isEmpty()){ - MutableText sourceText = Text.translatable("command.%s.helmet_attachment.hand_empty".formatted(MiddleEarth.MOD_ID)); - context.getSource().sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.helmet_attachment.hand_empty".formatted(MiddleEarth.MOD_ID)); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); return 0; } if ((handStack.getItem() instanceof CustomHelmetItem || handStack.getItem() instanceof HelmetAttachmentItem)){ if (helmetAttachment.getConstantState() == HelmetAttachmentsStatesME.DOWN){ - handStack.set(DataComponentTypesME.HELMET_ATTACHMENT_DATA, new HelmetAttachmentDataComponent(true, helmetAttachment, DyedColorComponent.DEFAULT_COLOR)); + handStack.set(DataComponentTypesME.HELMET_ATTACHMENT_DATA, new HelmetAttachmentDataComponent(true, helmetAttachment, DyedItemColor.LEATHER_COLOR)); } else if (helmetAttachment.getConstantState() == HelmetAttachmentsStatesME.UP || helmetAttachment.getConstantState() == null){ - handStack.set(DataComponentTypesME.HELMET_ATTACHMENT_DATA, new HelmetAttachmentDataComponent(false, helmetAttachment, DyedColorComponent.DEFAULT_COLOR)); + handStack.set(DataComponentTypesME.HELMET_ATTACHMENT_DATA, new HelmetAttachmentDataComponent(false, helmetAttachment, DyedItemColor.LEATHER_COLOR)); } - MutableText sourceText = Text.translatable("command.%s.helmet_attachment.success".formatted(MiddleEarth.MOD_ID)).append(Text.translatable("tooltip." + MiddleEarth.MOD_ID + "." + helmetAttachment.getName())); - context.getSource().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.helmet_attachment.success".formatted(MiddleEarth.MOD_ID)).append(Component.translatable("tooltip." + MiddleEarth.MOD_ID + "." + helmetAttachment.getName())); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); return 0; } else { - MutableText sourceText = Text.translatable("command.%s.helmet_attachment.wrong_item".formatted(MiddleEarth.MOD_ID)); - context.getSource().sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.helmet_attachment.wrong_item".formatted(MiddleEarth.MOD_ID)); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); return 0; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandDimensionTeleport.java b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandDimensionTeleport.java index 6f8645a67a..97123dbb6d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandDimensionTeleport.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandDimensionTeleport.java @@ -3,14 +3,14 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.command.argument.PosArgument; -import net.minecraft.command.argument.Vec3ArgumentType; -import net.minecraft.server.command.CommandManager; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.math.BlockPos; +import net.minecraft.commands.CommandBuildContext; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.Commands; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.commands.arguments.coordinates.Coordinates; +import net.minecraft.commands.arguments.coordinates.Vec3Argument; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerPlayer; import net.sevenstars.middleearth.commands.ModCommands; import net.sevenstars.middleearth.world.dimension.ModDimensions; @@ -18,23 +18,23 @@ public class CommandDimensionTeleport { private static final String TP = "tp"; private static final String PLAYER = "player"; private static final String LOCATION = "location"; - public static void register(CommandDispatcher dispatcher, CommandRegistryAccess commandRegistryAccess, CommandManager.RegistrationEnvironment registrationEnvironment) { - dispatcher.register((CommandManager.literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2))) - .then((CommandManager.literal(TP)) - .then(CommandManager.argument(PLAYER, EntityArgumentType.player()) - .then(CommandManager.argument(LOCATION, Vec3ArgumentType.vec3()) + public static void register(CommandDispatcher dispatcher, CommandBuildContext commandRegistryAccess, Commands.CommandSelection registrationEnvironment) { + dispatcher.register((Commands.literal(ModCommands.BASE_COMMAND) + .requires(source -> source.hasPermission(2))) + .then((Commands.literal(TP)) + .then(Commands.argument(PLAYER, EntityArgument.player()) + .then(Commands.argument(LOCATION, Vec3Argument.vec3()) .executes(CommandDimensionTeleport::run))))); } - public static int run(CommandContext context) throws CommandSyntaxException { + public static int run(CommandContext context) throws CommandSyntaxException { try{ - PosArgument posArgument = Vec3ArgumentType.getPosArgument(context, LOCATION); - BlockPos coordinates = posArgument.toAbsoluteBlockPos(context.getSource()); + Coordinates posArgument = Vec3Argument.getCoordinates(context, LOCATION); + BlockPos coordinates = posArgument.getBlockPos(context.getSource()); - ServerPlayerEntity targettedPlayer = EntityArgumentType.getPlayer(context, PLAYER); + ServerPlayer targettedPlayer = EntityArgument.getPlayer(context, PLAYER); - ModDimensions.teleportPlayerToMe(targettedPlayer, coordinates.toCenterPos(), true, true); + ModDimensions.teleportPlayerToMe(targettedPlayer, coordinates.getCenter(), true, true); return 1; } catch (Exception e){ return 0; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandFaction.java b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandFaction.java index 013f744d52..3f33ee6628 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandFaction.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandFaction.java @@ -3,15 +3,16 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.command.argument.IdentifierArgumentType; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.text.MutableText; -import net.minecraft.text.Text; -import net.minecraft.util.Formatting; -import net.minecraft.util.Identifier; +import net.minecraft.ChatFormatting; +import net.minecraft.commands.CommandBuildContext; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.Commands.CommandSelection; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.commands.arguments.ResourceLocationArgument; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.commands.CommandUtils; import net.sevenstars.middleearth.commands.ModCommands; @@ -28,7 +29,7 @@ import net.sevenstars.middleearth.utils.ModColors; import org.jetbrains.annotations.Nullable; -import static net.minecraft.server.command.CommandManager.*; +import static net.minecraft.commands.Commands.*; public class CommandFaction { public static String FACTION_BASE_COMMAND = "faction"; @@ -40,7 +41,7 @@ public class CommandFaction { private static final String PLAYER = "player"; private static final String BANNER = "banner"; - public static void register(CommandDispatcher dispatcher, CommandRegistryAccess commandRegistryAccess, RegistrationEnvironment registrationEnvironment) { + public static void register(CommandDispatcher dispatcher, CommandBuildContext commandRegistryAccess, CommandSelection registrationEnvironment) { // [GET] CommandUtils.simpleCommand(dispatcher, FACTION_BASE_COMMAND, literal(GET) // With Player Target .executes(CommandFaction::getFaction), PLAYER, literal(GET) // With Player Target @@ -48,9 +49,9 @@ public static void register(CommandDispatcher dispatcher, C // [CLEAR] dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(FACTION_BASE_COMMAND) - .then(argument(PLAYER, EntityArgumentType.player()) + .then(argument(PLAYER, EntityArgument.player()) .then(literal(CLEAR) // With Player Target .executes(CommandFaction::clearTargetFaction)))) .then(literal(FACTION_BASE_COMMAND) @@ -59,161 +60,161 @@ public static void register(CommandDispatcher dispatcher, C // [JOIN] dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(FACTION_BASE_COMMAND) - .then(argument(PLAYER, EntityArgumentType.player()) + .then(argument(PLAYER, EntityArgument.player()) .then(literal(JOIN) // With Player Target - .then(argument(FACTION_ID, IdentifierArgumentType.identifier()) + .then(argument(FACTION_ID, ResourceLocationArgument.id()) .suggests(new FactionSuggestionProvider()) .executes(CommandFaction::forceTargetToJoinFaction)))) .then(literal(JOIN) // Without Target - .then(argument(FACTION_ID, IdentifierArgumentType.identifier()) + .then(argument(FACTION_ID, ResourceLocationArgument.id()) .suggests(new FactionSuggestionProvider()) .executes(CommandFaction::joinFaction))))); // [JOIN + SET SPAWN] dispatcher.register((literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2))) // Require OP + .requires(source -> source.hasPermission(2))) // Require OP .then((literal(FACTION_BASE_COMMAND)) - .then(argument(PLAYER, EntityArgumentType.player()) + .then(argument(PLAYER, EntityArgument.player()) .then((literal(JOIN) // With Player Target - .then(argument(FACTION_ID, IdentifierArgumentType.identifier()) + .then(argument(FACTION_ID, ResourceLocationArgument.id()) .suggests(new FactionSuggestionProvider()) - .then(argument(SPAWN_ID, IdentifierArgumentType.identifier()) + .then(argument(SPAWN_ID, ResourceLocationArgument.id()) .suggests(new AllAvailableSpawnSuggestionProvider()) .executes(CommandFaction::forceTargetToJoinFaction)))))) .then((literal(JOIN)) // No Player Target - .then(argument(FACTION_ID, IdentifierArgumentType.identifier()) + .then(argument(FACTION_ID, ResourceLocationArgument.id()) .suggests(new FactionSuggestionProvider()) - .then(argument(SPAWN_ID, IdentifierArgumentType.identifier()) + .then(argument(SPAWN_ID, ResourceLocationArgument.id()) .suggests(new AllAvailableSpawnSuggestionProvider()) .executes(CommandFaction::joinFaction)))))); // [GET BANNER] dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(FACTION_BASE_COMMAND) .then(literal(BANNER) - .then(argument(FACTION_ID, IdentifierArgumentType.identifier()) + .then(argument(FACTION_ID, ResourceLocationArgument.id()) .suggests(new FactionSuggestionProvider()) .executes(CommandFaction::getBanner))))); } - private static int getBanner(CommandContext context) { - if(context.getSource().isExecutedByPlayer()) { - ServerPlayerEntity source = context.getSource().getPlayer(); - Identifier factionIdentifier = IdentifierArgumentType.getIdentifier(context, FACTION_ID);; + private static int getBanner(CommandContext context) { + if(context.getSource().isPlayer()) { + ServerPlayer source = context.getSource().getPlayer(); + ResourceLocation factionIdentifier = ResourceLocationArgument.getId(context, FACTION_ID);; try{ - Faction faction = FactionLookup.getFactionById(source.getWorld(), factionIdentifier); - source.giveItemStack(faction.getBannerItem(source.getWorld().getRegistryManager())); - MutableText sourceText = Text.translatable("command.%s.faction.banner.success".formatted(MiddleEarth.MOD_ID), faction.getFullName().formatted(Formatting.GOLD)); - source.sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + Faction faction = FactionLookup.getFactionById(source.level(), factionIdentifier); + source.addItem(faction.getBannerItem(source.level().registryAccess())); + MutableComponent sourceText = Component.translatable("command.%s.faction.banner.success".formatted(MiddleEarth.MOD_ID), faction.getFullName().withStyle(ChatFormatting.GOLD)); + source.sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); } catch (FactionIdentifierException e){ - MutableText sourceText = Text.translatable("command.%s.faction.banner.fail_id".formatted(MiddleEarth.MOD_ID), Text.of(factionIdentifier.toString())); - source.sendMessage(sourceText.withColor(ModColors.ALERT.color)); + MutableComponent sourceText = Component.translatable("command.%s.faction.banner.fail_id".formatted(MiddleEarth.MOD_ID), Component.nullToEmpty(factionIdentifier.toString())); + source.sendSystemMessage(sourceText.withColor(ModColors.ALERT.color)); return 0; } catch (Exception e){ - MutableText sourceText = Text.translatable("command.%s.faction.banner.fail_error".formatted(MiddleEarth.MOD_ID), Text.of(factionIdentifier.toString())); - source.sendMessage(sourceText.withColor(ModColors.ALERT.color)); + MutableComponent sourceText = Component.translatable("command.%s.faction.banner.fail_error".formatted(MiddleEarth.MOD_ID), Component.nullToEmpty(factionIdentifier.toString())); + source.sendSystemMessage(sourceText.withColor(ModColors.ALERT.color)); return 0; } } return 1; } - private static int getFaction(CommandContext context) { - if(context.getSource().isExecutedByPlayer()) { - ServerPlayerEntity source = context.getSource().getPlayer(); + private static int getFaction(CommandContext context) { + if(context.getSource().isPlayer()) { + ServerPlayer source = context.getSource().getPlayer(); if(source != null){ - Faction currentFaction = PlayerDataService.getPlayerFaction(source, source.getWorld()); + Faction currentFaction = PlayerDataService.getPlayerFaction(source, source.level()); if(currentFaction == null){ - MutableText sourceText = Text.translatable("command.%s.get.faction.no_faction".formatted(MiddleEarth.MOD_ID)); - source.sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.get.faction.no_faction".formatted(MiddleEarth.MOD_ID)); + source.sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); return 0; } - MutableText sourceText = Text.translatable("command.%s.get.faction.success".formatted(MiddleEarth.MOD_ID), currentFaction.getFullName()); - source.sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.get.faction.success".formatted(MiddleEarth.MOD_ID), currentFaction.getFullName()); + source.sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); } } return 0; } - private static int getTargetFaction(CommandContext context) throws CommandSyntaxException { - ServerPlayerEntity targetedPlayer = EntityArgumentType.getPlayer(context, PLAYER); - if(targetedPlayer != null && context.getSource().isExecutedByPlayer()) { - ServerPlayerEntity source = context.getSource().getPlayer(); + private static int getTargetFaction(CommandContext context) throws CommandSyntaxException { + ServerPlayer targetedPlayer = EntityArgument.getPlayer(context, PLAYER); + if(targetedPlayer != null && context.getSource().isPlayer()) { + ServerPlayer source = context.getSource().getPlayer(); if(source != null){ - Faction currentFaction = PlayerDataService.getPlayerFaction(source, source.getWorld()); + Faction currentFaction = PlayerDataService.getPlayerFaction(source, source.level()); if(currentFaction == null){ - MutableText sourceText = Text.translatable("command.%s.get.player.faction.no_faction".formatted(MiddleEarth.MOD_ID), targetedPlayer.getName()); - source.sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.get.player.faction.no_faction".formatted(MiddleEarth.MOD_ID), targetedPlayer.getName()); + source.sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); return 0; } - MutableText sourceText = Text.translatable("command.%s.get.player.faction.success".formatted(MiddleEarth.MOD_ID), targetedPlayer.getName(), currentFaction.getFullName()); - source.sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.get.player.faction.success".formatted(MiddleEarth.MOD_ID), targetedPlayer.getName(), currentFaction.getFullName()); + source.sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); } } return 0; } - private static int clearFaction(CommandContext context) { - if(context.getSource().isExecutedByPlayer()) { - ServerPlayerEntity source = context.getSource().getPlayer(); + private static int clearFaction(CommandContext context) { + if(context.getSource().isPlayer()) { + ServerPlayer source = context.getSource().getPlayer(); if(source != null) { try { if (FactionUtil.clearFaction(source)) { - MutableText sourceText = Text.translatable("command.%s.clear.faction.success".formatted(MiddleEarth.MOD_ID)); - source.sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.clear.faction.success".formatted(MiddleEarth.MOD_ID)); + source.sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); } return 1; } catch (NoFactionException e) { - MutableText sourceText = Text.translatable(NoFactionException.KEY_SOURCE); - source.sendMessage(sourceText.withColor(ModColors.ALERT.color)); + MutableComponent sourceText = Component.translatable(NoFactionException.KEY_SOURCE); + source.sendSystemMessage(sourceText.withColor(ModColors.ALERT.color)); } catch (FactionIdentifierException e) { - MutableText sourceText = Text.translatable(FactionIdentifierException.KEY); - source.sendMessage(sourceText.withColor(ModColors.ALERT.color)); + MutableComponent sourceText = Component.translatable(FactionIdentifierException.KEY); + source.sendSystemMessage(sourceText.withColor(ModColors.ALERT.color)); } } } return 0; } - private static int clearTargetFaction(CommandContext context) throws CommandSyntaxException { - ServerPlayerEntity targetedPlayer = EntityArgumentType.getPlayer(context, PLAYER); - boolean isPlayerSource = context.getSource().isExecutedByPlayer(); + private static int clearTargetFaction(CommandContext context) throws CommandSyntaxException { + ServerPlayer targetedPlayer = EntityArgument.getPlayer(context, PLAYER); + boolean isPlayerSource = context.getSource().isPlayer(); if(targetedPlayer != null){ - ServerPlayerEntity playerSource = null; + ServerPlayer playerSource = null; if(isPlayerSource) playerSource = context.getSource().getPlayer(); if(context.getSource() != null) { try { if (FactionUtil.clearFaction(playerSource)) { - MutableText sourceText = Text.translatable("command.%s.clear.player.faction.success".formatted(MiddleEarth.MOD_ID), targetedPlayer.getName()); - context.getSource().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.clear.player.faction.success".formatted(MiddleEarth.MOD_ID), targetedPlayer.getName()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); } return 1; } catch (NoFactionException e) { - MutableText sourceText = Text.translatable(NoFactionException.KEY_TARGET, targetedPlayer.getName()); - context.getSource().sendMessage(sourceText.withColor(ModColors.ALERT.color)); + MutableComponent sourceText = Component.translatable(NoFactionException.KEY_TARGET, targetedPlayer.getName()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.ALERT.color)); } catch (FactionIdentifierException e) { - MutableText sourceText = Text.translatable(FactionIdentifierException.KEY); - context.getSource().sendMessage(sourceText.withColor(ModColors.ALERT.color)); + MutableComponent sourceText = Component.translatable(FactionIdentifierException.KEY); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.ALERT.color)); } } } return 0; } - private static int joinFaction(CommandContext context) { - ServerPlayerEntity targetedPlayer = context.getSource().getPlayer(); - Identifier factionIdentifier = IdentifierArgumentType.getIdentifier(context, FACTION_ID);; + private static int joinFaction(CommandContext context) { + ServerPlayer targetedPlayer = context.getSource().getPlayer(); + ResourceLocation factionIdentifier = ResourceLocationArgument.getId(context, FACTION_ID);; if(targetedPlayer != null){ - Identifier spawnIdentifier = null; + ResourceLocation spawnIdentifier = null; try{ - spawnIdentifier = IdentifierArgumentType.getIdentifier(context, SPAWN_ID); + spawnIdentifier = ResourceLocationArgument.getId(context, SPAWN_ID); } catch (Exception ignored){ } boolean success = updateFactionFromCommand(targetedPlayer, context.getSource(), factionIdentifier, spawnIdentifier); @@ -225,23 +226,23 @@ private static int joinFaction(CommandContext context) { return 0; } - private static int forceTargetToJoinFaction(CommandContext context) throws CommandSyntaxException { - ServerPlayerEntity targetedPlayer = EntityArgumentType.getPlayer(context, PLAYER); - Identifier factionIdentifier = IdentifierArgumentType.getIdentifier(context, FACTION_ID); - Identifier spawnIdentifier = null; + private static int forceTargetToJoinFaction(CommandContext context) throws CommandSyntaxException { + ServerPlayer targetedPlayer = EntityArgument.getPlayer(context, PLAYER); + ResourceLocation factionIdentifier = ResourceLocationArgument.getId(context, FACTION_ID); + ResourceLocation spawnIdentifier = null; try{ - spawnIdentifier = IdentifierArgumentType.getIdentifier(context, SPAWN_ID); + spawnIdentifier = ResourceLocationArgument.getId(context, SPAWN_ID); } catch (Exception ignored){ } boolean success = updateFactionFromCommand(targetedPlayer, context.getSource(), factionIdentifier, spawnIdentifier); if(success){ try{ - Faction faction = FactionLookup.getFactionById(context.getSource().getWorld(), factionIdentifier); - if(context.getSource().isExecutedByPlayer()){ - ServerPlayerEntity source = context.getSource().getPlayer(); - MutableText sourceText = Text.translatable("command.%s.join.faction.join.success".formatted(MiddleEarth.MOD_ID), targetedPlayer.getName(), faction.getFullName()); - source.sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + Faction faction = FactionLookup.getFactionById(context.getSource().getLevel(), factionIdentifier); + if(context.getSource().isPlayer()){ + ServerPlayer source = context.getSource().getPlayer(); + MutableComponent sourceText = Component.translatable("command.%s.join.faction.join.success".formatted(MiddleEarth.MOD_ID), targetedPlayer.getName(), faction.getFullName()); + source.sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); } } catch (FactionIdentifierException e) { MiddleEarth.LOGGER.logDebugMsg("PlayerFactionPayload Id does not exist"); @@ -252,44 +253,44 @@ private static int forceTargetToJoinFaction(CommandContext return 0; } - public static boolean updateFactionFromCommand(ServerPlayerEntity target, ServerCommandSource source, Identifier factionIdentifier, @Nullable Identifier spawnId) { + public static boolean updateFactionFromCommand(ServerPlayer target, CommandSourceStack source, ResourceLocation factionIdentifier, @Nullable ResourceLocation spawnId) { Faction foundFaction = null; - boolean commandOnSelf = source.isExecutedByPlayer() && source.getPlayer() == target; + boolean commandOnSelf = source.isPlayer() && source.getPlayer() == target; try { - foundFaction = FactionLookup.getFactionById(source.getWorld(), factionIdentifier); + foundFaction = FactionLookup.getFactionById(source.getLevel(), factionIdentifier); FactionUtil.updateFaction(target, foundFaction, spawnId); return true; } catch (FactionIdentifierException e){ - MutableText errorMessage = Text.translatable(FactionIdentifierException.KEY, factionIdentifier.toString()); - source.sendMessage(errorMessage.withColor(ModColors.ALERT.color)); + MutableComponent errorMessage = Component.translatable(FactionIdentifierException.KEY, factionIdentifier.toString()); + source.sendSystemMessage(errorMessage.withColor(ModColors.ALERT.color)); return false; } catch (IdenticalFactionException e){ if(commandOnSelf){ // Player on himself - MutableText errorMessage = Text.translatable(IdenticalFactionException.KEY_SOURCE, (foundFaction == null) ? factionIdentifier.toString() : foundFaction.getFullName()); - source.sendMessage(errorMessage.withColor(ModColors.ALERT.color)); + MutableComponent errorMessage = Component.translatable(IdenticalFactionException.KEY_SOURCE, (foundFaction == null) ? factionIdentifier.toString() : foundFaction.getFullName()); + source.sendSystemMessage(errorMessage.withColor(ModColors.ALERT.color)); return false; } else { // Player on another target or Command block - MutableText errorMessage = Text.translatable(IdenticalFactionException.KEY_TARGET, target.getName(), (foundFaction == null) ? factionIdentifier.toString() : foundFaction.getFullName()); - source.sendMessage(errorMessage.withColor(ModColors.ALERT.color)); + MutableComponent errorMessage = Component.translatable(IdenticalFactionException.KEY_TARGET, target.getName(), (foundFaction == null) ? factionIdentifier.toString() : foundFaction.getFullName()); + source.sendSystemMessage(errorMessage.withColor(ModColors.ALERT.color)); return false; } } catch (SpawnIdentifierException e){ - MutableText errorMessage; + MutableComponent errorMessage; if(spawnId != null){ - errorMessage = Text.translatable(SpawnIdentifierException.KEY, spawnId.toString()); + errorMessage = Component.translatable(SpawnIdentifierException.KEY, spawnId.toString()); } else { - errorMessage = Text.translatable("command.%s.fail".formatted(MiddleEarth.MOD_ID)); + errorMessage = Component.translatable("command.%s.fail".formatted(MiddleEarth.MOD_ID)); } - source.sendMessage(errorMessage.withColor(ModColors.ALERT.color)); + source.sendSystemMessage(errorMessage.withColor(ModColors.ALERT.color)); return false; } catch (NoFactionException e){ if(commandOnSelf){ // Player on himself - MutableText errorMessage = Text.translatable(NoFactionException.KEY_SOURCE); - source.sendMessage(errorMessage.withColor(ModColors.ALERT.color)); + MutableComponent errorMessage = Component.translatable(NoFactionException.KEY_SOURCE); + source.sendSystemMessage(errorMessage.withColor(ModColors.ALERT.color)); return false; } else { // Player on another target or Command block - MutableText errorMessage = Text.translatable(NoFactionException.KEY_TARGET, target); - source.sendMessage(errorMessage.withColor(ModColors.ALERT.color)); + MutableComponent errorMessage = Component.translatable(NoFactionException.KEY_TARGET, target); + source.sendSystemMessage(errorMessage.withColor(ModColors.ALERT.color)); return false; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandInformation.java b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandInformation.java index c912a370ae..9967312096 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandInformation.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandInformation.java @@ -3,13 +3,12 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.server.command.CommandManager; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.text.Text; +import net.minecraft.commands.CommandBuildContext; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.Commands; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerPlayer; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.commands.ModCommands; import net.sevenstars.middleearth.resources.StateSaverAndLoader; @@ -19,73 +18,69 @@ import net.sevenstars.middleearth.resources.persistent_datas.PlayerData; import net.sevenstars.middleearth.resources.persistent_datas.PlayerDataService; -import static net.minecraft.server.command.CommandManager.argument; -import static net.minecraft.server.command.CommandManager.literal; +import static net.minecraft.commands.Commands.argument; +import static net.minecraft.commands.Commands.literal; public class CommandInformation { private static final String INFO_BASE_COMMAND = "info"; private static final String PLAYER = "player"; - public static void register(CommandDispatcher dispatcher, CommandRegistryAccess commandRegistryAccess, CommandManager.RegistrationEnvironment registrationEnvironment) { + public static void register(CommandDispatcher dispatcher, CommandBuildContext commandRegistryAccess, Commands.CommandSelection registrationEnvironment) { // [INFO] dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(INFO_BASE_COMMAND) - .then(argument(PLAYER, EntityArgumentType.player()) // With Player Target + .then(argument(PLAYER, EntityArgument.player()) // With Player Target .executes(CommandInformation::getTargetInfo)) .executes(CommandInformation::getInfo))); } - private static int getInfo(CommandContext context) { - if(!context.getSource().isExecutedByPlayer() || context.getSource().getPlayer() == null) + private static int getInfo(CommandContext context) { + if(!context.getSource().isPlayer() || context.getSource().getPlayer() == null) return 1; - ServerPlayerEntity source = context.getSource().getPlayer(); + ServerPlayer source = context.getSource().getPlayer(); - PlayerData data = StateSaverAndLoader.getPlayerState(source); - - Race race = PlayerDataService.getPlayerRace(source, source.getWorld()); + Race race = PlayerDataService.getPlayerRace(source, source.level()); if(race != null) - source.sendMessage(Text.literal("Race : ").append(Text.translatable(race.getTranslatableKey()))); + source.sendSystemMessage(Component.literal("Race : ").append(Component.translatable(race.getTranslatableKey()))); - Faction faction = PlayerDataService.getPlayerFaction(source, source.getWorld()); + Faction faction = PlayerDataService.getPlayerFaction(source, source.level()); if(faction != null) - source.sendMessage(Text.literal("Faction : ").append(faction.getFullName())); + source.sendSystemMessage(Component.literal("Faction : ").append(faction.getFullName())); - SpawnData spawnData = PlayerDataService.getPlayerSpawnData(source, source.getWorld()); + SpawnData spawnData = PlayerDataService.getPlayerSpawnData(source, source.level()); if(spawnData != null){ - source.sendMessage(Text.literal("Middle-earth Spawn : ").append(spawnData.getFullName())); + source.sendSystemMessage(Component.literal("Middle-earth Spawn : ").append(spawnData.getFullName())); } - PlayerDataService.OriginAggregate origin = PlayerDataService.getOriginAggregate(source, source.getWorld()); + PlayerDataService.OriginAggregate origin = PlayerDataService.getOriginAggregate(source, source.level()); if(origin != null){ - source.sendMessage(Text.literal("Origin : ").append(Text.translatable(origin.dimensionId().toTranslationKey())).append(" " + origin.origin().toShortString())); + source.sendSystemMessage(Component.literal("Origin : ").append(Component.translatable(origin.dimensionId().toLanguageKey())).append(" " + origin.origin().toShortString())); } return 0; } - private static int getTargetInfo(CommandContext context) throws CommandSyntaxException { - ServerPlayerEntity targettedPlayer = EntityArgumentType.getPlayer(context, PLAYER); - - PlayerData data = StateSaverAndLoader.getPlayerState(targettedPlayer); + private static int getTargetInfo(CommandContext context) throws CommandSyntaxException { + ServerPlayer targettedPlayer = EntityArgument.getPlayer(context, PLAYER); - Race race = PlayerDataService.getPlayerRace(targettedPlayer, targettedPlayer.getWorld()); + Race race = PlayerDataService.getPlayerRace(targettedPlayer, targettedPlayer.level()); if(race != null) - context.getSource().sendMessage(Text.literal("Race : ").append(Text.translatable(race.getTranslatableKey()))); + context.getSource().sendSystemMessage(Component.literal("Race : ").append(Component.translatable(race.getTranslatableKey()))); - Faction faction = PlayerDataService.getPlayerFaction(targettedPlayer, targettedPlayer.getWorld()); + Faction faction = PlayerDataService.getPlayerFaction(targettedPlayer, targettedPlayer.level()); if(faction != null) - context.getSource().sendMessage(Text.literal("Faction : ").append(Text.translatable(faction.getId().toTranslationKey()))); + context.getSource().sendSystemMessage(Component.literal("Faction : ").append(Component.translatable(faction.getId().toLanguageKey()))); return 0; } - private static int run(CommandContext context) { + private static int run(CommandContext context) { try{ - ServerPlayerEntity targettedPlayer = EntityArgumentType.getPlayer(context, PLAYER); + ServerPlayer targettedPlayer = EntityArgument.getPlayer(context, PLAYER); - PlayerData data = StateSaverAndLoader.getPlayerState(targettedPlayer); - targettedPlayer.sendMessage(Text.of(data.toString())); + PlayerData data = StateSaverAndLoader.getPlayerStateReadOnly(targettedPlayer); + targettedPlayer.sendSystemMessage(Component.nullToEmpty(data == null ? "No Data" : data.toString())); return 1; } catch (Exception e){ @@ -94,6 +89,4 @@ private static int run(CommandContext context) { } } - public static void register(CommandDispatcher fabricClientCommandSourceCommandDispatcher, CommandRegistryAccess commandRegistryAccess) { - } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandOnboarding.java b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandOnboarding.java index feb27ec126..64129f9102 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandOnboarding.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandOnboarding.java @@ -3,38 +3,39 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.server.command.CommandManager; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.text.MutableText; -import net.minecraft.text.Text; +import net.minecraft.commands.CommandBuildContext; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.Commands; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.server.level.ServerPlayer; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.commands.CommandUtils; import net.sevenstars.middleearth.commands.ModCommands; import net.sevenstars.middleearth.config.ModServerConfigs; import net.sevenstars.middleearth.network.packets.S2C.PacketForceOnboardingScreen; +import net.sevenstars.middleearth.network.connections.ConnectionToClient; +import net.sevenstars.middleearth.network.handlers.OnboardingServerHandler; import net.sevenstars.middleearth.resources.persistent_datas.PlayerDataService; import net.sevenstars.middleearth.utils.ModColors; -import static net.minecraft.server.command.CommandManager.argument; -import static net.minecraft.server.command.CommandManager.literal; +import static net.minecraft.commands.Commands.argument; +import static net.minecraft.commands.Commands.literal; public class CommandOnboarding { public static String ONBOARDING_BASE_COMMAND = "onboarding"; private static final String OPEN = "open"; private static final String TRY = "try"; private static final String PLAYER = "player"; - public static void register(CommandDispatcher dispatcher, CommandRegistryAccess commandRegistryAccess, CommandManager.RegistrationEnvironment registrationEnvironment) { + public static void register(CommandDispatcher dispatcher, CommandBuildContext commandRegistryAccess, Commands.CommandSelection registrationEnvironment) { // [TRY OPEN] dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(ONBOARDING_BASE_COMMAND) .then(literal(TRY) .then(literal(OPEN) - .then(argument(PLAYER, EntityArgumentType.player()) + .then(argument(PLAYER, EntityArgument.player()) .executes(CommandOnboarding::tryOpenForTarget))))) .then(literal(ONBOARDING_BASE_COMMAND) .then(literal(TRY) @@ -47,52 +48,56 @@ public static void register(CommandDispatcher dispatcher, C PLAYER, literal(OPEN).executes(CommandOnboarding::openForTarget)); } - private static int open(CommandContext context) { - if(context.getSource().isExecutedByPlayer()) { - ServerPlayerEntity source = context.getSource().getPlayer(); - if(source != null){ - ServerPlayNetworking.send(source, new PacketForceOnboardingScreen(ModServerConfigs.DELAY_ON_TELEPORT_CONFIRMATION, source)); + private static int open(CommandContext context) { + if(context.getSource().isPlayer()) { + ServerPlayer source = context.getSource().getPlayer(); + if(source != null && OnboardingServerHandler.beginForced(source)){ + ConnectionToClient.send(source, new PacketForceOnboardingScreen(ModServerConfigs.DELAY_ON_TELEPORT_CONFIRMATION, source)); + return 1; } } return 0; } - private static int openForTarget(CommandContext context) throws CommandSyntaxException { - ServerPlayerEntity targetPlayer = EntityArgumentType.getPlayer(context, PLAYER); - if(targetPlayer != null){ - ServerPlayNetworking.send(targetPlayer, new PacketForceOnboardingScreen(ModServerConfigs.DELAY_ON_TELEPORT_CONFIRMATION, targetPlayer)); + private static int openForTarget(CommandContext context) throws CommandSyntaxException { + ServerPlayer targetPlayer = EntityArgument.getPlayer(context, PLAYER); + if(targetPlayer != null && OnboardingServerHandler.beginForced(targetPlayer)){ + ConnectionToClient.send(targetPlayer, new PacketForceOnboardingScreen(ModServerConfigs.DELAY_ON_TELEPORT_CONFIRMATION, targetPlayer)); + return 1; } return 0; } - private static int tryOpen(CommandContext context) { - if(context.getSource().isExecutedByPlayer()) { - ServerPlayerEntity playerSource = context.getSource().getPlayer(); + private static int tryOpen(CommandContext context) { + if(context.getSource().isPlayer()) { + ServerPlayer playerSource = context.getSource().getPlayer(); if(playerSource != null){ boolean playerPassedOnboarding = PlayerDataService.playerPassedOnboarding(playerSource); - if(playerPassedOnboarding){ - ServerPlayNetworking.send(playerSource, new PacketForceOnboardingScreen(ModServerConfigs.DELAY_ON_TELEPORT_CONFIRMATION, playerSource)); + if(playerPassedOnboarding && OnboardingServerHandler.beginForced(playerSource)){ + ConnectionToClient.send(playerSource, new PacketForceOnboardingScreen(ModServerConfigs.DELAY_ON_TELEPORT_CONFIRMATION, playerSource)); + return 1; } else { - MutableText sourceText = Text.translatable("command.%s.open.onboarding.error".formatted(MiddleEarth.MOD_ID)); - playerSource.sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.open.onboarding.error".formatted(MiddleEarth.MOD_ID)); + playerSource.sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); } } } return 0; } - private static int tryOpenForTarget(CommandContext context) throws CommandSyntaxException { - ServerPlayerEntity playerTarget = EntityArgumentType.getPlayer(context, PLAYER); + private static int tryOpenForTarget(CommandContext context) throws CommandSyntaxException { + ServerPlayer playerTarget = EntityArgument.getPlayer(context, PLAYER); if(playerTarget != null){ boolean playerPassedOnboarding = PlayerDataService.playerPassedOnboarding(playerTarget); - if(playerPassedOnboarding){ - ServerPlayNetworking.send(playerTarget, new PacketForceOnboardingScreen(ModServerConfigs.DELAY_ON_TELEPORT_CONFIRMATION, playerTarget)); - MutableText sourceText = Text.translatable("command.%s.open_target.onboarding.success".formatted(MiddleEarth.MOD_ID), playerTarget.getName()); - context.getSource().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + if(playerPassedOnboarding && OnboardingServerHandler.beginForced(playerTarget)){ + ConnectionToClient.send(playerTarget, new PacketForceOnboardingScreen(ModServerConfigs.DELAY_ON_TELEPORT_CONFIRMATION, playerTarget)); + MutableComponent sourceText = Component.translatable("command.%s.open_target.onboarding.success".formatted(MiddleEarth.MOD_ID), playerTarget.getName()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); + return 1; } else { - MutableText sourceText = Text.translatable("command.%s.open_target.onboarding.error".formatted(MiddleEarth.MOD_ID), playerTarget.getName()); - context.getSource().sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.open_target.onboarding.error".formatted(MiddleEarth.MOD_ID), playerTarget.getName()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandRace.java b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandRace.java index 55b95752d9..f716c74978 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandRace.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandRace.java @@ -3,6 +3,15 @@ import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; +import net.minecraft.commands.CommandBuildContext; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.Commands; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.commands.arguments.ResourceLocationArgument; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.commands.CommandUtils; import net.sevenstars.middleearth.commands.ModCommands; @@ -14,18 +23,9 @@ import net.sevenstars.middleearth.resources.persistent_datas.PlayerData; import net.sevenstars.middleearth.resources.persistent_datas.PlayerDataService; import net.sevenstars.middleearth.utils.ModColors; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.command.argument.IdentifierArgumentType; -import net.minecraft.server.command.CommandManager; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.text.MutableText; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; - -import static net.minecraft.server.command.CommandManager.argument; -import static net.minecraft.server.command.CommandManager.literal; + +import static net.minecraft.commands.Commands.argument; +import static net.minecraft.commands.Commands.literal; public class CommandRace { public static String RACE_BASE_COMMAND = "race"; @@ -35,7 +35,7 @@ public class CommandRace { private static final String PLAYER = "player"; private static final String RACE_ID = "race_id"; private static final int RACE_COLOR = ModColors.WARNING.color; - public static void register(CommandDispatcher dispatcher, CommandRegistryAccess commandRegistryAccess, CommandManager.RegistrationEnvironment registrationEnvironment) { + public static void register(CommandDispatcher dispatcher, CommandBuildContext commandRegistryAccess, Commands.CommandSelection registrationEnvironment) { // [GET] CommandUtils.simpleCommand(dispatcher, RACE_BASE_COMMAND, literal(GET) .executes(CommandRace::getRace), PLAYER, literal(GET) @@ -43,150 +43,150 @@ public static void register(CommandDispatcher dispatcher, C // [SET] dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(RACE_BASE_COMMAND) - .then(argument(PLAYER, EntityArgumentType.player()) + .then(argument(PLAYER, EntityArgument.player()) .then(literal(SET) // With Player Target - .then(argument(RACE_ID, IdentifierArgumentType.identifier()) + .then(argument(RACE_ID, ResourceLocationArgument.id()) .suggests(new AllRaceSuggestionProvider()) .executes(CommandRace::setTargetRace)))) .then(literal(SET) // Without Target - .then(argument(RACE_ID, IdentifierArgumentType.identifier()) + .then(argument(RACE_ID, ResourceLocationArgument.id()) .suggests(new AllRaceSuggestionProvider()) .executes(CommandRace::setRace))))); // [RESET] dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(RACE_BASE_COMMAND) - .then(argument(PLAYER, EntityArgumentType.player()) + .then(argument(PLAYER, EntityArgument.player()) .then(literal(RESET) // With Player Target .executes(CommandRace::resetTargetRace))) .then(literal(RESET) // Without Target .executes(CommandRace::resetRace)))); } - private static int getRace(CommandContext context) { - if(context.getSource().isExecutedByPlayer()) { - ServerPlayerEntity playerSource = context.getSource().getPlayer(); + private static int getRace(CommandContext context) { + if(context.getSource().isPlayer()) { + ServerPlayer playerSource = context.getSource().getPlayer(); if(playerSource != null){ - Race playerRace = PlayerDataService.getPlayerRace(playerSource, playerSource.getWorld()); + Race playerRace = PlayerDataService.getPlayerRace(playerSource, playerSource.level()); if(playerRace != null){ - MutableText sourceText = Text.translatable("command.%s.race.get.success".formatted(MiddleEarth.MOD_ID), - playerRace.getFullName().copyContentOnly().withColor(RACE_COLOR)); - playerSource.sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.race.get.success".formatted(MiddleEarth.MOD_ID), + playerRace.getFullName().plainCopy().withColor(RACE_COLOR)); + playerSource.sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); return 0; } - MutableText sourceText = Text.translatable("command.%s.race.get.fail".formatted(MiddleEarth.MOD_ID)); - playerSource.sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.race.get.fail".formatted(MiddleEarth.MOD_ID)); + playerSource.sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); } } return 0; } - private static int getTargetRace(CommandContext context) throws CommandSyntaxException { - if(context.getSource().isExecutedByPlayer()) { - ServerPlayerEntity targetPlayer = EntityArgumentType.getPlayer(context, PLAYER); - ServerPlayerEntity source = context.getSource().getPlayer(); + private static int getTargetRace(CommandContext context) throws CommandSyntaxException { + if(context.getSource().isPlayer()) { + ServerPlayer targetPlayer = EntityArgument.getPlayer(context, PLAYER); + ServerPlayer source = context.getSource().getPlayer(); if(source != null){ - PlayerData playerData = StateSaverAndLoader.getPlayerState(targetPlayer); + PlayerData playerData = StateSaverAndLoader.getPlayerStateReadOnly(targetPlayer); if(playerData != null){ - Identifier id = playerData.getRace(); + ResourceLocation id = playerData.getRace(); if(id != null){ - Race race = RaceLookup.getRace(context.getSource().getWorld(), id); + Race race = RaceLookup.getRace(context.getSource().getLevel(), id); if(race != null){ - MutableText sourceText = Text.translatable("command.%s.race.get.target.success".formatted(MiddleEarth.MOD_ID), targetPlayer.getName(), - race.getFullName().copyContentOnly().withColor(RACE_COLOR)); - source.sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.race.get.target.success".formatted(MiddleEarth.MOD_ID), targetPlayer.getName(), + race.getFullName().plainCopy().withColor(RACE_COLOR)); + source.sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); return 0; } } } - MutableText sourceText = Text.translatable("command.%s.race.get.target.fail".formatted(MiddleEarth.MOD_ID), targetPlayer.getName()); - source.sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.race.get.target.fail".formatted(MiddleEarth.MOD_ID), targetPlayer.getName()); + source.sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); } } return 0; } - private static int setRace(CommandContext context) { - if(context.getSource().isExecutedByPlayer()) { - Identifier raceId = IdentifierArgumentType.getIdentifier(context, RACE_ID); - ServerPlayerEntity source = context.getSource().getPlayer(); + private static int setRace(CommandContext context) { + if(context.getSource().isPlayer()) { + ResourceLocation raceId = ResourceLocationArgument.getId(context, RACE_ID); + ServerPlayer source = context.getSource().getPlayer(); if(raceId != null && source != null) { PlayerData playerData = StateSaverAndLoader.getPlayerState(source); if(playerData != null){ - Race race = RaceLookup.getRace(source.getWorld(), raceId); + Race race = RaceLookup.getRace(source.level(), raceId); if(race != null){ RaceUtil.updateRace(source, race, true); - MutableText sourceText = Text.translatable("command.%s.race.set.success".formatted(MiddleEarth.MOD_ID), - race.getFullName().copyContentOnly().withColor(RACE_COLOR)); - source.sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.race.set.success".formatted(MiddleEarth.MOD_ID), + race.getFullName().plainCopy().withColor(RACE_COLOR)); + source.sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); return 0; } } - MutableText sourceText = Text.translatable("command.%s.race.set.fail".formatted(MiddleEarth.MOD_ID), raceId.toString()); - source.sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.race.set.fail".formatted(MiddleEarth.MOD_ID), raceId.toString()); + source.sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); } } return 0; } - private static int setTargetRace(CommandContext context) throws CommandSyntaxException { - Identifier raceId = IdentifierArgumentType.getIdentifier(context, RACE_ID); - ServerPlayerEntity targetPlayer = EntityArgumentType.getPlayer(context, PLAYER); - ServerPlayerEntity source = context.getSource().getPlayer(); + private static int setTargetRace(CommandContext context) throws CommandSyntaxException { + ResourceLocation raceId = ResourceLocationArgument.getId(context, RACE_ID); + ServerPlayer targetPlayer = EntityArgument.getPlayer(context, PLAYER); + ServerPlayer source = context.getSource().getPlayer(); if(raceId != null && targetPlayer != null) { PlayerData playerData = StateSaverAndLoader.getPlayerState(targetPlayer); if(playerData != null){ - Race race = RaceLookup.getRace(targetPlayer.getWorld(), raceId); + Race race = RaceLookup.getRace(targetPlayer.level(), raceId); if(race != null){ RaceUtil.updateRace(targetPlayer, race, true); - MutableText targetText = Text.translatable("command.%s.race.set.success".formatted(MiddleEarth.MOD_ID), - race.getFullName().copyContentOnly().withColor(RACE_COLOR)); - targetPlayer.sendMessage(targetText.withColor(ModColors.SUCCESS.color)); + MutableComponent targetText = Component.translatable("command.%s.race.set.success".formatted(MiddleEarth.MOD_ID), + race.getFullName().plainCopy().withColor(RACE_COLOR)); + targetPlayer.sendSystemMessage(targetText.withColor(ModColors.SUCCESS.color)); if(source != null){ - MutableText sourceText = Text.translatable("command.%s.race.set.target.success".formatted(MiddleEarth.MOD_ID), targetPlayer.getName(), - race.getFullName().copyContentOnly().withColor(RACE_COLOR)); - source.sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.race.set.target.success".formatted(MiddleEarth.MOD_ID), targetPlayer.getName(), + race.getFullName().plainCopy().withColor(RACE_COLOR)); + source.sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); } return 0; } } - MutableText sourceText = Text.translatable("command.%s.race.set.target.fail".formatted(MiddleEarth.MOD_ID), raceId.toString()); - source.sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.race.set.target.fail".formatted(MiddleEarth.MOD_ID), raceId.toString()); + source.sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); } return 0; } - private static int resetRace(CommandContext context) { - if(context.getSource().isExecutedByPlayer()) { - ServerPlayerEntity source = context.getSource().getPlayer(); + private static int resetRace(CommandContext context) { + if(context.getSource().isPlayer()) { + ServerPlayer source = context.getSource().getPlayer(); if(source != null) { PlayerData playerData = StateSaverAndLoader.getPlayerState(source); if(playerData != null){ RaceUtil.updateRace(source, null, true); RaceUtil.reset(source); - MutableText sourceText = Text.translatable("command.%s.race.reset.success".formatted(MiddleEarth.MOD_ID)); - source.sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.race.reset.success".formatted(MiddleEarth.MOD_ID)); + source.sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); return 0; } - MutableText sourceText = Text.translatable("command.%s.race.reset.fail".formatted(MiddleEarth.MOD_ID)); - source.sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.race.reset.fail".formatted(MiddleEarth.MOD_ID)); + source.sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); } } return 0; } - private static int resetTargetRace(CommandContext context) throws CommandSyntaxException { - ServerPlayerEntity targetPlayer = EntityArgumentType.getPlayer(context, PLAYER); - ServerPlayerEntity source = context.getSource().getPlayer(); + private static int resetTargetRace(CommandContext context) throws CommandSyntaxException { + ServerPlayer targetPlayer = EntityArgument.getPlayer(context, PLAYER); + ServerPlayer source = context.getSource().getPlayer(); PlayerData playerData = StateSaverAndLoader.getPlayerState(targetPlayer); if(targetPlayer != null){ @@ -194,15 +194,15 @@ private static int resetTargetRace(CommandContext context) RaceUtil.reset(targetPlayer); if(source != null && targetPlayer != null) { - MutableText sourceText = Text.translatable("command.%s.race.reset.target.success".formatted(MiddleEarth.MOD_ID), targetPlayer.getName()); - targetPlayer.sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.race.reset.target.success".formatted(MiddleEarth.MOD_ID), targetPlayer.getName()); + targetPlayer.sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); } - MutableText targetText = Text.translatable("command.%s.race.reset.success".formatted(MiddleEarth.MOD_ID)); - targetPlayer.sendMessage(targetText.withColor(ModColors.SUCCESS.color)); + MutableComponent targetText = Component.translatable("command.%s.race.reset.success".formatted(MiddleEarth.MOD_ID)); + targetPlayer.sendSystemMessage(targetText.withColor(ModColors.SUCCESS.color)); return 0; } - MutableText sourceText = Text.translatable("command.%s.race.reset.target.fail".formatted(MiddleEarth.MOD_ID), targetPlayer.getName()); - source.sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.race.reset.target.fail".formatted(MiddleEarth.MOD_ID), targetPlayer.getName()); + source.sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); return 0; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandSpawn.java b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandSpawn.java index c57b27d35b..0ca4795ef3 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandSpawn.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/custom/CommandSpawn.java @@ -4,21 +4,21 @@ import com.mojang.brigadier.arguments.BoolArgumentType; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.command.argument.BlockPosArgumentType; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.command.argument.IdentifierArgumentType; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.server.command.CommandManager; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.text.MutableText; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; -import net.minecraft.world.dimension.DimensionTypes; +import net.minecraft.commands.CommandBuildContext; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.Commands; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.commands.arguments.ResourceLocationArgument; +import net.minecraft.commands.arguments.coordinates.BlockPosArgument; +import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.dimension.BuiltinDimensionTypes; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.commands.ModCommands; import net.sevenstars.middleearth.commands.suggestions.AllAvailableSpawnSuggestionProvider; @@ -32,8 +32,8 @@ import net.sevenstars.middleearth.world.dimension.ModDimensions; import org.joml.Vector3i; -import static net.minecraft.server.command.CommandManager.argument; -import static net.minecraft.server.command.CommandManager.literal; +import static net.minecraft.commands.Commands.argument; +import static net.minecraft.commands.Commands.literal; public class CommandSpawn { private static final String SPAWN_BASE_COMMAND = "spawn"; @@ -49,12 +49,12 @@ public class CommandSpawn { private static final String SPAWN_ID = "spawn_id"; private static final String PLAYER = "player"; - public static void register(CommandDispatcher dispatcher, CommandRegistryAccess commandRegistryAccess, CommandManager.RegistrationEnvironment registrationEnvironment) { + public static void register(CommandDispatcher dispatcher, CommandBuildContext commandRegistryAccess, Commands.CommandSelection registrationEnvironment) { // [GET OVERWORLD SPAWN] dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(SPAWN_BASE_COMMAND) - .then(argument(PLAYER, EntityArgumentType.player()) // With Player Target + .then(argument(PLAYER, EntityArgument.player()) // With Player Target .then(literal(GET) .then(literal(OVERWORLD) .executes(CommandSpawn::getPlayerSpawnOverworld)))) @@ -64,9 +64,9 @@ public static void register(CommandDispatcher dispatcher, C // [GET SPAWN ID] dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(SPAWN_BASE_COMMAND) - .then(argument(PLAYER, EntityArgumentType.player()) // With Player Target + .then(argument(PLAYER, EntityArgument.player()) // With Player Target .then(literal(GET) .then(literal(MIDDLE_EARTH) .executes(CommandSpawn::getPlayerSpawnMiddleEarth)))) @@ -76,9 +76,9 @@ public static void register(CommandDispatcher dispatcher, C // [TP - MIDDLE_EARTH] dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(SPAWN_BASE_COMMAND) - .then(argument(PLAYER, EntityArgumentType.player()) + .then(argument(PLAYER, EntityArgument.player()) .then(literal(TP) // With Player Target .then(literal(MIDDLE_EARTH) .then(argument(WELCOME, BoolArgumentType.bool()) @@ -90,9 +90,9 @@ public static void register(CommandDispatcher dispatcher, C // [TP - OVERWORLD] dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(SPAWN_BASE_COMMAND) - .then(argument(PLAYER, EntityArgumentType.player()) + .then(argument(PLAYER, EntityArgument.player()) .then(literal(TP) // With Player Target .then(literal(OVERWORLD) .executes(CommandSpawn::teleportPlayerToSpawnOverworld)))) @@ -102,39 +102,39 @@ public static void register(CommandDispatcher dispatcher, C // [SET - OVERWORLD] dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(SPAWN_BASE_COMMAND) - .then(argument(PLAYER, EntityArgumentType.player()) + .then(argument(PLAYER, EntityArgument.player()) .then(literal(SET) .then(literal(OVERWORLD) // With Player Target - .then(argument(OVERWORLD_COORD, BlockPosArgumentType.blockPos()) + .then(argument(OVERWORLD_COORD, BlockPosArgument.blockPos()) .executes(CommandSpawn::setPlayerSpawnOverworld))))) .then(literal(SET) // Without Target .then(literal(OVERWORLD) - .then(argument(OVERWORLD_COORD, BlockPosArgumentType.blockPos()) + .then(argument(OVERWORLD_COORD, BlockPosArgument.blockPos()) .executes(CommandSpawn::setSpawnOverworld)))))); // [SET - MIDDLE_EARTH] dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(SPAWN_BASE_COMMAND) - .then(argument(PLAYER, EntityArgumentType.player()) + .then(argument(PLAYER, EntityArgument.player()) .then(literal(SET) .then(literal(MIDDLE_EARTH) // With Player Target - .then(argument(SPAWN_ID, IdentifierArgumentType.identifier()) + .then(argument(SPAWN_ID, ResourceLocationArgument.id()) .suggests(new AllAvailableSpawnSuggestionProvider()) .executes(CommandSpawn::setPlayerSpawnMiddleEarth))))) .then(literal(SET) // Without Target .then(literal(MIDDLE_EARTH) - .then(argument(SPAWN_ID, IdentifierArgumentType.identifier()) + .then(argument(SPAWN_ID, ResourceLocationArgument.id()) .suggests(new AllAvailableSpawnSuggestionProvider()) .executes(CommandSpawn::setSpawnMiddleEarth)))))); // [RESET - OVERWORLD] dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(SPAWN_BASE_COMMAND) - .then(argument(PLAYER, EntityArgumentType.player()) + .then(argument(PLAYER, EntityArgument.player()) .then(literal(RESET) // With Player Target .then(literal(OVERWORLD) .executes(CommandSpawn::resetPlayerSpawnOverworld)))) @@ -144,9 +144,9 @@ public static void register(CommandDispatcher dispatcher, C // [RESET - MIDDLE_EARTH] dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(SPAWN_BASE_COMMAND) - .then(argument(PLAYER, EntityArgumentType.player()) + .then(argument(PLAYER, EntityArgument.player()) .then(literal(RESET) // With Player Target .then(literal(MIDDLE_EARTH) .executes(CommandSpawn::resetPlayerSpawnMiddleEarth)))) @@ -156,244 +156,258 @@ public static void register(CommandDispatcher dispatcher, C // [TP TO - SPAWN ID] dispatcher.register(literal(ModCommands.BASE_COMMAND) - .requires(source -> source.hasPermissionLevel(2)) // Require OP + .requires(source -> source.hasPermission(2)) // Require OP .then(literal(TP) - .then(argument(PLAYER, EntityArgumentType.player()) + .then(argument(PLAYER, EntityArgument.player()) .then(literal(TO) - .then(argument(SPAWN_ID, IdentifierArgumentType.identifier()) + .then(argument(SPAWN_ID, ResourceLocationArgument.id()) .suggests(new AllSpawnSuggestionProvider()) .executes(CommandSpawn::forceTeleportPlayerToSpawnMiddleEarth)))) .then(literal(TO) // Without Target - .then(argument(SPAWN_ID, IdentifierArgumentType.identifier()) + .then(argument(SPAWN_ID, ResourceLocationArgument.id()) .suggests(new AllSpawnSuggestionProvider()) .executes(CommandSpawn::forceTeleportToSpawnMiddleEarth))))); } // region Getters - private static int getSpawnOverworld(CommandContext context) { - if(!context.getSource().isExecutedByPlayer() || context.getSource().getPlayer() == null) + private static int getSpawnOverworld(CommandContext context) { + if(!context.getSource().isPlayer() || context.getSource().getPlayer() == null) return 0; - ServerPlayerEntity playerSource = context.getSource().getPlayer(); - PlayerDataService.OriginAggregate originAggregate = PlayerDataService.getOriginAggregateOrDefault(playerSource, playerSource.getWorld()); + ServerPlayer playerSource = context.getSource().getPlayer(); + PlayerDataService.OriginAggregate originAggregate = PlayerDataService.getOriginAggregateOrDefault(playerSource, playerSource.level()); BlockPos pos = originAggregate.origin(); - MutableText sourceText = Text.translatable("command.%s.get.spawn.overworld.success".formatted(MiddleEarth.MOD_ID), pos.getX(), pos.getY(), pos.getZ()); - context.getSource().getPlayer().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.get.spawn.overworld.success".formatted(MiddleEarth.MOD_ID), pos.getX(), pos.getY(), pos.getZ()); + context.getSource().getPlayer().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); - return 0; + return 1; } - private static int getPlayerSpawnOverworld(CommandContext context) throws CommandSyntaxException { - ServerPlayerEntity playerTarget = EntityArgumentType.getPlayer(context, PLAYER); - PlayerData data = StateSaverAndLoader.getPlayerState(playerTarget); - PlayerDataService.OriginAggregate originAggregate = PlayerDataService.getOriginAggregateOrDefault(playerTarget, playerTarget.getWorld()); + private static int getPlayerSpawnOverworld(CommandContext context) throws CommandSyntaxException { + ServerPlayer playerTarget = EntityArgument.getPlayer(context, PLAYER); + PlayerDataService.OriginAggregate originAggregate = PlayerDataService.getOriginAggregateOrDefault(playerTarget, playerTarget.level()); BlockPos pos = originAggregate.origin(); - MutableText sourceText = Text.translatable("command.%s.get.player.spawn.overworld.success".formatted(MiddleEarth.MOD_ID), playerTarget.getName(), pos.getX(), pos.getY(), pos.getZ()); - context.getSource().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.get.player.spawn.overworld.success".formatted(MiddleEarth.MOD_ID), playerTarget.getName(), pos.getX(), pos.getY(), pos.getZ()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); - return 0; + return 1; } - private static int getSpawnMiddleEarth(CommandContext context) { - if(!context.getSource().isExecutedByPlayer() || context.getSource().getPlayer() == null) + private static int getSpawnMiddleEarth(CommandContext context) { + if(!context.getSource().isPlayer() || context.getSource().getPlayer() == null) return 0; - PlayerEntity playerSource = context.getSource().getPlayer(); - SpawnData spawnData = PlayerDataService.getPlayerSpawnData(playerSource, playerSource.getWorld()); + Player playerSource = context.getSource().getPlayer(); + SpawnData spawnData = PlayerDataService.getPlayerSpawnData(playerSource, playerSource.level()); if(spawnData != null){ BlockPos pos = spawnData.getBlockPos(); - MutableText sourceText = Text.translatable("command.%s.get.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), Text.translatable("spawn."+ spawnData.getIdentifier().toTranslationKey()), pos.getX(), pos.getY(), pos.getZ()); - context.getSource().getPlayer().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.get.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), Component.translatable("spawn."+ spawnData.getIdentifier().toLanguageKey()), pos.getX(), pos.getY(), pos.getZ()); + context.getSource().getPlayer().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); + return 1; } else { - MutableText sourceText = Text.translatable("command.%s.get.spawn.middle_earth.no_spawn".formatted(MiddleEarth.MOD_ID)); - context.getSource().sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.get.spawn.middle_earth.no_spawn".formatted(MiddleEarth.MOD_ID)); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); } return 0; } - private static int getPlayerSpawnMiddleEarth(CommandContext context) throws CommandSyntaxException { - if(!context.getSource().isExecutedByPlayer()) return 0; + private static int getPlayerSpawnMiddleEarth(CommandContext context) throws CommandSyntaxException { + if(!context.getSource().isPlayer()) return 0; - ServerPlayerEntity playerTarget = EntityArgumentType.getPlayer(context, PLAYER); - SpawnData spawnData = PlayerDataService.getPlayerSpawnData(playerTarget, playerTarget.getWorld()); + ServerPlayer playerTarget = EntityArgument.getPlayer(context, PLAYER); + SpawnData spawnData = PlayerDataService.getPlayerSpawnData(playerTarget, playerTarget.level()); if(spawnData != null){ BlockPos pos = spawnData.getBlockPos(); - MutableText sourceText = Text.translatable("command.%s.get.player.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), playerTarget.getName(), Text.translatable("spawn."+spawnData.getIdentifier().toTranslationKey()), pos.getX(), pos.getY(), pos.getZ()); - context.getSource().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.get.player.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), playerTarget.getName(), Component.translatable("spawn."+spawnData.getIdentifier().toLanguageKey()), pos.getX(), pos.getY(), pos.getZ()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); + return 1; } else { - MutableText sourceText = Text.translatable("command.%s.get.player.spawn.middle_earth.no_spawn".formatted(MiddleEarth.MOD_ID), playerTarget.getName()); - context.getSource().sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.get.player.spawn.middle_earth.no_spawn".formatted(MiddleEarth.MOD_ID), playerTarget.getName()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); } return 0; } // endregion // region Setters - private static int setSpawnMiddleEarth(CommandContext context) { - if(!context.getSource().isExecutedByPlayer() || context.getSource().getPlayer() == null) + private static int setSpawnMiddleEarth(CommandContext context) { + if(!context.getSource().isPlayer() || context.getSource().getPlayer() == null) return 0; - ServerPlayerEntity playerSource = context.getSource().getPlayer(); + ServerPlayer playerSource = context.getSource().getPlayer(); - Identifier spawnIdInput = IdentifierArgumentType.getIdentifier(context, SPAWN_ID); + ResourceLocation spawnIdInput = ResourceLocationArgument.getId(context, SPAWN_ID); if(!PlayerDataService.playerPassedOnboarding(playerSource)){ - MutableText sourceText = Text.translatable("command.%s.set.spawn.middle_earth.no_faction".formatted(MiddleEarth.MOD_ID)); - context.getSource().sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.set.spawn.middle_earth.no_faction".formatted(MiddleEarth.MOD_ID)); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); return 0; } - if(PlayerDataService.setSpawn(playerSource, playerSource.getWorld(), spawnIdInput)){ - SpawnData spawnData = PlayerDataService.getPlayerSpawnData(playerSource, playerSource.getWorld()); + if(PlayerDataService.setSpawn(playerSource, playerSource.level(), spawnIdInput)){ + SpawnData spawnData = PlayerDataService.getPlayerSpawnData(playerSource, playerSource.level()); BlockPos pos = spawnData.getBlockPos(); if(pos != null) { - if(ModDimensions.isInMiddleEarth(playerSource.getWorld())){ - ServerPlayerEntity.Respawn respawn = new ServerPlayerEntity.Respawn(ModDimensions.ME_WORLD_KEY, pos, 0, true); - playerSource.setSpawnPoint(respawn, true); + if(ModDimensions.isInMiddleEarth(playerSource.level())){ + playerSource.setRespawnPosition(ModDimensions.ME_WORLD_KEY, pos, 0.0F, true, true); } - MutableText sourceText = Text.translatable("command.%s.set.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), Text.translatable("spawn."+spawnIdInput.toTranslationKey()), pos.getX(), pos.getY(), pos.getZ()); - playerSource.sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); - return 0; + MutableComponent sourceText = Component.translatable("command.%s.set.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), Component.translatable("spawn."+spawnIdInput.toLanguageKey()), pos.getX(), pos.getY(), pos.getZ()); + playerSource.sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); + return 1; } } - MutableText sourceText = Text.translatable("command.%s.set.spawn.middle_earth.no_spawn_found".formatted(MiddleEarth.MOD_ID), spawnIdInput.toString()); - playerSource.sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.set.spawn.middle_earth.no_spawn_found".formatted(MiddleEarth.MOD_ID), spawnIdInput.toString()); + playerSource.sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); return 0; } - private static int setPlayerSpawnMiddleEarth(CommandContext context) throws CommandSyntaxException { - ServerPlayerEntity playerTarget = EntityArgumentType.getPlayer(context, PLAYER); + private static int setPlayerSpawnMiddleEarth(CommandContext context) throws CommandSyntaxException { + ServerPlayer playerTarget = EntityArgument.getPlayer(context, PLAYER); - Identifier spawnIdInput = IdentifierArgumentType.getIdentifier(context, SPAWN_ID); + ResourceLocation spawnIdInput = ResourceLocationArgument.getId(context, SPAWN_ID); if(!PlayerDataService.playerPassedOnboarding(playerTarget)){ - MutableText sourceText = Text.translatable("command.%s.set.player.spawn.middle_earth.no_faction".formatted(MiddleEarth.MOD_ID), playerTarget.getName()); - context.getSource().sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.set.player.spawn.middle_earth.no_faction".formatted(MiddleEarth.MOD_ID), playerTarget.getName()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); return 0; } - if(PlayerDataService.setSpawn(playerTarget, playerTarget.getWorld(), spawnIdInput)){ - SpawnData spawnData = PlayerDataService.getPlayerSpawnData(playerTarget, playerTarget.getWorld()); + if(PlayerDataService.setSpawn(playerTarget, playerTarget.level(), spawnIdInput)){ + SpawnData spawnData = PlayerDataService.getPlayerSpawnData(playerTarget, playerTarget.level()); BlockPos pos = spawnData.getBlockPos(); if(pos != null) { - if(ModDimensions.isInMiddleEarth(playerTarget.getWorld())){ - ServerPlayerEntity.Respawn respawn = new ServerPlayerEntity.Respawn(ModDimensions.ME_WORLD_KEY, pos, 0, true); - playerTarget.setSpawnPoint(respawn, true); + if(ModDimensions.isInMiddleEarth(playerTarget.level())){ + playerTarget.setRespawnPosition(ModDimensions.ME_WORLD_KEY, pos, 0.0F, true, true); } - MutableText targetText = Text.translatable("command.%s.set.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), Text.translatable("spawn."+spawnIdInput.toTranslationKey()), pos.getX(), pos.getY(), pos.getZ()); - playerTarget.sendMessage(targetText.withColor(ModColors.SUCCESS.color)); - MutableText sourceText = Text.translatable("command.%s.set.player.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), playerTarget.getName(),Text.translatable("spawn."+spawnIdInput.toTranslationKey()), pos.getX(), pos.getY(), pos.getZ()); - context.getSource().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); - return 0; + MutableComponent targetText = Component.translatable("command.%s.set.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), Component.translatable("spawn."+spawnIdInput.toLanguageKey()), pos.getX(), pos.getY(), pos.getZ()); + playerTarget.sendSystemMessage(targetText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.set.player.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), playerTarget.getName(),Component.translatable("spawn."+spawnIdInput.toLanguageKey()), pos.getX(), pos.getY(), pos.getZ()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); + return 1; } } - MutableText sourceText = Text.translatable("command.%s.set.spawn.middle_earth.no_spawn_found".formatted(MiddleEarth.MOD_ID), spawnIdInput.toString()); - context.getSource().sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.set.spawn.middle_earth.no_spawn_found".formatted(MiddleEarth.MOD_ID), spawnIdInput.toString()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); return 0; } - private static int setSpawnOverworld(CommandContext context) { - if(!context.getSource().isExecutedByPlayer() || context.getSource().getPlayer() == null) + private static int setSpawnOverworld(CommandContext context) { + if(!context.getSource().isPlayer() || context.getSource().getPlayer() == null) return 0; - BlockPos posInput = BlockPosArgumentType.getBlockPos(context, OVERWORLD_COORD); + BlockPos posInput = BlockPosArgument.getBlockPos(context, OVERWORLD_COORD); - ServerPlayerEntity playerSource = context.getSource().getPlayer(); + ServerPlayer playerSource = context.getSource().getPlayer(); - if(PlayerDataService.setOrigin(playerSource, playerSource.getWorld(), DimensionTypes.OVERWORLD.getRegistry(), posInput)) { - if(ModDimensions.isInOverworld(playerSource.getWorld())){ - ServerPlayerEntity.Respawn respawn = new ServerPlayerEntity.Respawn(World.OVERWORLD, posInput, 0, true); - playerSource.setSpawnPoint(respawn, true); - return 0; - } + if(!PlayerDataService.setOrigin(playerSource, playerSource.level(), BuiltinDimensionTypes.OVERWORLD.location(), posInput)) { + return 0; } - MutableText sourceText = Text.translatable("command.%s.set.spawn.overworld.success".formatted(MiddleEarth.MOD_ID), posInput.getX(), posInput.getY(), posInput.getZ()); - context.getSource().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); - return 0; + if(ModDimensions.isInOverworld(playerSource.level())){ + playerSource.setRespawnPosition(Level.OVERWORLD, posInput, 0.0F, true, true); + } + MutableComponent sourceText = Component.translatable("command.%s.set.spawn.overworld.success".formatted(MiddleEarth.MOD_ID), posInput.getX(), posInput.getY(), posInput.getZ()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); + return 1; } - private static int setPlayerSpawnOverworld(CommandContext context) throws CommandSyntaxException { - BlockPos posInput = BlockPosArgumentType.getBlockPos(context, OVERWORLD_COORD); - ServerPlayerEntity playerTarget = EntityArgumentType.getPlayer(context, PLAYER); + private static int setPlayerSpawnOverworld(CommandContext context) throws CommandSyntaxException { + BlockPos posInput = BlockPosArgument.getBlockPos(context, OVERWORLD_COORD); + ServerPlayer playerTarget = EntityArgument.getPlayer(context, PLAYER); - PlayerDataService.setOrigin(playerTarget, playerTarget.getWorld(), DimensionTypes.OVERWORLD.getRegistry(), posInput); + if(!PlayerDataService.setOrigin(playerTarget, playerTarget.level(), BuiltinDimensionTypes.OVERWORLD.location(), posInput)) { + return 0; + } + if(ModDimensions.isInOverworld(playerTarget.level())) { + playerTarget.setRespawnPosition(Level.OVERWORLD, posInput, 0.0F, true, true); + } - MutableText sourceText = Text.translatable("command.%s.set.player.spawn.overworld.success".formatted(MiddleEarth.MOD_ID), playerTarget.getName() ,posInput.getX(), posInput.getY(), posInput.getZ()); - context.getSource().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.set.player.spawn.overworld.success".formatted(MiddleEarth.MOD_ID), playerTarget.getName() ,posInput.getX(), posInput.getY(), posInput.getZ()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); - MutableText targetText = Text.translatable("command.%s.set.spawn.overworld.success".formatted(MiddleEarth.MOD_ID), posInput.getX(), posInput.getY(), posInput.getZ()); - playerTarget.sendMessage(targetText.withColor(ModColors.SUCCESS.color)); + MutableComponent targetText = Component.translatable("command.%s.set.spawn.overworld.success".formatted(MiddleEarth.MOD_ID), posInput.getX(), posInput.getY(), posInput.getZ()); + playerTarget.sendSystemMessage(targetText.withColor(ModColors.SUCCESS.color)); - return 0; + return 1; } // endregion // region Resets - private static int resetPlayerSpawnOverworld(CommandContext context) throws CommandSyntaxException { - ServerPlayerEntity playerTarget = EntityArgumentType.getPlayer(context, PLAYER); - BlockPos posInput = context.getSource().getServer().getOverworld().getSpawnPos(); - PlayerDataService.setOrigin(playerTarget, playerTarget.getWorld(), DimensionTypes.OVERWORLD.getRegistry(), posInput); - - MutableText sourceText = Text.translatable("command.%s.reset.player.spawn.overworld.success".formatted(MiddleEarth.MOD_ID), playerTarget.getName(), posInput.getX(), posInput.getY(), posInput.getZ()); - context.getSource().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); - MutableText targetText = Text.translatable("command.%s.reset.spawn.overworld.success".formatted(MiddleEarth.MOD_ID), posInput.getX(), posInput.getY(), posInput.getZ()); - playerTarget.sendMessage(targetText.withColor(ModColors.SUCCESS.color)); - return 0; + private static int resetPlayerSpawnOverworld(CommandContext context) throws CommandSyntaxException { + ServerPlayer playerTarget = EntityArgument.getPlayer(context, PLAYER); + BlockPos posInput = context.getSource().getServer().overworld().getSharedSpawnPos(); + if(!PlayerDataService.setOrigin(playerTarget, playerTarget.level(), BuiltinDimensionTypes.OVERWORLD.location(), posInput)) { + return 0; + } + if(ModDimensions.isInOverworld(playerTarget.level())) { + playerTarget.setRespawnPosition(Level.OVERWORLD, posInput, 0.0F, true, true); + } + + MutableComponent sourceText = Component.translatable("command.%s.reset.player.spawn.overworld.success".formatted(MiddleEarth.MOD_ID), playerTarget.getName(), posInput.getX(), posInput.getY(), posInput.getZ()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent targetText = Component.translatable("command.%s.reset.spawn.overworld.success".formatted(MiddleEarth.MOD_ID), posInput.getX(), posInput.getY(), posInput.getZ()); + playerTarget.sendSystemMessage(targetText.withColor(ModColors.SUCCESS.color)); + return 1; } - private static int resetSpawnOverworld(CommandContext context) { - if(!context.getSource().isExecutedByPlayer() || context.getSource().getPlayer() == null) + private static int resetSpawnOverworld(CommandContext context) { + if(!context.getSource().isPlayer() || context.getSource().getPlayer() == null) return 0; - ServerPlayerEntity playerSource = context.getSource().getPlayer(); - PlayerDataService.resetOrigin(playerSource, playerSource.getWorld()); - PlayerDataService.OriginAggregate newOrigin = PlayerDataService.getOriginAggregateOrDefault(playerSource, playerSource.getWorld()); - MutableText sourceText = Text.translatable("command.%s.reset.spawn.overworld.success".formatted(MiddleEarth.MOD_ID), newOrigin.origin().getX(), newOrigin.origin().getY(), newOrigin.origin().getZ()); - playerSource.sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); - return 0; + ServerPlayer playerSource = context.getSource().getPlayer(); + if(!PlayerDataService.resetOrigin(playerSource, playerSource.level())) { + return 0; + } + PlayerDataService.OriginAggregate newOrigin = PlayerDataService.getOriginAggregateOrDefault(playerSource, playerSource.level()); + if(ModDimensions.isInOverworld(playerSource.level())) { + playerSource.setRespawnPosition(Level.OVERWORLD, newOrigin.origin(), 0.0F, true, true); + } + MutableComponent sourceText = Component.translatable("command.%s.reset.spawn.overworld.success".formatted(MiddleEarth.MOD_ID), newOrigin.origin().getX(), newOrigin.origin().getY(), newOrigin.origin().getZ()); + playerSource.sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); + return 1; } - private static int resetPlayerSpawnMiddleEarth(CommandContext context) throws CommandSyntaxException { - ServerPlayerEntity playerTarget = EntityArgumentType.getPlayer(context, PLAYER); + private static int resetPlayerSpawnMiddleEarth(CommandContext context) throws CommandSyntaxException { + ServerPlayer playerTarget = EntityArgument.getPlayer(context, PLAYER); if(!PlayerDataService.playerPassedOnboarding(playerTarget)){ - MutableText sourceText = Text.translatable("command.%s.reset.player.spawn.middle_earth.no_faction".formatted(MiddleEarth.MOD_ID), playerTarget.getName()); - context.getSource().sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.reset.player.spawn.middle_earth.no_faction".formatted(MiddleEarth.MOD_ID), playerTarget.getName()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); return 0; } - if(PlayerDataService.resetSpawn(playerTarget, playerTarget.getWorld())){ - SpawnData data = PlayerDataService.getPlayerSpawnData(playerTarget, playerTarget.getWorld()); + if(PlayerDataService.resetSpawn(playerTarget, playerTarget.level())){ + SpawnData data = PlayerDataService.getPlayerSpawnData(playerTarget, playerTarget.level()); - MutableText sourceText = Text.translatable("command.%s.reset.player.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), playerTarget.getName(), - Text.translatable("spawn." + data.getIdentifier().toTranslationKey()), data.getBlockPos().getX(), data.getBlockPos().getY(), data.getBlockPos().getZ()); - context.getSource().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.reset.player.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), playerTarget.getName(), + Component.translatable("spawn." + data.getIdentifier().toLanguageKey()), data.getBlockPos().getX(), data.getBlockPos().getY(), data.getBlockPos().getZ()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); - MutableText targetText = Text.translatable("command.%s.reset.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), - Text.translatable("spawn." + data.getIdentifier().toTranslationKey()), data.getBlockPos().getX(), data.getBlockPos().getY(), data.getBlockPos().getZ()); - playerTarget.sendMessage(targetText.withColor(ModColors.SUCCESS.color)); - return 0; + MutableComponent targetText = Component.translatable("command.%s.reset.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), + Component.translatable("spawn." + data.getIdentifier().toLanguageKey()), data.getBlockPos().getX(), data.getBlockPos().getY(), data.getBlockPos().getZ()); + playerTarget.sendSystemMessage(targetText.withColor(ModColors.SUCCESS.color)); + return 1; } return 0; } - private static int resetSpawnMiddleEarth(CommandContext context) { - if(!context.getSource().isExecutedByPlayer() || context.getSource().getPlayer() == null) + private static int resetSpawnMiddleEarth(CommandContext context) { + if(!context.getSource().isPlayer() || context.getSource().getPlayer() == null) return 0; - ServerPlayerEntity playerSource = context.getSource().getPlayer(); + ServerPlayer playerSource = context.getSource().getPlayer(); if(!PlayerDataService.playerPassedOnboarding(playerSource)){ - MutableText sourceText = Text.translatable("command.%s.reset.spawn.middle_earth.no_faction".formatted(MiddleEarth.MOD_ID)); - playerSource.sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.reset.spawn.middle_earth.no_faction".formatted(MiddleEarth.MOD_ID)); + playerSource.sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); return 0; } - if(PlayerDataService.resetSpawn(playerSource, playerSource.getWorld())){ - SpawnData data = PlayerDataService.getPlayerSpawnData(playerSource, playerSource.getWorld()); + if(PlayerDataService.resetSpawn(playerSource, playerSource.level())){ + SpawnData data = PlayerDataService.getPlayerSpawnData(playerSource, playerSource.level()); - MutableText sourceText = Text.translatable("command.%s.reset.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), - Text.translatable("spawn." + data.getIdentifier().toTranslationKey()), data.getBlockPos().getX(), data.getBlockPos().getY(), data.getBlockPos().getZ()); - playerSource.sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.reset.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), + Component.translatable("spawn." + data.getIdentifier().toLanguageKey()), data.getBlockPos().getX(), data.getBlockPos().getY(), data.getBlockPos().getZ()); + playerSource.sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); + return 1; } return 0; } @@ -401,134 +415,138 @@ private static int resetSpawnMiddleEarth(CommandContext con // endregion // region Teleports - private static int teleportToSpawnMiddleEarth(CommandContext context) { - if(!context.getSource().isExecutedByPlayer() || context.getSource().getPlayer() == null) + private static int teleportToSpawnMiddleEarth(CommandContext context) { + if(!context.getSource().isPlayer() || context.getSource().getPlayer() == null) return 0; boolean welcomeNeeded = BoolArgumentType.getBool(context, WELCOME); - ServerPlayerEntity playerSource = context.getSource().getPlayer(); - if(!PlayerDataService.playerPassedOnboarding(playerSource)){ - SpawnData spawnData = PlayerDataService.getPlayerSpawnData(playerSource, playerSource.getWorld()); + ServerPlayer playerSource = context.getSource().getPlayer(); + if(PlayerDataService.playerPassedOnboarding(playerSource)){ + SpawnData spawnData = PlayerDataService.getPlayerSpawnData(playerSource, playerSource.level()); if(spawnData == null) return 0; - PlayerDataService.OriginAggregate origin = PlayerDataService.getOriginAggregate(playerSource, playerSource.getWorld()); - if(ModDimensions.isInOverworld(playerSource.getWorld()) && origin != null){ - PlayerDataService.setOrigin(playerSource, playerSource.getWorld(), DimensionTypes.OVERWORLD_ID, playerSource.getBlockPos()); + PlayerDataService.OriginAggregate origin = PlayerDataService.getOriginAggregate(playerSource, playerSource.level()); + if(ModDimensions.isInOverworld(playerSource.level()) && origin != null){ + PlayerDataService.setOrigin(playerSource, playerSource.level(), BuiltinDimensionTypes.OVERWORLD.location(), playerSource.blockPosition()); } Vector3i spawnCoordinates = spawnData.getWorldCoordinates(); if(spawnCoordinates != null) { BlockPos pos = new BlockPos(spawnCoordinates.x, spawnCoordinates.y,spawnCoordinates.z); - if(ModDimensions.isInMiddleEarth(playerSource.getWorld())){ - ServerPlayerEntity.Respawn respawn = new ServerPlayerEntity.Respawn(ModDimensions.ME_WORLD_KEY, pos, 0, true); - playerSource.setSpawnPoint(respawn, true); + if(ModDimensions.isInMiddleEarth(playerSource.level())){ + playerSource.setRespawnPosition(ModDimensions.ME_WORLD_KEY, pos, 0.0F, true, true); } - ModDimensions.teleportPlayerToMe(playerSource, new Vec3d(spawnCoordinates.x, spawnCoordinates.y, spawnCoordinates.z), true, welcomeNeeded); - MutableText sourceText = Text.translatable("command.%s.teleport.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), - Text.translatable("spawn."+ spawnData.getIdentifier().toTranslationKey())); - context.getSource().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); - return 0; + if (!ModDimensions.teleportPlayerToMe(playerSource, new Vec3(spawnCoordinates.x, spawnCoordinates.y, spawnCoordinates.z), true, welcomeNeeded)) { + return 0; + } + MutableComponent sourceText = Component.translatable("command.%s.teleport.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), + Component.translatable("spawn."+ spawnData.getIdentifier().toLanguageKey())); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); + return 1; } } - MutableText sourceText = Text.translatable("command.%s.teleport.spawn.middle_earth.no_spawn".formatted(MiddleEarth.MOD_ID)); - context.getSource().sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.teleport.spawn.middle_earth.no_spawn".formatted(MiddleEarth.MOD_ID)); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); return 0; } - private static int teleportPlayerToSpawnMiddleEarth(CommandContext context) throws CommandSyntaxException { - ServerPlayerEntity playerTarget = EntityArgumentType.getPlayer(context, PLAYER); + private static int teleportPlayerToSpawnMiddleEarth(CommandContext context) throws CommandSyntaxException { + ServerPlayer playerTarget = EntityArgument.getPlayer(context, PLAYER); boolean welcomeNeeded = BoolArgumentType.getBool(context, WELCOME); if(PlayerDataService.playerPassedOnboarding(playerTarget)){ - SpawnData spawnData = PlayerDataService.getPlayerSpawnData(playerTarget, playerTarget.getWorld()); + SpawnData spawnData = PlayerDataService.getPlayerSpawnData(playerTarget, playerTarget.level()); if(spawnData == null) return 0; - PlayerDataService.OriginAggregate origin = PlayerDataService.getOriginAggregate(playerTarget, playerTarget.getWorld()); - if(ModDimensions.isInOverworld(playerTarget.getWorld()) && origin != null){ - PlayerDataService.setOrigin(playerTarget, playerTarget.getWorld(), DimensionTypes.OVERWORLD_ID, playerTarget.getBlockPos()); + PlayerDataService.OriginAggregate origin = PlayerDataService.getOriginAggregate(playerTarget, playerTarget.level()); + if(ModDimensions.isInOverworld(playerTarget.level()) && origin != null){ + PlayerDataService.setOrigin(playerTarget, playerTarget.level(), BuiltinDimensionTypes.OVERWORLD.location(), playerTarget.blockPosition()); } Vector3i spawnCoordinates = spawnData.getWorldCoordinates(); if(spawnCoordinates != null) { BlockPos pos = new BlockPos(spawnCoordinates.x, spawnCoordinates.y,spawnCoordinates.z); - if(ModDimensions.isInMiddleEarth(playerTarget.getWorld())){ - ServerPlayerEntity.Respawn respawn = new ServerPlayerEntity.Respawn(ModDimensions.ME_WORLD_KEY, pos, 0, true); - playerTarget.setSpawnPoint(respawn, true); + if(ModDimensions.isInMiddleEarth(playerTarget.level())){ + playerTarget.setRespawnPosition(ModDimensions.ME_WORLD_KEY, pos, 0.0F, true, true); } - ModDimensions.teleportPlayerToMe(playerTarget, new Vec3d(spawnCoordinates.x, spawnCoordinates.y, spawnCoordinates.z), true, welcomeNeeded); - MutableText sourceText = Text.translatable("command.%s.teleport.player.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), playerTarget.getName(), Text.translatable("spawn."+spawnData.getIdentifier().toTranslationKey()), pos.getX(), pos.getY(), pos.getZ()); - context.getSource().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); - MutableText targetText = Text.translatable("command.%s.teleport.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), Text.translatable("spawn."+spawnData.getIdentifier().toTranslationKey())); - playerTarget.sendMessage(targetText.withColor(ModColors.SUCCESS.color)); - return 0; + if (!ModDimensions.teleportPlayerToMe(playerTarget, new Vec3(spawnCoordinates.x, spawnCoordinates.y, spawnCoordinates.z), true, welcomeNeeded)) { + return 0; + } + MutableComponent sourceText = Component.translatable("command.%s.teleport.player.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), playerTarget.getName(), Component.translatable("spawn."+spawnData.getIdentifier().toLanguageKey()), pos.getX(), pos.getY(), pos.getZ()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); + MutableComponent targetText = Component.translatable("command.%s.teleport.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), Component.translatable("spawn."+spawnData.getIdentifier().toLanguageKey())); + playerTarget.sendSystemMessage(targetText.withColor(ModColors.SUCCESS.color)); + return 1; } } - MutableText sourceText = Text.translatable("command.%s.teleport.player.spawn.middle_earth.no_spawn".formatted(MiddleEarth.MOD_ID), playerTarget.getName()); - context.getSource().sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.teleport.player.spawn.middle_earth.no_spawn".formatted(MiddleEarth.MOD_ID), playerTarget.getName()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); return 0; } - private static int teleportToSpawnOverworld(CommandContext context) { - if(!context.getSource().isExecutedByPlayer() || context.getSource().getPlayer() == null) + private static int teleportToSpawnOverworld(CommandContext context) { + if(!context.getSource().isPlayer() || context.getSource().getPlayer() == null) return 0; - ServerPlayerEntity player = context.getSource().getPlayer(); + ServerPlayer player = context.getSource().getPlayer(); if(ModDimensions.teleportPlayerToOverworld(player)){ - MutableText sourceText = Text.translatable("command.%s.teleport.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID)); - context.getSource().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); - return 0; + MutableComponent sourceText = Component.translatable("command.%s.teleport.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID)); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); + return 1; } - MutableText sourceText = Text.translatable("command.%s.teleport.spawn.middle_earth.error".formatted(MiddleEarth.MOD_ID)); - context.getSource().sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.teleport.spawn.middle_earth.error".formatted(MiddleEarth.MOD_ID)); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); return 0; } - private static int teleportPlayerToSpawnOverworld(CommandContext context) throws CommandSyntaxException { - ServerPlayerEntity player = EntityArgumentType.getPlayer(context, PLAYER); + private static int teleportPlayerToSpawnOverworld(CommandContext context) throws CommandSyntaxException { + ServerPlayer player = EntityArgument.getPlayer(context, PLAYER); if(ModDimensions.teleportPlayerToOverworld(player)){ - MutableText sourceText = Text.translatable("command.%s.teleport.player.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), player.getName(), player.getX(), player.getY(), player.getZ()); - context.getSource().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); - return 0; + MutableComponent sourceText = Component.translatable("command.%s.teleport.player.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), player.getName(), player.getX(), player.getY(), player.getZ()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); + return 1; } - MutableText sourceText = Text.translatable("command.%s.teleport.player.spawn.middle_earth.no_spawn".formatted(MiddleEarth.MOD_ID), player.getName()); - context.getSource().sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.teleport.player.spawn.middle_earth.no_spawn".formatted(MiddleEarth.MOD_ID), player.getName()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); return 0; } - private static int forceTeleportToSpawnMiddleEarth(CommandContext context) { - if(!context.getSource().isExecutedByPlayer() || context.getSource().getPlayer() == null) + private static int forceTeleportToSpawnMiddleEarth(CommandContext context) { + if(!context.getSource().isPlayer() || context.getSource().getPlayer() == null) return 0; - Identifier spawnId = IdentifierArgumentType.getIdentifier(context, SPAWN_ID); + ResourceLocation spawnId = ResourceLocationArgument.getId(context, SPAWN_ID); if(FactionUtil.forceTeleportToSpawnMiddleEarthId(context.getSource().getPlayer(), spawnId)){ - BlockPos pos = FactionUtil.getSpawnBlockPos(context.getSource().getWorld(), spawnId); - MutableText targetText = Text.translatable("command.%s.teleport.to.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), Text.translatable("spawn."+spawnId.toTranslationKey()), pos.getX(), pos.getY(), pos.getZ()); - context.getSource().sendMessage(targetText.withColor(ModColors.SUCCESS.color)); + BlockPos pos = FactionUtil.getSpawnBlockPos(context.getSource().getLevel(), spawnId); + MutableComponent targetText = Component.translatable("command.%s.teleport.to.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), Component.translatable("spawn."+spawnId.toLanguageKey()), pos.getX(), pos.getY(), pos.getZ()); + context.getSource().sendSystemMessage(targetText.withColor(ModColors.SUCCESS.color)); + return 1; } else { - MutableText sourceText = Text.translatable("command.%s.teleport.to.spawn.middle_earth.error".formatted(MiddleEarth.MOD_ID), Text.translatable("spawn."+spawnId.toTranslationKey())); - context.getSource().sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.teleport.to.spawn.middle_earth.error".formatted(MiddleEarth.MOD_ID), Component.translatable("spawn."+spawnId.toLanguageKey())); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); } return 0; } - private static int forceTeleportPlayerToSpawnMiddleEarth(CommandContext context) throws CommandSyntaxException { - ServerPlayerEntity targetedPlayer = EntityArgumentType.getPlayer(context, PLAYER); - Identifier spawnId = IdentifierArgumentType.getIdentifier(context, SPAWN_ID); + private static int forceTeleportPlayerToSpawnMiddleEarth(CommandContext context) throws CommandSyntaxException { + ServerPlayer targetedPlayer = EntityArgument.getPlayer(context, PLAYER); + ResourceLocation spawnId = ResourceLocationArgument.getId(context, SPAWN_ID); if(FactionUtil.forceTeleportToSpawnMiddleEarthId(targetedPlayer, spawnId)){ - BlockPos pos = FactionUtil.getSpawnBlockPos(context.getSource().getWorld(), spawnId); - MutableText targetText = Text.translatable("command.%s.teleport.to.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), Text.translatable("spawn."+spawnId.toTranslationKey()), pos.getX(), pos.getY(), pos.getZ()); - targetedPlayer.sendMessage(targetText.withColor(ModColors.SUCCESS.color)); - MutableText sourceText = Text.translatable("command.%s.teleport.player.to.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), targetedPlayer.getName(),Text.translatable("spawn."+spawnId.toTranslationKey()), pos.getX(), pos.getY(), pos.getZ()); - context.getSource().sendMessage(sourceText.withColor(ModColors.SUCCESS.color)); + BlockPos pos = FactionUtil.getSpawnBlockPos(context.getSource().getLevel(), spawnId); + MutableComponent targetText = Component.translatable("command.%s.teleport.to.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), Component.translatable("spawn."+spawnId.toLanguageKey()), pos.getX(), pos.getY(), pos.getZ()); + targetedPlayer.sendSystemMessage(targetText.withColor(ModColors.SUCCESS.color)); + MutableComponent sourceText = Component.translatable("command.%s.teleport.player.to.spawn.middle_earth.success".formatted(MiddleEarth.MOD_ID), targetedPlayer.getName(),Component.translatable("spawn."+spawnId.toLanguageKey()), pos.getX(), pos.getY(), pos.getZ()); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.SUCCESS.color)); + return 1; } else { - MutableText sourceText = Text.translatable("command.%s.teleport.player.to.spawn.middle_earth.error".formatted(MiddleEarth.MOD_ID), Text.translatable("spawn."+spawnId.toTranslationKey())); - context.getSource().sendMessage(sourceText.withColor(ModColors.WARNING.color)); + MutableComponent sourceText = Component.translatable("command.%s.teleport.player.to.spawn.middle_earth.error".formatted(MiddleEarth.MOD_ID), Component.translatable("spawn."+spawnId.toLanguageKey())); + context.getSource().sendSystemMessage(sourceText.withColor(ModColors.WARNING.color)); } return 0; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllAvailableSpawnSuggestionProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllAvailableSpawnSuggestionProvider.java index 832c8eb56f..7036f5162a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllAvailableSpawnSuggestionProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllAvailableSpawnSuggestionProvider.java @@ -4,10 +4,10 @@ import com.mojang.brigadier.suggestion.SuggestionProvider; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; -import net.minecraft.command.argument.EntityArgumentType; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.Identifier; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; import net.sevenstars.middleearth.exceptions.FactionIdentifierException; import net.sevenstars.middleearth.resources.datas.factions.Faction; import net.sevenstars.middleearth.resources.datas.factions.FactionLookup; @@ -18,11 +18,11 @@ import java.util.List; import java.util.concurrent.CompletableFuture; -public class AllAvailableSpawnSuggestionProvider implements SuggestionProvider { +public class AllAvailableSpawnSuggestionProvider implements SuggestionProvider { @Override - public CompletableFuture getSuggestions(CommandContext context, SuggestionsBuilder builder) { + public CompletableFuture getSuggestions(CommandContext context, SuggestionsBuilder builder) { try { - List candidates = null; + List candidates = null; candidates = getAllSpawns(context); return SuggestionUtil.getCorrespondingIdentifiers(candidates, builder); } catch (FactionIdentifierException e) { @@ -30,43 +30,43 @@ public CompletableFuture getSuggestions(CommandContext getAllSpawns(CommandContext context) throws FactionIdentifierException { - ServerPlayerEntity targettedPlayer = null; // Null for command blocks + private static List getAllSpawns(CommandContext context) throws FactionIdentifierException { + ServerPlayer targettedPlayer = null; // Null for command blocks try { - targettedPlayer = EntityArgumentType.getPlayer(context, "player"); // Targeted player when the argument is there + targettedPlayer = EntityArgument.getPlayer(context, "player"); // Targeted player when the argument is there } catch (Exception e){ // There is no player argument in the command - if(context.getSource().isExecutedByPlayer()){ + if(context.getSource().isPlayer()){ targettedPlayer = context.getSource().getPlayer(); // Source player when no player argument } } Faction currentSelectedFaction = null; // Null by default try { - Identifier factionId = context.getArgument("faction_id", Identifier.class); - currentSelectedFaction = FactionLookup.getFactionById(context.getSource().getWorld(), factionId); + ResourceLocation factionId = context.getArgument("faction_id", ResourceLocation.class); + currentSelectedFaction = FactionLookup.getFactionById(context.getSource().getLevel(), factionId); } catch (Exception e){ // There is no player argument in the command if(targettedPlayer != null){ - currentSelectedFaction = PlayerDataService.getPlayerFaction(targettedPlayer, targettedPlayer.getWorld()); + currentSelectedFaction = PlayerDataService.getPlayerFaction(targettedPlayer, targettedPlayer.level()); } } - List candidates = new ArrayList<>(); + List candidates = new ArrayList<>(); if(currentSelectedFaction != null) { SpawnDataHandler spawnDataHandler = currentSelectedFaction.getSpawnData(); if(spawnDataHandler != null && spawnDataHandler.getSpawnList() != null){ - List factionSpawns = spawnDataHandler.getAllSpawnIdentifiers().stream().toList(); + List factionSpawns = spawnDataHandler.getAllSpawnIdentifiers().stream().toList(); candidates.addAll(factionSpawns); return candidates; } } // Return all faction spawns - List allFactions = FactionLookup.getAllJoinableFaction(context.getSource().getWorld()); + List allFactions = FactionLookup.getAllJoinableFaction(context.getSource().getLevel()); for(Faction faction : allFactions){ SpawnDataHandler spawnDataHandler = faction.getSpawnData(); if(spawnDataHandler != null && spawnDataHandler.getSpawnList() != null){ - List factionSpawns = spawnDataHandler.getAllSpawnIdentifiers().stream().toList(); + List factionSpawns = spawnDataHandler.getAllSpawnIdentifiers().stream().toList(); candidates.addAll(factionSpawns); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllBackAttachmentsSuggestionProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllBackAttachmentsSuggestionProvider.java index fffd3de428..9bed8f2808 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllBackAttachmentsSuggestionProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllBackAttachmentsSuggestionProvider.java @@ -4,17 +4,16 @@ import com.mojang.brigadier.suggestion.SuggestionProvider; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; +import net.minecraft.commands.CommandSourceStack; import net.sevenstars.middleearth.item.utils.armor.backAttachments.BackAttachmentsME; -import net.minecraft.server.command.ServerCommandSource; - import java.util.ArrayList; import java.util.List; import java.util.concurrent.CompletableFuture; -public class AllBackAttachmentsSuggestionProvider implements SuggestionProvider { +public class AllBackAttachmentsSuggestionProvider implements SuggestionProvider { @Override - public CompletableFuture getSuggestions(CommandContext context, SuggestionsBuilder builder) { + public CompletableFuture getSuggestions(CommandContext context, SuggestionsBuilder builder) { try { List candidates = getAllBackAttachments(); return SuggestionUtil.getCorrespondingNames(candidates, builder); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllHelmetAttachmentsSuggestionProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllHelmetAttachmentsSuggestionProvider.java index 899c70f932..a16e63a269 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllHelmetAttachmentsSuggestionProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllHelmetAttachmentsSuggestionProvider.java @@ -4,17 +4,16 @@ import com.mojang.brigadier.suggestion.SuggestionProvider; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; +import net.minecraft.commands.CommandSourceStack; import net.sevenstars.middleearth.item.utils.armor.helmetAttachments.HelmetAttachmentsME; -import net.minecraft.server.command.ServerCommandSource; - import java.util.ArrayList; import java.util.List; import java.util.concurrent.CompletableFuture; -public class AllHelmetAttachmentsSuggestionProvider implements SuggestionProvider { +public class AllHelmetAttachmentsSuggestionProvider implements SuggestionProvider { @Override - public CompletableFuture getSuggestions(CommandContext context, SuggestionsBuilder builder) { + public CompletableFuture getSuggestions(CommandContext context, SuggestionsBuilder builder) { try { List candidates = getAllHelmetAttachments(); return SuggestionUtil.getCorrespondingNames(candidates, builder); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllRaceSuggestionProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllRaceSuggestionProvider.java index 6301b1a3b8..e8bb2c3d69 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllRaceSuggestionProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllRaceSuggestionProvider.java @@ -4,21 +4,20 @@ import com.mojang.brigadier.suggestion.SuggestionProvider; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.exceptions.FactionIdentifierException; import net.sevenstars.middleearth.resources.datas.races.Race; import net.sevenstars.middleearth.resources.datas.races.RaceLookup; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.util.Identifier; - import java.util.ArrayList; import java.util.List; import java.util.concurrent.CompletableFuture; -public class AllRaceSuggestionProvider implements SuggestionProvider { +public class AllRaceSuggestionProvider implements SuggestionProvider { @Override - public CompletableFuture getSuggestions(CommandContext context, SuggestionsBuilder builder) { + public CompletableFuture getSuggestions(CommandContext context, SuggestionsBuilder builder) { try { - List candidates = null; + List candidates = null; candidates = getAllRaces(context); return SuggestionUtil.getCorrespondingIdentifiers(candidates, builder); } catch (FactionIdentifierException e) { @@ -26,9 +25,9 @@ public CompletableFuture getSuggestions(CommandContext getAllRaces(CommandContext context) throws FactionIdentifierException { - List races = RaceLookup.getAllRaces(context.getSource().getWorld()); - List candidates = new ArrayList<>(); + private static List getAllRaces(CommandContext context) throws FactionIdentifierException { + List races = RaceLookup.getAllRaces(context.getSource().getLevel()); + List candidates = new ArrayList<>(); for(Race race: races){ candidates.add(race.getId()); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllSpawnSuggestionProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllSpawnSuggestionProvider.java index c8456adce8..93e6d4ee09 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllSpawnSuggestionProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/AllSpawnSuggestionProvider.java @@ -4,22 +4,21 @@ import com.mojang.brigadier.suggestion.SuggestionProvider; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.exceptions.FactionIdentifierException; import net.sevenstars.middleearth.resources.datas.factions.Faction; import net.sevenstars.middleearth.resources.datas.factions.FactionLookup; import net.sevenstars.middleearth.resources.datas.factions.data.SpawnDataHandler; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.util.Identifier; - import java.util.ArrayList; import java.util.List; import java.util.concurrent.CompletableFuture; -public class AllSpawnSuggestionProvider implements SuggestionProvider { +public class AllSpawnSuggestionProvider implements SuggestionProvider { @Override - public CompletableFuture getSuggestions(CommandContext context, SuggestionsBuilder builder) { + public CompletableFuture getSuggestions(CommandContext context, SuggestionsBuilder builder) { try { - List candidates = null; + List candidates = null; candidates = getAllSpawns(context); return SuggestionUtil.getCorrespondingIdentifiers(candidates, builder); } catch (FactionIdentifierException e) { @@ -27,23 +26,23 @@ public CompletableFuture getSuggestions(CommandContext getAllSpawns(CommandContext context) throws FactionIdentifierException { - List factions = FactionLookup.getAllFactions(context.getSource().getWorld()); - List candidates = new ArrayList<>(); + private static List getAllSpawns(CommandContext context) throws FactionIdentifierException { + List factions = FactionLookup.getAllFactions(context.getSource().getLevel()); + List candidates = new ArrayList<>(); for(Faction faction: factions){ SpawnDataHandler spawnDataHandler = faction.getSpawnData(); if(spawnDataHandler != null){ - List spawnIds = spawnDataHandler.getAllSpawnIdentifiers(); + List spawnIds = spawnDataHandler.getAllSpawnIdentifiers(); if(spawnIds != null) candidates.addAll(spawnIds); } if(faction.getSubFactions() != null){ - for(Identifier subfactionId : faction.getSubFactions()){ - Faction subFaction = FactionLookup.getFactionById(context.getSource().getWorld(), subfactionId); + for(ResourceLocation subfactionId : faction.getSubFactions()){ + Faction subFaction = FactionLookup.getFactionById(context.getSource().getLevel(), subfactionId); SpawnDataHandler subFacspawnDataHandler = subFaction.getSpawnData(); - List spawnIds = subFacspawnDataHandler.getAllSpawnIdentifiers(); + List spawnIds = subFacspawnDataHandler.getAllSpawnIdentifiers(); if(spawnIds != null) candidates.addAll(spawnIds); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/FactionSuggestionProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/FactionSuggestionProvider.java index 22a911fa34..76618d6f2a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/FactionSuggestionProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/FactionSuggestionProvider.java @@ -4,17 +4,16 @@ import com.mojang.brigadier.suggestion.SuggestionProvider; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.resources.datas.common.FactionType; import net.sevenstars.middleearth.resources.datas.factions.Faction; import net.sevenstars.middleearth.resources.datas.factions.FactionLookup; -import net.minecraft.server.command.ServerCommandSource; -import net.minecraft.util.Identifier; - import java.util.ArrayList; import java.util.List; import java.util.concurrent.CompletableFuture; -public class FactionSuggestionProvider implements SuggestionProvider { +public class FactionSuggestionProvider implements SuggestionProvider { boolean onlyJoinable = true; public FactionSuggestionProvider(){ @@ -23,9 +22,9 @@ public FactionSuggestionProvider(boolean onlyJoinable){ this.onlyJoinable = onlyJoinable; } @Override - public CompletableFuture getSuggestions(CommandContext context, SuggestionsBuilder builder) { - List candidates = FactionLookup.getAllJoinableFaction(context.getSource().getWorld()); - List identifiers = new ArrayList<>(); + public CompletableFuture getSuggestions(CommandContext context, SuggestionsBuilder builder) { + List candidates = FactionLookup.getAllJoinableFaction(context.getSource().getLevel()); + List identifiers = new ArrayList<>(); for(Faction faction : candidates){ if(onlyJoinable){ if(faction.getFactionType() == FactionType.SUBFACTION) diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/SuggestionUtil.java b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/SuggestionUtil.java index 2e67944e5f..7eb2473478 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/SuggestionUtil.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/commands/suggestions/SuggestionUtil.java @@ -2,17 +2,16 @@ import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; -import net.minecraft.util.Identifier; - import java.util.List; import java.util.Locale; import java.util.concurrent.CompletableFuture; +import net.minecraft.resources.ResourceLocation; public class SuggestionUtil { - public static CompletableFuture getCorrespondingIdentifiers(List candidates, SuggestionsBuilder builder){ + public static CompletableFuture getCorrespondingIdentifiers(List candidates, SuggestionsBuilder builder){ String string = builder.getRemaining().toLowerCase(Locale.ROOT); - for (Identifier id : candidates){ + for (ResourceLocation id : candidates){ if(id.toString().contains(string)){ builder.suggest(id.toString()); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/compat/REIClientPluginME.java b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/REIClientPluginME.java index 2e395ff656..17929ad33c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/compat/REIClientPluginME.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/REIClientPluginME.java @@ -6,8 +6,9 @@ import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; import me.shedaniel.rei.api.client.registry.screen.ScreenRegistry; import me.shedaniel.rei.api.common.util.EntryStacks; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; +import me.shedaniel.rei.forge.REIPluginClient; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import net.sevenstars.middleearth.compat.artisantable.ArtisanTableCategory; import net.sevenstars.middleearth.compat.artisantable.ArtisanTableDisplay; @@ -18,30 +19,50 @@ import net.sevenstars.middleearth.recipe.AlloyingRecipe; import net.sevenstars.middleearth.recipe.ArtisanRecipe; -@Environment(EnvType.CLIENT) -public class REIClientPluginME implements REIClientPlugin { - +@OnlyIn(Dist.CLIENT) +@REIPluginClient +public final class REIClientPluginME implements REIClientPlugin { @Override public void registerCategories(CategoryRegistry registry) { registry.add(new ArtisanTableCategory()); registry.add(new AlloyingCategory()); - registry.addWorkstations(REICommonPluginME.ARTISAN_TABLE_CATEGORY, EntryStacks.of(ModDecorativeBlocks.ARTISAN_TABLE)); - registry.addWorkstations(REICommonPluginME.FORGE_CATEGORY, EntryStacks.of(ModDecorativeBlocks.FORGE)); + registry.addWorkstations( + REICommonPluginME.ARTISAN_TABLE_CATEGORY, + EntryStacks.of(ModDecorativeBlocks.ARTISAN_TABLE) + ); + registry.addWorkstations( + REICommonPluginME.FORGE_CATEGORY, + EntryStacks.of(ModDecorativeBlocks.FORGE) + ); } @Override public void registerDisplays(DisplayRegistry registry) { - REIClientPlugin.super.registerDisplays(registry); - registry.beginFiller(ArtisanRecipe.class) - .fill(ArtisanTableDisplay::new); - registry.beginFiller(AlloyingRecipe.class) - .fill(AlloyingDisplay::new); + registry.registerRecipeFiller( + ArtisanRecipe.class, + ArtisanRecipe.Type.INSTANCE, + holder -> new ArtisanTableDisplay(holder.value()) + ); + registry.registerRecipeFiller( + AlloyingRecipe.class, + AlloyingRecipe.Type.INSTANCE, + holder -> holder.value().output.contains("nugget") + ? null + : new AlloyingDisplay(holder.value()) + ); } @Override public void registerScreens(ScreenRegistry registry) { - REIClientPlugin.super.registerScreens(registry); - registry.registerClickArea(screen -> new Rectangle(75, 30, 20, 30), ArtisanTableScreen.class, REICommonPluginME.ARTISAN_TABLE_CATEGORY); - registry.registerClickArea(screen -> new Rectangle(75, 30, 20, 30), ForgeAlloyingScreen.class, REICommonPluginME.FORGE_CATEGORY); + registry.registerClickArea( + screen -> new Rectangle(75, 30, 20, 30), + ArtisanTableScreen.class, + REICommonPluginME.ARTISAN_TABLE_CATEGORY + ); + registry.registerClickArea( + screen -> new Rectangle(75, 30, 20, 30), + ForgeAlloyingScreen.class, + REICommonPluginME.FORGE_CATEGORY + ); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/compat/REICommonPluginME.java b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/REICommonPluginME.java index 83867e0660..0a5ecc262f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/compat/REICommonPluginME.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/REICommonPluginME.java @@ -1,52 +1,23 @@ package net.sevenstars.middleearth.compat; -import dev.architectury.utils.GameInstance; import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.display.DisplaySerializerRegistry; -import me.shedaniel.rei.api.common.entry.EntryIngredient; -import me.shedaniel.rei.api.common.plugins.REICommonPlugin; -import me.shedaniel.rei.api.common.registry.display.ServerDisplayRegistry; -import me.shedaniel.rei.api.common.util.EntryIngredients; -import net.minecraft.recipe.RecipeEntry; +import me.shedaniel.rei.api.common.plugins.REIServerPlugin; +import me.shedaniel.rei.forge.REIPluginCommon; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.compat.artisantable.ArtisanTableDisplay; import net.sevenstars.middleearth.compat.forge.AlloyingDisplay; -import net.sevenstars.middleearth.recipe.AlloyingRecipe; -import net.sevenstars.middleearth.recipe.ArtisanRecipe; -import net.sevenstars.middleearth.recipe.RecipesME; -import java.util.Collection; -import java.util.List; - -public class REICommonPluginME implements REICommonPlugin { - public static final CategoryIdentifier ARTISAN_TABLE_CATEGORY = CategoryIdentifier.of(MiddleEarth.MOD_ID, "artisan_table"); - public static final CategoryIdentifier FORGE_CATEGORY = CategoryIdentifier.of(MiddleEarth.MOD_ID, "forge"); +@REIPluginCommon +public final class REICommonPluginME implements REIServerPlugin { + public static final CategoryIdentifier ARTISAN_TABLE_CATEGORY = + CategoryIdentifier.of(MiddleEarth.MOD_ID, "artisan_table"); + public static final CategoryIdentifier FORGE_CATEGORY = + CategoryIdentifier.of(MiddleEarth.MOD_ID, "forge"); @Override public void registerDisplaySerializer(DisplaySerializerRegistry registry) { - REICommonPlugin.super.registerDisplaySerializer(registry); - registry.register(MiddleEarth.of("artisan_table"), ArtisanTableDisplay.SERIALIZER); - registry.register(MiddleEarth.of("forge"), AlloyingDisplay.SERIALIZER); - } - - @Override - public void registerDisplays(ServerDisplayRegistry registry) { - REICommonPlugin.super.registerDisplays(registry); - - Collection> recipeEntryList = GameInstance.getServer().getRecipeManager().getAllOfType(RecipesME.ARTISAN_TABLE_SUPPLIER.get()); - for(RecipeEntry recipeEntry : recipeEntryList) { - ArtisanRecipe artisanRecipe = recipeEntry.value(); - List inputs = ArtisanTableDisplay.getInputs(artisanRecipe); - registry.add(new ArtisanTableDisplay(inputs, List.of(EntryIngredients.of(artisanRecipe.getOutput())), artisanRecipe.category)); - } - - Collection> alloyRecipeEntryList = GameInstance.getServer().getRecipeManager().getAllOfType(RecipesME.FORGE); - for(RecipeEntry recipeEntry : alloyRecipeEntryList) { - AlloyingRecipe alloyRecipe = recipeEntry.value(); - if(!alloyRecipe.output.contains("nugget")) { - List inputs = AlloyingDisplay.getInputs(alloyRecipe); - registry.add(new AlloyingDisplay(inputs, alloyRecipe.output, alloyRecipe.amount)); - } - } + registry.register(ARTISAN_TABLE_CATEGORY, ArtisanTableDisplay.SERIALIZER); + registry.register(FORGE_CATEGORY, AlloyingDisplay.SERIALIZER); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/compat/artisantable/ArtisanTableCategory.java b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/artisantable/ArtisanTableCategory.java index 0122018ea3..ca66778a2a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/compat/artisantable/ArtisanTableCategory.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/artisantable/ArtisanTableCategory.java @@ -8,21 +8,23 @@ import me.shedaniel.rei.api.client.registry.display.DisplayCategory; import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.util.EntryStacks; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import net.sevenstars.middleearth.compat.REICommonPluginME; +import net.sevenstars.middleearth.gui.artisantable.ArtisanTableInputsShape; import net.sevenstars.middleearth.gui.artisantable.InputType; import java.util.LinkedList; import java.util.List; -@Environment(EnvType.CLIENT) -public class ArtisanTableCategory implements DisplayCategory { - public static final Identifier TEXTURE = MiddleEarth.of('/', "textures", "gui", "artisan_table_rei.png"); +@OnlyIn(Dist.CLIENT) +public final class ArtisanTableCategory implements DisplayCategory { + private static final ResourceLocation TEXTURE = + MiddleEarth.of('/', "textures", "gui", "artisan_table_rei.png"); @Override public CategoryIdentifier getCategoryIdentifier() { @@ -30,13 +32,13 @@ public CategoryIdentifier getCategoryIdentifier() } @Override - public Text getTitle() { - return Text.translatable("container." + MiddleEarth.MOD_ID + ".artisan_table"); + public Component getTitle() { + return Component.translatable("container." + MiddleEarth.MOD_ID + ".artisan_table"); } @Override public Renderer getIcon() { - return EntryStacks.of(ModDecorativeBlocks.ARTISAN_TABLE.asItem().getDefaultStack()); + return EntryStacks.of(ModDecorativeBlocks.ARTISAN_TABLE); } @Override @@ -46,31 +48,39 @@ public int getDisplayHeight() { @Override public List setupDisplay(ArtisanTableDisplay display, Rectangle bounds) { - final Point startPoint = new Point(bounds.getCenterX() - 87, bounds.getCenterY() - 35); + Point startPoint = new Point(bounds.getCenterX() - 87, bounds.getCenterY() - 35); List widgets = new LinkedList<>(); - - widgets.add(Widgets.createTexturedWidget(TEXTURE, new Rectangle(startPoint.x, startPoint.y, 175, 82))); + widgets.add(Widgets.createTexturedWidget( + TEXTURE, + new Rectangle(startPoint.x, startPoint.y, 175, 82) + )); int index = 0; - for(int y = 0; y < 3; y++) { - for(int x = 0; x < 3; x++) { - if (index < display.getInputEntries().size()){ - if(display.getArtisanTableInputShape() != null) { - InputType inputType = display.getArtisanTableInputShape().getInputType(x,y); - if (inputType != InputType.NONE){ - widgets.add(Widgets.createSlot(new Point(startPoint.x + 9 + 18*x, startPoint.y + 16 + 18*y)) - .markOutput().entries(display.getInputEntries().get(index++))); - } + ArtisanTableInputsShape inputShape = display.getArtisanTableInputShape(); + if (inputShape != null) { + for (int y = 0; y < 3; y++) { + for (int x = 0; x < 3 && index < display.getInputEntries().size(); x++) { + InputType inputType = inputShape.getInputType(x, y); + if (inputType != InputType.NONE) { + widgets.add(Widgets.createSlot( + new Point(startPoint.x + 9 + 18 * x, startPoint.y + 16 + 18 * y) + ) + .markInput() + .entries(display.getInputEntries().get(index++))); } } } } - widgets.add(Widgets.createSlot(new Point(startPoint.x + 128, startPoint.y + 34)) - .markOutput().entries(display.getOutputEntries().get((0)))); - - widgets.add(Widgets.createLabel(new Point(startPoint.x + 63, startPoint.y + 5), - Text.translatable("screen." + MiddleEarth.MOD_ID +".artisan_table." + display.getCategory()))); + widgets.add(Widgets.createSlot(new Point(startPoint.x + 128, startPoint.y + 34)) + .markOutput() + .entries(display.getOutputEntries().get(0))); + widgets.add(Widgets.createLabel( + new Point(startPoint.x + 63, startPoint.y + 5), + Component.translatable( + "screen." + MiddleEarth.MOD_ID + ".artisan_table." + display.getCategory() + ) + )); return widgets; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/compat/artisantable/ArtisanTableDisplay.java b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/artisantable/ArtisanTableDisplay.java index 903be26182..f6ae37b297 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/compat/artisantable/ArtisanTableDisplay.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/artisantable/ArtisanTableDisplay.java @@ -1,50 +1,32 @@ package net.sevenstars.middleearth.compat.artisantable; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; import me.shedaniel.rei.api.common.category.CategoryIdentifier; -import me.shedaniel.rei.api.common.display.Display; import me.shedaniel.rei.api.common.display.DisplaySerializer; import me.shedaniel.rei.api.common.display.basic.BasicDisplay; import me.shedaniel.rei.api.common.entry.EntryIngredient; import me.shedaniel.rei.api.common.util.EntryIngredients; -import net.fabricmc.fabric.impl.recipe.ingredient.builtin.ComponentsIngredient; -import net.minecraft.component.*; -import net.minecraft.item.ItemStack; -import net.minecraft.item.equipment.trim.ArmorTrim; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.recipe.Ingredient; +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.armortrim.ArmorTrim; +import net.minecraft.world.item.crafting.Ingredient; +import net.neoforged.neoforge.common.crafting.DataComponentIngredient; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.compat.REICommonPluginME; import net.sevenstars.middleearth.gui.artisantable.ArtisanTableInputsShape; -import net.sevenstars.middleearth.mixin.ComponentsIngredientMixin; import net.sevenstars.middleearth.recipe.ArtisanRecipe; -import org.jetbrains.annotations.Nullable; import java.util.ArrayList; -import java.util.Collections; import java.util.List; -public class ArtisanTableDisplay extends BasicDisplay { - protected String category; +public final class ArtisanTableDisplay extends BasicDisplay { + public static final DisplaySerializer SERIALIZER = + BasicDisplay.Serializer.ofRecipeLess( + (inputs, outputs, tag) -> + new ArtisanTableDisplay(inputs, outputs, tag.getString("category")), + (display, tag) -> tag.putString("category", display.category) + ); - public static final DisplaySerializer SERIALIZER = DisplaySerializer.of( - RecordCodecBuilder.mapCodec(instance -> instance.group( - EntryIngredient.codec().listOf().fieldOf("inputs").forGetter(ArtisanTableDisplay::getInputEntries), - EntryIngredient.codec().listOf().fieldOf("outputs").forGetter(ArtisanTableDisplay::getOutputEntries), - Codec.STRING.fieldOf("category").forGetter(ArtisanTableDisplay::getCategory) - ).apply(instance, ArtisanTableDisplay::new)), - PacketCodec.tuple( - EntryIngredient.streamCodec().collect(PacketCodecs.toList()), - ArtisanTableDisplay::getInputEntries, - EntryIngredient.streamCodec().collect(PacketCodecs.toList()), - ArtisanTableDisplay::getOutputEntries, - PacketCodecs.STRING, - ArtisanTableDisplay::getCategory, - ArtisanTableDisplay::new - ) - ); + private final String category; public ArtisanTableDisplay(List inputs, List outputs, String category) { super(inputs, outputs); @@ -52,42 +34,33 @@ public ArtisanTableDisplay(List inputs, List o } public ArtisanTableDisplay(ArtisanRecipe recipe) { - this(getInputs(recipe), getOutputs(recipe), recipe.category); + this(getInputs(recipe), List.of(EntryIngredients.of(recipe.getOutput())), recipe.category); } public static List getInputs(ArtisanRecipe recipe) { - List inputs = new ArrayList<>(EntryIngredients.ofIngredients(recipe.getIngredients())); - int index = 0; - for(Ingredient ingredient : recipe.getIngredients()) { - if(index > inputs.size() || index > recipe.inputs.size()) break; - ComponentsIngredient customIngredient = (ComponentsIngredient) ingredient.getCustomIngredient(); - if(customIngredient != null) { - ComponentsIngredientMixin ingredientComponentsAccessor = (ComponentsIngredientMixin) customIngredient; - ComponentChanges changedComponents = ingredientComponentsAccessor.getComponentChanges(); - if(changedComponents != null && changedComponents.get(DataComponentTypes.TRIM).isPresent()) { - ArmorTrim trim = changedComponents.get(DataComponentTypes.TRIM).get(); - if(trim.pattern().matchesId(MiddleEarth.of("smithing_part"))) { - ItemStack stackComponentsSmithing = new ItemStack(customIngredient.getMatchingItems().toList().getFirst()); - stackComponentsSmithing.set(DataComponentTypes.TRIM, trim); - EntryIngredient entryIngredient = EntryIngredients.of(stackComponentsSmithing); - inputs.set(index, entryIngredient); - } - } + List ingredients = recipe.getIngredients(); + List inputs = new ArrayList<>(EntryIngredients.ofIngredients(ingredients)); + + for (int index = 0; index < ingredients.size() && index < inputs.size(); index++) { + Ingredient ingredient = ingredients.get(index); + if (!(ingredient.getCustomIngredient() instanceof DataComponentIngredient componentIngredient)) { + continue; } - index++; + + int inputIndex = index; + componentIngredient.getItems() + .filter(ArtisanTableDisplay::isSmithingPart) + .findFirst() + .map(ItemStack::copy) + .ifPresent(stack -> inputs.set(inputIndex, EntryIngredients.of(stack))); } + return inputs; } - private static List getOutputs(ArtisanRecipe recipe) { - return List.of(EntryIngredients.of(recipe.getOutput())); - } - - public static ArtisanTableDisplay of(ArtisanRecipe recipe) { - List inputs = EntryIngredients.ofIngredients(recipe.getIngredients()); - List outputs = Collections.singletonList(EntryIngredients.of(recipe.getOutput())); - - return new ArtisanTableDisplay(inputs, outputs, recipe.category); + private static boolean isSmithingPart(ItemStack stack) { + ArmorTrim trim = stack.get(DataComponents.TRIM); + return trim != null && trim.pattern().is(MiddleEarth.of("smithing_part")); } public String getCategory() { @@ -102,9 +75,4 @@ public ArtisanTableInputsShape getArtisanTableInputShape() { public CategoryIdentifier getCategoryIdentifier() { return REICommonPluginME.ARTISAN_TABLE_CATEGORY; } - - @Override - public @Nullable DisplaySerializer getSerializer() { - return SERIALIZER; - } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/compat/emi/MiddleEarthEmiPlugin.java b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/emi/MiddleEarthEmiPlugin.java new file mode 100644 index 0000000000..63e97913e0 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/emi/MiddleEarthEmiPlugin.java @@ -0,0 +1,276 @@ +package net.sevenstars.middleearth.compat.emi; + +import dev.emi.emi.api.EmiEntrypoint; +import dev.emi.emi.api.EmiPlugin; +import dev.emi.emi.api.EmiRegistry; +import dev.emi.emi.api.recipe.BasicEmiRecipe; +import dev.emi.emi.api.recipe.EmiRecipeCategory; +import dev.emi.emi.api.recipe.VanillaEmiRecipeCategories; +import dev.emi.emi.api.render.EmiTexture; +import dev.emi.emi.api.stack.EmiIngredient; +import dev.emi.emi.api.stack.EmiStack; +import dev.emi.emi.api.widget.WidgetHolder; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeManager; +import net.neoforged.fml.ModList; +import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; +import net.sevenstars.middleearth.compat.recipeviewer.DynamicCraftingRecipeDisplay; +import net.sevenstars.middleearth.compat.recipeviewer.RecipeViewerHelper; +import net.sevenstars.middleearth.gui.artisantable.ArtisanTableInputsShape; +import net.sevenstars.middleearth.gui.artisantable.InputType; +import net.sevenstars.middleearth.recipe.AlloyingRecipe; +import net.sevenstars.middleearth.recipe.AnvilShapingRecipe; +import net.sevenstars.middleearth.recipe.ArtisanRecipe; +import net.sevenstars.middleearth.recipe.RecipesME; +import net.sevenstars.middleearth.recipe.inscription.InscriptionRecipe; + +import java.util.List; + +@EmiEntrypoint +public final class MiddleEarthEmiPlugin implements EmiPlugin { + private static final EmiStack ARTISAN_TABLE_ICON = EmiStack.of(ModDecorativeBlocks.ARTISAN_TABLE); + private static final EmiStack FORGE_ICON = EmiStack.of(ModDecorativeBlocks.FORGE); + private static final EmiStack ANVIL_ICON = EmiStack.of(ModDecorativeBlocks.TREATED_ANVIL); + private static final EmiStack INSCRIPTION_ICON = EmiStack.of(ModDecorativeBlocks.INSCRIPTION_TABLE); + + public static final EmiRecipeCategory ARTISAN_TABLE = new EmiRecipeCategory( + MiddleEarth.of("artisan_table"), ARTISAN_TABLE_ICON, + new EmiTexture(MiddleEarth.of("textures/gui/sprites/emi_sprite_sheet.png"), 0, 0, 16, 16)); + public static final EmiRecipeCategory FORGE = new EmiRecipeCategory( + MiddleEarth.of("forge"), FORGE_ICON, + new EmiTexture(MiddleEarth.of("textures/gui/sprites/emi_sprite_sheet.png"), 0, 16, 16, 16)); + public static final EmiRecipeCategory ANVIL_SHAPING = new EmiRecipeCategory( + MiddleEarth.of("anvil_shaping"), ANVIL_ICON, + new EmiTexture(MiddleEarth.of("textures/gui/sprites/emi_sprite_sheet.png"), 0, 32, 16, 16)); + public static final EmiRecipeCategory INSCRIPTION_TABLE = new EmiRecipeCategory( + MiddleEarth.of("inscription_table"), INSCRIPTION_ICON); + + @Override + public void register(EmiRegistry registry) { + RecipeManager recipes = registry.getRecipeManager(); + List> artisanRecipes = recipes.getAllRecipesFor(RecipesME.ARTISAN_TABLE); + List> forgeRecipes = recipes.getAllRecipesFor(RecipesME.FORGE); + List> anvilRecipes = recipes.getAllRecipesFor(RecipesME.ANVIL_SHAPING); + List> inscriptionRecipes = recipes.getAllRecipesFor(RecipesME.INSCRIPTION_TABLE); + + registry.addCategory(ARTISAN_TABLE); + registry.addWorkstation(ARTISAN_TABLE, ARTISAN_TABLE_ICON); + registry.addWorkstation(ARTISAN_TABLE, EmiStack.of(ModDecorativeBlocks.ORCISH_ARTISAN_TABLE)); + for (RecipeHolder holder : artisanRecipes) { + registry.addRecipe(new ArtisanEmiRecipe(holder)); + } + + registry.addCategory(FORGE); + registry.addWorkstation(FORGE, FORGE_ICON); + for (RecipeHolder holder : forgeRecipes) { + registry.addRecipe(new ForgeEmiRecipe(holder)); + } + + registry.addCategory(ANVIL_SHAPING); + registry.addWorkstation(ANVIL_SHAPING, ANVIL_ICON); + registry.addWorkstation(ANVIL_SHAPING, EmiStack.of(ModDecorativeBlocks.DWARVEN_TREATED_ANVIL)); + registry.addWorkstation(ANVIL_SHAPING, EmiStack.of(ModDecorativeBlocks.ELVEN_TREATED_ANVIL)); + registry.addWorkstation(ANVIL_SHAPING, EmiStack.of(ModDecorativeBlocks.ORCISH_TREATED_ANVIL)); + for (RecipeHolder holder : anvilRecipes) { + registry.addRecipe(new AnvilEmiRecipe(holder)); + } + + registry.addCategory(INSCRIPTION_TABLE); + registry.addWorkstation(INSCRIPTION_TABLE, INSCRIPTION_ICON); + for (RecipeHolder holder : inscriptionRecipes) { + registry.addRecipe(new InscriptionEmiRecipe(holder)); + } + + boolean importDynamicCraftingFromJei = ModList.get().isLoaded("jei"); + int dynamicCraftingCount = 0; + for (RecipeHolder holder + : recipes.getAllRecipesFor(net.minecraft.world.item.crafting.RecipeType.CRAFTING)) { + if (DynamicCraftingRecipeDisplay.supports(holder.value())) { + if (!importDynamicCraftingFromJei) { + registry.addRecipe(new DynamicCraftingEmiRecipe(holder)); + } + dynamicCraftingCount++; + } + } + MiddleEarth.LOGGER.logInfoMsg(( + "EMI recipe viewer registered: artisan=%d, inscription=%d, anvil=%d, forge=%d, dynamic_crafting=%d" + ).formatted(artisanRecipes.size(), inscriptionRecipes.size(), anvilRecipes.size(), + forgeRecipes.size(), dynamicCraftingCount)); + } + + private static final class DynamicCraftingEmiRecipe extends BasicEmiRecipe { + private final RecipeHolder holder; + private final EmiIngredient outputAlternatives; + + private DynamicCraftingEmiRecipe(RecipeHolder holder) { + super(VanillaEmiRecipeCategories.CRAFTING, holder.id(), 118, 54); + this.holder = holder; + DynamicCraftingRecipeDisplay.Display display = DynamicCraftingRecipeDisplay.create(holder.value()); + this.inputs = display.inputs().stream() + .map(stacks -> EmiIngredient.of(stacks.stream().map(EmiStack::of).toList())) + .toList(); + this.outputs = display.outputs().stream().map(EmiStack::of).toList(); + this.outputAlternatives = EmiIngredient.of(this.outputs); + } + + @Override + public RecipeHolder getBackingRecipe() { + return this.holder; + } + + @Override + public boolean supportsRecipeTree() { + return false; + } + + @Override + public void addWidgets(WidgetHolder widgets) { + widgets.addTexture(EmiTexture.EMPTY_ARROW, 60, 18); + widgets.addTexture(EmiTexture.SHAPELESS, 97, 0); + for (int index = 0; index < 9; index++) { + EmiIngredient ingredient = index < this.inputs.size() + ? this.inputs.get(index) + : EmiStack.EMPTY; + widgets.addSlot(ingredient, (index % 3) * 18, (index / 3) * 18); + } + widgets.addSlot(this.outputAlternatives, 92, 14).large(true).recipeContext(this); + } + } + + private abstract static class HolderEmiRecipe> extends BasicEmiRecipe { + protected final RecipeHolder holder; + + private HolderEmiRecipe(EmiRecipeCategory category, RecipeHolder holder, int width, int height) { + super(category, holder.id(), width, height); + this.holder = holder; + } + + @Override + public RecipeHolder getBackingRecipe() { + return this.holder; + } + } + + private static final class ArtisanEmiRecipe extends HolderEmiRecipe { + private final ArtisanTableInputsShape shape; + private final Component categoryLabel; + + private ArtisanEmiRecipe(RecipeHolder holder) { + super(ARTISAN_TABLE, holder, 146, 70); + this.shape = ArtisanTableInputsShape.getShape(holder.value().category); + this.inputs = holder.value().inputs.stream().map(EmiIngredient::of).toList(); + this.outputs = java.util.List.of(EmiStack.of(holder.value().getOutput())); + this.categoryLabel = Component.translatable( + "screen." + MiddleEarth.MOD_ID + ".artisan_table." + holder.value().category); + } + + @Override + public void addWidgets(WidgetHolder widgets) { + int ingredientIndex = 0; + if (this.shape != null) { + for (int y = 0; y < 3; y++) { + for (int x = 0; x < 3; x++) { + if (this.shape.getInputType(x, y) != InputType.NONE + && ingredientIndex < this.inputs.size()) { + widgets.addSlot(this.inputs.get(ingredientIndex++), 4 + 18 * x, 7 + 18 * y); + } + } + } + } + widgets.addSlot(this.outputs.getFirst(), 123, 25).recipeContext(this); + widgets.addText(this.categoryLabel, 64, 7, 0x404040, false); + } + } + + private static final class ForgeEmiRecipe extends HolderEmiRecipe { + private final Component unitsLabel; + private final Component ingotEquivalentLabel; + + private ForgeEmiRecipe(RecipeHolder holder) { + super(FORGE, holder, 138, 64); + this.inputs = holder.value().getIngredients().stream().map(EmiIngredient::of).toList(); + ItemStack output = RecipeViewerHelper.getAlloyOutput(holder.value()); + this.outputs = output.isEmpty() ? java.util.List.of() : java.util.List.of(EmiStack.of(output)); + this.unitsLabel = Component.translatable( + "recipe." + MiddleEarth.MOD_ID + ".metal_units", holder.value().getAmount()); + this.ingotEquivalentLabel = Component.translatable( + "recipe." + MiddleEarth.MOD_ID + ".ingot_equivalent", + RecipeViewerHelper.getIngotEquivalent(holder.value())); + } + + @Override + public void addWidgets(WidgetHolder widgets) { + for (int index = 0; index < this.inputs.size(); index++) { + widgets.addSlot(this.inputs.get(index), 2 + 18 * index, 6); + } + widgets.addTexture(EmiTexture.EMPTY_ARROW, 80, 7); + if (!this.outputs.isEmpty()) { + widgets.addSlot(this.outputs.getFirst(), 116, 6).recipeContext(this); + } + widgets.addText(this.unitsLabel, 3, 34, 0x404040, false); + widgets.addText(this.ingotEquivalentLabel, 3, 46, 0x404040, false); + } + + @Override + public boolean supportsRecipeTree() { + return false; + } + } + + private static final class AnvilEmiRecipe extends HolderEmiRecipe { + private final Component strikesLabel; + + private AnvilEmiRecipe(RecipeHolder holder) { + super(ANVIL_SHAPING, holder, 94, 50); + this.inputs = java.util.List.of(EmiIngredient.of(holder.value().getIngredient())); + this.outputs = java.util.List.of(EmiStack.of(holder.value().getOutput())); + this.strikesLabel = Component.translatable( + "recipe." + MiddleEarth.MOD_ID + ".hammer_strikes", holder.value().getAmount()); + } + + @Override + public void addWidgets(WidgetHolder widgets) { + widgets.addSlot(this.inputs.getFirst(), 2, 6); + widgets.addTexture(EmiTexture.EMPTY_ARROW, 35, 7); + widgets.addSlot(this.outputs.getFirst(), 72, 6).recipeContext(this); + widgets.addText(this.strikesLabel, 3, 36, 0x404040, false); + } + } + + private static final class InscriptionEmiRecipe extends HolderEmiRecipe { + private final Component wordsLabel; + private final Component levelCostLabel; + + private InscriptionEmiRecipe(RecipeHolder holder) { + super(INSCRIPTION_TABLE, holder, 138, 66); + InscriptionRecipe recipe = holder.value(); + this.inputs = java.util.List.of( + EmiIngredient.of(RecipeViewerHelper.getInscriptionCatalyst(recipe)), + EmiIngredient.of(recipe.inputChisel)); + this.outputs = java.util.List.of(EmiStack.of(RecipeViewerHelper.getInscriptionOutput(recipe))); + this.wordsLabel = Component.literal(String.join(" / ", recipe.inputWords)); + this.levelCostLabel = Component.translatable( + "recipe." + MiddleEarth.MOD_ID + ".level_cost", recipe.levelCost); + } + + @Override + public void addWidgets(WidgetHolder widgets) { + widgets.addSlot(this.inputs.get(0), 2, 6); + widgets.addSlot(this.inputs.get(1), 26, 6); + widgets.addTexture(EmiTexture.EMPTY_ARROW, 75, 7); + widgets.addSlot(this.outputs.getFirst(), 116, 6).recipeContext(this); + widgets.addText(this.wordsLabel, 3, 34, 0x404040, false); + widgets.addText(this.levelCostLabel, 3, 48, 0x404040, false); + } + + @Override + public boolean supportsRecipeTree() { + return false; + } + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/compat/forge/AlloyingCategory.java b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/forge/AlloyingCategory.java index b5fe9a6e71..f323c2c4a3 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/compat/forge/AlloyingCategory.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/forge/AlloyingCategory.java @@ -9,11 +9,10 @@ import me.shedaniel.rei.api.client.registry.display.DisplayCategory; import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.util.EntryStacks; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import net.sevenstars.middleearth.compat.REICommonPluginME; @@ -22,9 +21,10 @@ import java.util.LinkedList; import java.util.List; -@Environment(EnvType.CLIENT) -public class AlloyingCategory implements DisplayCategory { - public static final Identifier TEXTURE = MiddleEarth.of('/', "textures", "gui", "forge_rei.png"); +@OnlyIn(Dist.CLIENT) +public final class AlloyingCategory implements DisplayCategory { + private static final ResourceLocation TEXTURE = + MiddleEarth.of('/', "textures", "gui", "forge_rei.png"); @Override public CategoryIdentifier getCategoryIdentifier() { @@ -32,13 +32,13 @@ public CategoryIdentifier getCategoryIdentifier() { } @Override - public Text getTitle() { - return Text.translatable("screen." + MiddleEarth.MOD_ID + ".forge"); + public Component getTitle() { + return Component.translatable("screen." + MiddleEarth.MOD_ID + ".forge"); } @Override public Renderer getIcon() { - return EntryStacks.of(ModDecorativeBlocks.FORGE.asItem().getDefaultStack()); + return EntryStacks.of(ModDecorativeBlocks.FORGE); } @Override @@ -48,24 +48,46 @@ public int getDisplayHeight() { @Override public List setupDisplay(AlloyingDisplay display, Rectangle bounds) { - final Point startPoint = new Point(bounds.getCenterX() - 87, bounds.getCenterY() - 35); + Point startPoint = new Point(bounds.getCenterX() - 87, bounds.getCenterY() - 35); List widgets = new LinkedList<>(); + widgets.add(Widgets.createTexturedWidget( + TEXTURE, + new Rectangle(startPoint.x, startPoint.y, 175, 82) + )); - widgets.add(Widgets.createTexturedWidget(TEXTURE, new Rectangle(startPoint.x, startPoint.y, 175, 82))); - - for(int x = 0; x < 4; x++) { - Slot slot = Widgets.createSlot(new Point(startPoint.x + 41 + 18*x, startPoint.y + 16)); - if(display.getInputEntries().size() > x) slot.markOutput().entries(display.getInputEntries().get(x)); + for (int x = 0; x < 4; x++) { + Slot slot = Widgets.createSlot(new Point(startPoint.x + 41 + 18 * x, startPoint.y + 16)); + if (display.getInputEntries().size() > x) { + slot.markInput().entries(display.getInputEntries().get(x)); + } widgets.add(slot); } - widgets.add(Widgets.createTexturedWidget(TEXTURE,startPoint.x + 66, startPoint.y + 44, 218, 14, 20, 15)); - int storedLiquid = (int) (Math.min(1.0f, (float)display.amount / 576) * ForgeAlloyingScreen.LIQUID_HEIGHT); - widgets.add(Widgets.createTexturedWidget(TEXTURE,startPoint.x + 106, startPoint.y + 75 - storedLiquid, 211, 76 - storedLiquid, 20, storedLiquid)); - - widgets.add(Widgets.createLabel(new Point(startPoint.x + 77, startPoint.y + 5), - Text.translatable("trim_material." + MiddleEarth.MOD_ID + "." + display.output))); - + widgets.add(Widgets.createTexturedWidget( + TEXTURE, + startPoint.x + 66, + startPoint.y + 44, + 218, + 14, + 20, + 15 + )); + int storedLiquid = (int) ( + Math.min(1.0F, (float) display.amount / 576) * ForgeAlloyingScreen.LIQUID_HEIGHT + ); + widgets.add(Widgets.createTexturedWidget( + TEXTURE, + startPoint.x + 106, + startPoint.y + 75 - storedLiquid, + 211, + 76 - storedLiquid, + 20, + storedLiquid + )); + widgets.add(Widgets.createLabel( + new Point(startPoint.x + 77, startPoint.y + 5), + Component.translatable("trim_material." + MiddleEarth.MOD_ID + "." + display.output) + )); return widgets; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/compat/forge/AlloyingDisplay.java b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/forge/AlloyingDisplay.java index 7d6def2951..5ec8cec56f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/compat/forge/AlloyingDisplay.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/forge/AlloyingDisplay.java @@ -1,44 +1,31 @@ package net.sevenstars.middleearth.compat.forge; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; import me.shedaniel.rei.api.common.category.CategoryIdentifier; -import me.shedaniel.rei.api.common.display.Display; import me.shedaniel.rei.api.common.display.DisplaySerializer; import me.shedaniel.rei.api.common.display.basic.BasicDisplay; import me.shedaniel.rei.api.common.entry.EntryIngredient; import me.shedaniel.rei.api.common.util.EntryIngredients; -import net.minecraft.item.ItemStack; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; +import net.minecraft.world.item.ItemStack; import net.sevenstars.middleearth.block.special.forge.MetalTypes; import net.sevenstars.middleearth.compat.REICommonPluginME; import net.sevenstars.middleearth.recipe.AlloyingRecipe; -import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -public class AlloyingDisplay extends BasicDisplay { - protected String output; - protected int amount; +public final class AlloyingDisplay extends BasicDisplay { + public static final DisplaySerializer SERIALIZER = + BasicDisplay.Serializer.ofRecipeLess( + (inputs, outputs, tag) -> + new AlloyingDisplay(inputs, tag.getString("output"), tag.getInt("amount")), + (display, tag) -> { + tag.putString("output", display.output); + tag.putInt("amount", display.amount); + } + ); - public static final DisplaySerializer SERIALIZER = DisplaySerializer.of( - RecordCodecBuilder.mapCodec(instance -> instance.group( - EntryIngredient.codec().listOf().fieldOf("inputs").forGetter(AlloyingDisplay::getInputEntries), - Codec.STRING.fieldOf("output").forGetter(AlloyingDisplay::getOutput), - Codec.INT.fieldOf("amount").forGetter(AlloyingDisplay::getAmount) - ).apply(instance, AlloyingDisplay::new)), - PacketCodec.tuple( - EntryIngredient.streamCodec().collect(PacketCodecs.toList()), - AlloyingDisplay::getInputEntries, - PacketCodecs.STRING, - AlloyingDisplay::getOutput, - PacketCodecs.INTEGER, - AlloyingDisplay::getAmount, - AlloyingDisplay::new - ) - ); + final String output; + final int amount; public AlloyingDisplay(List inputs, String output, int amount) { super(inputs, List.of(EntryIngredients.of(new ItemStack(MetalTypes.fromValue(output).getIngot())))); @@ -51,8 +38,7 @@ public AlloyingDisplay(AlloyingRecipe recipe) { } public static List getInputs(AlloyingRecipe recipe) { - List inputs = new ArrayList<>(EntryIngredients.ofIngredients(recipe.getIngredients())); - return inputs; + return new ArrayList<>(EntryIngredients.ofIngredients(recipe.getIngredients())); } public String getOutput() { @@ -67,9 +53,4 @@ public int getAmount() { public CategoryIdentifier getCategoryIdentifier() { return REICommonPluginME.FORGE_CATEGORY; } - - @Override - public @Nullable DisplaySerializer getSerializer() { - return SERIALIZER; - } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/compat/jei/MiddleEarthJeiPlugin.java b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/jei/MiddleEarthJeiPlugin.java new file mode 100644 index 0000000000..020e395d25 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/jei/MiddleEarthJeiPlugin.java @@ -0,0 +1,390 @@ +package net.sevenstars.middleearth.compat.jei; + +import mezz.jei.api.IModPlugin; +import mezz.jei.api.JeiPlugin; +import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; +import mezz.jei.api.gui.drawable.IDrawable; +import mezz.jei.api.gui.ingredient.ICraftingGridHelper; +import mezz.jei.api.gui.ingredient.IRecipeSlotsView; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.recipe.IFocusGroup; +import mezz.jei.api.recipe.RecipeIngredientRole; +import mezz.jei.api.recipe.RecipeType; +import mezz.jei.api.recipe.category.IRecipeCategory; +import mezz.jei.api.recipe.category.extensions.vanilla.crafting.ICraftingCategoryExtension; +import mezz.jei.api.registration.IGuiHandlerRegistration; +import mezz.jei.api.registration.IRecipeCatalystRegistration; +import mezz.jei.api.registration.IRecipeCategoryRegistration; +import mezz.jei.api.registration.IRecipeRegistration; +import mezz.jei.api.registration.IVanillaCategoryExtensionRegistration; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeManager; +import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; +import net.sevenstars.middleearth.compat.recipeviewer.DynamicCraftingRecipeDisplay; +import net.sevenstars.middleearth.compat.recipeviewer.RecipeViewerHelper; +import net.sevenstars.middleearth.gui.artisantable.ArtisanTableInputsShape; +import net.sevenstars.middleearth.gui.artisantable.ArtisanTableScreen; +import net.sevenstars.middleearth.gui.artisantable.InputType; +import net.sevenstars.middleearth.gui.forge.ForgeAlloyingScreen; +import net.sevenstars.middleearth.recipe.AlloyingRecipe; +import net.sevenstars.middleearth.recipe.AnvilShapingRecipe; +import net.sevenstars.middleearth.recipe.ArtisanRecipe; +import net.sevenstars.middleearth.recipe.BackAttachmentRecipe; +import net.sevenstars.middleearth.recipe.BackAttachmentRemovalRecipe; +import net.sevenstars.middleearth.recipe.CustomItemDecorationRecipe; +import net.sevenstars.middleearth.recipe.HelmetAttachmentRecipe; +import net.sevenstars.middleearth.recipe.HelmetAttachmentRemovalRecipe; +import net.sevenstars.middleearth.recipe.MountArmorAddonRemovalRecipe; +import net.sevenstars.middleearth.recipe.MountArmorSideSkullAddonRecipe; +import net.sevenstars.middleearth.recipe.MountArmorTopSkullAddonRecipe; +import net.sevenstars.middleearth.recipe.RecipesME; +import net.sevenstars.middleearth.recipe.inscription.InscriptionRecipe; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@JeiPlugin +public final class MiddleEarthJeiPlugin implements IModPlugin { + private static final ResourceLocation PLUGIN_ID = MiddleEarth.of("jei_plugin"); + private static final Map DRAW_TEXT = new HashMap<>(); + + public static final RecipeType> ARTISAN_TABLE = + RecipeType.createRecipeHolderType(MiddleEarth.of("artisan_table")); + public static final RecipeType> FORGE = + RecipeType.createRecipeHolderType(MiddleEarth.of("forge")); + public static final RecipeType> ANVIL_SHAPING = + RecipeType.createRecipeHolderType(MiddleEarth.of("anvil_shaping")); + public static final RecipeType> INSCRIPTION_TABLE = + RecipeType.createRecipeHolderType(MiddleEarth.of("inscription_table")); + + @Override + public ResourceLocation getPluginUid() { + return PLUGIN_ID; + } + + @Override + public void registerCategories(IRecipeCategoryRegistration registration) { + IGuiHelper gui = registration.getJeiHelpers().getGuiHelper(); + registration.addRecipeCategories( + new ArtisanCategory(gui), + new ForgeCategory(gui), + new AnvilCategory(gui), + new InscriptionCategory(gui) + ); + } + + @Override + public void registerVanillaCategoryExtensions(IVanillaCategoryExtensionRegistration registration) { + var crafting = registration.getCraftingCategory(); + crafting.addExtension(BackAttachmentRecipe.class, new DynamicCraftingExtension<>()); + crafting.addExtension(BackAttachmentRemovalRecipe.class, new DynamicCraftingExtension<>()); + crafting.addExtension(HelmetAttachmentRecipe.class, new DynamicCraftingExtension<>()); + crafting.addExtension(HelmetAttachmentRemovalRecipe.class, new DynamicCraftingExtension<>()); + crafting.addExtension(MountArmorAddonRemovalRecipe.class, new DynamicCraftingExtension<>()); + crafting.addExtension(MountArmorSideSkullAddonRecipe.class, new DynamicCraftingExtension<>()); + crafting.addExtension(MountArmorTopSkullAddonRecipe.class, new DynamicCraftingExtension<>()); + crafting.addExtension(CustomItemDecorationRecipe.class, new DynamicCraftingExtension<>()); + } + + @Override + public void registerRecipes(IRecipeRegistration registration) { + Minecraft minecraft = Minecraft.getInstance(); + if (minecraft.level == null) { + return; + } + + RecipeManager recipes = minecraft.level.getRecipeManager(); + List> artisanRecipes = recipes.getAllRecipesFor(RecipesME.ARTISAN_TABLE); + List> forgeRecipes = recipes.getAllRecipesFor(RecipesME.FORGE); + List> anvilRecipes = recipes.getAllRecipesFor(RecipesME.ANVIL_SHAPING); + List> inscriptionRecipes = recipes.getAllRecipesFor(RecipesME.INSCRIPTION_TABLE); + + registration.addRecipes(ARTISAN_TABLE, artisanRecipes); + registration.addRecipes(FORGE, forgeRecipes); + registration.addRecipes(ANVIL_SHAPING, anvilRecipes); + registration.addRecipes(INSCRIPTION_TABLE, inscriptionRecipes); + + cacheDrawText(artisanRecipes, forgeRecipes, anvilRecipes, inscriptionRecipes); + long dynamicCraftingCount = recipes.getAllRecipesFor(net.minecraft.world.item.crafting.RecipeType.CRAFTING) + .stream() + .map(RecipeHolder::value) + .filter(DynamicCraftingRecipeDisplay::supports) + .count(); + MiddleEarth.LOGGER.logInfoMsg(( + "JEI recipe viewer registered: artisan=%d, inscription=%d, anvil=%d, forge=%d, dynamic_crafting=%d" + ).formatted(artisanRecipes.size(), inscriptionRecipes.size(), anvilRecipes.size(), + forgeRecipes.size(), dynamicCraftingCount)); + } + + @Override + public void registerRecipeCatalysts(IRecipeCatalystRegistration registration) { + registration.addRecipeCatalysts(ARTISAN_TABLE, + ModDecorativeBlocks.ARTISAN_TABLE, + ModDecorativeBlocks.ORCISH_ARTISAN_TABLE); + registration.addRecipeCatalysts(FORGE, ModDecorativeBlocks.FORGE); + registration.addRecipeCatalysts(ANVIL_SHAPING, + ModDecorativeBlocks.TREATED_ANVIL, + ModDecorativeBlocks.DWARVEN_TREATED_ANVIL, + ModDecorativeBlocks.ELVEN_TREATED_ANVIL, + ModDecorativeBlocks.ORCISH_TREATED_ANVIL); + registration.addRecipeCatalysts(INSCRIPTION_TABLE, ModDecorativeBlocks.INSCRIPTION_TABLE); + } + + @Override + public void registerGuiHandlers(IGuiHandlerRegistration registration) { + registration.addRecipeClickArea(ArtisanTableScreen.class, 75, 30, 20, 30, ARTISAN_TABLE); + registration.addRecipeClickArea(ForgeAlloyingScreen.class, 75, 30, 20, 30, FORGE); + } + + private static void cacheDrawText(List> artisanRecipes, + List> forgeRecipes, + List> anvilRecipes, + List> inscriptionRecipes) { + DRAW_TEXT.clear(); + for (RecipeHolder holder : artisanRecipes) { + DRAW_TEXT.put(holder.id(), new DrawText(Component.translatable( + "screen." + MiddleEarth.MOD_ID + ".artisan_table." + holder.value().category), null)); + } + for (RecipeHolder holder : forgeRecipes) { + DRAW_TEXT.put(holder.id(), new DrawText( + Component.translatable("recipe." + MiddleEarth.MOD_ID + ".metal_units", + holder.value().getAmount()), + Component.translatable("recipe." + MiddleEarth.MOD_ID + ".ingot_equivalent", + RecipeViewerHelper.getIngotEquivalent(holder.value())))); + } + for (RecipeHolder holder : anvilRecipes) { + DRAW_TEXT.put(holder.id(), new DrawText(Component.translatable( + "recipe." + MiddleEarth.MOD_ID + ".hammer_strikes", holder.value().getAmount()), null)); + } + for (RecipeHolder holder : inscriptionRecipes) { + DRAW_TEXT.put(holder.id(), new DrawText( + Component.literal(String.join(" / ", holder.value().inputWords)), + Component.translatable("recipe." + MiddleEarth.MOD_ID + ".level_cost", + holder.value().levelCost))); + } + } + + private static final class DynamicCraftingExtension + implements ICraftingCategoryExtension { + private DynamicCraftingRecipeDisplay.Display display; + + @Override + public void setRecipe(RecipeHolder holder, IRecipeLayoutBuilder builder, + ICraftingGridHelper craftingGridHelper, IFocusGroup focuses) { + DynamicCraftingRecipeDisplay.Display display = this.display(holder.value()); + builder.setShapeless(); + craftingGridHelper.createAndSetInputs(builder, display.inputs(), display.width(), display.height()); + craftingGridHelper.createAndSetOutputs(builder, display.outputs()); + } + + @Override + public int getWidth(RecipeHolder holder) { + return this.display(holder.value()).width(); + } + + @Override + public int getHeight(RecipeHolder holder) { + return this.display(holder.value()).height(); + } + + private DynamicCraftingRecipeDisplay.Display display(R recipe) { + if (this.display == null) { + this.display = DynamicCraftingRecipeDisplay.create(recipe); + } + return this.display; + } + } + + private record DrawText(Component primary, Component secondary) { + } + + private abstract static class HolderCategory> + implements IRecipeCategory> { + private final RecipeType> recipeType; + private final Component title; + private final IDrawable icon; + private final int width; + private final int height; + + private HolderCategory(RecipeType> recipeType, Component title, + IDrawable icon, int width, int height) { + this.recipeType = recipeType; + this.title = title; + this.icon = icon; + this.width = width; + this.height = height; + } + + @Override + public RecipeType> getRecipeType() { + return this.recipeType; + } + + @Override + public Component getTitle() { + return this.title; + } + + @Override + public IDrawable getIcon() { + return this.icon; + } + + @Override + public int getWidth() { + return this.width; + } + + @Override + public int getHeight() { + return this.height; + } + + @Override + public ResourceLocation getRegistryName(RecipeHolder recipe) { + return recipe.id(); + } + } + + private static final class ArtisanCategory extends HolderCategory { + private ArtisanCategory(IGuiHelper gui) { + super(ARTISAN_TABLE, + Component.translatable("container." + MiddleEarth.MOD_ID + ".artisan_table"), + gui.createDrawableItemLike(ModDecorativeBlocks.ARTISAN_TABLE), 146, 70); + } + + @Override + public void setRecipe(IRecipeLayoutBuilder builder, RecipeHolder holder, + IFocusGroup focuses) { + ArtisanRecipe recipe = holder.value(); + ArtisanTableInputsShape shape = ArtisanTableInputsShape.getShape(recipe.category); + int ingredientIndex = 0; + if (shape != null) { + for (int y = 0; y < 3; y++) { + for (int x = 0; x < 3; x++) { + if (shape.getInputType(x, y) != InputType.NONE + && ingredientIndex < recipe.inputs.size()) { + builder.addInputSlot(5 + 18 * x, 8 + 18 * y) + .addIngredients(recipe.inputs.get(ingredientIndex++)); + } + } + } + } + builder.addOutputSlot(123, 26).addItemStack(recipe.getOutput()); + } + + @Override + public void draw(RecipeHolder holder, IRecipeSlotsView slots, + GuiGraphics graphics, double mouseX, double mouseY) { + DrawText text = DRAW_TEXT.get(holder.id()); + if (text != null) { + graphics.drawString(Minecraft.getInstance().font, text.primary(), 65, 8, 0xFF404040, false); + } + } + } + + private static final class ForgeCategory extends HolderCategory { + private final IDrawable arrow; + + private ForgeCategory(IGuiHelper gui) { + super(FORGE, Component.translatable("screen." + MiddleEarth.MOD_ID + ".forge"), + gui.createDrawableItemLike(ModDecorativeBlocks.FORGE), 138, 64); + this.arrow = gui.getRecipeArrow(); + } + + @Override + public void setRecipe(IRecipeLayoutBuilder builder, RecipeHolder holder, + IFocusGroup focuses) { + List inputs = holder.value().getIngredients(); + for (int index = 0; index < inputs.size(); index++) { + builder.addInputSlot(3 + 18 * index, 7).addIngredients(inputs.get(index)); + } + ItemStack output = RecipeViewerHelper.getAlloyOutput(holder.value()); + if (!output.isEmpty()) { + builder.addOutputSlot(117, 7).addItemStack(output); + } + } + + @Override + public void draw(RecipeHolder holder, IRecipeSlotsView slots, + GuiGraphics graphics, double mouseX, double mouseY) { + this.arrow.draw(graphics, 80, 7); + DrawText text = DRAW_TEXT.get(holder.id()); + if (text != null) { + graphics.drawString(Minecraft.getInstance().font, + text.primary(), 4, 34, 0xFF404040, false); + graphics.drawString(Minecraft.getInstance().font, + text.secondary(), 4, 46, 0xFF404040, false); + } + } + } + + private static final class AnvilCategory extends HolderCategory { + private final IDrawable arrow; + + private AnvilCategory(IGuiHelper gui) { + super(ANVIL_SHAPING, Component.translatable("emi.category." + MiddleEarth.MOD_ID + ".anvil_shaping"), + gui.createDrawableItemLike(ModDecorativeBlocks.TREATED_ANVIL), 94, 50); + this.arrow = gui.getRecipeArrow(); + } + + @Override + public void setRecipe(IRecipeLayoutBuilder builder, RecipeHolder holder, + IFocusGroup focuses) { + builder.addInputSlot(3, 7).addIngredients(holder.value().getIngredient()); + builder.addOutputSlot(73, 7).addItemStack(holder.value().getOutput()); + } + + @Override + public void draw(RecipeHolder holder, IRecipeSlotsView slots, + GuiGraphics graphics, double mouseX, double mouseY) { + this.arrow.draw(graphics, 35, 7); + DrawText text = DRAW_TEXT.get(holder.id()); + if (text != null) { + graphics.drawString(Minecraft.getInstance().font, + text.primary(), 4, 36, 0xFF404040, false); + } + } + } + + private static final class InscriptionCategory extends HolderCategory { + private final IDrawable arrow; + + private InscriptionCategory(IGuiHelper gui) { + super(INSCRIPTION_TABLE, Component.translatable("block." + MiddleEarth.MOD_ID + ".inscription_table"), + gui.createDrawableItemLike(ModDecorativeBlocks.INSCRIPTION_TABLE), 138, 66); + this.arrow = gui.getRecipeArrow(); + } + + @Override + public void setRecipe(IRecipeLayoutBuilder builder, RecipeHolder holder, + IFocusGroup focuses) { + InscriptionRecipe recipe = holder.value(); + builder.addInputSlot(3, 7).addIngredients(RecipeViewerHelper.getInscriptionCatalyst(recipe)); + builder.addInputSlot(27, 7).addIngredients(recipe.inputChisel); + builder.addOutputSlot(117, 7).addItemStack(RecipeViewerHelper.getInscriptionOutput(recipe)); + } + + @Override + public void draw(RecipeHolder holder, IRecipeSlotsView slots, + GuiGraphics graphics, double mouseX, double mouseY) { + this.arrow.draw(graphics, 75, 7); + DrawText text = DRAW_TEXT.get(holder.id()); + if (text != null) { + graphics.drawString(Minecraft.getInstance().font, + text.primary(), 4, 34, 0xFF404040, false); + graphics.drawString(Minecraft.getInstance().font, + text.secondary(), 4, 48, 0xFF404040, false); + } + } + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/compat/recipeviewer/DynamicCraftingRecipeDisplay.java b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/recipeviewer/DynamicCraftingRecipeDisplay.java new file mode 100644 index 0000000000..af18be9180 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/recipeviewer/DynamicCraftingRecipeDisplay.java @@ -0,0 +1,302 @@ +package net.sevenstars.middleearth.compat.recipeviewer; + +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.item.BannerItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.component.DyedItemColor; +import net.minecraft.world.level.block.entity.BannerPatternLayers; +import net.sevenstars.middleearth.item.DataComponentTypesME; +import net.sevenstars.middleearth.item.EquipmentItemsME; +import net.sevenstars.middleearth.item.dataComponents.BackAttachmentDataComponent; +import net.sevenstars.middleearth.item.dataComponents.HelmetAttachmentDataComponent; +import net.sevenstars.middleearth.item.dataComponents.MountArmorAddonComponent; +import net.sevenstars.middleearth.item.items.HeldBannerItem; +import net.sevenstars.middleearth.item.items.armor.CustomChestplateItem; +import net.sevenstars.middleearth.item.items.armor.CustomHelmetItem; +import net.sevenstars.middleearth.item.items.shields.CustomBannerShieldItem; +import net.sevenstars.middleearth.item.utils.armor.helmetAttachments.HelmetAttachmentsStatesME; +import net.sevenstars.middleearth.recipe.BackAttachmentRecipe; +import net.sevenstars.middleearth.recipe.BackAttachmentRemovalRecipe; +import net.sevenstars.middleearth.recipe.CustomItemDecorationRecipe; +import net.sevenstars.middleearth.recipe.HelmetAttachmentRecipe; +import net.sevenstars.middleearth.recipe.HelmetAttachmentRemovalRecipe; +import net.sevenstars.middleearth.recipe.MountArmorAddonRemovalRecipe; +import net.sevenstars.middleearth.recipe.MountArmorSideSkullAddonRecipe; +import net.sevenstars.middleearth.recipe.MountArmorTopSkullAddonRecipe; +import net.sevenstars.middleearth.utils.ItemTagsME; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Comparator; +import java.util.List; +import java.util.function.BiFunction; +import java.util.function.Predicate; + +/** + * Builds finite, valid examples for custom crafting recipes whose real result depends on input components. + */ +public final class DynamicCraftingRecipeDisplay { + private static final List MOUNT_ADDON_STATES = List.of( + new MountArmorAddonComponent(false, false), + new MountArmorAddonComponent(true, false), + new MountArmorAddonComponent(false, true), + new MountArmorAddonComponent(true, true) + ); + + private DynamicCraftingRecipeDisplay() { + } + + public static boolean supports(CraftingRecipe recipe) { + return recipe instanceof BackAttachmentRecipe + || recipe instanceof BackAttachmentRemovalRecipe + || recipe instanceof HelmetAttachmentRecipe + || recipe instanceof HelmetAttachmentRemovalRecipe + || recipe instanceof MountArmorAddonRemovalRecipe + || recipe instanceof MountArmorSideSkullAddonRecipe + || recipe instanceof MountArmorTopSkullAddonRecipe + || recipe instanceof CustomItemDecorationRecipe; + } + + public static Display create(CraftingRecipe recipe) { + return switch (recipe) { + case BackAttachmentRecipe ignored -> backAttachment(false); + case BackAttachmentRemovalRecipe ignored -> backAttachment(true); + case HelmetAttachmentRecipe ignored -> helmetAttachment(false); + case HelmetAttachmentRemovalRecipe ignored -> helmetAttachment(true); + case MountArmorAddonRemovalRecipe ignored -> mountArmorRemoval(); + case MountArmorSideSkullAddonRecipe ignored -> mountArmorSideAddon(); + case MountArmorTopSkullAddonRecipe ignored -> mountArmorTopAddon(); + case CustomItemDecorationRecipe ignored -> itemDecoration(); + default -> throw new IllegalArgumentException("Unsupported dynamic crafting recipe: " + + recipe.getClass().getName()); + }; + } + + private static Display backAttachment(boolean removal) { + List chestplates = defaultStacks(EquipmentItemsME.armorPiecesListChestplates, + stack -> stack.getItem() instanceof CustomChestplateItem + && stack.get(DataComponentTypesME.BACK_ATTACHMENT_DATA) == null); + List attachments = defaultStacks(EquipmentItemsME.backAttachments, + stack -> stack.get(DataComponentTypesME.BACK_ATTACHMENT_DATA) != null); + List attachedChestplates = combineCoverage( + chestplates, attachments, DynamicCraftingRecipeDisplay::attachBack); + + return removal + ? new Display(List.of(attachedChestplates, List.of(new ItemStack(Items.SHEARS))), chestplates, 2, 1) + : new Display(List.of(chestplates, attachments), attachedChestplates, 2, 1); + } + + private static Display helmetAttachment(boolean removal) { + List helmets = defaultStacks(EquipmentItemsME.armorPiecesListHelmets, + stack -> stack.getItem() instanceof CustomHelmetItem + && stack.get(DataComponentTypesME.HELMET_ATTACHMENT_DATA) == null); + List attachments = defaultStacks(EquipmentItemsME.helmetAttachments, + stack -> stack.get(DataComponentTypesME.HELMET_ATTACHMENT_DATA) != null); + List attachedHelmets = combineCoverage( + helmets, attachments, DynamicCraftingRecipeDisplay::attachHelmet); + + return removal + ? new Display(List.of(attachedHelmets, List.of(new ItemStack(Items.SHEARS))), helmets, 2, 1) + : new Display(List.of(helmets, attachments), attachedHelmets, 2, 1); + } + + private static Display mountArmorRemoval() { + List armors = registryStacks(stack -> stack.is(ItemTagsME.WARG_ARMORS)); + List decoratedArmors = withMountAddonStates(armors); + List cleanArmors = decoratedArmors.stream() + .map(stack -> { + ItemStack clean = stack.copyWithCount(1); + clean.remove(DataComponentTypesME.MOUNT_ARMOR_DATA); + return clean; + }) + .toList(); + return new Display( + List.of(decoratedArmors, List.of(new ItemStack(Items.SHEARS))), + cleanArmors, + 2, + 1 + ); + } + + private static Display mountArmorSideAddon() { + List armors = registryStacks(stack -> stack.is(ItemTagsME.WARG_ARMORS)); + List armorStates = withMountAddonStates(armors).stream() + .filter(stack -> !currentSideAddon(stack)) + .toList(); + armorStates = withUnmodifiedStacks(armors, armorStates); + List outputs = armorStates.stream() + .map(stack -> setMountAddon(stack, currentTopAddon(stack), true)) + .toList(); + return new Display( + List.of(armorStates, List.of(new ItemStack(Items.STRING)), + List.of(new ItemStack(Items.SKELETON_SKULL))), + outputs, + 3, + 1 + ); + } + + private static Display mountArmorTopAddon() { + List armors = List.of( + new ItemStack(EquipmentItemsME.WARG_MORDOR_PLATE_ARMOR), + new ItemStack(EquipmentItemsME.WARG_GUNDABAD_PLATE_ARMOR) + ); + List armorStates = withMountAddonStates(armors).stream() + .filter(stack -> !currentTopAddon(stack)) + .toList(); + armorStates = withUnmodifiedStacks(armors, armorStates); + List outputs = armorStates.stream() + .map(stack -> setMountAddon(stack, true, currentSideAddon(stack))) + .toList(); + return new Display( + List.of(armorStates, List.of(new ItemStack(Items.STICK)), + List.of(new ItemStack(Items.SKELETON_SKULL))), + outputs, + 3, + 1 + ); + } + + private static Display itemDecoration() { + List targets = registryStacks(stack -> + (stack.getItem() instanceof CustomBannerShieldItem + || stack.getItem() instanceof HeldBannerItem) + && stack.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY) + .layers().isEmpty()); + List banners = registryStacks(stack -> stack.getItem() instanceof BannerItem); + List outputs = combineCoverage( + targets, banners, DynamicCraftingRecipeDisplay::decorateItem); + return new Display(List.of(targets, banners), outputs, 2, 1); + } + + private static ItemStack attachBack(ItemStack chestplate, ItemStack attachment) { + BackAttachmentDataComponent data = attachment.get(DataComponentTypesME.BACK_ATTACHMENT_DATA); + if (data == null) { + return ItemStack.EMPTY; + } + DyedItemColor dyedColor = attachment.get(DataComponents.DYED_COLOR); + int color = dyedColor == null ? 0 : dyedColor.rgb(); + return BackAttachmentDataComponent.setBackAttachmentWithColor( + chestplate, data.backAttachment(), color); + } + + private static ItemStack attachHelmet(ItemStack helmet, ItemStack attachment) { + HelmetAttachmentDataComponent data = attachment.get(DataComponentTypesME.HELMET_ATTACHMENT_DATA); + if (data == null) { + return ItemStack.EMPTY; + } + DyedItemColor dyedColor = attachment.get(DataComponents.DYED_COLOR); + int color = dyedColor == null ? 0 : dyedColor.rgb(); + boolean down = data.helmetAttachment().getConstantState() == HelmetAttachmentsStatesME.DOWN; + return HelmetAttachmentDataComponent.setHelmetAttachmentWithcolor( + helmet, down, data.helmetAttachment(), color); + } + + private static ItemStack decorateItem(ItemStack target, ItemStack banner) { + if (!(banner.getItem() instanceof BannerItem bannerItem)) { + return ItemStack.EMPTY; + } + ItemStack output = target.copyWithCount(1); + BannerPatternLayers patterns = banner.get(DataComponents.BANNER_PATTERNS); + if (patterns == null) { + output.remove(DataComponents.BANNER_PATTERNS); + } else { + output.set(DataComponents.BANNER_PATTERNS, patterns); + } + output.set(DataComponents.BASE_COLOR, bannerItem.getColor()); + return output; + } + + private static List withMountAddonStates(List armors) { + List stacks = new ArrayList<>(armors.size() * MOUNT_ADDON_STATES.size()); + for (ItemStack armor : armors) { + for (MountArmorAddonComponent state : MOUNT_ADDON_STATES) { + ItemStack stack = armor.copyWithCount(1); + stack.set(DataComponentTypesME.MOUNT_ARMOR_DATA, state); + stacks.add(stack); + } + } + return List.copyOf(stacks); + } + + private static List withUnmodifiedStacks(List base, List modified) { + List combined = new ArrayList<>(base.size() + modified.size()); + base.forEach(stack -> combined.add(stack.copyWithCount(1))); + modified.forEach(stack -> combined.add(stack.copyWithCount(1))); + return List.copyOf(combined); + } + + private static boolean currentTopAddon(ItemStack stack) { + MountArmorAddonComponent data = stack.get(DataComponentTypesME.MOUNT_ARMOR_DATA); + return data != null && data.topArmorAddon(); + } + + private static boolean currentSideAddon(ItemStack stack) { + MountArmorAddonComponent data = stack.get(DataComponentTypesME.MOUNT_ARMOR_DATA); + return data != null && data.sideArmorAddon(); + } + + private static ItemStack setMountAddon(ItemStack stack, boolean top, boolean side) { + ItemStack output = stack.copyWithCount(1); + output.set(DataComponentTypesME.MOUNT_ARMOR_DATA, new MountArmorAddonComponent(top, side)); + return output; + } + + private static List combineCoverage(List first, List second, + BiFunction operation) { + if (first.isEmpty() || second.isEmpty()) { + return List.of(); + } + int size = Math.max(first.size(), second.size()); + List outputs = new ArrayList<>(size); + for (int index = 0; index < size; index++) { + ItemStack output = operation.apply( + first.get(index % first.size()), second.get(index % second.size())); + if (!output.isEmpty()) { + outputs.add(output); + } + } + return List.copyOf(outputs); + } + + private static List defaultStacks(Collection items, Predicate filter) { + return items.stream() + .map(Item::getDefaultInstance) + .filter(stack -> !stack.isEmpty()) + .filter(filter) + .sorted(Comparator.comparing(DynamicCraftingRecipeDisplay::itemId)) + .map(ItemStack::copy) + .toList(); + } + + private static List registryStacks(Predicate filter) { + return BuiltInRegistries.ITEM.stream() + .map(Item::getDefaultInstance) + .filter(stack -> !stack.isEmpty()) + .filter(filter) + .sorted(Comparator.comparing(DynamicCraftingRecipeDisplay::itemId)) + .map(ItemStack::copy) + .toList(); + } + + private static String itemId(ItemStack stack) { + return BuiltInRegistries.ITEM.getKey(stack.getItem()).toString(); + } + + public record Display(List> inputs, List outputs, int width, int height) { + public Display { + inputs = inputs.stream().map(List::copyOf).toList(); + outputs = List.copyOf(outputs); + if (inputs.isEmpty() || inputs.stream().anyMatch(List::isEmpty) || outputs.isEmpty()) { + throw new IllegalStateException("Dynamic crafting display has no valid examples"); + } + if (width < 1 || height < 1 || width * height < inputs.size()) { + throw new IllegalArgumentException("Dynamic crafting display does not fit its grid"); + } + } + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/compat/recipeviewer/RecipeViewerHelper.java b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/recipeviewer/RecipeViewerHelper.java new file mode 100644 index 0000000000..439d7f095c --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/compat/recipeviewer/RecipeViewerHelper.java @@ -0,0 +1,68 @@ +package net.sevenstars.middleearth.compat.recipeviewer; + +import net.minecraft.core.component.DataComponents; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.enchantment.Enchantment; +import net.sevenstars.middleearth.block.special.forge.MetalTypes; +import net.sevenstars.middleearth.item.ResourceItemsME; +import net.sevenstars.middleearth.recipe.AlloyingRecipe; +import net.sevenstars.middleearth.recipe.inscription.InscriptionRecipe; +import net.sevenstars.middleearth.recipe.inscription.InscriptionWordBank; + +import java.util.ArrayList; +import java.util.List; + +public final class RecipeViewerHelper { + public static final int METAL_UNITS_PER_INGOT = 144; + private static final List INSCRIPTION_CATALYSTS = List.of( + Items.LAPIS_LAZULI, + Items.EMERALD, + ResourceItemsME.RUBY, + ResourceItemsME.SAPPHIRE, + ResourceItemsME.ADAMANT + ); + + private RecipeViewerHelper() { + } + + public static ItemStack getAlloyOutput(AlloyingRecipe recipe) { + MetalTypes metal = MetalTypes.fromValue(recipe.getAlloyResult()); + if (metal == null || metal.getIngot() == null) { + return ItemStack.EMPTY; + } + + return new ItemStack(metal.getIngot(), getIngotEquivalent(recipe)); + } + + public static int getIngotEquivalent(AlloyingRecipe recipe) { + return recipe.getAmount() / METAL_UNITS_PER_INGOT; + } + + public static Ingredient getInscriptionCatalyst(InscriptionRecipe recipe) { + List matches = new ArrayList<>(); + for (Item catalyst : INSCRIPTION_CATALYSTS) { + List availableWords = new ArrayList<>(InscriptionWordBank.wordBank.get(null)); + availableWords.addAll(InscriptionWordBank.wordBank.get(catalyst)); + if (availableWords.containsAll(recipe.inputWords)) { + matches.add(catalyst); + } + } + return matches.isEmpty() + ? Ingredient.EMPTY + : Ingredient.of(matches.toArray(Item[]::new)); + } + + public static ItemStack getInscriptionOutput(InscriptionRecipe recipe) { + ItemStack result = new ItemStack(Items.ENCHANTED_BOOK); + result.enchant(recipe.enchant, recipe.level); + result.set(DataComponents.CUSTOM_NAME, Component.translatable( + "recipe.middle-earth.applies_enchantment", + Enchantment.getFullname(recipe.enchant, recipe.level) + )); + return result; + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/config/ModClientConfigs.java b/middle-earth/src/main/java/net/sevenstars/middleearth/config/ModClientConfigs.java index d5d29c7240..16f823aedb 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/config/ModClientConfigs.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/config/ModClientConfigs.java @@ -54,8 +54,9 @@ private static void assignClientConfigs() { ENABLE_MAP_OVERLAY = CONFIG.getOrDefault("enableMapOverlay", false); ENABLE_SIMPLIFIED_CHARACTER_RENDERING = CONFIG.getOrDefault("enableSimplifiedCharacterRendering", false); LOD_NPC_ARMOR_DISTANCE = CONFIG.getOrDefault("npcsArmorDistanceLOD", 48); - LOD_NPC_FEATURES_DISTANCE = CONFIG.getOrDefault("npcsArmorDistanceLOD", 24); + // Upstream 1.21.8 effectively uses the armor LOD for modeled NPC features too. + LOD_NPC_FEATURES_DISTANCE = LOD_NPC_ARMOR_DISTANCE; DISABLE_GLINT = CONFIG.getOrDefault("disableGlint", true); MiddleEarth.LOGGER.logDebugMsg("All client configs (" + configs.getConfigsList().size() + ") have been set properly"); } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/config/ModServerConfigs.java b/middle-earth/src/main/java/net/sevenstars/middleearth/config/ModServerConfigs.java index 3498c901e3..1e25490fdc 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/config/ModServerConfigs.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/config/ModServerConfigs.java @@ -30,8 +30,6 @@ public class ModServerConfigs { public static int SHARPNESS_MAX_LEVEL; /** Amount of levels that a power enchant can have in Middle-earth**/ public static int POWER_MAX_LEVEL; - /** Global Mob Cap**/ - public static int GLOBAL_MOB_CAP; public static void registerConfigs() { configs = new ModConfigProvider(); @@ -53,8 +51,6 @@ private static void createServerConfigs() { configs.addKeyValuePair(new Pair<>("enableReturnToOverworld", true), "boolean"); configs.addDescription("Should procedural structures (such as Orthanc) generate in Middle-earth?"); configs.addKeyValuePair(new Pair<>("enableProceduralStructures", true), "boolean"); - configs.addDescription("Maximum amount of non-persistent entity per type in Middle-earth"); - configs.addKeyValuePair(new Pair<>("globalMobCap", true), "int"); configs.addLineJump(); // PlayerFactionPayload configurations @@ -95,8 +91,6 @@ private static void assignServerConfigs() { ENABLE_SPAWN_OVERRIDE = CONFIG.getOrDefault("enableSpawnOverride", true); ENABLE_RETURN_TO_OVERWORLD = CONFIG.getOrDefault("enableReturnToOverworld", true); ENABLE_PROCEDURAL_STRUCTURES = CONFIG.getOrDefault("enableProceduralStructures", true); - GLOBAL_MOB_CAP = CONFIG.getOrDefault("globalMobCap", 50); - // PlayerFactionPayload configurations ENABLE_FACTION_RESET = CONFIG.getOrDefault("enableFactionReset", true); ENABLE_KEEP_RACE_ON_DIMENSION_SWAP = CONFIG.getOrDefault("enableKeepRaceOnDimensionSwap", true); @@ -105,7 +99,7 @@ private static void assignServerConfigs() { ENABLE_MOUNT_BROADHOOF_GOAT = CONFIG.getOrDefault("enableMountBroadhoofGoat", true); ENABLE_GOLDEN_FOOD_RECIPES = CONFIG.getOrDefault("enableGoldenFoodRecipes", false); - ENABLE_GOLEMS = CONFIG.getOrDefault("enableGoldenFoodRecipes", false); + ENABLE_GOLEMS = CONFIG.getOrDefault("enableGolems", false); SHARPNESS_MAX_LEVEL = CONFIG.getOrDefault("sharpnessMaxLevel", 3); POWER_MAX_LEVEL = CONFIG.getOrDefault("powerMaxLevel", 3); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/config/SimpleConfig.java b/middle-earth/src/main/java/net/sevenstars/middleearth/config/SimpleConfig.java index 70260635c4..cce6d1fac6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/config/SimpleConfig.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/config/SimpleConfig.java @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -import net.fabricmc.loader.api.FabricLoader; +import net.neoforged.fml.loading.FMLPaths; import net.sevenstars.middleearth.MiddleEarth; import java.io.File; @@ -99,7 +99,7 @@ private String getConfig() { * @return new config request object */ public static ConfigRequest of( String filename ) { - Path path = FabricLoader.getInstance().getConfigDir(); + Path path = FMLPaths.CONFIGDIR.get(); return new ConfigRequest( path.resolve( filename + FILE_TYPE).toFile(), filename ); } @@ -249,4 +249,4 @@ public boolean delete() { return request.file.delete(); } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/DataGeneration.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/DataGeneration.java index 8868393bb2..d80031c699 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/DataGeneration.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/DataGeneration.java @@ -1,22 +1,14 @@ package net.sevenstars.middleearth.datageneration; -import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; -import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; -import net.minecraft.registry.RegistryBuilder; -import net.minecraft.registry.RegistryKeys; -import net.sevenstars.middleearth.datageneration.providers.BlockLootTableProvider; -import net.sevenstars.middleearth.datageneration.providers.DataWorldGenerator; -import net.sevenstars.middleearth.datageneration.providers.EnchantmentProvider; -import net.sevenstars.middleearth.datageneration.providers.LanguageProvider; -import net.sevenstars.middleearth.datageneration.providers.models.BlockModelProvider; -import net.sevenstars.middleearth.datageneration.providers.models.ItemModelProvider; -import net.sevenstars.middleearth.datageneration.providers.recipes.*; -import net.sevenstars.middleearth.datageneration.providers.tags.BlockTagProvider; -import net.sevenstars.middleearth.datageneration.providers.tags.ItemTagProvider; +import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.worldgen.BootstrapContext; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import net.minecraft.world.level.levelgen.placement.PlacedFeature; import net.sevenstars.middleearth.enchantments.EnchantmentsME; import net.sevenstars.middleearth.item.utils.SmithingTrimMaterialsME; import net.sevenstars.middleearth.item.utils.SmithingTrimPatternsME; -import net.sevenstars.middleearth.registries.AtlasesME; import net.sevenstars.middleearth.registries.CharacterMaterialsRegistryME; import net.sevenstars.middleearth.registries.CharacterPatternsRegistryME; import net.sevenstars.middleearth.registries.DynamicRegistriesME; @@ -29,7 +21,6 @@ import net.sevenstars.middleearth.world.features.misc.ModMiscPlacedFeatures; import net.sevenstars.middleearth.world.features.ores.OreConfiguredFeatures; import net.sevenstars.middleearth.world.features.ores.OrePlacedFeatures; -import net.sevenstars.middleearth.world.features.platedfood.PlatedFoodConfiguredFeatures; import net.sevenstars.middleearth.world.features.tree.ModTreeConfiguredFeatures; import net.sevenstars.middleearth.world.features.tree.ModTreePlacedFeatures; import net.sevenstars.middleearth.world.features.tree.MushroomTreeConfiguredFeatures; @@ -38,71 +29,66 @@ import net.sevenstars.middleearth.world.features.vegetation.ModVegetationConfiguredFeatures; import net.sevenstars.middleearth.world.features.vegetation.ModVegetationPlacedFeatures; -public class DataGeneration implements DataGeneratorEntrypoint { +public final class DataGeneration { public static boolean isDataGen = false; - @Override - public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { - isDataGen = true; + private DataGeneration() { + } - HelpingGenerator.generateFiles(); + public static RegistrySetBuilder createRegistrySetBuilder() { + return buildRegistryEntries(new RegistrySetBuilder()); + } - var pack = fabricDataGenerator.createPack(); - // Atlases - AtlasesME.addProviders(pack); - // Custom Dynamic Registries - DynamicRegistriesME.addProviders(pack); - // Others - pack.addProvider(InscriptionRecipeProvider::new); - pack.addProvider(BlockTagProvider::new); - pack.addProvider(BlockLootTableProvider::new); - pack.addProvider(ItemTagProvider::new); - pack.addProvider(BlockModelProvider::new); - pack.addProvider(ItemModelProvider::new); - pack.addProvider(RecipeProvider::new); - pack.addProvider(ArtisanTableHandheldRecipeProvider::new); - pack.addProvider(ArtisanTableArmorRecipeProvider::new); - pack.addProvider(ArtisanTableGenericArmorRecipeProvider::new); - pack.addProvider(DataWorldGenerator::new); - pack.addProvider(LanguageProvider::new); - pack.addProvider(EnchantmentProvider::new); + public static RegistrySetBuilder createCompleteLookupRegistrySetBuilder() { + RegistrySetBuilder registryBuilder = createRegistrySetBuilder(); + registryBuilder.add(Registries.ENCHANTMENT, EnchantmentsME::bootstrap); + registryBuilder.add(Registries.TRIM_MATERIAL, SmithingTrimMaterialsME::bootstrap); + registryBuilder.add(Registries.TRIM_PATTERN, SmithingTrimPatternsME::bootstrap); + return registryBuilder; } - @Override - public void buildRegistry(RegistryBuilder registryBuilder) { - DataGeneratorEntrypoint.super.buildRegistry(registryBuilder); - registryBuilder.addRegistry(RegistryKeys.BIOME, ModBiomes::bootstrap); - registryBuilder.addRegistry(RegistryKeys.BIOME, ModCaveBiomes::bootstrap); - registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, ModTreeConfiguredFeatures::bootstrap); - registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, ModVegetationConfiguredFeatures::bootstrap); - registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, BoulderConfiguredFeatures::bootstrap); - registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, OreConfiguredFeatures::bootstrap); - registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, CavesConfiguredFeatures::bootstrap); - registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, ModMiscConfiguredFeatures::bootstrap); - registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, MushroomTreeConfiguredFeatures::bootstrap); - registryBuilder.addRegistry(RegistryKeys.CONFIGURED_FEATURE, ChainConfiguredFeatures::bootstrap); - registryBuilder.addRegistry(RegistryKeys.PLACED_FEATURE, ModTreePlacedFeatures::bootstrap); - registryBuilder.addRegistry(RegistryKeys.PLACED_FEATURE, ModVegetationPlacedFeatures::bootstrap); - registryBuilder.addRegistry(RegistryKeys.PLACED_FEATURE, BoulderPlacedFeatures::bootstrap); - registryBuilder.addRegistry(RegistryKeys.PLACED_FEATURE, OrePlacedFeatures::bootstrap); - registryBuilder.addRegistry(RegistryKeys.PLACED_FEATURE, CavesPlacedFeatures::bootstrap); - registryBuilder.addRegistry(RegistryKeys.PLACED_FEATURE, ModMiscPlacedFeatures::bootstrap); + public static RegistrySetBuilder buildRegistryEntries(RegistrySetBuilder registryBuilder) { + registryBuilder.add(Registries.BIOME, DataGeneration::bootstrapBiomes); + registryBuilder.add(Registries.CONFIGURED_FEATURE, DataGeneration::bootstrapConfiguredFeatures); + registryBuilder.add(Registries.PLACED_FEATURE, DataGeneration::bootstrapPlacedFeatures); - registryBuilder.addRegistry(DynamicRegistriesME.SKIN_MATERIAL, CharacterMaterialsRegistryME::bootstrapSkins); - registryBuilder.addRegistry(DynamicRegistriesME.SKIN_PATTERN, CharacterPatternsRegistryME::bootstrapSkins); + registryBuilder.add(DynamicRegistriesME.SKIN_MATERIAL, CharacterMaterialsRegistryME::bootstrapSkins); + registryBuilder.add(DynamicRegistriesME.SKIN_PATTERN, CharacterPatternsRegistryME::bootstrapSkins); - registryBuilder.addRegistry(DynamicRegistriesME.HAIR_MATERIAL, CharacterMaterialsRegistryME::bootstrapHairs); - registryBuilder.addRegistry(DynamicRegistriesME.HAIR_PATTERN, CharacterPatternsRegistryME::bootstrapHairs); + registryBuilder.add(DynamicRegistriesME.HAIR_MATERIAL, CharacterMaterialsRegistryME::bootstrapHairs); + registryBuilder.add(DynamicRegistriesME.HAIR_PATTERN, CharacterPatternsRegistryME::bootstrapHairs); - registryBuilder.addRegistry(DynamicRegistriesME.EYE_MATERIAL, CharacterMaterialsRegistryME::bootstrapEyes); - registryBuilder.addRegistry(DynamicRegistriesME.EYE_PATTERN, CharacterPatternsRegistryME::bootstrapEyes); + registryBuilder.add(DynamicRegistriesME.EYE_MATERIAL, CharacterMaterialsRegistryME::bootstrapEyes); + registryBuilder.add(DynamicRegistriesME.EYE_PATTERN, CharacterPatternsRegistryME::bootstrapEyes); // Mod Dynamic DynamicRegistriesME.prepareBoostrap(registryBuilder); - // Vanilla registries - registryBuilder.addRegistry(RegistryKeys.TRIM_MATERIAL, SmithingTrimMaterialsME::bootstrap); - registryBuilder.addRegistry(RegistryKeys.TRIM_PATTERN, SmithingTrimPatternsME::bootstrap); - registryBuilder.addRegistry(RegistryKeys.ENCHANTMENT, EnchantmentsME::bootstrap); + return registryBuilder; + } + + private static void bootstrapBiomes(BootstrapContext context) { + ModBiomes.bootstrap(context); + ModCaveBiomes.bootstrap(context); + } + + private static void bootstrapConfiguredFeatures(BootstrapContext> context) { + ModTreeConfiguredFeatures.bootstrap(context); + ModVegetationConfiguredFeatures.bootstrap(context); + BoulderConfiguredFeatures.bootstrap(context); + OreConfiguredFeatures.bootstrap(context); + CavesConfiguredFeatures.bootstrap(context); + ModMiscConfiguredFeatures.bootstrap(context); + MushroomTreeConfiguredFeatures.bootstrap(context); + ChainConfiguredFeatures.bootstrap(context); + } + + private static void bootstrapPlacedFeatures(BootstrapContext context) { + ModTreePlacedFeatures.bootstrap(context); + ModVegetationPlacedFeatures.bootstrap(context); + BoulderPlacedFeatures.bootstrap(context); + OrePlacedFeatures.bootstrap(context); + CavesPlacedFeatures.bootstrap(context); + ModMiscPlacedFeatures.bootstrap(context); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/HelpingGenerator.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/HelpingGenerator.java index ea21495d7d..8141e21adf 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/HelpingGenerator.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/HelpingGenerator.java @@ -1,7 +1,8 @@ package net.sevenstars.middleearth.datageneration; -import net.minecraft.block.*; -import net.minecraft.registry.Registries; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.*; import net.sevenstars.middleearth.block.registration.*; import net.sevenstars.middleearth.block.special.*; import net.sevenstars.middleearth.block.special.verticalSlabs.VerticalSlabBlock; @@ -11,7 +12,7 @@ import net.sevenstars.middleearth.block.utils.setBuilders.SimpleBlockSetBuilder; import net.sevenstars.middleearth.block.utils.setBuilders.StoneBlockSetBuilder; import net.sevenstars.middleearth.block.utils.setBuilders.WoodBlockSetBuilder; -import net.sevenstars.middleearth.datageneration.content.loot_tables.BlockDrops; +import net.sevenstars.middleearth.datageneration.content.loot_tables.DynamicBlockDrops; import net.sevenstars.middleearth.datageneration.content.models.*; import net.sevenstars.middleearth.datageneration.content.tags.*; @@ -97,7 +98,7 @@ public static void generateFiles() { ModdedStrippedLogs.strippedLogs.add(set.strippedLogBlocks.log()); woodBlocks(set.strippedLogBlocks); } - case PLANK_BLOCKS -> plankBlocks(set.planksBlocks, set.vanilla); + case PLANK_BLOCKS -> plankBlocks(set.planksBlocks); case SHINGLE_BLOCKS -> { Shingles.shingles.add(set.shinglesBlocks.base()); regularBlocks(set.shinglesBlocks, 0); @@ -106,7 +107,7 @@ public static void generateFiles() { case FURNITURE_BLOCKS -> furnitureBlocks(set.furnitureBlocks, set.planksBlocks.base()); case REDSTONE_BLOCKS -> woodRedstoneBlocks(set.redstoneBlocks, set.planksBlocks.base()); case LEAVES -> { - if (!Objects.equals(Registries.BLOCK.getId(set.leaves).getNamespace(), "minecraft")){ + if (!Objects.equals(BuiltInRegistries.BLOCK.getKey(set.leaves).getNamespace(), "minecraft")){ if (set.setName.contains("beech")){ LeavesSets.grayscaleLeaves.add(set.leaves); } else { @@ -135,26 +136,26 @@ else if(set.setName.contains("clay") || set.setName.contains("stone") || set.set SimpleBlockModel.blocks.addAll(LeavesSets.leaves); for (SimpleVerticalSlabModel.VerticalSlab set : SimpleVerticalSlabModel.vanillaVerticalSlabs) { - BlockDrops.blocks.add(set.verticalSlab()); + DynamicBlockDrops.add(set.verticalSlab()); } for(SimpleWoodStoolModel.VanillaStool stool : SimpleWoodStoolModel.vanillaStools){ - BlockDrops.blocks.add(stool.base()); + DynamicBlockDrops.add(stool.base()); MineableAxe.blocks.add(stool.base()); } for(SimpleWoodBenchModel.VanillaBench bench : SimpleWoodBenchModel.vanillaBenchs){ - BlockDrops.blocks.add(bench.base()); + DynamicBlockDrops.add(bench.base()); MineableAxe.blocks.add(bench.base()); } for(SimpleWoodTableModel.VanillaTable table : SimpleWoodTableModel.vanillaTables) { - BlockDrops.blocks.add(table.base()); + DynamicBlockDrops.add(table.base()); MineableAxe.blocks.add(table.base()); } for(SimpleWoodChairModel.VanillaChair chair : SimpleWoodChairModel.vanillaChairs){ - BlockDrops.blocks.add(chair.base()); + DynamicBlockDrops.add(chair.base()); MineableAxe.blocks.add(chair.base()); } @@ -244,19 +245,19 @@ public static void addBlocksToLists(Block block, Block base, Block origin, int t case 3 -> MineableHoe.blocks.add(block); } - BlockDrops.blocks.add(block); + DynamicBlockDrops.add(block); String blockName = block.getName().toString(); String baseName = base.getName().toString(); - if (!(Objects.equals(Registries.BLOCK.getId(block).getNamespace(), "minecraft"))){ + if (!(Objects.equals(BuiltInRegistries.BLOCK.getKey(block).getNamespace(), "minecraft"))){ final boolean isPillar = blockName.contains("carved_window") || blockName.contains("chiseled") || blockName.contains("drystone") || blockName.contains("pillar"); final boolean woodModel = (blockName.contains("_wood") && !(blockName.contains("gilded") || blockName.contains("beam"))) || blockName.contains("hyphae"); switch (block){ - case PillarBlock pillarBlock -> { + case RotatedPillarBlock pillarBlock -> { if (woodModel){ SimpleBlockModel.woodBlocks.add(pillarBlock); } else { @@ -285,7 +286,7 @@ public static void addBlocksToLists(Block block, Block base, Block origin, int t SimpleVerticalSlabModel.verticalSlabs.add(new SimpleVerticalSlabModel.VerticalSlab(base, origin, verticalSlabBlock)); } } - case StairsBlock stairsBlock -> { + case StairBlock stairsBlock -> { if (blockName.contains("stripped")){ SimpleStairModel.strippedStairs.add(new SimpleStairModel.Stair(base, stairsBlock)); } else if (woodModel){ @@ -316,17 +317,17 @@ public static void addBlocksToLists(Block block, Block base, Block origin, int t FenceGates.fenceGates.add(fenceGateBlock); SimpleFenceGateModel.blocks.add(new SimpleFenceGateModel.FenceGate(base, fenceGateBlock)); } - case PaneBlock paneBlock -> SimplePaneModel.panes.add(new SimplePaneModel.Pane(base, paneBlock)); + case IronBarsBlock paneBlock -> SimplePaneModel.panes.add(new SimplePaneModel.Pane(base, paneBlock)); case PressurePlateBlock pressurePlateBlock -> { PressurePlates.pressurePlates.add(pressurePlateBlock); SimplePressurePlateModel.pressurePlates.add(new SimplePressurePlateModel.PressurePlate(base, pressurePlateBlock)); } case ButtonBlock buttonBlock -> { - if(woodModel) Buttons.woodButtons.add(buttonBlock); + if(woodModel || baseName.contains("planks")) Buttons.woodButtons.add(buttonBlock); else Buttons.stoneButtons.add(buttonBlock); SimpleButtonModel.buttons.add(new SimpleButtonModel.Button(base, buttonBlock)); } - case TrapdoorBlock trapdoorBlock -> { + case TrapDoorBlock trapdoorBlock -> { Trapdoors.trapdoors.add(trapdoorBlock); if (baseName.contains("planks")){ SimpleTrapDoorModel.trapdoors.add(new SimpleTrapDoorModel.Trapdoor(base, trapdoorBlock, true)); @@ -378,11 +379,13 @@ public static void mainStoneBlocks(BlockRecordTypes.BaseStoneSet set){ BlockRecordTypes.BaseStoneSet.getAllBlocks(set).forEach(block -> addBlocksToLists(block, set.base(), set.slab(), 1)); } - public static void plankBlocks(BlockRecordTypes.PlanksSet set, boolean vanilla) { + public static void plankBlocks(BlockRecordTypes.PlanksSet set) { BlockRecordTypes.PlanksSet.getAllBlocks(set).forEach(block -> addBlocksToLists(block, set.base(), set.slab(), 0)); WoodenVerticalSlabs.woodenVericalSlabs.add(set.verticalSlab()); Planks.planks.add(set.base()); - if(!vanilla) Planks.moddedPlanks.add(set.base()); + if(!BuiltInRegistries.BLOCK.getKey(set.base()).getNamespace().equals(ResourceLocation.DEFAULT_NAMESPACE)) { + Planks.moddedPlanks.add(set.base()); + } Planks.planksSlabs.add(set.slab()); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/NeoForgeDataGeneration.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/NeoForgeDataGeneration.java new file mode 100644 index 0000000000..1314656fa5 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/NeoForgeDataGeneration.java @@ -0,0 +1,129 @@ +package net.sevenstars.middleearth.datageneration; + +import net.minecraft.data.CachedOutput; +import net.minecraft.data.DataProvider; +import net.minecraft.data.PackOutput; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.data.loot.LootTableProvider; +import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.data.event.GatherDataEvent; +import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider; +import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.middleearth.datageneration.providers.BlockLootTableProvider; +import net.sevenstars.middleearth.datageneration.providers.LanguageProvider; +import net.sevenstars.middleearth.datageneration.providers.NeoForgeDataMapProvider; +import net.sevenstars.middleearth.datageneration.providers.models.BlockModelProvider; +import net.sevenstars.middleearth.datageneration.providers.models.ItemModelProvider; +import net.sevenstars.middleearth.datageneration.providers.recipes.ArtisanTableArmorRecipeProvider; +import net.sevenstars.middleearth.datageneration.providers.recipes.ArtisanTableGenericArmorRecipeProvider; +import net.sevenstars.middleearth.datageneration.providers.recipes.ArtisanTableHandheldRecipeProvider; +import net.sevenstars.middleearth.datageneration.providers.recipes.InscriptionRecipeProvider; +import net.sevenstars.middleearth.datageneration.providers.recipes.RecipeProvider; +import net.sevenstars.middleearth.datageneration.providers.tags.BlockTagProvider; +import net.sevenstars.middleearth.datageneration.providers.tags.ItemTagProvider; + +import java.util.List; +import java.util.Set; +import java.util.concurrent.CompletableFuture; + +@EventBusSubscriber(modid = MiddleEarth.NEOFORGE_MOD_ID) +public final class NeoForgeDataGeneration { + private NeoForgeDataGeneration() { + } + + @SubscribeEvent + public static void gatherData(GatherDataEvent event) { + DataGeneration.isDataGen = true; + CompletableFuture baseLookup = event.getLookupProvider(); + event.createDatapackRegistryObjects( + DataGeneration.createCompleteLookupRegistrySetBuilder(), + Set.of("middle-earth-datagen-lookup-only") + ); + + PackOutput output = event.getGenerator().getPackOutput(); + if (event.includeServer()) { + event.addProvider(new OutputRegistryProvider( + output, + baseLookup, + DataGeneration.createRegistrySetBuilder() + )); + event.createProvider(NeoForgeDataMapProvider::new); + event.createBlockAndItemTags( + (packOutput, lookup) -> new BlockTagProvider( + packOutput, lookup, event.getExistingFileHelper() + ), + (packOutput, lookup, blockTags) -> new ItemTagProvider( + packOutput, lookup, blockTags, event.getExistingFileHelper() + ) + ); + event.addProvider(new LootTableProvider( + output, + Set.of(), + List.of(new LootTableProvider.SubProviderEntry( + BlockLootTableProvider::new, + LootContextParamSets.BLOCK + )), + event.getLookupProvider() + )); + event.addProvider(namedProvider( + "Middle-earth recipes", + new RecipeProvider(output, event.getLookupProvider()) + )); + event.addProvider(namedProvider( + "Middle-earth inscription recipes", + new InscriptionRecipeProvider(output, event.getLookupProvider()) + )); + event.addProvider(namedProvider( + "Middle-earth artisan handheld recipes", + new ArtisanTableHandheldRecipeProvider(output, event.getLookupProvider()) + )); + event.addProvider(namedProvider( + "Middle-earth artisan armor recipes", + new ArtisanTableArmorRecipeProvider(output, event.getLookupProvider()) + )); + event.addProvider(namedProvider( + "Middle-earth artisan generic armor recipes", + new ArtisanTableGenericArmorRecipeProvider(output, event.getLookupProvider()) + )); + } + + if (event.includeClient()) { + HelpingGenerator.generateFiles(); + event.createProvider(LanguageProvider::new); + event.createProvider(BlockModelProvider::new); + event.createProvider(ItemModelProvider::new); + } + } + + private static DataProvider namedProvider(String name, DataProvider delegate) { + return new DataProvider() { + @Override + public CompletableFuture run(CachedOutput output) { + return delegate.run(output); + } + + @Override + public String getName() { + return name; + } + }; + } + + private static final class OutputRegistryProvider extends DatapackBuiltinEntriesProvider { + private OutputRegistryProvider( + PackOutput output, + CompletableFuture registries, + RegistrySetBuilder registryBuilder + ) { + super(output, registries, registryBuilder, Set.of(MiddleEarth.MOD_ID)); + } + + @Override + public String getName() { + return "Middle-earth registry objects"; + } + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/CustomItemModels.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/CustomItemModels.java index 7c1406ef29..4d6e4cad39 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/CustomItemModels.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/CustomItemModels.java @@ -1,26 +1,25 @@ package net.sevenstars.middleearth.datageneration.content; -import net.minecraft.client.data.Model; -import net.minecraft.client.data.TextureKey; +import net.minecraft.data.models.model.ModelTemplate; +import net.minecraft.data.models.model.TextureSlot; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; -import net.minecraft.util.Identifier; - import java.util.Optional; public class CustomItemModels { - public static final Model BIG_WEAPON = new Model(Optional.of( - MiddleEarth.of("item/big_weapon")), Optional.empty(), TextureKey.LAYER0); - public static final Model BIG_WEAPON_STAFF = new Model(Optional.of( - MiddleEarth.of("item/big_weapon_staff")), Optional.empty(), TextureKey.LAYER0); - public static final Model BIG_WEAPON_BLOCKING = new Model(Optional.of( - MiddleEarth.of("item/big_weapon_blocking")), Optional.of("_blocking"), TextureKey.LAYER0); - public static final Model BOW = new Model(Optional.of( - MiddleEarth.of("item/bow")), Optional.empty(), TextureKey.LAYER0); - public static final Model LONGBOW = new Model(Optional.of( - MiddleEarth.of("item/longbow")), Optional.empty(), TextureKey.LAYER0); - public static final Model DAGGER_STRIKE = new Model(Optional.of( - MiddleEarth.of("item/dagger_strike")), Optional.empty(), TextureKey.LAYER0); + public static final ModelTemplate BIG_WEAPON = new ModelTemplate(Optional.of( + MiddleEarth.of("item/big_weapon")), Optional.empty(), TextureSlot.LAYER0); + public static final ModelTemplate BIG_WEAPON_STAFF = new ModelTemplate(Optional.of( + MiddleEarth.of("item/big_weapon_staff")), Optional.empty(), TextureSlot.LAYER0); + public static final ModelTemplate BIG_WEAPON_BLOCKING = new ModelTemplate(Optional.of( + MiddleEarth.of("item/big_weapon_blocking")), Optional.of("_blocking"), TextureSlot.LAYER0); + public static final ModelTemplate BOW = new ModelTemplate(Optional.of( + MiddleEarth.of("item/bow")), Optional.empty(), TextureSlot.LAYER0); + public static final ModelTemplate LONGBOW = new ModelTemplate(Optional.of( + MiddleEarth.of("item/longbow")), Optional.empty(), TextureSlot.LAYER0); + public static final ModelTemplate DAGGER_STRIKE = new ModelTemplate(Optional.of( + MiddleEarth.of("item/dagger_strike")), Optional.empty(), TextureSlot.LAYER0); - public static final Model CROSSBOW = new Model(Optional.of( - Identifier.of("item/crossbow")), Optional.empty(), TextureKey.LAYER0); + public static final ModelTemplate CROSSBOW = new ModelTemplate(Optional.of( + ResourceLocation.parse("item/crossbow")), Optional.empty(), TextureSlot.LAYER0); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/MEModels.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/MEModels.java index 8b944a19e9..4dedb71c0b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/MEModels.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/MEModels.java @@ -1,110 +1,109 @@ package net.sevenstars.middleearth.datageneration.content; -import net.minecraft.client.data.Model; -import net.minecraft.client.data.TextureKey; +import net.minecraft.data.models.model.ModelTemplate; +import net.minecraft.data.models.model.TextureSlot; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; -import net.minecraft.util.Identifier; - import java.util.Optional; public class MEModels { - public static final Model VERTICAL_SLAB; - public static final Model VERTICAL_SLAB_INNER; - public static final Model VERTICAL_SLAB_OUTER; - public static final Model VERTICAL_COLUMN_SLAB; - public static final Model VERTICAL_COLUMN_SLAB_INNER; - public static final Model VERTICAL_COLUMN_SLAB_OUTER; + public static final ModelTemplate VERTICAL_SLAB; + public static final ModelTemplate VERTICAL_SLAB_INNER; + public static final ModelTemplate VERTICAL_SLAB_OUTER; + public static final ModelTemplate VERTICAL_COLUMN_SLAB; + public static final ModelTemplate VERTICAL_COLUMN_SLAB_INNER; + public static final ModelTemplate VERTICAL_COLUMN_SLAB_OUTER; - public static final Model COLUMN_WALL_POST; - public static final Model COLUMN_WALL_SIDE; - public static final Model COLUMN_WALL_SIDE_TALL; - public static final Model COLUMN_WALL_INVENTORY; + public static final ModelTemplate COLUMN_WALL_POST; + public static final ModelTemplate COLUMN_WALL_SIDE; + public static final ModelTemplate COLUMN_WALL_SIDE_TALL; + public static final ModelTemplate COLUMN_WALL_INVENTORY; - public static final Model WOOD_STOOL; - public static final Model WOOD_BENCH; - public static final Model WOOD_TABLE; - public static final Model WOOD_CHAIR; + public static final ModelTemplate WOOD_STOOL; + public static final ModelTemplate WOOD_BENCH; + public static final ModelTemplate WOOD_TABLE; + public static final ModelTemplate WOOD_CHAIR; - public static final Model STONE_STOOL; - public static final Model STONE_TABLE; - public static final Model STONE_CHAIR; + public static final ModelTemplate STONE_STOOL; + public static final ModelTemplate STONE_TABLE; + public static final ModelTemplate STONE_CHAIR; - public static final Model ROCKS_STAGE_0; - public static final Model ROCKS_STAGE_1; - public static final Model ROCKS_STAGE_2; - public static final Model ROCKS_STAGE_3; + public static final ModelTemplate ROCKS_STAGE_0; + public static final ModelTemplate ROCKS_STAGE_1; + public static final ModelTemplate ROCKS_STAGE_2; + public static final ModelTemplate ROCKS_STAGE_3; - public static final Model LARGE_DOOR_LEFT; - public static final Model LARGE_DOOR_LEFT_OPEN; - public static final Model LARGE_DOOR_RIGHT; - public static final Model LARGE_DOOR_RIGHT_OPEN; + public static final ModelTemplate LARGE_DOOR_LEFT; + public static final ModelTemplate LARGE_DOOR_LEFT_OPEN; + public static final ModelTemplate LARGE_DOOR_RIGHT; + public static final ModelTemplate LARGE_DOOR_RIGHT_OPEN; - public static final Model LARGE_THICK_DOOR_LEFT; - public static final Model LARGE_THICK_DOOR_LEFT_OPEN; - public static final Model LARGE_THICK_DOOR_RIGHT; - public static final Model LARGE_THICK_DOOR_RIGHT_OPEN; + public static final ModelTemplate LARGE_THICK_DOOR_LEFT; + public static final ModelTemplate LARGE_THICK_DOOR_LEFT_OPEN; + public static final ModelTemplate LARGE_THICK_DOOR_RIGHT; + public static final ModelTemplate LARGE_THICK_DOOR_RIGHT_OPEN; - public static final Model THICK_LADDER; + public static final ModelTemplate THICK_LADDER; - public static final Model LARGE_PLANT; - public static final Model TINTED_LARGE_PLANT; + public static final ModelTemplate LARGE_PLANT; + public static final ModelTemplate TINTED_LARGE_PLANT; - public static final Model CROP_VINE; + public static final ModelTemplate CROP_VINE; - public static final Model PATH_BLOCK; + public static final ModelTemplate PATH_BLOCK; - private static Model block(String parent, TextureKey... requiredTextureKeys) { - return new Model(Optional.of(Identifier.of(MiddleEarth.MOD_ID, "block/" + parent)), Optional.empty(), requiredTextureKeys); + private static ModelTemplate block(String parent, TextureSlot... requiredTextureKeys) { + return new ModelTemplate(Optional.of(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + parent)), Optional.empty(), requiredTextureKeys); } - private static Model block(String parent, String variant, TextureKey... requiredTextureKeys) { - return new Model(Optional.of(Identifier.of(MiddleEarth.MOD_ID, "block/" + parent)), Optional.of(variant), requiredTextureKeys); + private static ModelTemplate block(String parent, String variant, TextureSlot... requiredTextureKeys) { + return new ModelTemplate(Optional.of(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + parent)), Optional.of(variant), requiredTextureKeys); } static { - VERTICAL_SLAB = block("vertical_slab", TextureKey.ALL, TextureKey.PARTICLE); - VERTICAL_SLAB_INNER = block("vertical_slab_inner", "_inner", TextureKey.ALL, TextureKey.PARTICLE); - VERTICAL_SLAB_OUTER = block("vertical_slab_outer", "_outer", TextureKey.ALL, TextureKey.PARTICLE); - VERTICAL_COLUMN_SLAB = block("vertical_column_slab", TextureKey.TOP, TextureKey.BOTTOM, TextureKey.SIDE, TextureKey.PARTICLE); - VERTICAL_COLUMN_SLAB_INNER = block("vertical_column_slab_inner", "_inner", TextureKey.TOP, TextureKey.BOTTOM, TextureKey.SIDE, TextureKey.PARTICLE); - VERTICAL_COLUMN_SLAB_OUTER = block("vertical_column_slab_outer", "_outer", TextureKey.TOP, TextureKey.BOTTOM, TextureKey.SIDE, TextureKey.PARTICLE); - - COLUMN_WALL_POST = block("template_column_wall_post", "_post", TextureKey.TOP, TextureKey.BOTTOM, TextureKey.WALL, TextureKey.PARTICLE); - COLUMN_WALL_SIDE = block("template_column_wall_side", "_side", TextureKey.TOP, TextureKey.BOTTOM, TextureKey.WALL, TextureKey.PARTICLE); - COLUMN_WALL_SIDE_TALL = block("template_column_wall_side_tall", "_side_tall", TextureKey.TOP, TextureKey.BOTTOM, TextureKey.WALL, TextureKey.PARTICLE); - COLUMN_WALL_INVENTORY = block("template_column_wall_inventory", "_inventory", TextureKey.TOP, TextureKey.BOTTOM, TextureKey.WALL, TextureKey.PARTICLE); - - WOOD_STOOL = block("wood_stool_template", TextureKey.ALL, TextureKey.PARTICLE); - WOOD_BENCH = block("wood_bench_template", TextureKey.ALL, TextureKey.PARTICLE); - WOOD_TABLE = block("wood_table_template", TextureKey.ALL, TextureKey.PARTICLE); - WOOD_CHAIR = block("wood_chair_template", TextureKey.ALL, TextureKey.PARTICLE); - - STONE_STOOL = block("stone_stool_template", TextureKey.ALL, TextureKey.PARTICLE); - STONE_TABLE = block("stone_table_template", TextureKey.ALL, TextureKey.PARTICLE); - STONE_CHAIR = block("stone_chair_template", TextureKey.ALL, TextureKey.PARTICLE); - - ROCKS_STAGE_0 = block("rocks_stage_0_template", TextureKey.ALL, TextureKey.PARTICLE); - ROCKS_STAGE_1 = block("rocks_stage_1_template", "_1", TextureKey.ALL, TextureKey.PARTICLE); - ROCKS_STAGE_2 = block("rocks_stage_2_template", "_2", TextureKey.ALL, TextureKey.PARTICLE); - ROCKS_STAGE_3 = block("rocks_stage_3_template", "_3", TextureKey.ALL, TextureKey.PARTICLE); - - LARGE_DOOR_LEFT = block("large_door_left", TextureKey.ALL, TextureKey.PARTICLE); - LARGE_DOOR_LEFT_OPEN = block("large_door_left_open", TextureKey.ALL, TextureKey.PARTICLE); - LARGE_DOOR_RIGHT = block("large_door_right", TextureKey.ALL, TextureKey.PARTICLE); - LARGE_DOOR_RIGHT_OPEN = block("large_door_right_open", TextureKey.ALL, TextureKey.PARTICLE); - - LARGE_THICK_DOOR_LEFT = block("thick_large_door_left", TextureKey.ALL, TextureKey.PARTICLE); - LARGE_THICK_DOOR_LEFT_OPEN = block("thick_large_door_left_open", TextureKey.ALL, TextureKey.PARTICLE); - LARGE_THICK_DOOR_RIGHT = block("thick_large_door_right", TextureKey.ALL, TextureKey.PARTICLE); - LARGE_THICK_DOOR_RIGHT_OPEN = block("thick_large_door_right_open", TextureKey.ALL, TextureKey.PARTICLE); - - THICK_LADDER = block("thick_ladder", TextureKey.TEXTURE, TextureKey.PARTICLE); - - LARGE_PLANT = block("large_plant_template", TextureKey.ALL, TextureKey.PARTICLE); - TINTED_LARGE_PLANT = block("large_tinted_plant_template", TextureKey.ALL, TextureKey.PARTICLE); - - CROP_VINE = block("crop_no_shade_template", TextureKey.CROP); - - PATH_BLOCK = block("path_template", TextureKey.PARTICLE, TextureKey.TOP, TextureKey.SIDE, TextureKey.BOTTOM); + VERTICAL_SLAB = block("vertical_slab", TextureSlot.ALL, TextureSlot.PARTICLE); + VERTICAL_SLAB_INNER = block("vertical_slab_inner", "_inner", TextureSlot.ALL, TextureSlot.PARTICLE); + VERTICAL_SLAB_OUTER = block("vertical_slab_outer", "_outer", TextureSlot.ALL, TextureSlot.PARTICLE); + VERTICAL_COLUMN_SLAB = block("vertical_column_slab", TextureSlot.TOP, TextureSlot.BOTTOM, TextureSlot.SIDE, TextureSlot.PARTICLE); + VERTICAL_COLUMN_SLAB_INNER = block("vertical_column_slab_inner", "_inner", TextureSlot.TOP, TextureSlot.BOTTOM, TextureSlot.SIDE, TextureSlot.PARTICLE); + VERTICAL_COLUMN_SLAB_OUTER = block("vertical_column_slab_outer", "_outer", TextureSlot.TOP, TextureSlot.BOTTOM, TextureSlot.SIDE, TextureSlot.PARTICLE); + + COLUMN_WALL_POST = block("template_column_wall_post", "_post", TextureSlot.TOP, TextureSlot.BOTTOM, TextureSlot.WALL, TextureSlot.PARTICLE); + COLUMN_WALL_SIDE = block("template_column_wall_side", "_side", TextureSlot.TOP, TextureSlot.BOTTOM, TextureSlot.WALL, TextureSlot.PARTICLE); + COLUMN_WALL_SIDE_TALL = block("template_column_wall_side_tall", "_side_tall", TextureSlot.TOP, TextureSlot.BOTTOM, TextureSlot.WALL, TextureSlot.PARTICLE); + COLUMN_WALL_INVENTORY = block("template_column_wall_inventory", "_inventory", TextureSlot.TOP, TextureSlot.BOTTOM, TextureSlot.WALL, TextureSlot.PARTICLE); + + WOOD_STOOL = block("wood_stool_template", TextureSlot.ALL, TextureSlot.PARTICLE); + WOOD_BENCH = block("wood_bench_template", TextureSlot.ALL, TextureSlot.PARTICLE); + WOOD_TABLE = block("wood_table_template", TextureSlot.ALL, TextureSlot.PARTICLE); + WOOD_CHAIR = block("wood_chair_template", TextureSlot.ALL, TextureSlot.PARTICLE); + + STONE_STOOL = block("stone_stool_template", TextureSlot.ALL, TextureSlot.PARTICLE); + STONE_TABLE = block("stone_table_template", TextureSlot.ALL, TextureSlot.PARTICLE); + STONE_CHAIR = block("stone_chair_template", TextureSlot.ALL, TextureSlot.PARTICLE); + + ROCKS_STAGE_0 = block("rocks_stage_0_template", TextureSlot.ALL, TextureSlot.PARTICLE); + ROCKS_STAGE_1 = block("rocks_stage_1_template", "_1", TextureSlot.ALL, TextureSlot.PARTICLE); + ROCKS_STAGE_2 = block("rocks_stage_2_template", "_2", TextureSlot.ALL, TextureSlot.PARTICLE); + ROCKS_STAGE_3 = block("rocks_stage_3_template", "_3", TextureSlot.ALL, TextureSlot.PARTICLE); + + LARGE_DOOR_LEFT = block("large_door_left", TextureSlot.ALL, TextureSlot.PARTICLE); + LARGE_DOOR_LEFT_OPEN = block("large_door_left_open", TextureSlot.ALL, TextureSlot.PARTICLE); + LARGE_DOOR_RIGHT = block("large_door_right", TextureSlot.ALL, TextureSlot.PARTICLE); + LARGE_DOOR_RIGHT_OPEN = block("large_door_right_open", TextureSlot.ALL, TextureSlot.PARTICLE); + + LARGE_THICK_DOOR_LEFT = block("thick_large_door_left", TextureSlot.ALL, TextureSlot.PARTICLE); + LARGE_THICK_DOOR_LEFT_OPEN = block("thick_large_door_left_open", TextureSlot.ALL, TextureSlot.PARTICLE); + LARGE_THICK_DOOR_RIGHT = block("thick_large_door_right", TextureSlot.ALL, TextureSlot.PARTICLE); + LARGE_THICK_DOOR_RIGHT_OPEN = block("thick_large_door_right_open", TextureSlot.ALL, TextureSlot.PARTICLE); + + THICK_LADDER = block("thick_ladder", TextureSlot.TEXTURE, TextureSlot.PARTICLE); + + LARGE_PLANT = block("large_plant_template", TextureSlot.ALL, TextureSlot.PARTICLE); + TINTED_LARGE_PLANT = block("large_tinted_plant_template", TextureSlot.ALL, TextureSlot.PARTICLE); + + CROP_VINE = block("crop_no_shade_template", TextureSlot.CROP); + + PATH_BLOCK = block("path_template", TextureSlot.PARTICLE, TextureSlot.TOP, TextureSlot.SIDE, TextureSlot.BOTTOM); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/TranslationEntries.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/TranslationEntries.java index bcaea43e7e..e0ed47612a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/TranslationEntries.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/TranslationEntries.java @@ -1,9 +1,9 @@ package net.sevenstars.middleearth.datageneration.content; -import net.minecraft.block.Block; -import net.minecraft.entity.EntityType; -import net.minecraft.item.Item; -import net.minecraft.util.Identifier; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.registries.content.races.RacePools; import net.sevenstars.middleearth.resources.datas.structure_manager_datas.StructureManagerData; @@ -20,7 +20,7 @@ public class TranslationEntries { public static List itemEntries = new ArrayList<>() { }; - public static List spawnEggEntries = new ArrayList<>() { + public static List spawnEggEntries = new ArrayList<>() { }; public static List> entityEntries = new ArrayList<>() { @@ -41,9 +41,7 @@ public class TranslationEntries { }; public static List spawnEntries = new ArrayList<>() { }; - public static List inscriptionEntries = new ArrayList<>() { - }; public static Map manualEntries = new HashMap<>() { @@ -157,7 +155,7 @@ public class TranslationEntries { put("effect."+ MiddleEarth.MOD_ID +".restrained", "Restrained"); put("enchantment."+ MiddleEarth.MOD_ID +".ailment_protection", "Ailment Protection"); - put("enchantment."+ MiddleEarth.MOD_ID +".aule_blessing", "Aulë Blessing"); + put("enchantment."+ MiddleEarth.MOD_ID +".aule_blessing", "Aule's Blessing"); put("enchantment."+ MiddleEarth.MOD_ID +".bane_of_giants", "Bane of Giants"); put("enchantment."+ MiddleEarth.MOD_ID +".beheading", "Beheading"); put("enchantment."+ MiddleEarth.MOD_ID +".celerity", "Celerity"); @@ -316,7 +314,7 @@ public class TranslationEntries { put("block."+ MiddleEarth.MOD_ID +".faction_banner", "%s Banner"); - put(MiddleEarth.MOD_ID +".music.menu.swept_away", "Swept Away"); + put(MiddleEarth.MOD_ID + ".music.menu.swept_away", "Swept Away"); put("sounds."+ MiddleEarth.MOD_ID +".bellows_push", "Bellows blowing"); put("sounds."+ MiddleEarth.MOD_ID +".chisel_hit", "Chisel hits"); @@ -326,6 +324,7 @@ public class TranslationEntries { put("sounds."+ MiddleEarth.MOD_ID +".pipe_refill", "Pipe refills"); put("sounds."+ MiddleEarth.MOD_ID +".pipe_exhale", "Pipe exhales"); put("sounds."+ MiddleEarth.MOD_ID +".pipe_ignite", "Pipe ignites"); + put("sounds."+ MiddleEarth.MOD_ID +".pipe_cough", "Pipe coughs"); put("sounds."+ MiddleEarth.MOD_ID +".orc_drum", "Orc drums"); put("sounds."+ MiddleEarth.MOD_ID +".great_horn_idle", "Great Horn grunts"); put("sounds."+ MiddleEarth.MOD_ID +".great_horn_hurt", "Great Horn hurts"); @@ -485,8 +484,8 @@ public class TranslationEntries { put("spawn."+ MiddleEarth.MOD_ID +".none", "None"); - put(MiddleEarth.of("attribute_header").toTranslationKey("race_tooltip"), "Attributes : "); - put(MiddleEarth.of("no_attribute_change").toTranslationKey("race_tooltip"), "Nothing changes!"); + put(MiddleEarth.of("attribute_header").toLanguageKey("race_tooltip"), "Attributes : "); + put(MiddleEarth.of("no_attribute_change").toLanguageKey("race_tooltip"), "Nothing changes!"); put("tooltip."+ MiddleEarth.MOD_ID +".arkenstone_lore_0", "The fairest of gems found beneath"); put("tooltip."+ MiddleEarth.MOD_ID +".arkenstone_lore_1", "the lonely mountain."); @@ -669,6 +668,13 @@ public class TranslationEntries { put("ui."+ MiddleEarth.MOD_ID +".return_confirmation.title", "Onboarding Screen"); put("ui."+ MiddleEarth.MOD_ID +".return_confirmation.continue_character.title", "Return Button"); put("ui."+ MiddleEarth.MOD_ID +".return_confirmation.continue_character.content", "Go to Overworld"); + put("ui."+ MiddleEarth.MOD_ID +".return_confirmation.error.not_ready", "The passage is not ready yet."); + put("ui."+ MiddleEarth.MOD_ID +".return_confirmation.error.retry_later", "Please wait before trying again."); + put("ui."+ MiddleEarth.MOD_ID +".return_confirmation.error.invalid_session", "The starlight phial passage expired. Use the phial again."); + put("ui."+ MiddleEarth.MOD_ID +".return_confirmation.error.disabled", "Returning to the Overworld is disabled on this server."); + put("ui."+ MiddleEarth.MOD_ID +".return_confirmation.error.teleport_failed", "No safe Overworld destination is available. Try again shortly."); + put("ui."+ MiddleEarth.MOD_ID +".return_confirmation.error.persistence_failed", "Returned to the Overworld, but the Middle-earth return point could not be saved."); + put("ui."+ MiddleEarth.MOD_ID +".return_confirmation.error.internal_error", "The starlight phial passage failed unexpectedly."); put("ui."+ MiddleEarth.MOD_ID +".map_screen.button.fullscreen_toggle", "Toggle Fullscreen Button"); put("ui."+ MiddleEarth.MOD_ID +".map_screen.button.map_overlay_toggle", "Map Overlay Toggle Button"); @@ -833,6 +839,12 @@ public class TranslationEntries { put("emi.category."+ MiddleEarth.MOD_ID +".forge", "Forge"); put("emi.category."+ MiddleEarth.MOD_ID +".anvil_shaping", "Shaping Anvil"); put("emi.category."+ MiddleEarth.MOD_ID +".artisan_table", "Artisan Table"); + put("emi.category."+ MiddleEarth.MOD_ID +".inscription_table", "Inscription Table"); + put("recipe."+ MiddleEarth.MOD_ID +".metal_units", "%s metal units"); + put("recipe."+ MiddleEarth.MOD_ID +".ingot_equivalent", "%s ingot equivalent"); + put("recipe."+ MiddleEarth.MOD_ID +".hammer_strikes", "%s hammer strikes"); + put("recipe."+ MiddleEarth.MOD_ID +".level_cost", "%s levels"); + put("recipe."+ MiddleEarth.MOD_ID +".applies_enchantment", "Applies %s"); put("tag.item."+ MiddleEarth.MOD_ID +".anvil_items", "Anvil Items"); put("tag.item."+ MiddleEarth.MOD_ID +".bones", "Bones"); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/BlockDrops.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/BlockDrops.java index 33c74742c5..1ed6f0de85 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/BlockDrops.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/BlockDrops.java @@ -1,10 +1,9 @@ package net.sevenstars.middleearth.datageneration.content.loot_tables; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModBlocks; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/CropDrops.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/CropDrops.java index 6f7cd910f0..0f160a738b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/CropDrops.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/CropDrops.java @@ -1,38 +1,37 @@ package net.sevenstars.middleearth.datageneration.content.loot_tables; +import net.minecraft.advancements.critereon.StatePropertiesPredicate; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; import net.sevenstars.middleearth.block.special.crop.*; import net.sevenstars.middleearth.item.FoodItemsME; import net.sevenstars.middleearth.item.ResourceItemsME; -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.Items; -import net.minecraft.loot.condition.BlockStatePropertyLootCondition; -import net.minecraft.predicate.StatePredicate; - import java.util.ArrayList; import java.util.List; public class CropDrops { public static List crops = new ArrayList<>() { { - add(new CropDrop(BlockStatePropertyLootCondition.builder(ModNatureBlocks.TOMATO_CROP).properties(StatePredicate.Builder.create().exactMatch(TomatoCropBlock.AGE, 3)), + add(new CropDrop(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModNatureBlocks.TOMATO_CROP).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(TomatoCropBlock.AGE, 3)), ModNatureBlocks.TOMATO_CROP, FoodItemsME.TOMATO, ResourceItemsME.TOMATO_SEEDS)); - add(new CropDrop(BlockStatePropertyLootCondition.builder(ModNatureBlocks.BELL_PEPPER_CROP).properties(StatePredicate.Builder.create().exactMatch(BellpepperCropBlock.AGE, 4)), + add(new CropDrop(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModNatureBlocks.BELL_PEPPER_CROP).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(BellpepperCropBlock.AGE, 4)), ModNatureBlocks.BELL_PEPPER_CROP, FoodItemsME.BELL_PEPPER, ResourceItemsME.BELL_PEPPER_SEEDS)); - add(new CropDrop(BlockStatePropertyLootCondition.builder(ModNatureBlocks.CUCUMBER_CROP).properties(StatePredicate.Builder.create().exactMatch(CucumberCropBlock.AGE, 3)), + add(new CropDrop(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModNatureBlocks.CUCUMBER_CROP).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(CucumberCropBlock.AGE, 3)), ModNatureBlocks.CUCUMBER_CROP, FoodItemsME.CUCUMBER, ResourceItemsME.CUCUMBER_SEEDS)); - add(new CropDrop(BlockStatePropertyLootCondition.builder(ModNatureBlocks.FLAX_CROP).properties(StatePredicate.Builder.create().exactMatch(FlaxCropBlock.AGE, 3)), + add(new CropDrop(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModNatureBlocks.FLAX_CROP).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(FlaxCropBlock.AGE, 3)), ModNatureBlocks.FLAX_CROP, ResourceItemsME.FLAX, ResourceItemsME.FLAX_SEEDS)); - add(new CropDrop(BlockStatePropertyLootCondition.builder(ModNatureBlocks.GARLIC_CROP).properties(StatePredicate.Builder.create().exactMatch(GarlicCropBlock.AGE, 3)), + add(new CropDrop(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModNatureBlocks.GARLIC_CROP).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(GarlicCropBlock.AGE, 3)), ModNatureBlocks.GARLIC_CROP, FoodItemsME.GARLIC, FoodItemsME.GARLIC)); - add(new CropDrop(BlockStatePropertyLootCondition.builder(ModNatureBlocks.LEEK_CROP).properties(StatePredicate.Builder.create().exactMatch(LeekCropBlock.AGE, 3)), + add(new CropDrop(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModNatureBlocks.LEEK_CROP).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(LeekCropBlock.AGE, 3)), ModNatureBlocks.LEEK_CROP, FoodItemsME.LEEK, FoodItemsME.LEEK)); - add(new CropDrop(BlockStatePropertyLootCondition.builder(ModNatureBlocks.LETTUCE_CROP).properties(StatePredicate.Builder.create().exactMatch(LettuceCropBlock.AGE, 3)), + add(new CropDrop(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModNatureBlocks.LETTUCE_CROP).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(LettuceCropBlock.AGE, 3)), ModNatureBlocks.LETTUCE_CROP, FoodItemsME.LETTUCE, ResourceItemsME.LETTUCE_SEEDS)); - add(new CropDrop(BlockStatePropertyLootCondition.builder(ModNatureBlocks.ONION_CROP).properties(StatePredicate.Builder.create().exactMatch(OnionCropBlock.AGE, 3)), + add(new CropDrop(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModNatureBlocks.ONION_CROP).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(OnionCropBlock.AGE, 3)), ModNatureBlocks.ONION_CROP, FoodItemsME.ONION, FoodItemsME.ONION)); - add(new CropDrop(BlockStatePropertyLootCondition.builder(ModNatureBlocks.PIPEWEED_CROP).properties(StatePredicate.Builder.create().exactMatch(PipeweedCropBlock.AGE, 3)), + add(new CropDrop(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModNatureBlocks.PIPEWEED_CROP).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(PipeweedCropBlock.AGE, 3)), ModNatureBlocks.PIPEWEED_CROP, ResourceItemsME.PIPEWEED, ResourceItemsME.PIPEWEED_SEEDS)); } }; @@ -55,12 +54,12 @@ public class CropDrops { }; public static class CropDrop { - public BlockStatePropertyLootCondition.Builder builder; + public LootItemBlockStatePropertyCondition.Builder builder; public Block crop_block; public Item fruit; public Item seeds; - public CropDrop(BlockStatePropertyLootCondition.Builder builder, Block block, Item fruit, Item seeds) { + public CropDrop(LootItemBlockStatePropertyCondition.Builder builder, Block block, Item fruit, Item seeds) { this.builder = builder; this.crop_block = block; this.fruit = fruit; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/DynamicBlockDrops.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/DynamicBlockDrops.java new file mode 100644 index 0000000000..01c280b476 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/DynamicBlockDrops.java @@ -0,0 +1,19 @@ +package net.sevenstars.middleearth.datageneration.content.loot_tables; + +import net.minecraft.world.level.block.Block; + +import java.util.ArrayList; +import java.util.List; + +public final class DynamicBlockDrops { + public static final List BLOCKS = new ArrayList<>(); + + private DynamicBlockDrops() { + } + + public static void add(Block block) { + if (block != null) { + BLOCKS.add(block); + } + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/LeavesDrops.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/LeavesDrops.java index 077a3773d0..62dd19b205 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/LeavesDrops.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/LeavesDrops.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.loot_tables; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; import net.sevenstars.middleearth.block.registration.WoodBlockSets; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; @@ -25,6 +24,7 @@ public record LeavesDrop(Block block, Block drop) {} add(new LeavesDrop(WoodBlockSets.BLACK_PINE_SET.leaves, ModNatureBlocks.BLACK_PINE_SAPLING)); add(new LeavesDrop(WoodBlockSets.WHITE_SPRUCE_SET.leaves, ModNatureBlocks.WHITE_SPRUCE_SAPLING)); add(new LeavesDrop(WoodBlockSets.WILLOW_SET.leaves, ModNatureBlocks.WILLOW_SAPLING)); + add(new LeavesDrop(WoodBlockSets.PALE_OAK_SET.leaves, WoodBlockSets.PALE_OAK_SET.sapling)); add(new LeavesDrop(ModNatureBlocks.LEBETHRON_LEAVES, ModNatureBlocks.LEBETHRON_SAPLING)); add(new LeavesDrop(ModNatureBlocks.BERRY_HOLLY_LEAVES, ModNatureBlocks.HOLLY_SAPLING)); add(new LeavesDrop(ModNatureBlocks.DRY_LARCH_LEAVES, ModNatureBlocks.LARCH_SAPLING)); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/PotDrops.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/PotDrops.java index 32bd1e37a4..c0407d2721 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/PotDrops.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/loot_tables/PotDrops.java @@ -1,8 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.loot_tables; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; @@ -36,6 +35,7 @@ public class PotDrops { add(ModDecorativeBlocks.POTTED_YELLOW_FLOWER); add(ModDecorativeBlocks.POTTED_YELLOW_TROLLIUS); add(ModDecorativeBlocks.POTTED_TAN_SHRUB); + add(ModDecorativeBlocks.POTTED_BLUE_GENTIAN); add(ModDecorativeBlocks.POTTED_GREEN_JEWEL_CORNFLOWER); add(ModDecorativeBlocks.POTTED_NOBLEWHITE); add(ModDecorativeBlocks.POTTED_SCORCHED_SHRUB); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/HotMetalsModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/HotMetalsModel.java index 3774c56c3f..4bc016e4a9 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/HotMetalsModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/HotMetalsModel.java @@ -1,13 +1,12 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.item.ResourceItemsME; -import net.minecraft.item.Item; -import net.minecraft.item.Items; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.util.Identifier; - import java.util.ArrayList; import java.util.List; @@ -97,10 +96,10 @@ public record ShapingItem(Item item, Item output, int amount) {} //add(new ShapingTag(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "nugget_shaping")), ModResourceItems.MAIL_RING, 25)); //add(new ShapingTag(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "nugget_shaping")), ModResourceItems.SCALE, 25)); - add(new ShapingTag(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "ingot_shaping")), ResourceItemsME.SHORT_BLADE, 80)); - add(new ShapingTag(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "ingot_shaping")), ResourceItemsME.SHOVEL_HEAD, 80)); - add(new ShapingTag(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "ingot_shaping")), ResourceItemsME.SWORD_HILT, 80)); - add(new ShapingTag(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "ingot_shaping")), ResourceItemsME.SHIELD_BORDER, 80)); + add(new ShapingTag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "ingot_shaping")), ResourceItemsME.SHORT_BLADE, 80)); + add(new ShapingTag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "ingot_shaping")), ResourceItemsME.SHOVEL_HEAD, 80)); + add(new ShapingTag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "ingot_shaping")), ResourceItemsME.SWORD_HILT, 80)); + add(new ShapingTag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "ingot_shaping")), ResourceItemsME.SHIELD_BORDER, 80)); } }; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleArtefactModels.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleArtefactModels.java index 7b82339844..0967d6c1ce 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleArtefactModels.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleArtefactModels.java @@ -1,10 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; -import net.minecraft.block.Block; -import net.minecraft.item.Item; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.item.Item; public class SimpleArtefactModels { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleBigItemModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleBigItemModel.java index 09c74c0610..ec97bf6305 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleBigItemModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleBigItemModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; -import net.minecraft.item.Item; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.item.Item; public class SimpleBigItemModel { public static List items = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleBlockModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleBlockModel.java index 64317c81e8..b69ccb4945 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleBlockModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleBlockModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModBlocks; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleBowItemModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleBowItemModel.java index 1236eadb0c..6cd69d2288 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleBowItemModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleBowItemModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; -import net.minecraft.item.Item; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.item.Item; public class SimpleBowItemModel { public static List items = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleButtonModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleButtonModel.java index df1aae79f8..162c01ac35 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleButtonModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleButtonModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.level.block.Block; public class SimpleButtonModel { public record Button(Block block, Block button) {} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleCrossbowItemModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleCrossbowItemModel.java index 9594f43cdb..e874c81f1e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleCrossbowItemModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleCrossbowItemModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; -import net.minecraft.item.Item; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.item.Item; public class SimpleCrossbowItemModel { public static List items = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleDoorModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleDoorModel.java index 22ac7a95a8..2a18715d18 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleDoorModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleDoorModel.java @@ -1,9 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModBlocks; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleDoubleBlockModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleDoubleBlockModel.java index f7ed642d53..6de209ee97 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleDoubleBlockModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleDoubleBlockModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; import net.sevenstars.middleearth.item.ResourceItemsME; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleDyeableItemModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleDyeableItemModel.java index 39819419a4..4a6943bf7a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleDyeableItemModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleDyeableItemModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; -import net.minecraft.item.Item; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.item.Item; public class SimpleDyeableItemModel { public static List items = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFanModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFanModel.java index 69432d00c1..7b0706cf0c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFanModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFanModel.java @@ -1,8 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFenceGateModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFenceGateModel.java index 09a37ffa07..74548a5a73 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFenceGateModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFenceGateModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.level.block.Block; public class SimpleFenceGateModel { public record FenceGate(Block block, Block fenceGate) {} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFenceModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFenceModel.java index f0e2faba88..8ffc1c9d81 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFenceModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFenceModel.java @@ -1,9 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModBlocks; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFlowerBedModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFlowerBedModel.java index beaa41e390..b0a13b0afc 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFlowerBedModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFlowerBedModel.java @@ -1,8 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFlowerPotModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFlowerPotModel.java index 7fdea2aead..ef1dacb618 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFlowerPotModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleFlowerPotModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleHandheldItemModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleHandheldItemModel.java index 8558a6abb4..bfd57c5692 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleHandheldItemModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleHandheldItemModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; -import net.minecraft.item.Item; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.item.Item; public class SimpleHandheldItemModel { public static List items = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleItemModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleItemModel.java index 902ca4e726..756d50b210 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleItemModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleItemModel.java @@ -1,6 +1,6 @@ package net.sevenstars.middleearth.datageneration.content.models; -import net.minecraft.item.Item; +import net.minecraft.world.item.Item; import net.sevenstars.middleearth.block.registration.ModBlocks; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import net.sevenstars.middleearth.item.DecorativeItemsME; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleLadderModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleLadderModel.java index 3a823270da..14a5d1b601 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleLadderModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleLadderModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.GenericBlockSets; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleLayersModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleLayersModel.java index 8af237cb44..a4ca3dc959 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleLayersModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleLayersModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.sevenstars.middleearth.block.registration.ModBlocks; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleMushroomBlockModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleMushroomBlockModel.java index 016c6283b8..2efa4d39c4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleMushroomBlockModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleMushroomBlockModel.java @@ -1,8 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimplePaneModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimplePaneModel.java index 62b5c2cc92..d5614a5d2e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimplePaneModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimplePaneModel.java @@ -1,8 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimplePillarModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimplePillarModel.java index 3e9858fd36..e2a96edcc5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimplePillarModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimplePillarModel.java @@ -1,10 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModBlocks; import net.sevenstars.middleearth.block.registration.StoneBlockSets; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimplePressurePlateModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimplePressurePlateModel.java index 118e99d3f1..9afdf403c5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimplePressurePlateModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimplePressurePlateModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.level.block.Block; public class SimplePressurePlateModel { public record PressurePlate(Block block, Block pressurePlate) {} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleRocksModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleRocksModel.java index 68ee664f7f..74dfe6cb38 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleRocksModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleRocksModel.java @@ -1,9 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModBlocks; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleSlabModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleSlabModel.java index 32df2d4d71..72b9c92ad0 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleSlabModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleSlabModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.sevenstars.middleearth.block.registration.ModBlocks; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleSpearModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleSpearModel.java index 1f6e6a2fc9..af7da344bb 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleSpearModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleSpearModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; -import net.minecraft.item.Item; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.item.Item; public class SimpleSpearModel { public static List items = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleStairModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleStairModel.java index 04eb4c9f5d..4cfa9ae9b6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleStairModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleStairModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.sevenstars.middleearth.block.registration.ModBlocks; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleStoneChairModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleStoneChairModel.java index 31ac2cc08e..b0688d1913 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleStoneChairModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleStoneChairModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.level.block.Block; public class SimpleStoneChairModel { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleStoneStoolModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleStoneStoolModel.java index e045814c37..5001d960a4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleStoneStoolModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleStoneStoolModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.level.block.Block; public class SimpleStoneStoolModel { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleStoneTableModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleStoneTableModel.java index 5e9c4ffc7b..041e6c95d5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleStoneTableModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleStoneTableModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.level.block.Block; public class SimpleStoneTableModel { public record Table(Block base, Block table) {} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleTopWaterModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleTopWaterModel.java index 357a14fab0..9686d6b749 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleTopWaterModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleTopWaterModel.java @@ -1,8 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleTrapDoorModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleTrapDoorModel.java index 53b908cf3d..9fb29a4690 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleTrapDoorModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleTrapDoorModel.java @@ -1,9 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModBlocks; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleVerticalSlabModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleVerticalSlabModel.java index 9500e69493..24679b9110 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleVerticalSlabModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleVerticalSlabModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.sevenstars.middleearth.block.registration.ModBlocks; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWallModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWallModel.java index 42f7492c62..7bbfb72e6b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWallModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWallModel.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.sevenstars.middleearth.block.registration.ModBlocks; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWoodBenchModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWoodBenchModel.java index 4a8361abc9..e015f4917e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWoodBenchModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWoodBenchModel.java @@ -1,9 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWoodChairModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWoodChairModel.java index 2cb1cd000c..278d4fc08d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWoodChairModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWoodChairModel.java @@ -1,9 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWoodStoolModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWoodStoolModel.java index 697ffff94d..ba4804999f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWoodStoolModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWoodStoolModel.java @@ -1,9 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWoodTableModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWoodTableModel.java index 9ad08b3236..c8ba890b7d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWoodTableModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/SimpleWoodTableModel.java @@ -1,9 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.models; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/TintableCrossModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/TintableCrossModel.java index 5434e8efd9..170e03d23a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/TintableCrossModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/models/TintableCrossModel.java @@ -1,135 +1,135 @@ package net.sevenstars.middleearth.datageneration.content.models; -import net.sevenstars.middleearth.block.registration.ModNatureBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; +import java.util.LinkedHashSet; import java.util.List; +import net.minecraft.world.level.block.Block; +import net.sevenstars.middleearth.block.registration.ModNatureBlocks; -public class TintableCrossModel { - public static List notTintedBlocks = new ArrayList<>() { - { - add(ModNatureBlocks.WILD_CUCUMBER); - add(ModNatureBlocks.WILD_LEEK); - add(ModNatureBlocks.WILD_LETTUCE); - add(ModNatureBlocks.WILD_GARLIC); - add(ModNatureBlocks.WILD_ONION); - add(ModNatureBlocks.WILD_FLAX); - add(ModNatureBlocks.WILD_TOMATO); - add(ModNatureBlocks.WILD_WHEAT); - add(ModNatureBlocks.WILD_BELL_PEPPER); - - add(ModNatureBlocks.BROWN_BOLETE); - add(ModNatureBlocks.CAVE_AMANITA); - add(ModNatureBlocks.DEEP_FIRECAP); - add(ModNatureBlocks.GHOSTSHROOM); - add(ModNatureBlocks.MORSEL); - add(ModNatureBlocks.SKY_FIRECAP); - add(ModNatureBlocks.TRUMPET_SHROOM); - add(ModNatureBlocks.TUBESHRROM); - add(ModNatureBlocks.VIOLET_CAPS); - add(ModNatureBlocks.WHITE_MUSHROOM); - add(ModNatureBlocks.YELLOW_AMANITA); - - add(ModNatureBlocks.BLUE_GENTIAN); - add(ModNatureBlocks.GREEN_JEWEL_CORNFLOWER); - add(ModNatureBlocks.NOBLEWHITE); - - add(ModNatureBlocks.ELANOR); - add(ModNatureBlocks.MALLOS); - add(ModNatureBlocks.NIPHREDIL); - add(ModNatureBlocks.SIMBELMYNE); - add(ModNatureBlocks.YELLOW_FLOWER); - - add(ModNatureBlocks.LIGHT_BLUE_FLOWERS); - add(ModNatureBlocks.MAGENTA_FLOWERS); - add(ModNatureBlocks.ORANGE_FLOWERS); - add(ModNatureBlocks.PINK_FLOWERS); - add(ModNatureBlocks.PURPLE_FLOWERS); - add(ModNatureBlocks.RED_FLOWERS); - add(ModNatureBlocks.WHITE_FLOWERS); - add(ModNatureBlocks.YELLOW_FLOWERS); - - add(ModNatureBlocks.BLUE_LAVENDER); - add(ModNatureBlocks.LAVENDER); - add(ModNatureBlocks.WHITE_LAVENDER); - add(ModNatureBlocks.YELLOW_TROLLIUS); - } - }; - public static List tintedBlocks = new ArrayList<>() { - { - add(ModNatureBlocks.GRASS_TUFT); - add(ModNatureBlocks.MEADOWGRASS); - add(ModNatureBlocks.SPARSE_GRASS); - add(ModNatureBlocks.NETTLES); - add(ModNatureBlocks.THISTLE); - add(ModNatureBlocks.WHEATGRASS); - } - }; - - public static List grassLikeBlocks = new ArrayList<>() - { - { - add(ModNatureBlocks.ATHELAS); +public final class TintableCrossModel { + private static final List registeredNotTintedBlocks = new ArrayList<>(); - add(ModNatureBlocks.SHORT_HOGWEED); + private TintableCrossModel() { + } - add(ModNatureBlocks.BROWN_GRASS); - add(ModNatureBlocks.GREEN_SHRUB); - add(ModNatureBlocks.SMALL_DRY_SHRUB); - add(ModNatureBlocks.FROZEN_SHRUB); - add(ModNatureBlocks.TAN_SHRUB); + public static void addNotTintedBlock(Block block) { + registeredNotTintedBlocks.add(block); + } - add(ModNatureBlocks.BLUE_FESCUE); - add(ModNatureBlocks.DYING_GRASS); - add(ModNatureBlocks.FROZEN_GRASS); - add(ModNatureBlocks.GRIM_GRASS); - add(ModNatureBlocks.TEMPERATE_GRASS); - add(ModNatureBlocks.FROZEN_TUFT); - add(ModNatureBlocks.HEATHER); - add(ModNatureBlocks.RED_HEATHER); - add(ModNatureBlocks.DEAD_HEATHER); - add(ModNatureBlocks.DRY_HEATHER); - add(ModNatureBlocks.HEATH); - add(ModNatureBlocks.WILDERGRASS); - add(ModNatureBlocks.BEACH_GRASS); - add(ModNatureBlocks.COASTAL_PANIC_GRASS); - add(ModNatureBlocks.MISTWEED); - add(ModNatureBlocks.SEDUM); - add(ModNatureBlocks.ORANGE_SEDUM); - add(ModNatureBlocks.RED_SEDUM); - add(ModNatureBlocks.YELLOW_SEDUM); - add(ModNatureBlocks.BRAMBLES_OF_MORDOR); - add(ModNatureBlocks.SHORT_DEAD_RUSHES); - add(ModNatureBlocks.SHORT_RUSHES); - add(ModNatureBlocks.SHORT_REEDS); - add(ModNatureBlocks.SHORT_CATTAILS); - add(ModNatureBlocks.SHORT_BULRUSH); + public static List notTintedBlocks() { + LinkedHashSet blocks = new LinkedHashSet<>(registeredNotTintedBlocks); + blocks.addAll(List.of( + ModNatureBlocks.WILD_CUCUMBER, + ModNatureBlocks.WILD_LEEK, + ModNatureBlocks.WILD_LETTUCE, + ModNatureBlocks.WILD_GARLIC, + ModNatureBlocks.WILD_ONION, + ModNatureBlocks.WILD_FLAX, + ModNatureBlocks.WILD_TOMATO, + ModNatureBlocks.WILD_WHEAT, + ModNatureBlocks.WILD_BELL_PEPPER, + ModNatureBlocks.BROWN_BOLETE, + ModNatureBlocks.CAVE_AMANITA, + ModNatureBlocks.DEEP_FIRECAP, + ModNatureBlocks.GHOSTSHROOM, + ModNatureBlocks.MORSEL, + ModNatureBlocks.SKY_FIRECAP, + ModNatureBlocks.TRUMPET_SHROOM, + ModNatureBlocks.TUBESHRROM, + ModNatureBlocks.VIOLET_CAPS, + ModNatureBlocks.WHITE_MUSHROOM, + ModNatureBlocks.YELLOW_AMANITA, + ModNatureBlocks.BLUE_GENTIAN, + ModNatureBlocks.GREEN_JEWEL_CORNFLOWER, + ModNatureBlocks.NOBLEWHITE, + ModNatureBlocks.ELANOR, + ModNatureBlocks.MALLOS, + ModNatureBlocks.NIPHREDIL, + ModNatureBlocks.SIMBELMYNE, + ModNatureBlocks.YELLOW_FLOWER, + ModNatureBlocks.LIGHT_BLUE_FLOWERS, + ModNatureBlocks.MAGENTA_FLOWERS, + ModNatureBlocks.ORANGE_FLOWERS, + ModNatureBlocks.PINK_FLOWERS, + ModNatureBlocks.PURPLE_FLOWERS, + ModNatureBlocks.RED_FLOWERS, + ModNatureBlocks.WHITE_FLOWERS, + ModNatureBlocks.YELLOW_FLOWERS, + ModNatureBlocks.BLUE_LAVENDER, + ModNatureBlocks.LAVENDER, + ModNatureBlocks.WHITE_LAVENDER, + ModNatureBlocks.YELLOW_TROLLIUS + )); + return List.copyOf(blocks); + } - add(ModNatureBlocks.SHRIVELED_SHRUB); + public static List tintedBlocks() { + return List.of( + ModNatureBlocks.GRASS_TUFT, + ModNatureBlocks.MEADOWGRASS, + ModNatureBlocks.SPARSE_GRASS, + ModNatureBlocks.NETTLES, + ModNatureBlocks.THISTLE, + ModNatureBlocks.WHEATGRASS + ); + } - add(ModNatureBlocks.SCORCHED_GRASS); - add(ModNatureBlocks.SCORCHED_TUFT); - add(ModNatureBlocks.SCORCHED_SHRUB); - } - }; + public static List grassLikeBlocks() { + return List.of( + ModNatureBlocks.ATHELAS, + ModNatureBlocks.SHORT_HOGWEED, + ModNatureBlocks.BROWN_GRASS, + ModNatureBlocks.GREEN_SHRUB, + ModNatureBlocks.SMALL_DRY_SHRUB, + ModNatureBlocks.FROZEN_SHRUB, + ModNatureBlocks.TAN_SHRUB, + ModNatureBlocks.BLUE_FESCUE, + ModNatureBlocks.DYING_GRASS, + ModNatureBlocks.FROZEN_GRASS, + ModNatureBlocks.GRIM_GRASS, + ModNatureBlocks.TEMPERATE_GRASS, + ModNatureBlocks.FROZEN_TUFT, + ModNatureBlocks.HEATHER, + ModNatureBlocks.RED_HEATHER, + ModNatureBlocks.DEAD_HEATHER, + ModNatureBlocks.DRY_HEATHER, + ModNatureBlocks.HEATH, + ModNatureBlocks.WILDERGRASS, + ModNatureBlocks.BEACH_GRASS, + ModNatureBlocks.COASTAL_PANIC_GRASS, + ModNatureBlocks.MISTWEED, + ModNatureBlocks.SEDUM, + ModNatureBlocks.ORANGE_SEDUM, + ModNatureBlocks.RED_SEDUM, + ModNatureBlocks.YELLOW_SEDUM, + ModNatureBlocks.BRAMBLES_OF_MORDOR, + ModNatureBlocks.SHORT_DEAD_RUSHES, + ModNatureBlocks.SHORT_RUSHES, + ModNatureBlocks.SHORT_REEDS, + ModNatureBlocks.SHORT_CATTAILS, + ModNatureBlocks.SHORT_BULRUSH, + ModNatureBlocks.SHRIVELED_SHRUB, + ModNatureBlocks.SCORCHED_GRASS, + ModNatureBlocks.SCORCHED_TUFT, + ModNatureBlocks.SCORCHED_SHRUB + ); + } - public static List largePlants = new ArrayList<>() - { - { - add(ModNatureBlocks.CAMPION); - add(ModNatureBlocks.BLUE_BIGLEAF_HYDRANGEA); - add(ModNatureBlocks.PINK_BIGLEAF_HYDRANGEA); - add(ModNatureBlocks.WHITE_BIGLEAF_HYDRANGEA); - add(ModNatureBlocks.DEAD_HEATHER_BUSH); - add(ModNatureBlocks.DRY_HEATHER_BUSH); - add(ModNatureBlocks.DEAD_RUSHES); - add(ModNatureBlocks.FALSE_OATGRASS); - add(ModNatureBlocks.HEATHER_BUSH); - add(ModNatureBlocks.LARGE_BLUE_FESCUE); - add(ModNatureBlocks.LARGE_SHRIVELED_SHRUB); - add(ModNatureBlocks.RED_HEATHER_BUSH); - add(ModNatureBlocks.RUSHES); - } - }; + public static List largePlants() { + return List.of( + ModNatureBlocks.CAMPION, + ModNatureBlocks.BLUE_BIGLEAF_HYDRANGEA, + ModNatureBlocks.PINK_BIGLEAF_HYDRANGEA, + ModNatureBlocks.WHITE_BIGLEAF_HYDRANGEA, + ModNatureBlocks.DEAD_HEATHER_BUSH, + ModNatureBlocks.DRY_HEATHER_BUSH, + ModNatureBlocks.DEAD_RUSHES, + ModNatureBlocks.FALSE_OATGRASS, + ModNatureBlocks.HEATHER_BUSH, + ModNatureBlocks.LARGE_BLUE_FESCUE, + ModNatureBlocks.LARGE_SHRIVELED_SHRUB, + ModNatureBlocks.RED_HEATHER_BUSH, + ModNatureBlocks.RUSHES + ); + } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/ArmorTags.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/ArmorTags.java index e939410cd3..7921f68494 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/ArmorTags.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/ArmorTags.java @@ -1,6 +1,6 @@ package net.sevenstars.middleearth.datageneration.content.tags; -import net.minecraft.item.Item; +import net.minecraft.world.item.Item; import net.sevenstars.middleearth.block.special.forge.MetalTypes; import net.sevenstars.middleearth.item.EquipmentItemsME; import net.sevenstars.middleearth.resources.datas.common.DispositionType; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Bows.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Bows.java index 27f8c94264..86797aed31 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Bows.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Bows.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.tags; -import net.minecraft.item.Item; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.item.Item; public class Bows { public static List bows = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Buttons.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Buttons.java index 6bae23ed79..bcb30f00a5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Buttons.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Buttons.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.tags; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.level.block.Block; public class Buttons { public static List stoneButtons = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Crops.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Crops.java index 26dfea0ff3..f3d72f3898 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Crops.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Crops.java @@ -1,8 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.tags; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Crossbows.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Crossbows.java index afd6155fb9..17bfc3803c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Crossbows.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Crossbows.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.tags; -import net.minecraft.item.Item; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.item.Item; public class Crossbows { public static List crossbows = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Doors.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Doors.java index 7e7b79f610..5cf2e09750 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Doors.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Doors.java @@ -1,8 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.tags; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/FenceGates.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/FenceGates.java index af12dc1e98..8d20b7e90c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/FenceGates.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/FenceGates.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.tags; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.level.block.Block; public class FenceGates { public static List fenceGates = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Fences.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Fences.java index c2188c8e8e..42893780f1 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Fences.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Fences.java @@ -1,6 +1,6 @@ package net.sevenstars.middleearth.datageneration.content.tags; -import net.minecraft.block.Block; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModBlocks; import java.util.ArrayList; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/LeavesSets.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/LeavesSets.java index 5fbf59a135..1abad2d3c4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/LeavesSets.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/LeavesSets.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.tags; -import net.minecraft.item.Item; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Logs.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Logs.java index 4299c07031..c4d5f8a97a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Logs.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Logs.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.tags; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; -import net.minecraft.block.Block; -import net.minecraft.item.Item; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/LogsThatBurn.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/LogsThatBurn.java index cea28b1eac..02688ecb7e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/LogsThatBurn.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/LogsThatBurn.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.tags; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.level.block.Block; public class LogsThatBurn { public static List logsThatBurn = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/MineableAxe.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/MineableAxe.java index 17bc4611ca..4e48104658 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/MineableAxe.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/MineableAxe.java @@ -1,10 +1,9 @@ package net.sevenstars.middleearth.datageneration.content.tags; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModBlocks; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; @@ -44,19 +43,6 @@ public class MineableAxe { add(ModDecorativeBlocks.RUINED_DWARVEN_DOOR); add(ModDecorativeBlocks.GREAT_ELVEN_GATE); - add(ModDecorativeBlocks.THIN_BARREL); - add(ModDecorativeBlocks.SMALL_CRATE); - - add(ModDecorativeBlocks.BEECH_COFFER); - add(ModDecorativeBlocks.CHESTNUT_COFFER); - add(ModDecorativeBlocks.FIR_COFFER); - add(ModDecorativeBlocks.LARCH_COFFER); - add(ModDecorativeBlocks.OAK_COFFER); - add(ModDecorativeBlocks.PINE_COFFER); - add(ModDecorativeBlocks.SPRUCE_COFFER); - add(ModDecorativeBlocks.WILLOW_COFFER); - add(ModDecorativeBlocks.REINFORCED_CHEST); - add(ModBlocks.AGED_WOOD_TRAPDOOR); add(ModBlocks.BLACK_WATTLE_TRAPDOOR); add(ModBlocks.DARK_WATTLE_TRAPDOOR); @@ -74,6 +60,19 @@ public class MineableAxe { add(ModDecorativeBlocks.TREATED_WOOD_TABLE); add(ModDecorativeBlocks.TREATED_WOOD_BENCH); + add(ModDecorativeBlocks.THIN_BARREL); + add(ModDecorativeBlocks.SMALL_CRATE); + + add(ModDecorativeBlocks.BEECH_COFFER); + add(ModDecorativeBlocks.CHESTNUT_COFFER); + add(ModDecorativeBlocks.FIR_COFFER); + add(ModDecorativeBlocks.LARCH_COFFER); + add(ModDecorativeBlocks.OAK_COFFER); + add(ModDecorativeBlocks.PINE_COFFER); + add(ModDecorativeBlocks.SPRUCE_COFFER); + add(ModDecorativeBlocks.WILLOW_COFFER); + add(ModDecorativeBlocks.REINFORCED_CHEST); + add(ModNatureBlocks.BROWN_BOLETE_BLOCK); add(ModNatureBlocks.CAVE_AMANITA_BLOCK); add(ModNatureBlocks.DEEP_FIRECAP_BLOCK); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/MineableHoe.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/MineableHoe.java index 7bfab5ace2..2403ebaedc 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/MineableHoe.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/MineableHoe.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.tags; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModBlocks; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/MineablePickaxe.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/MineablePickaxe.java index 70ede9b811..640d2bb8a8 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/MineablePickaxe.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/MineablePickaxe.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.tags; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModBlocks; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/MineableShovel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/MineableShovel.java index 27436e08bf..e4e37dbe9c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/MineableShovel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/MineableShovel.java @@ -1,6 +1,6 @@ package net.sevenstars.middleearth.datageneration.content.tags; -import net.minecraft.block.Block; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModBlocks; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; @@ -9,115 +9,108 @@ public class MineableShovel { public static List blocks = new ArrayList<>() { - { - add(ModBlocks.ASH_BLOCK); - add(ModBlocks.RIVER_SAND); - add(ModBlocks.BLACK_SAND); - add(ModBlocks.WHITE_SAND); - add(ModBlocks.SNOWY_GRASS_BLOCK); - add(ModNatureBlocks.OLD_PODZOL); - add(ModNatureBlocks.LORIEN_PODZOL); - - add(ModBlocks.GRASSY_DIRT); - add(ModBlocks.GRASSY_DIRT_SLAB); - add(ModBlocks.GRASSY_DIRT_STAIRS); - - add(ModBlocks.CHALKSOIL_GRASS_BLOCK); - add(ModBlocks.CHALKSOIL); - add(ModBlocks.CHALKSOIL_SLAB); - add(ModBlocks.CHALKSOIL_STAIRS); - add(ModBlocks.GRASSY_CHALKSOIL); - add(ModBlocks.GRASSY_CHALKSOIL_SLAB); - add(ModBlocks.GRASSY_CHALKSOIL_STAIRS); - add(ModBlocks.COARSE_CHALKSOIL); - add(ModBlocks.COARSE_CHALKSOIL_SLAB); - add(ModBlocks.COARSE_CHALKSOIL_STAIRS); - add(ModBlocks.CHALKSOIL_PATH); - add(ModBlocks.CHALKSOIL_FARMLAND); - - add(ModBlocks.LOAM_GRASS_BLOCK); - add(ModBlocks.LOAM); - add(ModBlocks.LOAM_SLAB); - add(ModBlocks.LOAM_STAIRS); - add(ModBlocks.GRASSY_LOAM); - add(ModBlocks.GRASSY_LOAM_SLAB); - add(ModBlocks.GRASSY_LOAM_STAIRS); - add(ModBlocks.COARSE_LOAM); - add(ModBlocks.COARSE_LOAM_SLAB); - add(ModBlocks.COARSE_LOAM_STAIRS); - add(ModBlocks.LOAM_PATH); - add(ModBlocks.LOAM_FARMLAND); - - add(ModBlocks.PEAT_GRASS_BLOCK); - add(ModBlocks.PEAT); - add(ModBlocks.PEAT_SLAB); - add(ModBlocks.PEAT_STAIRS); - add(ModBlocks.GRASSY_PEAT); - add(ModBlocks.GRASSY_PEAT_SLAB); - add(ModBlocks.GRASSY_PEAT_STAIRS); - add(ModBlocks.COARSE_PEAT); - add(ModBlocks.COARSE_PEAT_SLAB); - add(ModBlocks.COARSE_PEAT_STAIRS); - add(ModBlocks.PEAT_PATH); - add(ModBlocks.PEAT_FARMLAND); - - add(ModBlocks.SILT_GRASS_BLOCK); - add(ModBlocks.SILT); - add(ModBlocks.SILT_SLAB); - add(ModBlocks.SILT_STAIRS); - add(ModBlocks.GRASSY_SILT); - add(ModBlocks.GRASSY_SILT_SLAB); - add(ModBlocks.GRASSY_SILT_STAIRS); - add(ModBlocks.COARSE_SILT); - add(ModBlocks.COARSE_SILT_SLAB); - add(ModBlocks.COARSE_SILT_STAIRS); - add(ModBlocks.SILT_PATH); - add(ModBlocks.SILT_FARMLAND); - - add(ModBlocks.TURF); - add(ModBlocks.TURF_SLAB); - add(ModBlocks.TURF_STAIRS); - add(ModBlocks.TURF_VERTICAL_SLAB); - - add(ModBlocks.MIRE); - add(ModBlocks.MIRE_SLAB); - add(ModBlocks.MIRE_STAIRS); - - add(ModBlocks.ASHEN_SAND); - add(ModBlocks.ASHEN_SAND_LAYER); - - add(ModBlocks.ASHEN_GRAVEL); - add(ModBlocks.ASHEN_GRAVEL_LAYER); - - add(ModBlocks.WASTE_PILE); - add(ModBlocks.WASTE_PILE_LAYER); - - add(ModBlocks.DRY_DIRT); - add(ModBlocks.DRY_DIRT_SLAB); - add(ModBlocks.DRY_DIRT_STAIRS); - - add(ModBlocks.FOUL_DIRT); - add(ModBlocks.FOUL_DIRT_SLAB); - add(ModBlocks.FOUL_DIRT_STAIRS); - - add(ModBlocks.DIRTY_ROOTS); - add(ModBlocks.DIRTY_ROOTS_SLAB); - add(ModBlocks.DIRTY_ROOTS_STAIRS); - - add(ModBlocks.ASHEN_DIRT); - add(ModBlocks.ASHEN_DIRT_SLAB); - add(ModBlocks.ASHEN_DIRT_STAIRS); - - add(ModBlocks.COBBLY_ASHEN_DIRT); - add(ModBlocks.COBBLY_ASHEN_DIRT_SLAB); - add(ModBlocks.COBBLY_ASHEN_DIRT_STAIRS); - - add(ModBlocks.COBBLY_DIRT); - add(ModBlocks.COBBLY_DIRT_SLAB); - add(ModBlocks.COBBLY_DIRT_STAIRS); - - add(ModBlocks.SNOWY_DIRT); - add(ModBlocks.SNOWY_DIRT_SLAB); - add(ModBlocks.SNOWY_DIRT_STAIRS); - }}; + { + add(ModBlocks.ASH_BLOCK); + add(ModBlocks.RIVER_SAND); + add(ModBlocks.BLACK_SAND); + add(ModBlocks.WHITE_SAND); + add(ModBlocks.SNOWY_GRASS_BLOCK); + add(ModNatureBlocks.OLD_PODZOL); + add(ModNatureBlocks.LORIEN_PODZOL); + + add(ModBlocks.GRASSY_DIRT); + add(ModBlocks.GRASSY_DIRT_SLAB); + add(ModBlocks.GRASSY_DIRT_STAIRS); + + add(ModBlocks.CHALKSOIL_GRASS_BLOCK); + add(ModBlocks.CHALKSOIL); + add(ModBlocks.CHALKSOIL_SLAB); + add(ModBlocks.CHALKSOIL_STAIRS); + add(ModBlocks.GRASSY_CHALKSOIL); + add(ModBlocks.GRASSY_CHALKSOIL_SLAB); + add(ModBlocks.GRASSY_CHALKSOIL_STAIRS); + add(ModBlocks.COARSE_CHALKSOIL); + add(ModBlocks.COARSE_CHALKSOIL_SLAB); + add(ModBlocks.COARSE_CHALKSOIL_STAIRS); + add(ModBlocks.CHALKSOIL_PATH); + add(ModBlocks.CHALKSOIL_FARMLAND); + + add(ModBlocks.LOAM_GRASS_BLOCK); + add(ModBlocks.LOAM); + add(ModBlocks.LOAM_SLAB); + add(ModBlocks.LOAM_STAIRS); + add(ModBlocks.GRASSY_LOAM); + add(ModBlocks.GRASSY_LOAM_SLAB); + add(ModBlocks.GRASSY_LOAM_STAIRS); + add(ModBlocks.COARSE_LOAM); + add(ModBlocks.COARSE_LOAM_SLAB); + add(ModBlocks.COARSE_LOAM_STAIRS); + add(ModBlocks.LOAM_PATH); + add(ModBlocks.LOAM_FARMLAND); + + add(ModBlocks.PEAT_GRASS_BLOCK); + add(ModBlocks.PEAT); + add(ModBlocks.PEAT_SLAB); + add(ModBlocks.PEAT_STAIRS); + add(ModBlocks.GRASSY_PEAT); + add(ModBlocks.GRASSY_PEAT_SLAB); + add(ModBlocks.GRASSY_PEAT_STAIRS); + add(ModBlocks.COARSE_PEAT); + add(ModBlocks.COARSE_PEAT_SLAB); + add(ModBlocks.COARSE_PEAT_STAIRS); + add(ModBlocks.PEAT_PATH); + add(ModBlocks.PEAT_FARMLAND); + + add(ModBlocks.SILT_GRASS_BLOCK); + add(ModBlocks.SILT); + add(ModBlocks.SILT_SLAB); + add(ModBlocks.SILT_STAIRS); + add(ModBlocks.GRASSY_SILT); + add(ModBlocks.GRASSY_SILT_SLAB); + add(ModBlocks.GRASSY_SILT_STAIRS); + add(ModBlocks.COARSE_SILT); + add(ModBlocks.COARSE_SILT_SLAB); + add(ModBlocks.COARSE_SILT_STAIRS); + add(ModBlocks.SILT_PATH); + add(ModBlocks.SILT_FARMLAND); + + add(ModBlocks.TURF); + add(ModBlocks.TURF_SLAB); + add(ModBlocks.TURF_STAIRS); + add(ModBlocks.TURF_VERTICAL_SLAB); + + add(ModBlocks.MIRE); + add(ModBlocks.MIRE_SLAB); + add(ModBlocks.MIRE_STAIRS); + + add(ModBlocks.ASHEN_SAND); + add(ModBlocks.ASHEN_SAND_LAYER); + add(ModBlocks.ASHEN_GRAVEL); + add(ModBlocks.ASHEN_GRAVEL_LAYER); + add(ModBlocks.WASTE_PILE); + add(ModBlocks.WASTE_PILE_LAYER); + + add(ModBlocks.DRY_DIRT); + add(ModBlocks.DRY_DIRT_SLAB); + add(ModBlocks.DRY_DIRT_STAIRS); + add(ModBlocks.FOUL_DIRT); + add(ModBlocks.FOUL_DIRT_SLAB); + add(ModBlocks.FOUL_DIRT_STAIRS); + add(ModBlocks.DIRTY_ROOTS); + add(ModBlocks.DIRTY_ROOTS_SLAB); + add(ModBlocks.DIRTY_ROOTS_STAIRS); + add(ModBlocks.ASHEN_DIRT); + add(ModBlocks.ASHEN_DIRT_SLAB); + add(ModBlocks.ASHEN_DIRT_STAIRS); + add(ModBlocks.COBBLY_ASHEN_DIRT); + add(ModBlocks.COBBLY_ASHEN_DIRT_SLAB); + add(ModBlocks.COBBLY_ASHEN_DIRT_STAIRS); + add(ModBlocks.COBBLY_DIRT); + add(ModBlocks.COBBLY_DIRT_SLAB); + add(ModBlocks.COBBLY_DIRT_STAIRS); + add(ModBlocks.SNOWY_DIRT); + add(ModBlocks.SNOWY_DIRT_SLAB); + add(ModBlocks.SNOWY_DIRT_STAIRS); + } + }; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/ModdedStrippedLogs.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/ModdedStrippedLogs.java index 0f87a15ed7..04c290c372 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/ModdedStrippedLogs.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/ModdedStrippedLogs.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.tags; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.level.block.Block; public class ModdedStrippedLogs { public static List strippedLogs = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Planks.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Planks.java index 47d5e1c3ef..1e0ee3c780 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Planks.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Planks.java @@ -1,10 +1,9 @@ package net.sevenstars.middleearth.datageneration.content.tags; -import net.minecraft.block.Block; -import net.minecraft.item.Item; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; public class Planks { public static List planks = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/PressurePlates.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/PressurePlates.java index ad7a123c09..2f9d055b9a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/PressurePlates.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/PressurePlates.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.tags; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.level.block.Block; public class PressurePlates { public static List pressurePlates = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Saplings.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Saplings.java index 16be8a8c5e..c6f5dc17f5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Saplings.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Saplings.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.tags; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.level.block.Block; public class Saplings{ public static List saplings = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Shingles.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Shingles.java index 42b9e538f6..a186d43824 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Shingles.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Shingles.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.tags; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.level.block.Block; public class Shingles { public static List shingles = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Trapdoors.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Trapdoors.java index 5fd8a4928a..585e52d481 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Trapdoors.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Trapdoors.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.tags; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.level.block.Block; public class Trapdoors { public static List trapdoors = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Walls.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Walls.java index 9e6c80f886..8a1b8f6c39 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Walls.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Walls.java @@ -1,8 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.tags; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/WeaponEnchants.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/WeaponEnchants.java index 1ab41c143a..416232f144 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/WeaponEnchants.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/WeaponEnchants.java @@ -1,6 +1,6 @@ package net.sevenstars.middleearth.datageneration.content.tags; -import net.minecraft.item.Item; +import net.minecraft.world.item.Item; import net.sevenstars.middleearth.item.ToolItemsME; import net.sevenstars.middleearth.item.WeaponItemsME; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/WoodenSlabs.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/WoodenSlabs.java index 3f13530874..22219a889e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/WoodenSlabs.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/WoodenSlabs.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.tags; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; +import net.minecraft.world.level.block.Block; public class WoodenSlabs { public static List woodenSlabs = new ArrayList<>() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/WoodenVerticalSlabs.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/WoodenVerticalSlabs.java index 109839a3c3..8b0179eb43 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/WoodenVerticalSlabs.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/WoodenVerticalSlabs.java @@ -1,8 +1,7 @@ package net.sevenstars.middleearth.datageneration.content.tags; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.ModBlocks; -import net.minecraft.block.Block; - import java.util.ArrayList; import java.util.List; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Wool.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Wool.java index ae6bf736c0..cd92f4f10d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Wool.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/content/tags/Wool.java @@ -1,8 +1,8 @@ package net.sevenstars.middleearth.datageneration.content.tags; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.block.registration.GenericBlockSets; import net.sevenstars.middleearth.block.registration.ModBlocks; -import net.minecraft.block.Block; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import java.util.ArrayList; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/custom/AlloyRecipeJsonBuilder.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/custom/AlloyRecipeJsonBuilder.java index 671b194751..538046d583 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/custom/AlloyRecipeJsonBuilder.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/custom/AlloyRecipeJsonBuilder.java @@ -1,42 +1,41 @@ package net.sevenstars.middleearth.datageneration.custom; -import net.minecraft.data.recipe.CraftingRecipeJsonBuilder; -import net.minecraft.data.recipe.RecipeExporter; -import net.minecraft.recipe.Recipe; -import net.minecraft.registry.RegistryEntryLookup; -import net.minecraft.registry.RegistryKey; +import net.minecraft.advancements.Advancement; +import net.minecraft.advancements.AdvancementRequirements; +import net.minecraft.advancements.AdvancementRewards; +import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; +import net.minecraft.core.HolderGetter; +import net.minecraft.core.NonNullList; +import net.minecraft.data.recipes.RecipeBuilder; +import net.minecraft.data.recipes.RecipeCategory; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.ItemLike; import net.sevenstars.middleearth.item.ResourceItemsME; import net.sevenstars.middleearth.recipe.AlloyingRecipe; -import net.minecraft.advancement.Advancement; -import net.minecraft.advancement.AdvancementCriterion; -import net.minecraft.advancement.AdvancementRequirements; -import net.minecraft.advancement.AdvancementRewards; -import net.minecraft.advancement.criterion.RecipeUnlockedCriterion; -import net.minecraft.item.Item; -import net.minecraft.item.ItemConvertible; -import net.minecraft.recipe.Ingredient; -import net.minecraft.recipe.book.RecipeCategory; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.util.collection.DefaultedList; import org.jetbrains.annotations.Nullable; import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; -public class AlloyRecipeJsonBuilder implements CraftingRecipeJsonBuilder { +public class AlloyRecipeJsonBuilder implements RecipeBuilder { private final RecipeCategory category; - private final DefaultedList inputs = DefaultedList.of(); + private final NonNullList inputs = NonNullList.create(); private final String metalOutput; private final int metalAmount; - private final Map> criteria = new LinkedHashMap<>(); + private final Map> criteria = new LinkedHashMap<>(); private String group; private final int xp; - private final RegistryEntryLookup registryLookup; + private final HolderGetter registryLookup; - public AlloyRecipeJsonBuilder(RegistryEntryLookup registryLookup, RecipeCategory category, String metalOutput, int metalAmount, int xp) { + public AlloyRecipeJsonBuilder(HolderGetter registryLookup, RecipeCategory category, String metalOutput, int metalAmount, int xp) { this.registryLookup = registryLookup; this.category = category; this.metalOutput = metalOutput; @@ -45,25 +44,25 @@ public AlloyRecipeJsonBuilder(RegistryEntryLookup registryLookup, RecipeCa } @Override - public CraftingRecipeJsonBuilder group(@Nullable String group) { + public RecipeBuilder group(@Nullable String group) { this.group = group; return this; } @Override - public Item getOutputItem() { + public Item getResult() { return ResourceItemsME.ROD; } @Override - public void offerTo(RecipeExporter exporter, RegistryKey> recipeKey) { - this.validate(recipeKey); - Advancement.Builder builder = exporter.getAdvancementBuilder().criterion("has_the_recipe", RecipeUnlockedCriterion.create(recipeKey)).rewards(AdvancementRewards.Builder.recipe(recipeKey)).criteriaMerger(AdvancementRequirements.CriterionMerger.OR); + public void save(RecipeOutput exporter, ResourceLocation recipeId) { + this.validate(recipeId); + Advancement.Builder builder = exporter.advancement().addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(recipeId)).rewards(AdvancementRewards.Builder.recipe(recipeId)).requirements(AdvancementRequirements.Strategy.OR); Objects.requireNonNull(builder); - this.criteria.forEach(builder::criterion); + this.criteria.forEach(builder::addCriterion); AlloyingRecipe alloyRecipeJsonBuilder = new AlloyingRecipe((String)Objects.requireNonNullElse(this.group, ""), - CraftingRecipeJsonBuilder.toCraftingCategory(this.category), this.metalOutput, this.inputs, this.metalAmount, this.xp); - exporter.accept(recipeKey, alloyRecipeJsonBuilder, builder.build(recipeKey.getValue().withPrefixedPath("recipes/" + this.category.getName() + "/"))); + RecipeBuilder.determineBookCategory(this.category), this.metalOutput, this.inputs, this.metalAmount, this.xp); + exporter.accept(recipeId, alloyRecipeJsonBuilder, builder.build(recipeId.withPrefix("recipes/" + this.category.getFolderName() + "/"))); } public String getOutputMetal() { @@ -74,21 +73,21 @@ public int getMetalAmount() { return this.metalAmount; } - public static AlloyRecipeJsonBuilder createAlloyRecipe(RegistryEntryLookup registryLookup, RecipeCategory category, String output, int amount, int xp) { + public static AlloyRecipeJsonBuilder createAlloyRecipe(HolderGetter registryLookup, RecipeCategory category, String output, int amount, int xp) { return new AlloyRecipeJsonBuilder(registryLookup, category, output, amount, xp); } public AlloyRecipeJsonBuilder input(TagKey tag) { - return this.input(Ingredient.ofTag(this.registryLookup.getOrThrow(tag))); + return this.input(Ingredient.of(tag)); } - public AlloyRecipeJsonBuilder input(ItemConvertible itemProvider) { - return this.input((ItemConvertible)itemProvider, 1); + public AlloyRecipeJsonBuilder input(ItemLike itemProvider) { + return this.input((ItemLike)itemProvider, 1); } - public AlloyRecipeJsonBuilder input(ItemConvertible itemProvider, int size) { + public AlloyRecipeJsonBuilder input(ItemLike itemProvider, int size) { for(int i = 0; i < size; ++i) { - this.input(Ingredient.ofItems(new ItemConvertible[]{itemProvider})); + this.input(Ingredient.of(new ItemLike[]{itemProvider})); } return this; } @@ -105,14 +104,14 @@ public AlloyRecipeJsonBuilder input(Ingredient ingredient, int size) { } @Override - public AlloyRecipeJsonBuilder criterion(String string, AdvancementCriterion advancementCriterion) { + public AlloyRecipeJsonBuilder unlockedBy(String string, Criterion advancementCriterion) { this.criteria.put(string, advancementCriterion); return this; } - private void validate(RegistryKey> recipeKey) { + private void validate(ResourceLocation recipeId) { if (this.criteria.isEmpty()) { - throw new IllegalStateException("No way of obtaining recipe " + String.valueOf(recipeKey)); + throw new IllegalStateException("No way of obtaining recipe " + String.valueOf(recipeId)); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/custom/AnvilShapingRecipeJsonBuilder.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/custom/AnvilShapingRecipeJsonBuilder.java index 153644881d..b1fb4a99c9 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/custom/AnvilShapingRecipeJsonBuilder.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/custom/AnvilShapingRecipeJsonBuilder.java @@ -1,40 +1,39 @@ package net.sevenstars.middleearth.datageneration.custom; -import net.minecraft.data.recipe.CraftingRecipeJsonBuilder; -import net.minecraft.data.recipe.RecipeExporter; -import net.minecraft.recipe.Recipe; -import net.minecraft.registry.RegistryEntryLookup; -import net.minecraft.registry.RegistryKey; +import net.minecraft.advancements.Advancement; +import net.minecraft.advancements.AdvancementRequirements; +import net.minecraft.advancements.AdvancementRewards; +import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; +import net.minecraft.core.HolderGetter; +import net.minecraft.data.recipes.RecipeBuilder; +import net.minecraft.data.recipes.RecipeCategory; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.ItemLike; import net.sevenstars.middleearth.recipe.AnvilShapingRecipe; -import net.minecraft.advancement.Advancement; -import net.minecraft.advancement.AdvancementCriterion; -import net.minecraft.advancement.AdvancementRequirements; -import net.minecraft.advancement.AdvancementRewards; -import net.minecraft.advancement.criterion.RecipeUnlockedCriterion; -import net.minecraft.item.Item; -import net.minecraft.item.ItemConvertible; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.Ingredient; -import net.minecraft.recipe.book.RecipeCategory; -import net.minecraft.registry.tag.TagKey; import org.jetbrains.annotations.Nullable; import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; -public class AnvilShapingRecipeJsonBuilder implements CraftingRecipeJsonBuilder { +public class AnvilShapingRecipeJsonBuilder implements RecipeBuilder { private final RecipeCategory category; private Ingredient input; private final Item output; private final int amount; - private final Map> criteria = new LinkedHashMap<>(); + private final Map> criteria = new LinkedHashMap<>(); private String group; - private final RegistryEntryLookup registryLookup; + private final HolderGetter registryLookup; - public AnvilShapingRecipeJsonBuilder(RegistryEntryLookup registryLookup, RecipeCategory category, Item output, int amount ) { + public AnvilShapingRecipeJsonBuilder(HolderGetter registryLookup, RecipeCategory category, Item output, int amount ) { this.registryLookup = registryLookup; this.category = category; this.output = output; @@ -42,41 +41,41 @@ public AnvilShapingRecipeJsonBuilder(RegistryEntryLookup registryLookup, R } @Override - public CraftingRecipeJsonBuilder group(@Nullable String group) { + public RecipeBuilder group(@Nullable String group) { this.group = group; return this; } @Override - public Item getOutputItem() { + public Item getResult() { return this.output; } @Override - public void offerTo(RecipeExporter exporter, RegistryKey> recipeKey) { - this.validate(recipeKey); - Advancement.Builder builder = exporter.getAdvancementBuilder().criterion("has_the_recipe", RecipeUnlockedCriterion.create(recipeKey)).rewards(AdvancementRewards.Builder.recipe(recipeKey)).criteriaMerger(AdvancementRequirements.CriterionMerger.OR); + public void save(RecipeOutput exporter, ResourceLocation recipeId) { + this.validate(recipeId); + Advancement.Builder builder = exporter.advancement().addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(recipeId)).rewards(AdvancementRewards.Builder.recipe(recipeId)).requirements(AdvancementRequirements.Strategy.OR); Objects.requireNonNull(builder); - this.criteria.forEach(builder::criterion); + this.criteria.forEach(builder::addCriterion); AnvilShapingRecipe anvilShapingRecipe = new AnvilShapingRecipe(this.input, new ItemStack(this.output), this.amount); - exporter.accept(recipeKey, anvilShapingRecipe, builder.build(recipeKey.getValue().withPrefixedPath("recipes/" + this.category.getName() + "/"))); + exporter.accept(recipeId, anvilShapingRecipe, builder.build(recipeId.withPrefix("recipes/" + this.category.getFolderName() + "/"))); } - public static AnvilShapingRecipeJsonBuilder createAnvilShapingRecipe(RegistryEntryLookup registryLookup, RecipeCategory category, Item output, int amount) { + public static AnvilShapingRecipeJsonBuilder createAnvilShapingRecipe(HolderGetter registryLookup, RecipeCategory category, Item output, int amount) { return new AnvilShapingRecipeJsonBuilder(registryLookup, category, output, amount); } public AnvilShapingRecipeJsonBuilder input(TagKey tag) { - return this.input(Ingredient.ofTag(this.registryLookup.getOrThrow(tag))); + return this.input(Ingredient.of(tag)); } - public AnvilShapingRecipeJsonBuilder input(ItemConvertible itemProvider) { - return this.input((ItemConvertible)itemProvider, 1); + public AnvilShapingRecipeJsonBuilder input(ItemLike itemProvider) { + return this.input((ItemLike)itemProvider, 1); } - public AnvilShapingRecipeJsonBuilder input(ItemConvertible itemProvider, int size) { + public AnvilShapingRecipeJsonBuilder input(ItemLike itemProvider, int size) { for(int i = 0; i < size; ++i) { - this.input(Ingredient.ofItems(new ItemConvertible[]{itemProvider})); + this.input(Ingredient.of(new ItemLike[]{itemProvider})); } return this; } @@ -92,14 +91,14 @@ public AnvilShapingRecipeJsonBuilder input(Ingredient ingredient, int size) { } @Override - public AnvilShapingRecipeJsonBuilder criterion(String string, AdvancementCriterion advancementCriterion) { + public AnvilShapingRecipeJsonBuilder unlockedBy(String string, Criterion advancementCriterion) { this.criteria.put(string, advancementCriterion); return this; } - private void validate(RegistryKey> recipeKey) { + private void validate(ResourceLocation recipeId) { if (this.criteria.isEmpty()) { - throw new IllegalStateException("No way of obtaining recipe " + String.valueOf(recipeKey)); + throw new IllegalStateException("No way of obtaining recipe " + String.valueOf(recipeId)); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/custom/ArtisanTableRecipeJsonBuilder.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/custom/ArtisanTableRecipeJsonBuilder.java index 5aaf436d2a..3b4cef5c7b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/custom/ArtisanTableRecipeJsonBuilder.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/custom/ArtisanTableRecipeJsonBuilder.java @@ -1,45 +1,43 @@ package net.sevenstars.middleearth.datageneration.custom; -import net.fabricmc.fabric.impl.recipe.ingredient.builtin.ComponentsIngredient; -import net.minecraft.data.recipe.CraftingRecipeJsonBuilder; -import net.minecraft.data.recipe.RecipeExporter; -import net.minecraft.recipe.Recipe; -import net.minecraft.registry.RegistryEntryLookup; -import net.minecraft.registry.RegistryKey; +import net.minecraft.advancements.Advancement; +import net.minecraft.advancements.AdvancementRequirements; +import net.minecraft.advancements.AdvancementRewards; +import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; +import net.minecraft.core.HolderGetter; +import net.minecraft.core.NonNullList; +import net.minecraft.data.recipes.RecipeBuilder; +import net.minecraft.data.recipes.RecipeCategory; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.ItemLike; import net.sevenstars.middleearth.recipe.ArtisanRecipe; import net.sevenstars.middleearth.resources.datas.common.DispositionType; -import net.minecraft.advancement.Advancement; -import net.minecraft.advancement.AdvancementCriterion; -import net.minecraft.advancement.AdvancementRequirements; -import net.minecraft.advancement.AdvancementRewards; -import net.minecraft.advancement.criterion.RecipeUnlockedCriterion; -import net.minecraft.item.Item; -import net.minecraft.item.ItemConvertible; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.Ingredient; -import net.minecraft.recipe.book.RecipeCategory; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.util.collection.DefaultedList; import org.jetbrains.annotations.Nullable; import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; -public class ArtisanTableRecipeJsonBuilder implements CraftingRecipeJsonBuilder { +public class ArtisanTableRecipeJsonBuilder implements RecipeBuilder { private final RecipeCategory category; private final String tab; - private final DefaultedList inputs = DefaultedList.of(); + private final NonNullList inputs = NonNullList.create(); private final ItemStack output; private final DispositionType dispositionType; - private final Map> criteria = new LinkedHashMap<>(); + private final Map> criteria = new LinkedHashMap<>(); private final int xp; private String group; - private final RegistryEntryLookup registryLookup; + private final HolderGetter registryLookup; - public ArtisanTableRecipeJsonBuilder(RegistryEntryLookup registryLookup, RecipeCategory category, ItemStack output, + public ArtisanTableRecipeJsonBuilder(HolderGetter registryLookup, RecipeCategory category, ItemStack output, String tab, DispositionType dispositionType, int xp) { this.registryLookup = registryLookup; this.category = category; @@ -50,55 +48,55 @@ public ArtisanTableRecipeJsonBuilder(RegistryEntryLookup registryLookup, R } @Override - public CraftingRecipeJsonBuilder group(@Nullable String group) { + public RecipeBuilder group(@Nullable String group) { this.group = group; return this; } @Override - public Item getOutputItem() { + public Item getResult() { return this.output.getItem(); } @Override - public void offerTo(RecipeExporter exporter, RegistryKey> recipeKey) { - this.validate(recipeKey); - Advancement.Builder builder = exporter.getAdvancementBuilder().criterion("has_the_recipe", RecipeUnlockedCriterion.create(recipeKey)).rewards(AdvancementRewards.Builder.recipe(recipeKey)).criteriaMerger(AdvancementRequirements.CriterionMerger.OR); + public void save(RecipeOutput exporter, ResourceLocation recipeId) { + this.validate(recipeId); + Advancement.Builder builder = exporter.advancement().addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(recipeId)).rewards(AdvancementRewards.Builder.recipe(recipeId)).requirements(AdvancementRequirements.Strategy.OR); Objects.requireNonNull(builder); - this.criteria.forEach(builder::criterion); + this.criteria.forEach(builder::addCriterion); ArtisanRecipe artisanRecipe = new ArtisanRecipe(this.tab, this.output, this.inputs, this.dispositionType.toString().toLowerCase(), this.xp); - exporter.accept(recipeKey, artisanRecipe, builder.build(recipeKey.getValue().withPrefixedPath("recipes/" + this.category.getName() + "/"))); + exporter.accept(recipeId, artisanRecipe, builder.build(recipeId.withPrefix("recipes/" + this.category.getFolderName() + "/"))); } - public static ArtisanTableRecipeJsonBuilder createArtisanRecipe(RegistryEntryLookup registryLookup, RecipeCategory category, + public static ArtisanTableRecipeJsonBuilder createArtisanRecipe(HolderGetter registryLookup, RecipeCategory category, ItemStack output, String tab, DispositionType dispositionType, int xp) { return new ArtisanTableRecipeJsonBuilder(registryLookup, category, output, tab, dispositionType, xp); } - public static ArtisanTableRecipeJsonBuilder createArtisanRecipe(RegistryEntryLookup registryLookup, RecipeCategory category, + public static ArtisanTableRecipeJsonBuilder createArtisanRecipe(HolderGetter registryLookup, RecipeCategory category, ItemStack output, String tab, DispositionType dispositionType) { return new ArtisanTableRecipeJsonBuilder(registryLookup, category, output, tab, dispositionType, 0); } - public static ArtisanTableRecipeJsonBuilder createArtisanRecipe(RegistryEntryLookup registryLookup, RecipeCategory category, ItemStack output, String tab) { + public static ArtisanTableRecipeJsonBuilder createArtisanRecipe(HolderGetter registryLookup, RecipeCategory category, ItemStack output, String tab) { return new ArtisanTableRecipeJsonBuilder(registryLookup, category, output, tab, null, 0); } public ArtisanTableRecipeJsonBuilder input(TagKey tag) { - return this.input(Ingredient.ofTag(this.registryLookup.getOrThrow(tag))); + return this.input(Ingredient.of(tag)); } - public ArtisanTableRecipeJsonBuilder input(ItemConvertible itemProvider) { + public ArtisanTableRecipeJsonBuilder input(ItemLike itemProvider) { return this.input(itemProvider, 1); } - public ArtisanTableRecipeJsonBuilder componentInput(ComponentsIngredient ingredient) { - return this.input(ingredient.toVanilla(), 1); + public ArtisanTableRecipeJsonBuilder componentInput(Ingredient ingredient) { + return this.input(ingredient, 1); } - public ArtisanTableRecipeJsonBuilder input(ItemConvertible itemProvider, int size) { + public ArtisanTableRecipeJsonBuilder input(ItemLike itemProvider, int size) { for(int i = 0; i < size; ++i) { - this.input(Ingredient.ofItems(itemProvider)); + this.input(Ingredient.of(itemProvider)); } return this; } @@ -115,12 +113,12 @@ public ArtisanTableRecipeJsonBuilder input(Ingredient ingredient, int size) { } @Override - public ArtisanTableRecipeJsonBuilder criterion(String string, AdvancementCriterion advancementCriterion) { + public ArtisanTableRecipeJsonBuilder unlockedBy(String string, Criterion advancementCriterion) { this.criteria.put(string, advancementCriterion); return this; } - private void validate(RegistryKey> recipeId) { + private void validate(ResourceLocation recipeId) { if (this.criteria.isEmpty()) { throw new IllegalStateException("No way of obtaining recipe " + String.valueOf(recipeId)); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/custom/InscriptionRecipeJsonBuilder.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/custom/InscriptionRecipeJsonBuilder.java index cbc949058b..07fbc761a3 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/custom/InscriptionRecipeJsonBuilder.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/custom/InscriptionRecipeJsonBuilder.java @@ -1,22 +1,20 @@ package net.sevenstars.middleearth.datageneration.custom; -import net.minecraft.advancement.Advancement; -import net.minecraft.advancement.AdvancementCriterion; -import net.minecraft.advancement.AdvancementRequirements; -import net.minecraft.advancement.AdvancementRewards; -import net.minecraft.advancement.criterion.RecipeUnlockedCriterion; -import net.minecraft.data.recipe.CraftingRecipeJsonBuilder; -import net.minecraft.data.recipe.RecipeExporter; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.item.Item; -import net.minecraft.item.ItemConvertible; -import net.minecraft.recipe.Ingredient; -import net.minecraft.recipe.Recipe; -import net.minecraft.recipe.book.RecipeCategory; -import net.minecraft.registry.RegistryEntryLookup; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.tag.TagKey; +import net.minecraft.advancements.Advancement; +import net.minecraft.advancements.AdvancementRequirements; +import net.minecraft.advancements.AdvancementRewards; +import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.critereon.RecipeUnlockedTrigger; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderGetter; +import net.minecraft.data.recipes.RecipeBuilder; +import net.minecraft.data.recipes.RecipeCategory; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.enchantment.Enchantment; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.item.ToolItemsME; import net.sevenstars.middleearth.recipe.inscription.InscriptionRecipe; @@ -24,20 +22,20 @@ import java.util.*; -public class InscriptionRecipeJsonBuilder implements CraftingRecipeJsonBuilder { +public class InscriptionRecipeJsonBuilder implements RecipeBuilder { private final RecipeCategory category; - public RegistryEntry enchant; + public Holder enchant; public int level; private List inputWords; private Ingredient chiselInput; private int levelCost; - private final Map> criteria = new LinkedHashMap<>(); + private final Map> criteria = new LinkedHashMap<>(); private String group; - private final RegistryEntryLookup registryLookup; + private final HolderGetter registryLookup; - public InscriptionRecipeJsonBuilder(RegistryEntryLookup registryLookup, RecipeCategory category, RegistryEntry enchant, int level, int levelCost) { + public InscriptionRecipeJsonBuilder(HolderGetter registryLookup, RecipeCategory category, Holder enchant, int level, int levelCost) { this.registryLookup = registryLookup; this.category = category; this.enchant = enchant; @@ -49,33 +47,34 @@ public InscriptionRecipeJsonBuilder(RegistryEntryLookup registryLookup, Re } public InscriptionRecipeJsonBuilder chisel(TagKey tag) { - this.chiselInput = Ingredient.ofTag(this.registryLookup.getOrThrow(tag)); + this.chiselInput = Ingredient.of(tag); return this; } @Override - public CraftingRecipeJsonBuilder group(@Nullable String group) { + public RecipeBuilder group(@Nullable String group) { this.group = group; return this; } @Override - public Item getOutputItem() { + public Item getResult() { return ToolItemsME.MITHRIL_CHISEL; } @Override - public void offerTo(RecipeExporter exporter, RegistryKey> recipeKey) { - this.validate(recipeKey); - Advancement.Builder builder = exporter.getAdvancementBuilder().criterion("has_the_recipe", RecipeUnlockedCriterion.create(recipeKey)).rewards(AdvancementRewards.Builder.recipe(recipeKey)).criteriaMerger(AdvancementRequirements.CriterionMerger.OR); + public void save(RecipeOutput exporter, ResourceLocation recipeId) { + this.validate(recipeId); + Advancement.Builder builder = exporter.advancement().addCriterion("has_the_recipe", RecipeUnlockedTrigger.unlocked(recipeId)).rewards(AdvancementRewards.Builder.recipe(recipeId)).requirements(AdvancementRequirements.Strategy.OR); Objects.requireNonNull(builder); - this.criteria.forEach(builder::criterion); + this.criteria.forEach(builder::addCriterion); InscriptionRecipe inscriptionRecipeBuilder = new InscriptionRecipe(this.enchant, this.level, this.inputWords, this.chiselInput, this.levelCost); - exporter.accept(recipeKey, inscriptionRecipeBuilder, builder.build(MiddleEarth.ofPath( "recipes", - this.category.getName(), "inscription%s%s".formatted(enchant.getKey().get().getRegistry().getPath(), level)))); + exporter.accept(recipeId, inscriptionRecipeBuilder, builder.build(MiddleEarth.ofPath( + "recipes", this.category.getFolderName(), recipeId.getPath() + ))); } - public static InscriptionRecipeJsonBuilder createInscriptionRecipe(RegistryEntryLookup registryLookup, RecipeCategory category, RegistryEntry enchant, int level, int levelCost) { + public static InscriptionRecipeJsonBuilder createInscriptionRecipe(HolderGetter registryLookup, RecipeCategory category, Holder enchant, int level, int levelCost) { return new InscriptionRecipeJsonBuilder(registryLookup, category, enchant, level, levelCost); } @@ -86,14 +85,14 @@ public InscriptionRecipeJsonBuilder addWord(String word) { } @Override - public InscriptionRecipeJsonBuilder criterion(String string, AdvancementCriterion advancementCriterion) { + public InscriptionRecipeJsonBuilder unlockedBy(String string, Criterion advancementCriterion) { this.criteria.put(string, advancementCriterion); return this; } - private void validate(RegistryKey> recipeKey) { + private void validate(ResourceLocation recipeId) { if (this.criteria.isEmpty()) { - throw new IllegalStateException("No way of obtaining recipe " + recipeKey); + throw new IllegalStateException("No way of obtaining recipe " + recipeId); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/BlockLootTableProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/BlockLootTableProvider.java index 7ab560a38c..6db8b2430c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/BlockLootTableProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/BlockLootTableProvider.java @@ -1,33 +1,44 @@ package net.sevenstars.middleearth.datageneration.providers; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; -import net.minecraft.block.SlabBlock; -import net.minecraft.block.enums.SlabType; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.Enchantments; -import net.minecraft.item.Items; -import net.minecraft.loot.LootPool; -import net.minecraft.loot.LootTable; -import net.minecraft.loot.condition.BlockStatePropertyLootCondition; -import net.minecraft.loot.condition.RandomChanceLootCondition; -import net.minecraft.loot.condition.TableBonusLootCondition; -import net.minecraft.loot.entry.ItemEntry; -import net.minecraft.loot.entry.LeafEntry; -import net.minecraft.loot.function.SetCountLootFunction; -import net.minecraft.loot.provider.number.ConstantLootNumberProvider; -import net.minecraft.predicate.StatePredicate; -import net.minecraft.registry.Registries; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.RegistryWrapper; +import net.minecraft.advancements.critereon.StatePropertiesPredicate; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.loot.BlockLootSubProvider; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.flag.FeatureFlags; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.Enchantments; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.DoublePlantBlock; +import net.minecraft.world.level.block.FlowerPotBlock; +import net.minecraft.world.level.block.SlabBlock; +import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; +import net.minecraft.world.level.block.state.properties.SlabType; +import net.minecraft.world.level.storage.loot.LootPool; +import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.world.level.storage.loot.BuiltInLootTables; +import net.minecraft.world.level.storage.loot.entries.LootItem; +import net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer; +import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction; +import net.minecraft.world.level.storage.loot.predicates.BonusLevelTableCondition; +import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition; +import net.minecraft.world.level.storage.loot.predicates.LootItemRandomChanceCondition; +import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; +import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.*; import net.sevenstars.middleearth.block.special.LargeDoorBlock; +import net.sevenstars.middleearth.block.special.LayersBlock; import net.sevenstars.middleearth.block.special.RocksBlock; +import net.sevenstars.middleearth.block.special.forge.ForgeBlock; +import net.sevenstars.middleearth.block.special.forge.ForgePart; +import net.sevenstars.middleearth.block.special.statues.StatueBlock; import net.sevenstars.middleearth.block.special.verticalSlabs.VerticalSlabBlock; import net.sevenstars.middleearth.datageneration.content.loot_tables.BlockDrops; import net.sevenstars.middleearth.datageneration.content.loot_tables.CropDrops; +import net.sevenstars.middleearth.datageneration.content.loot_tables.DynamicBlockDrops; import net.sevenstars.middleearth.datageneration.content.loot_tables.LeavesDrops; import net.sevenstars.middleearth.datageneration.content.loot_tables.PotDrops; import net.sevenstars.middleearth.datageneration.content.models.SimplePaneModel; @@ -37,167 +48,197 @@ import net.sevenstars.middleearth.item.DecorativeItemsME; import net.sevenstars.middleearth.item.ResourceItemsME; -import java.util.concurrent.CompletableFuture; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; -public class BlockLootTableProvider extends FabricBlockLootTableProvider { - private final CompletableFuture registryLookup; +public class BlockLootTableProvider extends BlockLootSubProvider { protected static final float[] SAPLING_COMMON_DROP_CHANCE = new float[]{0.1F, 0.1625F, 0.183333336F, 0.2F}; - public BlockLootTableProvider(FabricDataOutput dataOutput, CompletableFuture registryLookup) { - super(dataOutput, registryLookup); + public BlockLootTableProvider(HolderLookup.Provider registryLookup) { + super(Set.of(), FeatureFlags.REGISTRY.allFlags(), registryLookup); + } + + @Override + protected void add(Block block, LootTable.Builder lootTable) { + if (!BuiltInRegistries.BLOCK.getKey(block).getNamespace().equals(MiddleEarth.MOD_ID)) { + return; + } + if (!hasStaticLootTable(block.getLootTable())) { + super.add(block, lootTable); + } + } + + @Override + protected Iterable getKnownBlocks() { + return getAllModBlocks().stream() + .filter(block -> map.containsKey(block.getLootTable())) + .toList(); + } - this.registryLookup = registryLookup; + private List getAllModBlocks() { + return BuiltInRegistries.BLOCK.stream() + .filter(block -> BuiltInRegistries.BLOCK.getKey(block).getNamespace().equals(MiddleEarth.MOD_ID)) + .toList(); } @Override public void generate() { - for (Block block : BlockDrops.blocks) { - if (Registries.BLOCK.getId(block).getPath().equals("nurgon")) { + Set standardDrops = new HashSet<>(BlockDrops.blocks); + standardDrops.addAll(DynamicBlockDrops.BLOCKS); + for (Block block : standardDrops) { + if (BuiltInRegistries.BLOCK.getKey(block).getPath().equals("nurgon")) { cobbleDrops(block, StoneBlockSets.NURGON_SET.cobblestoneBlocks.base()); - } else if (Registries.BLOCK.getId(block).getPath().equals("medgon")) { + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().equals("medgon")) { cobbleDrops(block, StoneBlockSets.MEDGON_SET.cobblestoneBlocks.base()); - } else if (Registries.BLOCK.getId(block).getPath().equals("khagalaban")) { + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().equals("khagalaban")) { cobbleDrops(block, StoneBlockSets.KHAGALABAN_SET.cobblestoneBlocks.base()); - } else if (Registries.BLOCK.getId(block).getPath().equals("limestone")) { + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().equals("limestone")) { cobbleDrops(block, StoneBlockSets.LIMESTONE_SET.cobblestoneBlocks.base()); - } else if (Registries.BLOCK.getId(block).getPath().equals("dolomite")) { + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().equals("dolomite")) { cobbleDrops(block, StoneBlockSets.DOLOMITE_SET.cobblestoneBlocks.base()); - } else if (Registries.BLOCK.getId(block).getPath().equals("quartzite")) { + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().equals("quartzite")) { cobbleDrops(block, StoneBlockSets.QUARTZITE_SET.cobblestoneBlocks.base()); - } else if (Registries.BLOCK.getId(block).getPath().equals("jadeite")) { + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().equals("jadeite")) { cobbleDrops(block, StoneBlockSets.JADEITE_SET.cobblestoneBlocks.base()); - } else if (Registries.BLOCK.getId(block).getPath().equals("ashen_stone")) { + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().equals("ashen_stone")) { cobbleDrops(block, StoneBlockSets.ASHENSTONE_SET.cobblestoneBlocks.base()); - } else if (Registries.BLOCK.getId(block).getPath().equals("ironstone")) { + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().equals("ironstone")) { cobbleDrops(block, StoneBlockSets.IRONSTONE_SET.cobblestoneBlocks.base()); - } else if (Registries.BLOCK.getId(block).getPath().equals("hematite")) { + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().equals("hematite")) { cobbleDrops(block, StoneBlockSets.HEMATITE_SET.cobblestoneBlocks.base()); - } else if (Registries.BLOCK.getId(block).getPath().equals("gneiss")) { + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().equals("gneiss")) { cobbleDrops(block, StoneBlockSets.GNEISS_SET.cobblestoneBlocks.base()); - } else if (Registries.BLOCK.getId(block).getPath().equals("izheraban")) { + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().equals("izheraban")) { cobbleDrops(block, StoneBlockSets.IZHERABAN_SET.cobblestoneBlocks.base()); - } else if (Registries.BLOCK.getId(block).getPath().equals("schist")) { + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().equals("schist")) { cobbleDrops(block, StoneBlockSets.SCHIST_SET.cobblestoneBlocks.base()); - } else if (Registries.BLOCK.getId(block).getPath().equals("galonn")) { + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().equals("galonn")) { cobbleDrops(block, StoneBlockSets.GALONN_SET.cobblestoneBlocks.base()); - } else if (Registries.BLOCK.getId(block).getPath().equals("slate")) { + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().equals("slate")) { cobbleDrops(block, StoneBlockSets.SLATE_SET.cobblestoneBlocks.base()); - } else if (Registries.BLOCK.getId(block).getPath().equals("blue_tuff")) { + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().equals("blue_tuff")) { cobbleDrops(block, StoneBlockSets.BLUE_TUFF_SET.cobblestoneBlocks.base()); - } else if (Registries.BLOCK.getId(block).getPath().contains("_door")) { - addDrop(block, doorDrops(block)); - } else if (Registries.BLOCK.getId(block).getPath().contains("vertical_slab")) { - addDrop(block, verticalSlabDrops(block)); - } else if (Registries.BLOCK.getId(block).getPath().contains("slab")) { - addDrop(block, slabDrops(block)); - } else if (Registries.BLOCK.getId(block).getPath().equals("reinforced_scaffolding")) { - addDrop(block, drops(DecorativeItemsME.REINFORCED_SCAFFOLDING)); + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().contains("_door")) { + add(block, createDoorTable(block)); + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().contains("vertical_slab")) { + add(block, verticalSlabDrops(block)); + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().contains("slab")) { + add(block, createSlabItemTable(block)); + } else if (BuiltInRegistries.BLOCK.getKey(block).getPath().equals("reinforced_scaffolding")) { + add(block, createSingleItemTable(DecorativeItemsME.REINFORCED_SCAFFOLDING)); } else { // TODO : crashes during Datagen if (block == null) continue; if(block == Blocks.STONE || block == Blocks.DEEPSLATE) continue; - addDrop(block); + dropSelf(block); } } for (LeavesDrops.LeavesDrop drop : LeavesDrops.blocks) { - RegistryWrapper.Impl impl = this.registries.getOrThrow(RegistryKeys.ENCHANTMENT); + HolderLookup.RegistryLookup impl = this.registries.lookupOrThrow(Registries.ENCHANTMENT); if (drop.toString().contains("pine")) { - addDrop(drop.block(), this.leavesDrops(drop.block(), drop.drop(), SAPLING_COMMON_DROP_CHANCE).pool( - LootPool.builder().rolls(ConstantLootNumberProvider.create(1.0F)).conditionally(this.createWithoutShearsOrSilkTouchCondition()) - .with(((LeafEntry.Builder)this.addSurvivesExplosionCondition(drop.block(), ItemEntry.builder(ResourceItemsME.PINECONE))) - .conditionally(TableBonusLootCondition.builder(impl.getOrThrow(Enchantments.FORTUNE), + add(drop.block(), this.createLeavesDrops(drop.block(), drop.drop(), SAPLING_COMMON_DROP_CHANCE).withPool( + LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).when(HAS_SHEARS.or(this.hasSilkTouch()).invert()) + .add(((LootPoolSingletonContainer.Builder)this.applyExplosionCondition(drop.block(), LootItem.lootTableItem(ResourceItemsME.PINECONE))) + .when(BonusLevelTableCondition.bonusLevelFlatChance(impl.getOrThrow(Enchantments.FORTUNE), 0.025F, 0.03F, 0.035F, 0.04F, 0.045F))))); } else { - addDrop(drop.block(), this.leavesDrops(drop.block(), drop.drop(), SAPLING_DROP_CHANCE)); + add(drop.block(), this.createLeavesDrops(drop.block(), drop.drop(), NORMAL_LEAVES_SAPLING_CHANCES)); } } for (Block sapling : Saplings.saplings) { - addDrop(sapling); + dropSelf(sapling); } for (CropDrops.CropDrop cd : CropDrops.crops) { - addDrop(cd.crop_block, cropDrops(cd.crop_block, cd.fruit, cd.seeds, cd.builder)); + add(cd.crop_block, createCropDrops(cd.crop_block, cd.fruit, cd.seeds, cd.builder)); } for (CropDrops.CropDrop cd : CropDrops.wild_crops) { - addDrop(cd.crop_block, - LootTable.builder().pool(LootPool.builder().rolls(ConstantLootNumberProvider.create(1.0F)) - .with(ItemEntry.builder(cd.seeds) - .conditionally(RandomChanceLootCondition.builder(0.125f))) - .with(ItemEntry.builder(cd.fruit)))); + add(cd.crop_block, + LootTable.lootTable().withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)) + .add(LootItem.lootTableItem(cd.seeds) + .when(LootItemRandomChanceCondition.randomChance(0.125f))) + .add(LootItem.lootTableItem(cd.fruit)))); } for (Block pot : PotDrops.pots) { - addPottedPlantDrops(pot); + if (!(pot instanceof FlowerPotBlock flowerPot) || flowerPot.getPotted() == null) { + throw new IllegalStateException("Invalid potted block registration: " + BuiltInRegistries.BLOCK.getKey(pot)); + } + dropPottedContents(pot); } - addDrop(ModNatureBlocks.CAMPION, shortPlantDrops(ModNatureBlocks.CAMPION)); - addDrop(ModNatureBlocks.BLUE_BIGLEAF_HYDRANGEA, shortPlantDrops(ModNatureBlocks.BLUE_BIGLEAF_HYDRANGEA)); - addDrop(ModNatureBlocks.PINK_BIGLEAF_HYDRANGEA, shortPlantDrops(ModNatureBlocks.PINK_BIGLEAF_HYDRANGEA)); - addDrop(ModNatureBlocks.WHITE_BIGLEAF_HYDRANGEA, shortPlantDrops(ModNatureBlocks.WHITE_BIGLEAF_HYDRANGEA)); - addDrop(ModNatureBlocks.DEAD_HEATHER_BUSH, shortPlantDrops(ModNatureBlocks.DEAD_HEATHER_BUSH)); - addDrop(ModNatureBlocks.DRY_HEATHER_BUSH, shortPlantDrops(ModNatureBlocks.DRY_HEATHER_BUSH)); - addDrop(ModNatureBlocks.DEAD_RUSHES, shortPlantDrops(ModNatureBlocks.DEAD_RUSHES)); - addDrop(ModNatureBlocks.FALSE_OATGRASS, shortPlantDrops(ModNatureBlocks.FALSE_OATGRASS)); - addDrop(ModNatureBlocks.HEATHER_BUSH, shortPlantDrops(ModNatureBlocks.HEATHER_BUSH)); - addDrop(ModNatureBlocks.LARGE_BLUE_FESCUE, shortPlantDrops(ModNatureBlocks.LARGE_BLUE_FESCUE)); - addDrop(ModNatureBlocks.LARGE_BUSH, shortPlantDrops(ModNatureBlocks.LARGE_BUSH)); - addDrop(ModNatureBlocks.LARGE_SHRIVELED_SHRUB, shortPlantDrops(ModNatureBlocks.LARGE_SHRIVELED_SHRUB)); - addDrop(ModNatureBlocks.RED_HEATHER_BUSH, shortPlantDrops(ModNatureBlocks.RED_HEATHER_BUSH)); - addDrop(ModNatureBlocks.RUSHES, shortPlantDrops(ModNatureBlocks.RUSHES)); - - addDrop(ModNatureBlocks.BRACKEN, shortPlantDrops(ModNatureBlocks.BRACKEN)); - addDrop(ModNatureBlocks.GIANT_BUTTERBUR, shortPlantDrops(ModNatureBlocks.GIANT_BUTTERBUR)); - - for (Block block : TintableCrossModel.grassLikeBlocks) { - addDrop(block, shortPlantDrops(block)); + add(ModNatureBlocks.CAMPION, createGrassDrops(ModNatureBlocks.CAMPION)); + add(ModNatureBlocks.BLUE_BIGLEAF_HYDRANGEA, createGrassDrops(ModNatureBlocks.BLUE_BIGLEAF_HYDRANGEA)); + add(ModNatureBlocks.PINK_BIGLEAF_HYDRANGEA, createGrassDrops(ModNatureBlocks.PINK_BIGLEAF_HYDRANGEA)); + add(ModNatureBlocks.WHITE_BIGLEAF_HYDRANGEA, createGrassDrops(ModNatureBlocks.WHITE_BIGLEAF_HYDRANGEA)); + add(ModNatureBlocks.DEAD_HEATHER_BUSH, createGrassDrops(ModNatureBlocks.DEAD_HEATHER_BUSH)); + add(ModNatureBlocks.DRY_HEATHER_BUSH, createGrassDrops(ModNatureBlocks.DRY_HEATHER_BUSH)); + add(ModNatureBlocks.DEAD_RUSHES, createGrassDrops(ModNatureBlocks.DEAD_RUSHES)); + add(ModNatureBlocks.FALSE_OATGRASS, createGrassDrops(ModNatureBlocks.FALSE_OATGRASS)); + add(ModNatureBlocks.HEATHER_BUSH, createGrassDrops(ModNatureBlocks.HEATHER_BUSH)); + add(ModNatureBlocks.LARGE_BLUE_FESCUE, createGrassDrops(ModNatureBlocks.LARGE_BLUE_FESCUE)); + add(ModNatureBlocks.LARGE_BUSH, createGrassDrops(ModNatureBlocks.LARGE_BUSH)); + add(ModNatureBlocks.LARGE_SHRIVELED_SHRUB, createGrassDrops(ModNatureBlocks.LARGE_SHRIVELED_SHRUB)); + add(ModNatureBlocks.RED_HEATHER_BUSH, createGrassDrops(ModNatureBlocks.RED_HEATHER_BUSH)); + add(ModNatureBlocks.RUSHES, createGrassDrops(ModNatureBlocks.RUSHES)); + + add(ModNatureBlocks.BRACKEN, createGrassDrops(ModNatureBlocks.BRACKEN)); + add(ModNatureBlocks.GIANT_BUTTERBUR, createGrassDrops(ModNatureBlocks.GIANT_BUTTERBUR)); + + for (Block block : TintableCrossModel.grassLikeBlocks()) { + add(block, createGrassDrops(block)); } - for (Block block : TintableCrossModel.tintedBlocks) { - addDropWithSilkTouch(block); + for (Block block : TintableCrossModel.tintedBlocks()) { + dropWhenSilkTouch(block); } for (OreRockSets.OreRockSet set : OreRockSets.sets) { if (set.coal_ore() != null) { - addDrop(set.coal_ore(), oreDrops(set.coal_ore(), Items.COAL)); + add(set.coal_ore(), createOreDrop(set.coal_ore(), Items.COAL)); } if (set.copper_ore() != null) { - addDrop(set.copper_ore(), copperOreDrops(set.copper_ore())); + add(set.copper_ore(), createCopperOreDrops(set.copper_ore())); } if (set.tin_ore() != null) { - addDrop(set.tin_ore(), oreDrops(set.tin_ore(), ResourceItemsME.RAW_TIN)); + add(set.tin_ore(), createOreDrop(set.tin_ore(), ResourceItemsME.RAW_TIN)); } if (set.lead_ore() != null) { - addDrop(set.lead_ore(), oreDrops(set.lead_ore(), ResourceItemsME.RAW_LEAD)); + add(set.lead_ore(), createOreDrop(set.lead_ore(), ResourceItemsME.RAW_LEAD)); } if (set.silver_ore() != null) { - addDrop(set.silver_ore(), oreDrops(set.silver_ore(), ResourceItemsME.RAW_SILVER)); + add(set.silver_ore(), createOreDrop(set.silver_ore(), ResourceItemsME.RAW_SILVER)); } if (set.gold_ore() != null) { - addDrop(set.gold_ore(), oreDrops(set.gold_ore(), Items.RAW_GOLD)); + add(set.gold_ore(), createOreDrop(set.gold_ore(), Items.RAW_GOLD)); } if (set.iron_ore() != null) { - addDrop(set.iron_ore(), oreDrops(set.iron_ore(), Items.RAW_IRON)); + add(set.iron_ore(), createOreDrop(set.iron_ore(), Items.RAW_IRON)); } if (set.mithril_ore() != null) { - addDrop(set.mithril_ore(), oreDrops(set.mithril_ore(), ResourceItemsME.RAW_MITHRIL)); + add(set.mithril_ore(), createOreDrop(set.mithril_ore(), ResourceItemsME.RAW_MITHRIL)); } if (set.adamant_ore() != null) { - addDrop(set.adamant_ore(), oreDrops(set.adamant_ore(), ResourceItemsME.ADAMANT)); + add(set.adamant_ore(), createOreDrop(set.adamant_ore(), ResourceItemsME.ADAMANT)); } if (set.emerald_ore() != null) { - addDrop(set.emerald_ore(), oreDrops(set.emerald_ore(), Items.EMERALD)); + add(set.emerald_ore(), createOreDrop(set.emerald_ore(), Items.EMERALD)); } if (set.ruby_ore() != null) { - addDrop(set.ruby_ore(), oreDrops(set.ruby_ore(), ResourceItemsME.RUBY)); + add(set.ruby_ore(), createOreDrop(set.ruby_ore(), ResourceItemsME.RUBY)); } if (set.sapphire_ore() != null) { - addDrop(set.sapphire_ore(), oreDrops(set.sapphire_ore(), ResourceItemsME.SAPPHIRE)); + add(set.sapphire_ore(), createOreDrop(set.sapphire_ore(), ResourceItemsME.SAPPHIRE)); } } for (SimplePaneModel.Pane pane : SimplePaneModel.panes){ - addDropWithSilkTouch(pane.pane()); - addDropWithSilkTouch(pane.glass()); + dropWhenSilkTouch(pane.pane()); + dropWhenSilkTouch(pane.glass()); } cobbleDrops(ModBlocks.STONE_MYCELIUM, Blocks.COBBLESTONE); @@ -239,49 +280,187 @@ public void generate() { for (SimpleRocksModel.Rocks rock : SimpleRocksModel.vanillaRocks) { rocksDrop(rock.rocks()); } + + generatePortCompletionLootTables(); + validateAllModBlocksHaveLootTables(); + } + + private void generatePortCompletionLootTables() { + add(ModDecorativeBlocks.FORGE, LootTable.lootTable() + .withPool(LootPool.lootPool() + .setRolls(ConstantValue.exactly(1.0F)) + .when(LootItemBlockStatePropertyCondition + .hasBlockStateProperties(ModDecorativeBlocks.FORGE) + .setProperties(StatePropertiesPredicate.Builder.properties() + .hasProperty(ForgeBlock.PART, ForgePart.TOP))) + .add((LootPoolSingletonContainer.Builder) applyExplosionCondition( + ModDecorativeBlocks.FORGE, + LootItem.lootTableItem(ModDecorativeBlocks.FORGE))))); + + add(ModBlocks.SKELETAL_PILE_LAYER, createLayerDrops(ModBlocks.SKELETAL_PILE_LAYER)); + add(ModBlocks.WASTE_PILE_LAYER, createLayerDrops(ModBlocks.WASTE_PILE_LAYER)); + + add(ModBlocks.BUDDING_QUARTZ, noDrop()); + add(ModBlocks.BUDDING_RED_AGATE, noDrop()); + add(ModBlocks.BUDDING_CITRINE, noDrop()); + add(ModBlocks.BUDDING_GLOWSTONE, noDrop()); + add(ModBlocks.LAYERED_CAKE, noDrop()); + add(ModDecorativeBlocks.BRIGAND_TRIAL_SPAWNER, noDrop()); + add(ModDecorativeBlocks.SPIDER_TRIAL_SPAWNER, noDrop()); + add(ModDecorativeBlocks.BRIGAND_VAULT, noDrop()); + add(ModDecorativeBlocks.SPIDER_VAULT, noDrop()); + + add(ModBlocks.CANDLES_LAYERED_CAKE, createCandleCakeDrops(Blocks.CANDLE)); + add(ModBlocks.WHITE_CANDLES_LAYERED_CAKE, createCandleCakeDrops(Blocks.WHITE_CANDLE)); + add(ModBlocks.ORANGE_CANDLES_LAYERED_CAKE, createCandleCakeDrops(Blocks.ORANGE_CANDLE)); + add(ModBlocks.MAGENTA_CANDLES_LAYERED_CAKE, createCandleCakeDrops(Blocks.MAGENTA_CANDLE)); + add(ModBlocks.LIGHT_BLUE_CANDLES_LAYERED_CAKE, createCandleCakeDrops(Blocks.LIGHT_BLUE_CANDLE)); + add(ModBlocks.YELLOW_CANDLES_LAYERED_CAKE, createCandleCakeDrops(Blocks.YELLOW_CANDLE)); + add(ModBlocks.LIME_CANDLES_LAYERED_CAKE, createCandleCakeDrops(Blocks.LIME_CANDLE)); + add(ModBlocks.PINK_CANDLES_LAYERED_CAKE, createCandleCakeDrops(Blocks.PINK_CANDLE)); + add(ModBlocks.GRAY_CANDLES_LAYERED_CAKE, createCandleCakeDrops(Blocks.GRAY_CANDLE)); + add(ModBlocks.LIGHT_GRAY_CANDLES_LAYERED_CAKE, createCandleCakeDrops(Blocks.LIGHT_GRAY_CANDLE)); + add(ModBlocks.CYAN_CANDLES_LAYERED_CAKE, createCandleCakeDrops(Blocks.CYAN_CANDLE)); + add(ModBlocks.PURPLE_CANDLES_LAYERED_CAKE, createCandleCakeDrops(Blocks.PURPLE_CANDLE)); + add(ModBlocks.BLUE_CANDLES_LAYERED_CAKE, createCandleCakeDrops(Blocks.BLUE_CANDLE)); + add(ModBlocks.BROWN_CANDLES_LAYERED_CAKE, createCandleCakeDrops(Blocks.BROWN_CANDLE)); + add(ModBlocks.GREEN_CANDLES_LAYERED_CAKE, createCandleCakeDrops(Blocks.GREEN_CANDLE)); + add(ModBlocks.RED_CANDLES_LAYERED_CAKE, createCandleCakeDrops(Blocks.RED_CANDLE)); + add(ModBlocks.BLACK_CANDLES_LAYERED_CAKE, createCandleCakeDrops(Blocks.BLACK_CANDLE)); + + add(ModNatureBlocks.MORGUL_IVY, createMultifaceBlockDrops(ModNatureBlocks.MORGUL_IVY, HAS_SHEARS)); + add(ModNatureBlocks.STICKY_SNOW, createMultifaceBlockDrops(ModNatureBlocks.STICKY_SNOW, HAS_SHEARS)); + add(ModNatureBlocks.STICKY_ICE, createMultifaceBlockDrops(ModNatureBlocks.STICKY_ICE, HAS_SHEARS)); + add(ModNatureBlocks.WEBBING, createMultifaceBlockDrops(ModNatureBlocks.WEBBING, HAS_SHEARS)); + add(ModNatureBlocks.WILD_GRASS, createGrassDrops(ModNatureBlocks.WILD_GRASS)); + + dropSelf(ModNatureBlocks.BLUE_GENTIAN); + dropSelf(ModNatureBlocks.NOBLEWHITE); + dropSelf(ModNatureBlocks.SHORT_ICICLES); + dropSelf(ModNatureBlocks.DROOPING_ICICLES); + dropSelf(ModDecorativeBlocks.STRUCTURE_MANAGER); + dropSelf(ModDecorativeBlocks.ORC_STRUCTURE_MANAGER); + + add(ModNatureBlocks.HOBBIT_SUNFLOWERS, + createSinglePropConditionTable(ModNatureBlocks.HOBBIT_SUNFLOWERS, + DoublePlantBlock.HALF, DoubleBlockHalf.LOWER)); + add(ModDecorativeBlocks.DIORITE_STATUE, + createSinglePropConditionTable(ModDecorativeBlocks.DIORITE_STATUE, + StatueBlock.HALF, DoubleBlockHalf.LOWER)); + add(ModDecorativeBlocks.GABBRO_STATUE, + createSinglePropConditionTable(ModDecorativeBlocks.GABBRO_STATUE, + StatueBlock.HALF, DoubleBlockHalf.LOWER)); + add(ModDecorativeBlocks.ZIGILABAN_STATUE, + createSinglePropConditionTable(ModDecorativeBlocks.ZIGILABAN_STATUE, + StatueBlock.HALF, DoubleBlockHalf.LOWER)); + + add(ModNatureBlocks.HOGWEED, + createDoublePlantWithSeedDrops(ModNatureBlocks.HOGWEED, ModNatureBlocks.SHORT_HOGWEED)); + add(ModNatureBlocks.CLOVERS, createPetalsDrops(ModNatureBlocks.CLOVERS)); + dropWhenSilkTouch(ModNatureBlocks.SHELOBITE_LARVA_EGG); + dropWhenSilkTouch(ModNatureBlocks.HANGING_SHELOBITE_LARVA_EGG); + add(ModNatureBlocks.WILLOW_VINES, createWillowVinesDrops()); + } + + private LootTable.Builder createLayerDrops(Block block) { + LootTable.Builder table = LootTable.lootTable(); + for (int layers = 1; layers <= 8; layers++) { + table.withPool(LootPool.lootPool() + .setRolls(ConstantValue.exactly(1.0F)) + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) + .setProperties(StatePropertiesPredicate.Builder.properties() + .hasProperty(LayersBlock.LAYERS, layers))) + .add(applyExplosionDecay(block, LootItem.lootTableItem(block) + .apply(SetItemCountFunction.setCount(ConstantValue.exactly(layers)))))); + } + return table; + } + + private LootTable.Builder createWillowVinesDrops() { + HolderLookup.RegistryLookup enchantments = + registries.lookupOrThrow(Registries.ENCHANTMENT); + LootPoolSingletonContainer.Builder fortuneDrop = LootItem.lootTableItem(ModNatureBlocks.WILLOW_VINES) + .when(BonusLevelTableCondition.bonusLevelFlatChance( + enchantments.getOrThrow(Enchantments.FORTUNE), + 0.33F, 0.55F, 0.77F, 1.0F)); + return createSilkTouchOrShearsDispatchTable( + ModNatureBlocks.WILLOW_VINES, + applyExplosionCondition(ModNatureBlocks.WILLOW_VINES, fortuneDrop)); + } + + private void validateAllModBlocksHaveLootTables() { + Set> seen = new HashSet<>(); + List missing = new ArrayList<>(); + for (Block block : getAllModBlocks()) { + ResourceKey lootTable = block.getLootTable(); + if (lootTable != BuiltInLootTables.EMPTY + && seen.add(lootTable) + && !map.containsKey(lootTable) + && !hasStaticLootTable(lootTable)) { + missing.add(BuiltInRegistries.BLOCK.getKey(block) + + " [item=" + (block.asItem() != Items.AIR) + + ", class=" + block.getClass().getSimpleName() + "]"); + } + } + if (!missing.isEmpty()) { + throw new IllegalStateException("Missing Middle-earth block loot tables: " + missing); + } + } + + private boolean hasStaticLootTable(ResourceKey lootTable) { + String existingRoot = System.getProperty("middleearth.datagen.existing"); + if (existingRoot == null || existingRoot.isBlank()) { + return false; + } + Path path = Path.of(existingRoot) + .resolve("data") + .resolve(lootTable.location().getNamespace()) + .resolve("loot_table") + .resolve(lootTable.location().getPath() + ".json"); + return Files.isRegularFile(path); } public void rocksDrop(Block rocksDrop) { - addDrop(rocksDrop, LootTable.builder() - .pool(LootPool.builder() - .conditionally(BlockStatePropertyLootCondition.builder(rocksDrop).properties( - StatePredicate.Builder.create().exactMatch(RocksBlock.STAGE, 0))) - .rolls(ConstantLootNumberProvider.create(1.0f)) - .with(ItemEntry.builder(rocksDrop))) - .pool(LootPool.builder() - .conditionally(BlockStatePropertyLootCondition.builder(rocksDrop).properties( - StatePredicate.Builder.create().exactMatch(RocksBlock.STAGE, 1))) - .rolls(ConstantLootNumberProvider.create(2.0f)) - .with(ItemEntry.builder(rocksDrop))) - .pool(LootPool.builder() - .conditionally(BlockStatePropertyLootCondition.builder(rocksDrop).properties( - StatePredicate.Builder.create().exactMatch(RocksBlock.STAGE, 2))) - .rolls(ConstantLootNumberProvider.create(3.0f)) - .with(ItemEntry.builder(rocksDrop))) - .pool(LootPool.builder() - .conditionally(BlockStatePropertyLootCondition.builder(rocksDrop).properties( - StatePredicate.Builder.create().exactMatch(RocksBlock.STAGE, 3))) - .rolls(ConstantLootNumberProvider.create(4.0f)) - .with(ItemEntry.builder(rocksDrop)))); + add(rocksDrop, LootTable.lootTable() + .withPool(LootPool.lootPool() + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(rocksDrop).setProperties( + StatePropertiesPredicate.Builder.properties().hasProperty(RocksBlock.STAGE, 0))) + .setRolls(ConstantValue.exactly(1.0f)) + .add(LootItem.lootTableItem(rocksDrop))) + .withPool(LootPool.lootPool() + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(rocksDrop).setProperties( + StatePropertiesPredicate.Builder.properties().hasProperty(RocksBlock.STAGE, 1))) + .setRolls(ConstantValue.exactly(2.0f)) + .add(LootItem.lootTableItem(rocksDrop))) + .withPool(LootPool.lootPool() + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(rocksDrop).setProperties( + StatePropertiesPredicate.Builder.properties().hasProperty(RocksBlock.STAGE, 2))) + .setRolls(ConstantValue.exactly(3.0f)) + .add(LootItem.lootTableItem(rocksDrop))) + .withPool(LootPool.lootPool() + .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(rocksDrop).setProperties( + StatePropertiesPredicate.Builder.properties().hasProperty(RocksBlock.STAGE, 3))) + .setRolls(ConstantValue.exactly(4.0f)) + .add(LootItem.lootTableItem(rocksDrop)))); } - public LootTable.Builder slabDrops(Block drop) { - return LootTable.builder().pool( - LootPool.builder().rolls(ConstantLootNumberProvider.create(1.0F)) - .with(this.applyExplosionDecay(drop, ItemEntry.builder(drop).apply(SetCountLootFunction.builder(ConstantLootNumberProvider.create(2.0F)).conditionally(BlockStatePropertyLootCondition.builder(drop).properties(StatePredicate.Builder.create().exactMatch(SlabBlock.TYPE, SlabType.DOUBLE))))))); + public LootTable.Builder createSlabItemTable(Block drop) { + return LootTable.lootTable().withPool( + LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)) + .add(this.applyExplosionDecay(drop, LootItem.lootTableItem(drop).apply(SetItemCountFunction.setCount(ConstantValue.exactly(2.0F)).when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(drop).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(SlabBlock.TYPE, SlabType.DOUBLE))))))); } public LootTable.Builder verticalSlabDrops(Block drop) { - return LootTable.builder().pool( - LootPool.builder().rolls(ConstantLootNumberProvider.create(1.0F)) - .with(this.applyExplosionDecay(drop, ItemEntry.builder(drop).apply(SetCountLootFunction.builder(ConstantLootNumberProvider.create(2.0F)).conditionally(BlockStatePropertyLootCondition.builder(drop).properties(StatePredicate.Builder.create().exactMatch(VerticalSlabBlock.DOUBLE, true))))))); + return LootTable.lootTable().withPool( + LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)) + .add(this.applyExplosionDecay(drop, LootItem.lootTableItem(drop).apply(SetItemCountFunction.setCount(ConstantValue.exactly(2.0F)).when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(drop).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(VerticalSlabBlock.DOUBLE, true))))))); } public void cobbleDrops(Block stoneBlock, Block cobbledBlock) { - addDrop(stoneBlock, this.dropsWithSilkTouch(stoneBlock, this.applyExplosionDecay(cobbledBlock, ((LeafEntry.Builder) - ItemEntry.builder(cobbledBlock))))); + add(stoneBlock, this.createSilkTouchDispatchTable(stoneBlock, this.applyExplosionDecay(cobbledBlock, ((LootPoolSingletonContainer.Builder) + LootItem.lootTableItem(cobbledBlock))))); } public void largeDoorDrop(Block doorblock) { - addDrop(doorblock, LootTable.builder().pool(this.addSurvivesExplosionCondition(doorblock, LootPool.builder().rolls(ConstantLootNumberProvider.create(1.0F)).with(ItemEntry.builder(doorblock).conditionally(BlockStatePropertyLootCondition.builder(doorblock).properties(StatePredicate.Builder.create().exactMatch(LargeDoorBlock.PART, 0))))))); + add(doorblock, LootTable.lootTable().withPool(this.applyExplosionCondition(doorblock, LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)).add(LootItem.lootTableItem(doorblock).when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(doorblock).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(LargeDoorBlock.PART, 0))))))); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/DataWorldGenerator.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/DataWorldGenerator.java index 0a1811caed..be562198e1 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/DataWorldGenerator.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/DataWorldGenerator.java @@ -1,23 +1,17 @@ package net.sevenstars.middleearth.datageneration.providers; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider; +import net.minecraft.core.HolderLookup; +import net.minecraft.data.PackOutput; +import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider; import net.sevenstars.middleearth.MiddleEarth; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.RegistryWrapper; +import net.sevenstars.middleearth.datageneration.DataGeneration; +import java.util.Set; import java.util.concurrent.CompletableFuture; -public class DataWorldGenerator extends FabricDynamicRegistryProvider { - public DataWorldGenerator(FabricDataOutput output, CompletableFuture registriesFuture) { - super(output, registriesFuture); - } - - @Override - protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) { - entries.addAll(registries.getOrThrow(RegistryKeys.BIOME)); - entries.addAll(registries.getOrThrow(RegistryKeys.CONFIGURED_FEATURE)); - entries.addAll(registries.getOrThrow(RegistryKeys.PLACED_FEATURE)); +public class DataWorldGenerator extends DatapackBuiltinEntriesProvider { + public DataWorldGenerator(PackOutput output, CompletableFuture registriesFuture) { + super(output, registriesFuture, DataGeneration.createRegistrySetBuilder(), Set.of(MiddleEarth.MOD_ID)); } @Override diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/EnchantmentProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/EnchantmentProvider.java index 0616ab229c..12d816556e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/EnchantmentProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/EnchantmentProvider.java @@ -1,28 +1,22 @@ package net.sevenstars.middleearth.datageneration.providers; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider; -import net.fabricmc.fabric.api.resource.conditions.v1.ResourceCondition; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryWrapper; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.PackOutput; +import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider; import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.middleearth.enchantments.EnchantmentsME; +import java.util.Set; import java.util.concurrent.CompletableFuture; -public class EnchantmentProvider extends FabricDynamicRegistryProvider { +public class EnchantmentProvider extends DatapackBuiltinEntriesProvider { - public EnchantmentProvider(FabricDataOutput output, CompletableFuture registriesFuture) { - super(output, registriesFuture); - } - - @Override - protected void configure(RegistryWrapper.WrapperLookup wrapperLookup, Entries entries) { - - } - - private void register(Entries entries, RegistryKey key, Enchantment.Builder builder, ResourceCondition... resourceConditions) { - entries.add(key, builder.build(key.getValue()), resourceConditions); + public EnchantmentProvider(PackOutput output, CompletableFuture registriesFuture) { + super(output, registriesFuture, + new RegistrySetBuilder().add(Registries.ENCHANTMENT, EnchantmentsME::bootstrap), + Set.of(MiddleEarth.MOD_ID)); } @Override diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/LanguageProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/LanguageProvider.java index 8e426886aa..9739e79654 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/LanguageProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/LanguageProvider.java @@ -1,10 +1,8 @@ package net.sevenstars.middleearth.datageneration.providers; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricLanguageProvider; -import net.minecraft.block.Block; -import net.minecraft.registry.Registries; -import net.minecraft.registry.RegistryWrapper; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.PackOutput; +import net.minecraft.world.level.block.Block; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.forge.MetalTypes; import net.sevenstars.middleearth.datageneration.content.TranslationEntries; @@ -15,15 +13,18 @@ import java.util.Arrays; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; -import java.util.concurrent.CompletableFuture; +import java.util.Set; -public class LanguageProvider extends FabricLanguageProvider { +public class LanguageProvider extends net.neoforged.neoforge.common.data.LanguageProvider { private final Map specialNames = new HashMap<>(); + private final Map emittedTranslations = new HashMap<>(); + private final Set manualTranslationKeys = new HashSet<>(); - public LanguageProvider(FabricDataOutput dataOutput, CompletableFuture registryLookup) { - super(dataOutput, "en_us", registryLookup); + public LanguageProvider(PackOutput output) { + super(output, MiddleEarth.MOD_ID, "en_us"); specialNames.put("Izheraban", "Izhêr'Aban"); specialNames.put("Khagalaban", "Khagal'Aban"); @@ -50,9 +51,14 @@ public LanguageProvider(FabricDataOutput dataOutput, CompletableFuture { + manualTranslationKeys.add(key); + add(key, value); + }); + TranslationEntries.blockEntries.forEach(block -> { - translateBlock(translationBuilder, block); + translateBlock(block); }); TranslationEntries.spawnEggEntries.forEach(spawnEgg -> { @@ -60,92 +66,103 @@ public void generateTranslations(RegistryWrapper.WrapperLookup wrapperLookup, Tr if(!path.contains("_spawn_egg")) path += "_spawn_egg"; - translationBuilder.add("item." + MiddleEarth.MOD_ID + "." + path, generateName(path)); + add("item." + MiddleEarth.MOD_ID + "." + path, generateName(path)); }); TranslationEntries.itemEntries.forEach(item -> { - translationBuilder.add(item, generateName(Registries.ITEM.getId(item).getPath())); + add(item, generateName(BuiltInRegistries.ITEM.getKey(item).getPath())); }); TranslationEntries.entityEntries.forEach(entityType -> { - translationBuilder.add(entityType, generateName(Registries.ENTITY_TYPE.getId(entityType).getPath())); + add(entityType, generateName(BuiltInRegistries.ENTITY_TYPE.getKey(entityType).getPath())); }); TranslationEntries.biomeEntries.forEach(name -> { - translationBuilder.add("biome." + MiddleEarth.MOD_ID + "." + name, generateName(name)); + add("biome." + MiddleEarth.MOD_ID + "." + name, generateName(name)); }); TranslationEntries.bannerPatternEntries.forEach(name -> { - createBannerTranslation(translationBuilder, "block", "banner." + name); + createBannerTranslation("block", "banner." + name); }); for (MetalTypes metalTypes : MetalTypes.values()){ - createTranslation(translationBuilder, "tooltip", "liquid_" + metalTypes.getName()); + createTranslation("tooltip", "liquid_" + metalTypes.getName()); } for (BackAttachmentsME cape : BackAttachmentsME.values()){ - createTranslation(translationBuilder, "tooltip", cape.getName()); + createTranslation("tooltip", cape.getName()); } for (HelmetAttachmentsME hood : HelmetAttachmentsME.values()){ - createTranslation(translationBuilder, "tooltip", hood.getName()); + createTranslation("tooltip", hood.getName()); } for (DispositionType dispositionType : DispositionType.values()){ - createTranslation(translationBuilder, "disposition", dispositionType.name().toLowerCase()); + createTranslation("disposition", dispositionType.name().toLowerCase()); } TranslationEntries.factionEntries.forEach(faction -> { - createTranslation(translationBuilder, "faction", faction); + createTranslation("faction", faction); }); TranslationEntries.npcTypeEntries.forEach(npcData -> { - createNpcDataTranslation(translationBuilder, "npc_type", npcData); + createNpcDataTranslation("npc_type", npcData); }); TranslationEntries.raceEntries.forEach(race -> { - createTranslation(translationBuilder, "race", race); + createTranslation("race", race); }); TranslationEntries.structureManagerEntries.forEach(structureManagerData -> { - createTranslation(translationBuilder, "structure_manager_data", structureManagerData.getId().getPath()); + createTranslation("structure_manager_data", structureManagerData.getId().getPath()); for(SpawnNestNodeData spawnNest : structureManagerData.getNpcSpawnNest()) { - createTranslation(translationBuilder, "structure_nest", spawnNest.getId().getPath()); + createTranslation("structure_nest", spawnNest.getId().getPath()); } }); TranslationEntries.spawnEntries.forEach(faction -> { - createTranslation(translationBuilder, "spawn", faction); + createTranslation("spawn", faction); }); TranslationEntries.inscriptionEntries.forEach(inscription -> { - createTranslation(translationBuilder, "inscription", inscription); + createTranslation("inscription", inscription); }); - TranslationEntries.manualEntries.forEach(translationBuilder::add); + createBannerTranslation("item", "round_shield"); + createBannerTranslation("item", "heater_shield"); + createBannerTranslation("item", "kite_shield"); + } - createBannerTranslation(translationBuilder, "item", "round_shield"); - createBannerTranslation(translationBuilder, "item", "heater_shield"); - createBannerTranslation(translationBuilder, "item", "kite_shield"); + @Override + public void add(String key, String value) { + String existing = emittedTranslations.putIfAbsent(key, value); + if (existing == null) { + super.add(key, value); + return; + } + if (manualTranslationKeys.contains(key) || existing.equals(value)) { + return; + } + throw new IllegalStateException( + "Conflicting generated translation key " + key + ": '" + existing + "' vs '" + value + "'" + ); } - public void translateBlock(TranslationBuilder translationBuilder, Block block){ + public void translateBlock(Block block){ if (block == null) return; - translationBuilder.add(block, generateName(Registries.BLOCK.getId(block).getPath())); - if (block.asItem() == null) return; - translationBuilder.add(block.asItem(), generateName(Registries.ITEM.getId(block.asItem()).getPath())); + add(block, generateName(BuiltInRegistries.BLOCK.getKey(block).getPath())); } - public void createTranslation(TranslationBuilder translationBuilder, String prefix, String suffix){ + public void createTranslation(String prefix, String suffix){ String suffixSplit = suffix; if (suffix.contains(".")){ String [] sub = suffix.split("\\."); suffixSplit = Arrays.stream(sub).toList().getLast(); } - translationBuilder.add(prefix + "." + MiddleEarth.MOD_ID + "." + suffix, generateName(suffixSplit)); + add(prefix + "." + MiddleEarth.MOD_ID + "." + suffix, generateName(suffixSplit)); } - public void createNpcDataTranslation(TranslationBuilder translationBuilder, String prefix, String suffix) { + public void createNpcDataTranslation(String prefix, String suffix) { StringBuilder generatedName = new StringBuilder(); if (suffix.contains(".")){ String [] sub = suffix.split("\\."); @@ -164,28 +181,28 @@ public void createNpcDataTranslation(TranslationBuilder translationBuilder, Stri } } - translationBuilder.add(prefix + "." + MiddleEarth.MOD_ID + "." + suffix, generatedName.toString()); + add(prefix + "." + MiddleEarth.MOD_ID + "." + suffix, generatedName.toString()); } - public void createBannerTranslation(TranslationBuilder translationBuilder, String prefix, String suffix){ + public void createBannerTranslation(String prefix, String suffix){ String baseTranslationKey = prefix + "." + MiddleEarth.MOD_ID + "." + suffix; - translationBuilder.add(baseTranslationKey + ".black", "Black " + generateName(suffix)); - translationBuilder.add(baseTranslationKey + ".blue", "Blue " + generateName(suffix)); - translationBuilder.add(baseTranslationKey + ".brown", "Brown " + generateName(suffix)); - translationBuilder.add(baseTranslationKey + ".cyan", "Cyan " + generateName(suffix)); - translationBuilder.add(baseTranslationKey + ".gray", "Gray " + generateName(suffix)); - translationBuilder.add(baseTranslationKey + ".green", "Green " + generateName(suffix)); - translationBuilder.add(baseTranslationKey + ".light_blue", "Light Blue " + generateName(suffix)); - translationBuilder.add(baseTranslationKey + ".light_gray", "light Gray " + generateName(suffix)); - translationBuilder.add(baseTranslationKey + ".lime", "Lime " + generateName(suffix)); - translationBuilder.add(baseTranslationKey + ".magenta", "Magenta " + generateName(suffix)); - translationBuilder.add(baseTranslationKey + ".orange", "Orange " + generateName(suffix)); - translationBuilder.add(baseTranslationKey + ".pink", "Pink " + generateName(suffix)); - translationBuilder.add(baseTranslationKey + ".purple", "Purple " + generateName(suffix)); - translationBuilder.add(baseTranslationKey + ".red", "Red " + generateName(suffix)); - translationBuilder.add(baseTranslationKey + ".white", "White " + generateName(suffix)); - translationBuilder.add(baseTranslationKey + ".yellow", "yellow " + generateName(suffix)); + add(baseTranslationKey + ".black", "Black " + generateName(suffix)); + add(baseTranslationKey + ".blue", "Blue " + generateName(suffix)); + add(baseTranslationKey + ".brown", "Brown " + generateName(suffix)); + add(baseTranslationKey + ".cyan", "Cyan " + generateName(suffix)); + add(baseTranslationKey + ".gray", "Gray " + generateName(suffix)); + add(baseTranslationKey + ".green", "Green " + generateName(suffix)); + add(baseTranslationKey + ".light_blue", "Light Blue " + generateName(suffix)); + add(baseTranslationKey + ".light_gray", "light Gray " + generateName(suffix)); + add(baseTranslationKey + ".lime", "Lime " + generateName(suffix)); + add(baseTranslationKey + ".magenta", "Magenta " + generateName(suffix)); + add(baseTranslationKey + ".orange", "Orange " + generateName(suffix)); + add(baseTranslationKey + ".pink", "Pink " + generateName(suffix)); + add(baseTranslationKey + ".purple", "Purple " + generateName(suffix)); + add(baseTranslationKey + ".red", "Red " + generateName(suffix)); + add(baseTranslationKey + ".white", "White " + generateName(suffix)); + add(baseTranslationKey + ".yellow", "yellow " + generateName(suffix)); } public String generateName(String registryName) { @@ -211,4 +228,4 @@ public String generateName(String registryName) { return result; } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/NeoForgeDataMapProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/NeoForgeDataMapProvider.java new file mode 100644 index 0000000000..42511cad54 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/NeoForgeDataMapProvider.java @@ -0,0 +1,73 @@ +package net.sevenstars.middleearth.datageneration.providers; + +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.PackOutput; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.block.Blocks; +import net.neoforged.neoforge.common.data.DataMapProvider; +import net.neoforged.neoforge.registries.datamaps.builtin.Compostable; +import net.neoforged.neoforge.registries.datamaps.builtin.FurnaceFuel; +import net.neoforged.neoforge.registries.datamaps.builtin.NeoForgeDataMaps; +import net.neoforged.neoforge.registries.datamaps.builtin.Oxidizable; +import net.neoforged.neoforge.registries.datamaps.builtin.Strippable; +import net.neoforged.neoforge.registries.datamaps.builtin.Waxable; +import net.sevenstars.middleearth.block.utils.BlockDataMapCollector; + +import java.util.concurrent.CompletableFuture; + +public final class NeoForgeDataMapProvider extends DataMapProvider { + public NeoForgeDataMapProvider(PackOutput output, + CompletableFuture lookupProvider) { + super(output, lookupProvider); + } + + @Override + protected void gather(HolderLookup.Provider provider) { + BlockDataMapCollector.fuels().forEach((item, ticks) -> { + if (item != Items.AIR) { + builder(NeoForgeDataMaps.FURNACE_FUELS).add( + BuiltInRegistries.ITEM.getKey(item), + new FurnaceFuel(ticks), + false + ); + } + }); + BlockDataMapCollector.compostables().forEach((item, chance) -> { + if (item != Items.AIR) { + builder(NeoForgeDataMaps.COMPOSTABLES).add( + BuiltInRegistries.ITEM.getKey(item), + new Compostable(chance), + false + ); + } + }); + BlockDataMapCollector.strippables().forEach((input, stripped) -> { + if (input != Blocks.AIR && stripped != Blocks.AIR) { + builder(NeoForgeDataMaps.STRIPPABLES).add( + BuiltInRegistries.BLOCK.getKey(input), + new Strippable(stripped), + false + ); + } + }); + BlockDataMapCollector.oxidizables().forEach((input, oxidized) -> { + if (input != Blocks.AIR && oxidized != Blocks.AIR) { + builder(NeoForgeDataMaps.OXIDIZABLES).add( + BuiltInRegistries.BLOCK.getKey(input), + new Oxidizable(oxidized), + false + ); + } + }); + BlockDataMapCollector.waxables().forEach((input, waxed) -> { + if (input != Blocks.AIR && waxed != Blocks.AIR) { + builder(NeoForgeDataMaps.WAXABLES).add( + BuiltInRegistries.BLOCK.getKey(input), + new Waxable(waxed), + false + ); + } + }); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/BiomeEventProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/BiomeEventProvider.java index c4280e2957..509080998e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/BiomeEventProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/BiomeEventProvider.java @@ -1,24 +1,25 @@ package net.sevenstars.middleearth.datageneration.providers.dynamic; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider; -import net.minecraft.registry.RegistryWrapper; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.data.PackOutput; +import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider; +import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.registries.DynamicRegistriesME; +import net.sevenstars.middleearth.registries.content.biomevents.BiomeEventRegistry; +import java.util.Set; import java.util.concurrent.CompletableFuture; -public class BiomeEventProvider extends FabricDynamicRegistryProvider { - public BiomeEventProvider(FabricDataOutput output, CompletableFuture registriesFuture) { - super(output, registriesFuture); - } - - @Override - protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) { - entries.addAll(registries.getOrThrow(DynamicRegistriesME.BIOME_EVENT)); +public class BiomeEventProvider extends DatapackBuiltinEntriesProvider { + public BiomeEventProvider(PackOutput output, CompletableFuture registriesFuture) { + super(output, registriesFuture, + new RegistrySetBuilder().add(DynamicRegistriesME.BIOME_EVENT, BiomeEventRegistry::bootstrap), + Set.of(MiddleEarth.MOD_ID)); } @Override public String getName() { - return DynamicRegistriesME.BIOME_EVENT.getValue().getPath(); + return DynamicRegistriesME.BIOME_EVENT.location().getPath(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/CharacterAtlasTexturesProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/CharacterAtlasTexturesProvider.java index 2fd11867fa..5224e8ee1c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/CharacterAtlasTexturesProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/CharacterAtlasTexturesProvider.java @@ -1,25 +1,31 @@ package net.sevenstars.middleearth.datageneration.providers.dynamic; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider; -import net.minecraft.registry.RegistryWrapper; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.data.PackOutput; +import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider; +import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.middleearth.registries.CharacterMaterialsRegistryME; +import net.sevenstars.middleearth.registries.CharacterPatternsRegistryME; import net.sevenstars.middleearth.registries.DynamicRegistriesME; +import java.util.Set; import java.util.concurrent.CompletableFuture; -public class CharacterAtlasTexturesProvider extends FabricDynamicRegistryProvider { - public CharacterAtlasTexturesProvider(FabricDataOutput output, CompletableFuture registriesFuture) { - super(output, registriesFuture); +public class CharacterAtlasTexturesProvider extends DatapackBuiltinEntriesProvider { + public CharacterAtlasTexturesProvider(PackOutput output, + CompletableFuture registriesFuture) { + super(output, registriesFuture, createRegistrySetBuilder(), Set.of(MiddleEarth.MOD_ID)); } - @Override - protected void configure(RegistryWrapper.WrapperLookup registries, FabricDynamicRegistryProvider.Entries entries) { - entries.addAll(registries.getOrThrow(DynamicRegistriesME.SKIN_PATTERN)); - entries.addAll(registries.getOrThrow(DynamicRegistriesME.SKIN_MATERIAL)); - entries.addAll(registries.getOrThrow(DynamicRegistriesME.EYE_PATTERN)); - entries.addAll(registries.getOrThrow(DynamicRegistriesME.EYE_MATERIAL)); - entries.addAll(registries.getOrThrow(DynamicRegistriesME.HAIR_PATTERN)); - entries.addAll(registries.getOrThrow(DynamicRegistriesME.HAIR_MATERIAL)); + private static RegistrySetBuilder createRegistrySetBuilder() { + return new RegistrySetBuilder() + .add(DynamicRegistriesME.SKIN_PATTERN, CharacterPatternsRegistryME::bootstrapSkins) + .add(DynamicRegistriesME.SKIN_MATERIAL, CharacterMaterialsRegistryME::bootstrapSkins) + .add(DynamicRegistriesME.EYE_PATTERN, CharacterPatternsRegistryME::bootstrapEyes) + .add(DynamicRegistriesME.EYE_MATERIAL, CharacterMaterialsRegistryME::bootstrapEyes) + .add(DynamicRegistriesME.HAIR_PATTERN, CharacterPatternsRegistryME::bootstrapHairs) + .add(DynamicRegistriesME.HAIR_MATERIAL, CharacterMaterialsRegistryME::bootstrapHairs); } @Override diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/FactionProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/FactionProvider.java index d1f2914c35..5a4d09fd85 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/FactionProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/FactionProvider.java @@ -1,24 +1,25 @@ package net.sevenstars.middleearth.datageneration.providers.dynamic; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider; -import net.minecraft.registry.RegistryWrapper; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.data.PackOutput; +import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider; +import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.registries.DynamicRegistriesME; +import net.sevenstars.middleearth.registries.content.factions.FactionRegistry; +import java.util.Set; import java.util.concurrent.CompletableFuture; -public class FactionProvider extends FabricDynamicRegistryProvider { - public FactionProvider(FabricDataOutput output, CompletableFuture registriesFuture) { - super(output, registriesFuture); - } - - @Override - protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) { - entries.addAll(registries.getOrThrow(DynamicRegistriesME.FACTION)); +public class FactionProvider extends DatapackBuiltinEntriesProvider { + public FactionProvider(PackOutput output, CompletableFuture registriesFuture) { + super(output, registriesFuture, + new RegistrySetBuilder().add(DynamicRegistriesME.FACTION, FactionRegistry::bootstrap), + Set.of(MiddleEarth.MOD_ID)); } @Override public String getName() { - return DynamicRegistriesME.FACTION.getValue().getPath(); + return DynamicRegistriesME.FACTION.location().getPath(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/GreatHornVariantsProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/GreatHornVariantsProvider.java index cd23e60f2a..f6eab17ec4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/GreatHornVariantsProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/GreatHornVariantsProvider.java @@ -1,20 +1,24 @@ package net.sevenstars.middleearth.datageneration.providers.dynamic; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider; -import net.minecraft.registry.RegistryWrapper; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.data.PackOutput; +import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider; +import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.registries.DynamicRegistriesME; +import net.sevenstars.middleearth.registries.content.greathornvariants.GreatHornVariantRegistry; +import java.util.Set; import java.util.concurrent.CompletableFuture; -public class GreatHornVariantsProvider extends FabricDynamicRegistryProvider { - public GreatHornVariantsProvider(FabricDataOutput output, CompletableFuture registriesFuture) { - super(output, registriesFuture); - } - - @Override - protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) { - entries.addAll(registries.getOrThrow(DynamicRegistriesME.GREAT_HORN_VARIANTS)); +public class GreatHornVariantsProvider extends DatapackBuiltinEntriesProvider { + public GreatHornVariantsProvider(PackOutput output, CompletableFuture registriesFuture) { + super(output, registriesFuture, + new RegistrySetBuilder().add( + DynamicRegistriesME.GREAT_HORN_VARIANTS, + GreatHornVariantRegistry::bootstrap + ), + Set.of(MiddleEarth.MOD_ID)); } @Override diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/NpcProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/NpcProvider.java index 0c94cf3f72..db227bc1ff 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/NpcProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/NpcProvider.java @@ -1,23 +1,25 @@ package net.sevenstars.middleearth.datageneration.providers.dynamic; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider; -import net.minecraft.registry.RegistryWrapper; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.data.PackOutput; +import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider; +import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.registries.DynamicRegistriesME; +import net.sevenstars.middleearth.registries.content.npctypes.NpcRegistry; +import java.util.Set; import java.util.concurrent.CompletableFuture; -public class NpcProvider extends FabricDynamicRegistryProvider { - public NpcProvider(FabricDataOutput output, CompletableFuture registriesFuture) { - super(output, registriesFuture); - } - - @Override - protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) { - entries.addAll(registries.getOrThrow(DynamicRegistriesME.NPC_TYPE)); +public class NpcProvider extends DatapackBuiltinEntriesProvider { + public NpcProvider(PackOutput output, CompletableFuture registriesFuture) { + super(output, registriesFuture, + new RegistrySetBuilder().add(DynamicRegistriesME.NPC_TYPE, NpcRegistry::bootstrap), + Set.of(MiddleEarth.MOD_ID)); } @Override public String getName() { - return DynamicRegistriesME.NPC_TYPE.getValue().getPath(); - }} + return DynamicRegistriesME.NPC_TYPE.location().getPath(); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/RaceProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/RaceProvider.java index ccb31cd598..bb5435029c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/RaceProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/RaceProvider.java @@ -1,23 +1,25 @@ package net.sevenstars.middleearth.datageneration.providers.dynamic; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider; -import net.minecraft.registry.RegistryWrapper; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.data.PackOutput; +import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider; +import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.registries.DynamicRegistriesME; +import net.sevenstars.middleearth.registries.content.races.RaceRegistry; +import java.util.Set; import java.util.concurrent.CompletableFuture; -public class RaceProvider extends FabricDynamicRegistryProvider { - public RaceProvider(FabricDataOutput output, CompletableFuture registriesFuture) { - super(output, registriesFuture); - } - - @Override - protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) { - entries.addAll(registries.getOrThrow(DynamicRegistriesME.RACE)); +public class RaceProvider extends DatapackBuiltinEntriesProvider { + public RaceProvider(PackOutput output, CompletableFuture registriesFuture) { + super(output, registriesFuture, + new RegistrySetBuilder().add(DynamicRegistriesME.RACE, RaceRegistry::bootstrap), + Set.of(MiddleEarth.MOD_ID)); } @Override public String getName() { - return DynamicRegistriesME.RACE.getValue().getPath(); - }} + return DynamicRegistriesME.RACE.location().getPath(); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/SpiderVariantsProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/SpiderVariantsProvider.java index e99ee65ddd..e7584b53b8 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/SpiderVariantsProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/SpiderVariantsProvider.java @@ -1,24 +1,28 @@ package net.sevenstars.middleearth.datageneration.providers.dynamic; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider; -import net.minecraft.registry.RegistryWrapper; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.data.PackOutput; +import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider; +import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.registries.DynamicRegistriesME; +import net.sevenstars.middleearth.registries.content.spidervariants.SpiderVariantRegistry; +import java.util.Set; import java.util.concurrent.CompletableFuture; -public class SpiderVariantsProvider extends FabricDynamicRegistryProvider { - public SpiderVariantsProvider(FabricDataOutput output, CompletableFuture registriesFuture) { - super(output, registriesFuture); - } - - @Override - protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) { - entries.addAll(registries.getOrThrow(DynamicRegistriesME.SPIDER_VARIANTS)); +public class SpiderVariantsProvider extends DatapackBuiltinEntriesProvider { + public SpiderVariantsProvider(PackOutput output, CompletableFuture registriesFuture) { + super(output, registriesFuture, + new RegistrySetBuilder().add( + DynamicRegistriesME.SPIDER_VARIANTS, + SpiderVariantRegistry::bootstrap + ), + Set.of(MiddleEarth.MOD_ID)); } @Override public String getName() { - return DynamicRegistriesME.SPIDER_VARIANTS.getValue().getPath(); + return DynamicRegistriesME.SPIDER_VARIANTS.location().getPath(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/StructureDataProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/StructureDataProvider.java index 3d25cabf1d..7b9f5ac7c2 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/StructureDataProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/StructureDataProvider.java @@ -1,24 +1,28 @@ package net.sevenstars.middleearth.datageneration.providers.dynamic; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider; -import net.minecraft.registry.RegistryWrapper; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.data.PackOutput; +import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider; +import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.registries.DynamicRegistriesME; +import net.sevenstars.middleearth.registries.content.structuremanagerdatas.StructureManagerDataRegistry; +import java.util.Set; import java.util.concurrent.CompletableFuture; -public class StructureDataProvider extends FabricDynamicRegistryProvider { - public StructureDataProvider(FabricDataOutput output, CompletableFuture registriesFuture) { - super(output, registriesFuture); - } - - @Override - protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) { - entries.addAll(registries.getOrThrow(DynamicRegistriesME.STRUCTURE_MANAGER_DATA)); +public class StructureDataProvider extends DatapackBuiltinEntriesProvider { + public StructureDataProvider(PackOutput output, CompletableFuture registriesFuture) { + super(output, registriesFuture, + new RegistrySetBuilder().add( + DynamicRegistriesME.STRUCTURE_MANAGER_DATA, + StructureManagerDataRegistry::bootstrap + ), + Set.of(MiddleEarth.MOD_ID)); } @Override public String getName() { - return DynamicRegistriesME.STRUCTURE_MANAGER_DATA.getValue().getPath(); + return DynamicRegistriesME.STRUCTURE_MANAGER_DATA.location().getPath(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/StructureEventProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/StructureEventProvider.java index c8c61234e3..dd8987720a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/StructureEventProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/StructureEventProvider.java @@ -1,24 +1,28 @@ package net.sevenstars.middleearth.datageneration.providers.dynamic; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider; -import net.minecraft.registry.RegistryWrapper; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.data.PackOutput; +import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider; +import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.registries.DynamicRegistriesME; +import net.sevenstars.middleearth.registries.content.biomevents.BiomeEventRegistry; +import java.util.Set; import java.util.concurrent.CompletableFuture; -public class StructureEventProvider extends FabricDynamicRegistryProvider { - public StructureEventProvider(FabricDataOutput output, CompletableFuture registriesFuture) { - super(output, registriesFuture); - } - - @Override - protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) { - entries.addAll(registries.getOrThrow(DynamicRegistriesME.STRUCTURE_EVENT)); +public class StructureEventProvider extends DatapackBuiltinEntriesProvider { + public StructureEventProvider(PackOutput output, CompletableFuture registriesFuture) { + super(output, registriesFuture, + new RegistrySetBuilder().add( + DynamicRegistriesME.STRUCTURE_EVENT, + BiomeEventRegistry::bootstrapStructureEvents + ), + Set.of(MiddleEarth.MOD_ID)); } @Override public String getName() { - return DynamicRegistriesME.STRUCTURE_EVENT.getValue().getPath(); + return DynamicRegistriesME.STRUCTURE_EVENT.location().getPath(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/TexturePresetsProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/TexturePresetsProvider.java index a63f817501..27a0cf35a5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/TexturePresetsProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/dynamic/TexturePresetsProvider.java @@ -1,24 +1,28 @@ package net.sevenstars.middleearth.datageneration.providers.dynamic; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricDynamicRegistryProvider; -import net.minecraft.registry.RegistryWrapper; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.RegistrySetBuilder; +import net.minecraft.data.PackOutput; +import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider; +import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.registries.DynamicRegistriesME; +import net.sevenstars.middleearth.registries.content.texturepresets.TexturePresetsRegistry; +import java.util.Set; import java.util.concurrent.CompletableFuture; -public class TexturePresetsProvider extends FabricDynamicRegistryProvider { - public TexturePresetsProvider(FabricDataOutput output, CompletableFuture registriesFuture) { - super(output, registriesFuture); - } - - @Override - protected void configure(RegistryWrapper.WrapperLookup registries, Entries entries) { - entries.addAll(registries.getOrThrow(DynamicRegistriesME.TEXTURE_PRESETS)); +public class TexturePresetsProvider extends DatapackBuiltinEntriesProvider { + public TexturePresetsProvider(PackOutput output, CompletableFuture registriesFuture) { + super(output, registriesFuture, + new RegistrySetBuilder().add( + DynamicRegistriesME.TEXTURE_PRESETS, + TexturePresetsRegistry::bootstrap + ), + Set.of(MiddleEarth.MOD_ID)); } @Override public String getName() { - return DynamicRegistriesME.TEXTURE_PRESETS.getValue().getPath(); + return DynamicRegistriesME.TEXTURE_PRESETS.location().getPath(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/models/BlockModelProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/models/BlockModelProvider.java index 783c57b3a8..5af8b01103 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/models/BlockModelProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/models/BlockModelProvider.java @@ -1,26 +1,35 @@ package net.sevenstars.middleearth.datageneration.providers.models; -import net.fabricmc.fabric.api.client.datagen.v1.provider.FabricModelProvider; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; -import net.minecraft.block.HangingMossBlock; -import net.minecraft.block.enums.BlockFace; -import net.minecraft.block.enums.DoorHinge; -import net.minecraft.block.enums.Thickness; -import net.minecraft.client.data.*; -import net.minecraft.client.render.item.model.ItemModel; -import net.minecraft.client.render.item.tint.GrassTintSource; -import net.minecraft.client.render.model.json.ModelVariant; -import net.minecraft.client.render.model.json.ModelVariantOperator; -import net.minecraft.client.render.model.json.WeightedVariant; -import net.minecraft.item.Item; -import net.minecraft.registry.Registries; -import net.minecraft.state.property.IntProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.AxisRotation; -import net.minecraft.util.math.Direction; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import net.minecraft.data.CachedOutput; +import net.minecraft.data.DataProvider; +import net.minecraft.data.PackOutput; +import net.minecraft.data.models.BlockModelGenerators; +import net.minecraft.data.models.blockstates.BlockStateGenerator; +import net.minecraft.data.models.blockstates.MultiPartGenerator; +import net.minecraft.data.models.blockstates.MultiVariantGenerator; +import net.minecraft.data.models.blockstates.PropertyDispatch; +import net.minecraft.data.models.blockstates.Variant; +import net.minecraft.data.models.blockstates.VariantProperties; +import net.minecraft.data.models.model.DelegatedModel; +import net.minecraft.data.models.model.ModelLocationUtils; +import net.minecraft.data.models.model.ModelTemplate; +import net.minecraft.data.models.model.ModelTemplates; +import net.minecraft.data.models.model.TextureMapping; +import net.minecraft.data.models.model.TextureSlot; +import net.minecraft.data.models.model.TexturedModel; +import net.minecraft.core.Direction; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.properties.AttachFace; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.DoorHingeSide; +import net.minecraft.world.level.block.state.properties.DripstoneThickness; +import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.*; import net.sevenstars.middleearth.block.special.LargeDoorBlock; @@ -33,23 +42,47 @@ import net.sevenstars.middleearth.datageneration.content.models.*; import net.sevenstars.middleearth.datageneration.content.tags.LeavesSets; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; import java.util.Objects; - -import static net.minecraft.client.data.BlockStateModelGenerator.*; - -public class BlockModelProvider extends FabricModelProvider { - - public static final ModelVariantOperator UV_LOCK = ModelVariantOperator.UV_LOCK.withValue(true); - public static final ModelVariantOperator ROTATE_X_90 = ModelVariantOperator.ROTATION_X.withValue(AxisRotation.R90); - ; - public static final ModelVariantOperator ROTATE_X_180 = ModelVariantOperator.ROTATION_X.withValue(AxisRotation.R180); - public static final ModelVariantOperator ROTATE_X_270 = ModelVariantOperator.ROTATION_X.withValue(AxisRotation.R270); - public static final ModelVariantOperator ROTATE_Y_90 = ModelVariantOperator.ROTATION_Y.withValue(AxisRotation.R90); - public static final ModelVariantOperator ROTATE_Y_180 = ModelVariantOperator.ROTATION_Y.withValue(AxisRotation.R180); - public static final ModelVariantOperator ROTATE_Y_270 = ModelVariantOperator.ROTATION_Y.withValue(AxisRotation.R270); - - public BlockModelProvider(FabricDataOutput output) { - super(output); +import java.util.Set; +import java.util.concurrent.CompletableFuture; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.util.function.Function; +import java.util.function.Supplier; + +import static net.minecraft.data.models.blockstates.Condition.condition; + +public class BlockModelProvider implements DataProvider { + private static final Map PALE_OAK_TEXTURE_FALLBACKS = Map.ofEntries( + Map.entry("middle-earth:block/pale_oak_door_bottom", "minecraft:block/birch_door_bottom"), + Map.entry("middle-earth:block/pale_oak_door_top", "minecraft:block/birch_door_top"), + Map.entry("middle-earth:block/pale_oak_leaves", "minecraft:block/dark_oak_leaves"), + Map.entry("middle-earth:block/pale_oak_log", "minecraft:block/birch_log"), + Map.entry("middle-earth:block/pale_oak_log_top", "minecraft:block/birch_log_top"), + Map.entry("middle-earth:block/pale_oak_planks", "minecraft:block/birch_planks"), + Map.entry("middle-earth:block/pale_oak_trapdoor", "minecraft:block/birch_trapdoor"), + Map.entry("middle-earth:block/stripped_pale_oak_log", "minecraft:block/stripped_birch_log"), + Map.entry("middle-earth:block/stripped_pale_oak_log_top", "minecraft:block/stripped_birch_log_top") + ); + private final PackOutput.PathProvider blockStatePathProvider; + private final PackOutput.PathProvider modelPathProvider; + private final Path authoredModelsRoot; + + public BlockModelProvider(PackOutput output) { + this.blockStatePathProvider = output.createPathProvider(PackOutput.Target.RESOURCE_PACK, "blockstates"); + this.modelPathProvider = output.createPathProvider(PackOutput.Target.RESOURCE_PACK, "models"); + this.authoredModelsRoot = output.getOutputFolder() + .resolveSibling("resources") + .resolve("assets") + .resolve(MiddleEarth.MOD_ID) + .resolve("models"); } @Override @@ -57,435 +90,434 @@ public String getName() { return "BlockModelProvider"; } - @Override - public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) { + public void generateBlockStateModels(GenerationContext blockStateModelGenerator) { for (Block block : SimpleBlockModel.blocks) { - blockStateModelGenerator.registerSimpleCubeAll(block); + blockStateModelGenerator.createTrivialCube(block); } for (Block block : LeavesSets.grayscaleLeaves) { - blockStateModelGenerator.registerTintedBlockAndItem(block, TexturedModel.LEAVES, -12012264); + blockStateModelGenerator.createTintedLeaves(block, TexturedModel.LEAVES, -12012264); } for (SimpleBlockModel.ChiseledBlock block : SimpleBlockModel.chiseledMainBlockTopBottom) { - blockStateModelGenerator.registerAxisRotated(block.base(), TexturedModel.END_FOR_TOP_CUBE_COLUMN, TexturedModel.END_FOR_TOP_CUBE_COLUMN_HORIZONTAL); + blockStateModelGenerator.createRotatedPillarWithHorizontalVariant(block.base(), TexturedModel.COLUMN_ALT, TexturedModel.COLUMN_HORIZONTAL_ALT); } for (SimpleBlockModel.ChiseledBlock block : SimpleBlockModel.chiseledBlocksTopBottom) { - blockStateModelGenerator.registerAxisRotated(block.base(), TexturedModel.END_FOR_TOP_CUBE_COLUMN, TexturedModel.END_FOR_TOP_CUBE_COLUMN_HORIZONTAL); + blockStateModelGenerator.createRotatedPillarWithHorizontalVariant(block.base(), TexturedModel.COLUMN_ALT, TexturedModel.COLUMN_HORIZONTAL_ALT); } for (SimpleBlockModel.ChiseledPolishedBlock block : SimpleBlockModel.chiseledPolishedBlocksTopBottom) { - blockStateModelGenerator.registerAxisRotated(block.base(), TexturedModel.END_FOR_TOP_CUBE_COLUMN, TexturedModel.END_FOR_TOP_CUBE_COLUMN_HORIZONTAL); + blockStateModelGenerator.createRotatedPillarWithHorizontalVariant(block.base(), TexturedModel.COLUMN_ALT, TexturedModel.COLUMN_HORIZONTAL_ALT); } for (SimpleBlockModel.ChiseledPolishedBlock block : SimpleBlockModel.chiseledTilesBlocksTopBottom) { - blockStateModelGenerator.registerAxisRotated(block.base(), TexturedModel.END_FOR_TOP_CUBE_COLUMN, TexturedModel.END_FOR_TOP_CUBE_COLUMN_HORIZONTAL); + blockStateModelGenerator.createRotatedPillarWithHorizontalVariant(block.base(), TexturedModel.COLUMN_ALT, TexturedModel.COLUMN_HORIZONTAL_ALT); } for (SimpleBlockModel.ChiseledPolishedBlock block : SimpleBlockModel.chiseledSmoothBlocksTopBottom) { - blockStateModelGenerator.registerAxisRotated(block.base(), TexturedModel.END_FOR_TOP_CUBE_COLUMN, TexturedModel.END_FOR_TOP_CUBE_COLUMN_HORIZONTAL); + blockStateModelGenerator.createRotatedPillarWithHorizontalVariant(block.base(), TexturedModel.COLUMN_ALT, TexturedModel.COLUMN_HORIZONTAL_ALT); } for (Block wood : SimpleBlockModel.woodBlocks) { - TextureMap textureMap = new TextureMap().put(TextureKey.ALL, - Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(wood).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); - WeightedVariant identifier = createWeightedVariant(Models.CUBE_COLUMN.upload(wood, textureMap, blockStateModelGenerator.modelCollector)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createAxisRotatedBlockState(wood, identifier)); + TextureMapping textureMap = new TextureMapping().put(TextureSlot.ALL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(wood).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); + Variant identifier = plainVariant(ModelTemplates.CUBE_COLUMN.create(wood, textureMap, blockStateModelGenerator.modelOutput)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider.createAxisAlignedPillarBlock(wood, identifier)); } for (SimpleBlockModel.ChiseledPolishedBlock block : SimpleBlockModel.chiseledPolishedBlocks) { - blockStateModelGenerator.registerSimpleCubeAll(block.base()); + blockStateModelGenerator.createTrivialCube(block.base()); } for (SimplePillarModel.Pillar block : SimplePillarModel.blocks) { - blockStateModelGenerator.registerAxisRotated(block.base(), TexturedModel.END_FOR_TOP_CUBE_COLUMN, TexturedModel.END_FOR_TOP_CUBE_COLUMN_HORIZONTAL); + blockStateModelGenerator.createRotatedPillarWithHorizontalVariant(block.base(), TexturedModel.COLUMN_ALT, TexturedModel.COLUMN_HORIZONTAL_ALT); } for (SimplePillarModel.StonePillar block : SimplePillarModel.stonePillars) { - blockStateModelGenerator.registerAxisRotated(block.base(), TexturedModel.END_FOR_TOP_CUBE_COLUMN, TexturedModel.END_FOR_TOP_CUBE_COLUMN_HORIZONTAL); + blockStateModelGenerator.createRotatedPillarWithHorizontalVariant(block.base(), TexturedModel.COLUMN_ALT, TexturedModel.COLUMN_HORIZONTAL_ALT); } for (SimplePillarModel.StonePillar block : SimplePillarModel.carvedWindows) { - TextureMap textureMap; + TextureMapping textureMap; if (block.origin() == Blocks.BASALT || block.origin() == Blocks.DEEPSLATE){ - textureMap = TextureMap.sideEnd(TextureMap.getId(block.base()), TextureMap.getSubId(block.origin(), "_top")); + textureMap = TextureMapping.column(TextureMapping.getBlockTexture(block.base()), TextureMapping.getBlockTexture(block.origin(), "_top")); } else { - textureMap = TextureMap.sideEnd(TextureMap.getId(block.base()), TextureMap.getId(block.origin())); + textureMap = TextureMapping.column(TextureMapping.getBlockTexture(block.base()), TextureMapping.getBlockTexture(block.origin())); } - WeightedVariant weightedVariant = createWeightedVariant(Models.CUBE_COLUMN.upload(block.base(), textureMap, blockStateModelGenerator.modelCollector)); - blockStateModelGenerator.blockStateCollector.accept(createSingletonBlockState(block.base(), weightedVariant)); + Variant weightedVariant = plainVariant(ModelTemplates.CUBE_COLUMN.create(block.base(), textureMap, blockStateModelGenerator.modelOutput)); + blockStateModelGenerator.blockStateOutput.accept(createSimpleBlock(block.base(), weightedVariant)); } for (SimpleSlabModel.Slab block : SimpleSlabModel.slabs) { - WeightedVariant id = createWeightedVariant(ModelIds.getBlockModelId(block.origin())); + Variant id = plainVariant(ModelLocationUtils.getModelLocation(block.origin())); Block slab = block.slab(); - TexturedModel texturedModel = TexturedModel.CUBE_ALL.get(block.origin()); + TexturedModel texturedModel = TexturedModel.CUBE.get(block.origin()); if (block.origin() == Blocks.BASALT || block.origin() == Blocks.POLISHED_BASALT) { - texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.origin()).getPath() + "_side")); + texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.origin()).getPath() + "_side")); } - WeightedVariant bottom = createWeightedVariant(Models.SLAB.upload(slab, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant top = createWeightedVariant(Models.SLAB_TOP.upload(slab, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + Variant bottom = plainVariant(ModelTemplates.SLAB_BOTTOM.create(slab, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant top = plainVariant(ModelTemplates.SLAB_TOP.create(slab, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createSlabBlockState(slab, bottom, top, id)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createSlab(slab, bottom, top, id)); } for (SimpleSlabModel.Slab block : SimpleSlabModel.woodSlabs) { - WeightedVariant id = createWeightedVariant(ModelIds.getBlockModelId(block.origin())); + Variant id = plainVariant(ModelLocationUtils.getModelLocation(block.origin())); Block slab = block.slab(); - String modid = Registries.BLOCK.getId(block.origin()).getNamespace(); + String modid = BuiltInRegistries.BLOCK.getKey(block.origin()).getNamespace(); - TexturedModel texturedModel = TexturedModel.getCubeAll(Identifier.of(modid, "block/" + Registries.BLOCK.getId(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); - WeightedVariant bottom = createWeightedVariant(Models.SLAB.upload(slab, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant top = createWeightedVariant(Models.SLAB_TOP.upload(slab, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + TexturedModel texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath(modid, "block/" + BuiltInRegistries.BLOCK.getKey(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); + Variant bottom = plainVariant(ModelTemplates.SLAB_BOTTOM.create(slab, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant top = plainVariant(ModelTemplates.SLAB_TOP.create(slab, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createSlabBlockState(slab, bottom, top, id)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createSlab(slab, bottom, top, id)); } for (SimpleSlabModel.Slab block : SimpleSlabModel.strippedSlabs) { - WeightedVariant id = createWeightedVariant(ModelIds.getBlockModelId(block.origin())); + Variant id = plainVariant(ModelLocationUtils.getModelLocation(block.origin())); Block slab = block.slab(); - String modid = Registries.BLOCK.getId(block.origin()).getNamespace(); + String modid = BuiltInRegistries.BLOCK.getKey(block.origin()).getNamespace(); - TexturedModel texturedModel = TexturedModel.getCubeAll(Identifier.of(modid, "block/" + Registries.BLOCK.getId(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); - WeightedVariant bottom = createWeightedVariant(Models.SLAB.upload(slab, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant top = createWeightedVariant(Models.SLAB_TOP.upload(slab, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + TexturedModel texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath(modid, "block/" + BuiltInRegistries.BLOCK.getKey(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); + Variant bottom = plainVariant(ModelTemplates.SLAB_BOTTOM.create(slab, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant top = plainVariant(ModelTemplates.SLAB_TOP.create(slab, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createSlabBlockState(slab, bottom, top, id)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createSlab(slab, bottom, top, id)); } for (SimpleSlabModel.Slab block : SimpleSlabModel.vanillaSlabs) { - WeightedVariant id = createWeightedVariant(ModelIds.getBlockModelId(block.origin())); + Variant id = plainVariant(ModelLocationUtils.getModelLocation(block.origin())); Block slab = block.slab(); - TexturedModel texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); - WeightedVariant bottom = createWeightedVariant(Models.SLAB.upload(slab, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant top = createWeightedVariant(Models.SLAB_TOP.upload(slab, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + TexturedModel texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); + Variant bottom = plainVariant(ModelTemplates.SLAB_BOTTOM.create(slab, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant top = plainVariant(ModelTemplates.SLAB_TOP.create(slab, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createSlabBlockState(slab, bottom, top, id)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createSlab(slab, bottom, top, id)); } for (SimpleSlabModel.Slab block : SimpleSlabModel.vanillaWoodSlabs) { - WeightedVariant id = createWeightedVariant(ModelIds.getBlockModelId(block.origin())); + Variant id = plainVariant(ModelLocationUtils.getModelLocation(block.origin())); Block slab = block.slab(); - TexturedModel texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); - WeightedVariant bottom = createWeightedVariant(Models.SLAB.upload(slab, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant top = createWeightedVariant(Models.SLAB_TOP.upload(slab, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + TexturedModel texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); + Variant bottom = plainVariant(ModelTemplates.SLAB_BOTTOM.create(slab, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant top = plainVariant(ModelTemplates.SLAB_TOP.create(slab, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createSlabBlockState(slab, bottom, top, id)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createSlab(slab, bottom, top, id)); } for (SimpleSlabModel.Slab block : SimpleSlabModel.vanillaStrippedSlab) { - WeightedVariant id = createWeightedVariant(ModelIds.getBlockModelId(block.origin())); + Variant id = plainVariant(ModelLocationUtils.getModelLocation(block.origin())); Block slab = block.slab(); - TexturedModel texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); - WeightedVariant bottom = createWeightedVariant(Models.SLAB.upload(slab, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant top = createWeightedVariant(Models.SLAB_TOP.upload(slab, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + TexturedModel texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); + Variant bottom = plainVariant(ModelTemplates.SLAB_BOTTOM.create(slab, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant top = plainVariant(ModelTemplates.SLAB_TOP.create(slab, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createSlabBlockState(slab, bottom, top, id)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createSlab(slab, bottom, top, id)); } for (SimpleStairModel.Stair block : SimpleStairModel.stairs) { - TexturedModel texturedModel = TexturedModel.CUBE_ALL.get(block.origin()); + TexturedModel texturedModel = TexturedModel.CUBE.get(block.origin()); if (block.origin() == Blocks.BASALT || block.origin() == Blocks.POLISHED_BASALT) { - texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.origin()).getPath() + "_side")); + texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.origin()).getPath() + "_side")); } Block stairs = block.stairs(); - TextureMap textureMap = texturedModel.getTextures(); + TextureMapping textureMap = texturedModel.getMapping(); if(block.origin() == StoneBlockSets.DRYSTONE_SET.cobblestoneBlocks.base()) { - textureMap = TextureMap.top(block.origin()); - textureMap.put(TextureKey.SIDE, Registries.BLOCK.getId(block.origin()).withPath((path) -> "block/" + path)); - textureMap.put(TextureKey.BOTTOM, Registries.BLOCK.getId(block.origin()).withPath((path) -> "block/" + path)); + textureMap = TextureMapping.top(block.origin()); + textureMap.put(TextureSlot.SIDE, BuiltInRegistries.BLOCK.getKey(block.origin()).withPath((path) -> "block/" + path)); + textureMap.put(TextureSlot.BOTTOM, BuiltInRegistries.BLOCK.getKey(block.origin()).withPath((path) -> "block/" + path)); } - WeightedVariant inner = createWeightedVariant(Models.INNER_STAIRS.upload(stairs, textureMap, blockStateModelGenerator.modelCollector)); - WeightedVariant regular = createWeightedVariant(Models.STAIRS.upload(stairs, textureMap, blockStateModelGenerator.modelCollector)); - WeightedVariant outer = createWeightedVariant(Models.OUTER_STAIRS.upload(stairs, textureMap, blockStateModelGenerator.modelCollector)); + Variant inner = plainVariant(ModelTemplates.STAIRS_INNER.create(stairs, textureMap, blockStateModelGenerator.modelOutput)); + Variant regular = plainVariant(ModelTemplates.STAIRS_STRAIGHT.create(stairs, textureMap, blockStateModelGenerator.modelOutput)); + Variant outer = plainVariant(ModelTemplates.STAIRS_OUTER.create(stairs, textureMap, blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createStairsBlockState(stairs, inner, regular, outer)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createStairs(stairs, inner, regular, outer)); } for (SimpleStairModel.Stair block : SimpleStairModel.woodStairs) { - String modid = Registries.BLOCK.getId(block.origin()).getNamespace(); + String modid = BuiltInRegistries.BLOCK.getKey(block.origin()).getNamespace(); - TexturedModel texturedModel = TexturedModel.getCubeAll(Identifier.of(modid, "block/" + Registries.BLOCK.getId(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); + TexturedModel texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath(modid, "block/" + BuiltInRegistries.BLOCK.getKey(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); Block stairs = block.stairs(); - WeightedVariant inner = createWeightedVariant(Models.INNER_STAIRS.upload(stairs, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant regular = createWeightedVariant(Models.STAIRS.upload(stairs, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant outer = createWeightedVariant(Models.OUTER_STAIRS.upload(stairs, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + Variant inner = plainVariant(ModelTemplates.STAIRS_INNER.create(stairs, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant regular = plainVariant(ModelTemplates.STAIRS_STRAIGHT.create(stairs, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant outer = plainVariant(ModelTemplates.STAIRS_OUTER.create(stairs, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createStairsBlockState(stairs, inner, regular, outer)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createStairs(stairs, inner, regular, outer)); } for (SimpleStairModel.Stair block : SimpleStairModel.strippedStairs) { - String modid = Registries.BLOCK.getId(block.origin()).getNamespace(); + String modid = BuiltInRegistries.BLOCK.getKey(block.origin()).getNamespace(); - TexturedModel texturedModel = TexturedModel.getCubeAll(Identifier.of(modid, "block/" + Registries.BLOCK.getId(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); + TexturedModel texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath(modid, "block/" + BuiltInRegistries.BLOCK.getKey(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); Block stairs = block.stairs(); - WeightedVariant inner = createWeightedVariant(Models.INNER_STAIRS.upload(stairs, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant regular = createWeightedVariant(Models.STAIRS.upload(stairs, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant outer = createWeightedVariant(Models.OUTER_STAIRS.upload(stairs, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + Variant inner = plainVariant(ModelTemplates.STAIRS_INNER.create(stairs, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant regular = plainVariant(ModelTemplates.STAIRS_STRAIGHT.create(stairs, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant outer = plainVariant(ModelTemplates.STAIRS_OUTER.create(stairs, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createStairsBlockState(stairs, inner, regular, outer)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createStairs(stairs, inner, regular, outer)); } for (SimpleStairModel.Stair block : SimpleStairModel.vanillaWoodStairs) { - TexturedModel texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); + TexturedModel texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); Block stairs = block.stairs(); - WeightedVariant inner = createWeightedVariant(Models.INNER_STAIRS.upload(stairs, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant regular = createWeightedVariant(Models.STAIRS.upload(stairs, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant outer = createWeightedVariant(Models.OUTER_STAIRS.upload(stairs, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + Variant inner = plainVariant(ModelTemplates.STAIRS_INNER.create(stairs, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant regular = plainVariant(ModelTemplates.STAIRS_STRAIGHT.create(stairs, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant outer = plainVariant(ModelTemplates.STAIRS_OUTER.create(stairs, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createStairsBlockState(stairs, inner, regular, outer)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createStairs(stairs, inner, regular, outer)); } for (SimpleStairModel.Stair block : SimpleStairModel.vanillaStrippedStairs) { - TexturedModel texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); + TexturedModel texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.origin()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); Block stairs = block.stairs(); - WeightedVariant inner = createWeightedVariant(Models.INNER_STAIRS.upload(stairs, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant regular = createWeightedVariant(Models.STAIRS.upload(stairs, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant outer = createWeightedVariant(Models.OUTER_STAIRS.upload(stairs, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + Variant inner = plainVariant(ModelTemplates.STAIRS_INNER.create(stairs, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant regular = plainVariant(ModelTemplates.STAIRS_STRAIGHT.create(stairs, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant outer = plainVariant(ModelTemplates.STAIRS_OUTER.create(stairs, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createStairsBlockState(stairs, inner, regular, outer)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createStairs(stairs, inner, regular, outer)); } for (SimpleStairModel.Stair block : SimpleStairModel.vanillaStairs) { - TexturedModel texturedModel = TexturedModel.CUBE_ALL.get(block.origin()); + TexturedModel texturedModel = TexturedModel.CUBE.get(block.origin()); Block stairs = block.stairs(); - WeightedVariant inner = createWeightedVariant(Models.INNER_STAIRS.upload(stairs, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant regular = createWeightedVariant(Models.STAIRS.upload(stairs, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant outer = createWeightedVariant(Models.OUTER_STAIRS.upload(stairs, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + Variant inner = plainVariant(ModelTemplates.STAIRS_INNER.create(stairs, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant regular = plainVariant(ModelTemplates.STAIRS_STRAIGHT.create(stairs, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant outer = plainVariant(ModelTemplates.STAIRS_OUTER.create(stairs, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createStairsBlockState(stairs, inner, regular, outer)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createStairs(stairs, inner, regular, outer)); } for (SimpleWallModel.Wall block : SimpleWallModel.blocks) { - TexturedModel texturedModel = TexturedModel.getCubeAll(Identifier.of( - Registries.BLOCK.getId(block.block()).getNamespace(), "block/" + Registries.BLOCK.getId(block.block()).getPath().replaceAll("_wood","_log").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); + TexturedModel texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath( + BuiltInRegistries.BLOCK.getKey(block.block()).getNamespace(), "block/" + BuiltInRegistries.BLOCK.getKey(block.block()).getPath().replaceAll("_wood","_log").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); if (block.block() == Blocks.BASALT || block.block() == Blocks.POLISHED_BASALT) { - texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.block()).getPath() + "_side")); + texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.block()).getPath() + "_side")); } if (block.block() == Blocks.CRIMSON_HYPHAE || block.block() == Blocks.WARPED_HYPHAE) { - texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.block()).getPath().replaceAll("_hyphae", "_stem"))); + texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.block()).getPath().replaceAll("_hyphae", "_stem"))); } Block wall = block.wall(); - Identifier inventory = Models.WALL_INVENTORY.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector); + ResourceLocation inventory = ModelTemplates.WALL_INVENTORY.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput); - blockStateModelGenerator.registerParentedItemModel(wall,inventory); + blockStateModelGenerator.registerSimpleItemModel(wall,inventory); - WeightedVariant post = createWeightedVariant(Models.TEMPLATE_WALL_POST.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant low = createWeightedVariant(Models.TEMPLATE_WALL_SIDE.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant tall = createWeightedVariant(Models.TEMPLATE_WALL_SIDE_TALL.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + Variant post = plainVariant(ModelTemplates.WALL_POST.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant low = plainVariant(ModelTemplates.WALL_LOW_SIDE.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant tall = plainVariant(ModelTemplates.WALL_TALL_SIDE.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createWallBlockState(wall, post, low, tall)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createWall(wall, post, low, tall)); } for (SimpleWallModel.Wall block : SimpleWallModel.vanillaWalls) { TexturedModel texturedModel; - if (Registries.BLOCK.getId(block.block()).getPath().contains("waxed_") && Registries.BLOCK.getId(block.block()).getPath().contains("cut_copper")) { - texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.block()).getPath().replaceAll("waxed_", ""))); + if (BuiltInRegistries.BLOCK.getKey(block.block()).getPath().contains("waxed_") && BuiltInRegistries.BLOCK.getKey(block.block()).getPath().contains("cut_copper")) { + texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.block()).getPath().replaceAll("waxed_", ""))); } else { - texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.block()).getPath())); + texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.block()).getPath())); } Block wall = block.wall(); - Identifier inventory = Models.WALL_INVENTORY.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector); + ResourceLocation inventory = ModelTemplates.WALL_INVENTORY.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput); - blockStateModelGenerator.registerParentedItemModel(wall,inventory); + blockStateModelGenerator.registerSimpleItemModel(wall,inventory); - WeightedVariant post = createWeightedVariant(Models.TEMPLATE_WALL_POST.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant low = createWeightedVariant(Models.TEMPLATE_WALL_SIDE.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant tall = createWeightedVariant(Models.TEMPLATE_WALL_SIDE_TALL.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + Variant post = plainVariant(ModelTemplates.WALL_POST.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant low = plainVariant(ModelTemplates.WALL_LOW_SIDE.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant tall = plainVariant(ModelTemplates.WALL_TALL_SIDE.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createWallBlockState(wall, post, low, tall)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createWall(wall, post, low, tall)); } for (SimpleWallModel.Wall block : SimpleWallModel.strippedWalls) { - String modid = Registries.BLOCK.getId(block.block()).getNamespace(); + String modid = BuiltInRegistries.BLOCK.getKey(block.block()).getNamespace(); - TexturedModel texturedModel = TexturedModel.getCubeAll(Identifier.of(modid, "block/" + Registries.BLOCK.getId(block.block()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); + TexturedModel texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath(modid, "block/" + BuiltInRegistries.BLOCK.getKey(block.block()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); Block wall = block.wall(); - Identifier inventory = Models.WALL_INVENTORY.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector); + ResourceLocation inventory = ModelTemplates.WALL_INVENTORY.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput); - blockStateModelGenerator.registerParentedItemModel(wall, inventory); + blockStateModelGenerator.registerSimpleItemModel(wall, inventory); - WeightedVariant post = createWeightedVariant(Models.TEMPLATE_WALL_POST.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant low = createWeightedVariant(Models.TEMPLATE_WALL_SIDE.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant tall = createWeightedVariant(Models.TEMPLATE_WALL_SIDE_TALL.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + Variant post = plainVariant(ModelTemplates.WALL_POST.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant low = plainVariant(ModelTemplates.WALL_LOW_SIDE.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant tall = plainVariant(ModelTemplates.WALL_TALL_SIDE.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createWallBlockState(wall, post, low, tall)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createWall(wall, post, low, tall)); } for (SimpleWallModel.Wall block : SimpleWallModel.vanillaStrippedWalls) { - TexturedModel texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.block()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); + TexturedModel texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.block()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); Block wall = block.wall(); - Identifier inventory = Models.WALL_INVENTORY.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector); + ResourceLocation inventory = ModelTemplates.WALL_INVENTORY.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput); - blockStateModelGenerator.registerParentedItemModel(wall, inventory); + blockStateModelGenerator.registerSimpleItemModel(wall, inventory); - WeightedVariant post = createWeightedVariant(Models.TEMPLATE_WALL_POST.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant low = createWeightedVariant(Models.TEMPLATE_WALL_SIDE.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant tall = createWeightedVariant(Models.TEMPLATE_WALL_SIDE_TALL.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + Variant post = plainVariant(ModelTemplates.WALL_POST.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant low = plainVariant(ModelTemplates.WALL_LOW_SIDE.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant tall = plainVariant(ModelTemplates.WALL_TALL_SIDE.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createWallBlockState(wall, post, low, tall)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createWall(wall, post, low, tall)); } for (SimpleWallModel.Wall block : SimpleWallModel.vanillaWoodWalls) { - TexturedModel texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.block()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); + TexturedModel texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.block()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); Block wall = block.wall(); - Identifier inventory = Models.WALL_INVENTORY.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector); + ResourceLocation inventory = ModelTemplates.WALL_INVENTORY.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput); - blockStateModelGenerator.registerParentedItemModel(wall, inventory); + blockStateModelGenerator.registerSimpleItemModel(wall, inventory); - WeightedVariant post = createWeightedVariant(Models.TEMPLATE_WALL_POST.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant low = createWeightedVariant(Models.TEMPLATE_WALL_SIDE.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant tall = createWeightedVariant(Models.TEMPLATE_WALL_SIDE_TALL.upload(wall, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + Variant post = plainVariant(ModelTemplates.WALL_POST.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant low = plainVariant(ModelTemplates.WALL_LOW_SIDE.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant tall = plainVariant(ModelTemplates.WALL_TALL_SIDE.create(wall, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createWallBlockState(wall, post, low, tall)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createWall(wall, post, low, tall)); } for (SimpleFenceModel.Fence block : SimpleFenceModel.blocks) { - TexturedModel texturedModel = TexturedModel.getCubeAll(Identifier.of( - Registries.BLOCK.getId(block.block()).getNamespace(), "block/" + Registries.BLOCK.getId(block.block()).getPath().replaceAll("_wood","_log"))); + TexturedModel texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath( + BuiltInRegistries.BLOCK.getKey(block.block()).getNamespace(), "block/" + BuiltInRegistries.BLOCK.getKey(block.block()).getPath().replaceAll("_wood","_log"))); if (block.block() == Blocks.CRIMSON_HYPHAE || block.block() == Blocks.WARPED_HYPHAE) { - texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.block()).getPath().replaceAll("_hyphae", "_stem"))); + texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.block()).getPath().replaceAll("_hyphae", "_stem"))); } Block fence = block.fence(); - WeightedVariant post = createWeightedVariant(Models.FENCE_POST.upload(fence, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant side = createWeightedVariant(Models.FENCE_SIDE.upload(fence, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - Identifier inventory = Models.FENCE_INVENTORY.upload(fence, texturedModel.getTextures(), blockStateModelGenerator.modelCollector); + Variant post = plainVariant(ModelTemplates.FENCE_POST.create(fence, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant side = plainVariant(ModelTemplates.FENCE_SIDE.create(fence, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + ResourceLocation inventory = ModelTemplates.FENCE_INVENTORY.create(fence, texturedModel.getMapping(), blockStateModelGenerator.modelOutput); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createFenceBlockState(fence, post, side)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createFence(fence, post, side)); - blockStateModelGenerator.registerParentedItemModel(fence, inventory); + blockStateModelGenerator.registerSimpleItemModel(fence, inventory); } for (SimpleFenceModel.Fence block : SimpleFenceModel.strippedFences) { - String modid = Registries.BLOCK.getId(block.block()).getNamespace(); + String modid = BuiltInRegistries.BLOCK.getKey(block.block()).getNamespace(); - TexturedModel texturedModel = TexturedModel.getCubeAll(Identifier.of(modid, "block/" + Registries.BLOCK.getId(block.block()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); + TexturedModel texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath(modid, "block/" + BuiltInRegistries.BLOCK.getKey(block.block()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); Block fence = block.fence(); - WeightedVariant post = createWeightedVariant(Models.FENCE_POST.upload(fence, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant side = createWeightedVariant(Models.FENCE_SIDE.upload(fence, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - Identifier inventory = Models.FENCE_INVENTORY.upload(fence, texturedModel.getTextures(), blockStateModelGenerator.modelCollector); + Variant post = plainVariant(ModelTemplates.FENCE_POST.create(fence, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant side = plainVariant(ModelTemplates.FENCE_SIDE.create(fence, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + ResourceLocation inventory = ModelTemplates.FENCE_INVENTORY.create(fence, texturedModel.getMapping(), blockStateModelGenerator.modelOutput); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createFenceBlockState(fence, post, side)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createFence(fence, post, side)); - blockStateModelGenerator.registerParentedItemModel(fence, inventory); + blockStateModelGenerator.registerSimpleItemModel(fence, inventory); } for (SimpleFenceModel.Fence block : SimpleFenceModel.vanillaStrippedFences) { - TexturedModel texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.block()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); + TexturedModel texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.block()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); Block fence = block.fence(); - WeightedVariant post = createWeightedVariant(Models.FENCE_POST.upload(fence, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant side = createWeightedVariant(Models.FENCE_SIDE.upload(fence, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - Identifier inventory = Models.FENCE_INVENTORY.upload(fence, texturedModel.getTextures(), blockStateModelGenerator.modelCollector); + Variant post = plainVariant(ModelTemplates.FENCE_POST.create(fence, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant side = plainVariant(ModelTemplates.FENCE_SIDE.create(fence, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + ResourceLocation inventory = ModelTemplates.FENCE_INVENTORY.create(fence, texturedModel.getMapping(), blockStateModelGenerator.modelOutput); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createFenceBlockState(fence, post, side)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createFence(fence, post, side)); - blockStateModelGenerator.registerParentedItemModel(fence, inventory); + blockStateModelGenerator.registerSimpleItemModel(fence, inventory); } for (SimpleFenceModel.Fence block : SimpleFenceModel.vanillaWoodFences) { - TexturedModel texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.block()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); + TexturedModel texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.block()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"))); Block fence = block.fence(); - WeightedVariant post = createWeightedVariant(Models.FENCE_POST.upload(fence, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant side = createWeightedVariant(Models.FENCE_SIDE.upload(fence, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - Identifier inventory = Models.FENCE_INVENTORY.upload(fence, texturedModel.getTextures(), blockStateModelGenerator.modelCollector); + Variant post = plainVariant(ModelTemplates.FENCE_POST.create(fence, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant side = plainVariant(ModelTemplates.FENCE_SIDE.create(fence, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + ResourceLocation inventory = ModelTemplates.FENCE_INVENTORY.create(fence, texturedModel.getMapping(), blockStateModelGenerator.modelOutput); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createFenceBlockState(fence, post, side)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createFence(fence, post, side)); - blockStateModelGenerator.registerParentedItemModel(fence, inventory); + blockStateModelGenerator.registerSimpleItemModel(fence, inventory); } for (SimpleFenceGateModel.FenceGate block : SimpleFenceGateModel.blocks) { - TexturedModel texturedModel = TexturedModel.CUBE_ALL.get(block.block()); + TexturedModel texturedModel = TexturedModel.CUBE.get(block.block()); Block fenceGate = block.fenceGate(); - WeightedVariant open = createWeightedVariant(Models.TEMPLATE_FENCE_GATE_OPEN.upload(fenceGate, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant closed = createWeightedVariant(Models.TEMPLATE_FENCE_GATE.upload(fenceGate, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant openWall = createWeightedVariant(Models.TEMPLATE_FENCE_GATE_WALL_OPEN.upload(fenceGate, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant closedWall = createWeightedVariant(Models.TEMPLATE_FENCE_GATE_WALL.upload(fenceGate, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + Variant open = plainVariant(ModelTemplates.FENCE_GATE_OPEN.create(fenceGate, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant closed = plainVariant(ModelTemplates.FENCE_GATE_CLOSED.create(fenceGate, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant openWall = plainVariant(ModelTemplates.FENCE_GATE_WALL_OPEN.create(fenceGate, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant closedWall = plainVariant(ModelTemplates.FENCE_GATE_WALL_CLOSED.create(fenceGate, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createFenceGateBlockState(fenceGate, open, closed, openWall, closedWall, true)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createFenceGate(fenceGate, open, closed, openWall, closedWall, true)); } for (SimpleButtonModel.Button block : SimpleButtonModel.buttons) { - TexturedModel texturedModel = TexturedModel.CUBE_ALL.get(block.block()); + TexturedModel texturedModel = TexturedModel.CUBE.get(block.block()); if (block.block() == Blocks.BASALT || block.block() == Blocks.POLISHED_BASALT) { - texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.block()).getPath() + "_side")); + texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.block()).getPath() + "_side")); } Block button = block.button(); - WeightedVariant unpressed = createWeightedVariant(Models.BUTTON.upload(button, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant pressed = createWeightedVariant(Models.BUTTON_PRESSED.upload(button, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + Variant unpressed = plainVariant(ModelTemplates.BUTTON.create(button, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant pressed = plainVariant(ModelTemplates.BUTTON_PRESSED.create(button, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - Identifier inventory = Models.BUTTON_INVENTORY.upload(button, texturedModel.getTextures(), blockStateModelGenerator.modelCollector); + ResourceLocation inventory = ModelTemplates.BUTTON_INVENTORY.create(button, texturedModel.getMapping(), blockStateModelGenerator.modelOutput); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createButtonBlockState(button, unpressed, pressed)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createButton(button, unpressed, pressed)); - blockStateModelGenerator.registerParentedItemModel(button, inventory); + blockStateModelGenerator.registerSimpleItemModel(button, inventory); } for (SimplePressurePlateModel.PressurePlate block : SimplePressurePlateModel.pressurePlates) { - TexturedModel texturedModel = TexturedModel.CUBE_ALL.get(block.block()); + TexturedModel texturedModel = TexturedModel.CUBE.get(block.block()); if (block.block() == Blocks.BASALT || block.block() == Blocks.POLISHED_BASALT) { - texturedModel = TexturedModel.getCubeAll(Identifier.of("minecraft", "block/" + Registries.BLOCK.getId(block.block()).getPath() + "_side")); + texturedModel = TexturedModel.createAllSame(ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + BuiltInRegistries.BLOCK.getKey(block.block()).getPath() + "_side")); } Block pressurePlate = block.pressurePlate(); - WeightedVariant up = createWeightedVariant(Models.PRESSURE_PLATE_UP.upload(pressurePlate, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); - WeightedVariant down = createWeightedVariant(Models.PRESSURE_PLATE_DOWN.upload(pressurePlate, texturedModel.getTextures(), blockStateModelGenerator.modelCollector)); + Variant up = plainVariant(ModelTemplates.PRESSURE_PLATE_UP.create(pressurePlate, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); + Variant down = plainVariant(ModelTemplates.PRESSURE_PLATE_DOWN.create(pressurePlate, texturedModel.getMapping(), blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createPressurePlateBlockState(pressurePlate, up, down)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createPressurePlate(pressurePlate, up, down)); } for (SimpleTrapDoorModel.Trapdoor trapdoor : SimpleTrapDoorModel.trapdoors) { @@ -501,28 +533,54 @@ public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGen } for (SimpleDoorModel.Door door : SimpleDoorModel.doors) { - blockStateModelGenerator.registerDoor(door.door()); + blockStateModelGenerator.createDoor(door.door()); } //TODO find out why some blocks are null here - for (Block block : TintableCrossModel.notTintedBlocks) { - if (block != null) - blockStateModelGenerator.registerTintableCross(block, BlockStateModelGenerator.CrossType.NOT_TINTED); - } - - blockStateModelGenerator.registerPlantPart(ModNatureBlocks.GLOWWORM_WEBBING, ModNatureBlocks.GLOWWORM_MAIN, BlockStateModelGenerator.CrossType.NOT_TINTED); - blockStateModelGenerator.registerItemModel(ModNatureBlocks.GLOWWORM_WEBBING); - - for (Block block : TintableCrossModel.tintedBlocks) { - blockStateModelGenerator.registerTintableCrossBlockState(block, BlockStateModelGenerator.CrossType.TINTED); - blockStateModelGenerator.registerTintedItemModel(block, blockStateModelGenerator.uploadBlockItemModel(block.asItem(), block), new GrassTintSource()); - } - - for (Block block : TintableCrossModel.grassLikeBlocks) { - blockStateModelGenerator.registerTintableCross(block, BlockStateModelGenerator.CrossType.NOT_TINTED); - } - - for (Block block : TintableCrossModel.largePlants) { + for (Block block : TintableCrossModel.notTintedBlocks()) { + if (block != null + && block != ModNatureBlocks.PALE_OAK_SAPLING + && block != ModNatureBlocks.BUSH + && block != ModNatureBlocks.FIREFLY_BUSH + && block != ModNatureBlocks.SHORT_DRY_GRASS + && block != ModNatureBlocks.TALL_DRY_GRASS) + blockStateModelGenerator.createCrossBlockWithDefaultItem(block, GenerationContext.PlantType.NOT_TINTED); + } + registerCrossBlockWithTexture( + blockStateModelGenerator, + ModNatureBlocks.BUSH, + TextureMapping.getBlockTexture(ModNatureBlocks.LARGE_BUSH), + GenerationContext.PlantType.TINTED); + registerCrossBlockWithTexture( + blockStateModelGenerator, + ModNatureBlocks.FIREFLY_BUSH, + TextureMapping.getBlockTexture(ModNatureBlocks.TOUGH_BERRY_BUSH, "_stage3")); + registerCrossBlockWithTexture( + blockStateModelGenerator, + ModNatureBlocks.SHORT_DRY_GRASS, + TextureMapping.getBlockTexture(ModNatureBlocks.DEAD_HEATHER)); + registerCrossBlockWithTexture( + blockStateModelGenerator, + ModNatureBlocks.TALL_DRY_GRASS, + TextureMapping.getBlockTexture(ModNatureBlocks.DEAD_HEATHER_BUSH)); + registerCrossBlockWithTexture( + blockStateModelGenerator, + ModNatureBlocks.PALE_OAK_SAPLING, + TextureMapping.getBlockTexture(Blocks.DARK_OAK_SAPLING)); + + blockStateModelGenerator.createGrowingPlant(ModNatureBlocks.GLOWWORM_WEBBING, ModNatureBlocks.GLOWWORM_MAIN, GenerationContext.PlantType.NOT_TINTED); + blockStateModelGenerator.registerSimpleFlatItemModel(ModNatureBlocks.GLOWWORM_WEBBING); + + for (Block block : TintableCrossModel.tintedBlocks()) { + blockStateModelGenerator.createCrossBlock(block, GenerationContext.PlantType.TINTED); + blockStateModelGenerator.registerSimpleTintedItemModel(block, blockStateModelGenerator.createFlatItemModelWithBlockTexture(block.asItem(), block), null); + } + + for (Block block : TintableCrossModel.grassLikeBlocks()) { + blockStateModelGenerator.createCrossBlockWithDefaultItem(block, GenerationContext.PlantType.NOT_TINTED); + } + + for (Block block : TintableCrossModel.largePlants()) { registerLargePlant(blockStateModelGenerator, block); } @@ -530,27 +588,27 @@ public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGen registerTintableLargePlant(blockStateModelGenerator, ModNatureBlocks.WILD_GRASS); for (Block block : SimpleFlowerBedModel.flowerBeds) { - blockStateModelGenerator.registerFlowerbed(block); + blockStateModelGenerator.createFlowerBed(block); } for (SimpleFlowerPotModel.FlowerPot flowerPot : SimpleFlowerPotModel.pots) { - registerFlowerPotPlant(blockStateModelGenerator, flowerPot.plant(), flowerPot.pottedPlant(), BlockStateModelGenerator.CrossType.NOT_TINTED); + registerFlowerPotPlant(blockStateModelGenerator, flowerPot.plant(), flowerPot.pottedPlant(), GenerationContext.PlantType.NOT_TINTED); } for (Block block : SimpleDoubleBlockModel.doubleBlocks) { - registerDoubleBlock(blockStateModelGenerator, block, BlockStateModelGenerator.CrossType.NOT_TINTED); + registerDoubleBlock(blockStateModelGenerator, block, GenerationContext.PlantType.NOT_TINTED); } for (Block block : SimpleDoubleBlockModel.doubleBlocksItems) { - registerDoubleBlock(blockStateModelGenerator, block, BlockStateModelGenerator.CrossType.NOT_TINTED); + registerDoubleBlock(blockStateModelGenerator, block, GenerationContext.PlantType.NOT_TINTED); } for (Block block : SimpleMushroomBlockModel.mushroomBlocks) { - blockStateModelGenerator.registerMushroomBlock(block); + blockStateModelGenerator.createMushroomBlock(block); } for (SimpleVerticalSlabModel.VerticalSlab verticalSlab : SimpleVerticalSlabModel.verticalSlabs) { - String id = Registries.BLOCK.getId(verticalSlab.block()).getPath(); + String id = BuiltInRegistries.BLOCK.getKey(verticalSlab.block()).getPath(); if (verticalSlab.block() == Blocks.BASALT || verticalSlab.block() == Blocks.POLISHED_BASALT) { id = id + "_side"; } @@ -559,16 +617,16 @@ public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGen for (SimpleVerticalSlabModel.VerticalSlab verticalSlab : SimpleVerticalSlabModel.woodVerticalSlabs) { registerVerticalSlabModelBlockStates(blockStateModelGenerator, verticalSlab.verticalSlab(), verticalSlab.block(), - Registries.BLOCK.getId(verticalSlab.block()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood")); + BuiltInRegistries.BLOCK.getKey(verticalSlab.block()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood")); } for (SimpleVerticalSlabModel.VerticalSlab verticalSlab : SimpleVerticalSlabModel.strippedVerticalSlabs) { registerVerticalSlabModelBlockStates(blockStateModelGenerator, verticalSlab.verticalSlab(), verticalSlab.block(), - Registries.BLOCK.getId(verticalSlab.block()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood")); + BuiltInRegistries.BLOCK.getKey(verticalSlab.block()).getPath().replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood")); } for (SimpleVerticalSlabModel.VerticalSlab verticalSlab : SimpleVerticalSlabModel.plansVerticalSlabs) { - registerVerticalSlabModelBlockStates(blockStateModelGenerator, verticalSlab.verticalSlab(), verticalSlab.block(), Registries.BLOCK.getId(verticalSlab.block()).getPath()); + registerVerticalSlabModelBlockStates(blockStateModelGenerator, verticalSlab.verticalSlab(), verticalSlab.block(), BuiltInRegistries.BLOCK.getKey(verticalSlab.block()).getPath()); } for (SimpleLayersModel.Layers block : SimpleLayersModel.layers) { @@ -592,22 +650,22 @@ public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGen } for(SimpleStoneStoolModel.Stool stool : SimpleStoneStoolModel.stools){ - String id = "block/" + Registries.BLOCK.getId(stool.base()).getPath(); + String id = "block/" + BuiltInRegistries.BLOCK.getKey(stool.base()).getPath(); if (stool.base() == Blocks.BASALT) id += "_side"; registerStoneStoolModelBlockStates(blockStateModelGenerator, stool.stool(), - Identifier.of(Registries.BLOCK.getId(stool.base()).getNamespace(), id)); + ResourceLocation.fromNamespaceAndPath(BuiltInRegistries.BLOCK.getKey(stool.base()).getNamespace(), id)); } for(SimpleStoneTableModel.Table table : SimpleStoneTableModel.tables) { - String id = "block/" + Registries.BLOCK.getId(table.base()).getPath(); + String id = "block/" + BuiltInRegistries.BLOCK.getKey(table.base()).getPath(); if(table.base() == Blocks.BASALT) id += "_side"; - registerStoneTableModelBlockStates(blockStateModelGenerator, table.table(), Identifier.of(Registries.BLOCK.getId(table.base()).getNamespace(), id)); + registerStoneTableModelBlockStates(blockStateModelGenerator, table.table(), ResourceLocation.fromNamespaceAndPath(BuiltInRegistries.BLOCK.getKey(table.base()).getNamespace(), id)); } for(SimpleStoneChairModel.Chair chair : SimpleStoneChairModel.chairs){ - String id = "block/" + Registries.BLOCK.getId(chair.base()).getPath(); + String id = "block/" + BuiltInRegistries.BLOCK.getKey(chair.base()).getPath(); if(chair.base() == Blocks.BASALT) id += "_side"; - registerStoneChairModelBlockStates(blockStateModelGenerator, chair.chair(), Identifier.of(Registries.BLOCK.getId(chair.base()).getNamespace(), id)); + registerStoneChairModelBlockStates(blockStateModelGenerator, chair.chair(), ResourceLocation.fromNamespaceAndPath(BuiltInRegistries.BLOCK.getKey(chair.base()).getNamespace(), id)); } for(Block block : SimpleWoodTableModel.tables){ @@ -648,7 +706,7 @@ public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGen for (SimpleVerticalSlabModel.VerticalSlab verticalSlab : SimpleVerticalSlabModel.vanillaVerticalSlabs) { - String id = String.valueOf(Registries.BLOCK.getId(verticalSlab.block())); + String id = String.valueOf(BuiltInRegistries.BLOCK.getKey(verticalSlab.block())); id = id.substring(id.lastIndexOf(":") + 1); if (verticalSlab.block() == Blocks.SANDSTONE || verticalSlab.block() == Blocks.RED_SANDSTONE || verticalSlab.block() == Blocks.CUT_SANDSTONE || verticalSlab.block() == Blocks.CUT_RED_SANDSTONE) { @@ -679,10 +737,10 @@ public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGen } for (SimpleVerticalSlabModel.VerticalSlab verticalSlab : SimpleVerticalSlabModel.columnVerticalSlabs) { - Identifier identifier = Registries.BLOCK.getId(verticalSlab.verticalSlab()); + ResourceLocation identifier = BuiltInRegistries.BLOCK.getKey(verticalSlab.verticalSlab()); String sidePath = identifier.getPath().replaceAll("_vertical_slab", ""); - Identifier identifier2 = Registries.BLOCK.getId(verticalSlab.verticalSlab()).withSuffixedPath("_top"); + ResourceLocation identifier2 = BuiltInRegistries.BLOCK.getKey(verticalSlab.verticalSlab()).withSuffix("_top"); String topBottomPath = identifier2.getPath().replaceAll("_vertical_slab", ""); topBottomPath = topBottomPath.replaceAll("_carved_window_top", ""); @@ -691,10 +749,10 @@ public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGen } for (SimpleWallModel.Wall wall : SimpleWallModel.columnWalls) { - Identifier identifier = Registries.BLOCK.getId(wall.wall()); + ResourceLocation identifier = BuiltInRegistries.BLOCK.getKey(wall.wall()); String sidePath = identifier.getPath().replaceAll("_wall", ""); - Identifier identifier2 = Registries.BLOCK.getId(wall.wall()).withSuffixedPath("_top"); + ResourceLocation identifier2 = BuiltInRegistries.BLOCK.getKey(wall.wall()).withSuffix("_top"); String topBottomPath = identifier2.getPath().replaceAll("_wall", ""); registerColumnWallModelBlockStates(blockStateModelGenerator, wall.wall(), wall.block(), @@ -702,13 +760,13 @@ public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGen } for (SimpleVerticalSlabModel.VerticalSlab verticalSlab : SimpleVerticalSlabModel.vanillaWoodVerticalSlabs) { - String id = Registries.BLOCK.getId(verticalSlab.block()).getPath(); + String id = BuiltInRegistries.BLOCK.getKey(verticalSlab.block()).getPath(); String baseTextureId = id.substring(0, id.lastIndexOf("_")) + "_log"; baseTextureId = baseTextureId.replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"); registerVanillaVerticalSlabModelBlockStates(blockStateModelGenerator, verticalSlab.verticalSlab(), verticalSlab.block(), baseTextureId); } for (SimpleVerticalSlabModel.VerticalSlab verticalSlab : SimpleVerticalSlabModel.vanillaStrippedVerticalSlabs) { - String id = Registries.BLOCK.getId(verticalSlab.block()).getPath(); + String id = BuiltInRegistries.BLOCK.getKey(verticalSlab.block()).getPath(); String baseTextureId = id.substring(0, id.lastIndexOf("_")) + "_log"; baseTextureId = baseTextureId.replaceAll("_wood", "_log").replaceAll("_hyphae", "_stem").replaceAll("treated_log", "treated_wood").replaceAll("aged_log", "aged_wood"); registerVanillaVerticalSlabModelBlockStates(blockStateModelGenerator, verticalSlab.verticalSlab(), verticalSlab.block(), baseTextureId); @@ -719,31 +777,31 @@ public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGen }); // Crops - blockStateModelGenerator.registerCrop(ModNatureBlocks.BELL_PEPPER_CROP, BellpepperCropBlock.AGE, 0, 1, 2, 3, 4); - blockStateModelGenerator.registerCrop(ModNatureBlocks.CUCUMBER_CROP, CucumberCropBlock.AGE, 0, 1, 2, 3); - blockStateModelGenerator.registerCrop(ModNatureBlocks.FLAX_CROP, FlaxCropBlock.AGE, 0, 1, 2, 3); - blockStateModelGenerator.registerCrop(ModNatureBlocks.GARLIC_CROP, GarlicCropBlock.AGE, 0, 1, 2, 3); - blockStateModelGenerator.registerCrop(ModNatureBlocks.LEEK_CROP, LeekCropBlock.AGE, 0, 1, 2, 3); - blockStateModelGenerator.registerCrop(ModNatureBlocks.LETTUCE_CROP, LettuceCropBlock.AGE, 0, 1, 2, 3); - blockStateModelGenerator.registerCrop(ModNatureBlocks.ONION_CROP, OnionCropBlock.AGE, 0, 1, 2, 3); + blockStateModelGenerator.createCropBlock(ModNatureBlocks.BELL_PEPPER_CROP, BellpepperCropBlock.AGE, 0, 1, 2, 3, 4); + blockStateModelGenerator.createCropBlock(ModNatureBlocks.CUCUMBER_CROP, CucumberCropBlock.AGE, 0, 1, 2, 3); + blockStateModelGenerator.createCropBlock(ModNatureBlocks.FLAX_CROP, FlaxCropBlock.AGE, 0, 1, 2, 3); + blockStateModelGenerator.createCropBlock(ModNatureBlocks.GARLIC_CROP, GarlicCropBlock.AGE, 0, 1, 2, 3); + blockStateModelGenerator.createCropBlock(ModNatureBlocks.LEEK_CROP, LeekCropBlock.AGE, 0, 1, 2, 3); + blockStateModelGenerator.createCropBlock(ModNatureBlocks.LETTUCE_CROP, LettuceCropBlock.AGE, 0, 1, 2, 3); + blockStateModelGenerator.createCropBlock(ModNatureBlocks.ONION_CROP, OnionCropBlock.AGE, 0, 1, 2, 3); //CLUSTERS - blockStateModelGenerator.registerAmethyst(ModBlocks.GLOWSTONE_CLUSTER); - blockStateModelGenerator.registerAmethyst(ModBlocks.SMALL_GLOWSTONE_BUD); - blockStateModelGenerator.registerAmethyst(ModBlocks.MEDIUM_GLOWSTONE_BUD); - blockStateModelGenerator.registerAmethyst(ModBlocks.LARGE_GLOWSTONE_BUD); - blockStateModelGenerator.registerAmethyst(ModBlocks.RED_AGATE_CLUSTER); - blockStateModelGenerator.registerAmethyst(ModBlocks.SMALL_RED_AGATE_BUD); - blockStateModelGenerator.registerAmethyst(ModBlocks.MEDIUM_RED_AGATE_BUD); - blockStateModelGenerator.registerAmethyst(ModBlocks.LARGE_RED_AGATE_BUD); - blockStateModelGenerator.registerAmethyst(ModBlocks.CITRINE_CLUSTER); - blockStateModelGenerator.registerAmethyst(ModBlocks.SMALL_CITRINE_BUD); - blockStateModelGenerator.registerAmethyst(ModBlocks.MEDIUM_CITRINE_BUD); - blockStateModelGenerator.registerAmethyst(ModBlocks.LARGE_CITRINE_BUD); - blockStateModelGenerator.registerAmethyst(ModBlocks.QUARTZ_CLUSTER); - blockStateModelGenerator.registerAmethyst(ModBlocks.SMALL_QUARTZ_BUD); - blockStateModelGenerator.registerAmethyst(ModBlocks.MEDIUM_QUARTZ_BUD); - blockStateModelGenerator.registerAmethyst(ModBlocks.LARGE_QUARTZ_BUD); + blockStateModelGenerator.createAmethystCluster(ModBlocks.GLOWSTONE_CLUSTER); + blockStateModelGenerator.createAmethystCluster(ModBlocks.SMALL_GLOWSTONE_BUD); + blockStateModelGenerator.createAmethystCluster(ModBlocks.MEDIUM_GLOWSTONE_BUD); + blockStateModelGenerator.createAmethystCluster(ModBlocks.LARGE_GLOWSTONE_BUD); + blockStateModelGenerator.createAmethystCluster(ModBlocks.RED_AGATE_CLUSTER); + blockStateModelGenerator.createAmethystCluster(ModBlocks.SMALL_RED_AGATE_BUD); + blockStateModelGenerator.createAmethystCluster(ModBlocks.MEDIUM_RED_AGATE_BUD); + blockStateModelGenerator.createAmethystCluster(ModBlocks.LARGE_RED_AGATE_BUD); + blockStateModelGenerator.createAmethystCluster(ModBlocks.CITRINE_CLUSTER); + blockStateModelGenerator.createAmethystCluster(ModBlocks.SMALL_CITRINE_BUD); + blockStateModelGenerator.createAmethystCluster(ModBlocks.MEDIUM_CITRINE_BUD); + blockStateModelGenerator.createAmethystCluster(ModBlocks.LARGE_CITRINE_BUD); + blockStateModelGenerator.createAmethystCluster(ModBlocks.QUARTZ_CLUSTER); + blockStateModelGenerator.createAmethystCluster(ModBlocks.SMALL_QUARTZ_BUD); + blockStateModelGenerator.createAmethystCluster(ModBlocks.MEDIUM_QUARTZ_BUD); + blockStateModelGenerator.createAmethystCluster(ModBlocks.LARGE_QUARTZ_BUD); registerLargeDoor(blockStateModelGenerator, (LargeDoorBlock) ModDecorativeBlocks.BLUE_HOBBIT_DOOR, LargeDoor2x2.PART); registerLargeDoor(blockStateModelGenerator, (LargeDoorBlock) ModDecorativeBlocks.GREEN_HOBBIT_DOOR, LargeDoor2x2.PART); @@ -800,28 +858,28 @@ public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGen registerOrientableThickLadder(blockStateModelGenerator, ModDecorativeBlocks.ROPE_LADDER); - blockStateModelGenerator.registerMultifaceBlock(ModNatureBlocks.AZALEA_FLOWER_GROWTH); - blockStateModelGenerator.registerMultifaceBlock(ModNatureBlocks.DRY_GROWTH); - blockStateModelGenerator.registerMultifaceBlock(ModNatureBlocks.FROZEN_GROWTH); - blockStateModelGenerator.registerMultifaceBlock(ModNatureBlocks.GREEN_GROWTH); - blockStateModelGenerator.registerMultifaceBlock(ModNatureBlocks.IVY_GROWTH); - blockStateModelGenerator.registerMultifaceBlock(ModNatureBlocks.LILAC_FLOWER_GROWTH); - blockStateModelGenerator.registerMultifaceBlock(ModNatureBlocks.PINK_FLOWER_GROWTH); - blockStateModelGenerator.registerMultifaceBlock(ModNatureBlocks.RED_FLOWER_GROWTH); - blockStateModelGenerator.registerMultifaceBlock(ModNatureBlocks.THORNY_GROWTH); - blockStateModelGenerator.registerMultifaceBlock(ModNatureBlocks.WHITE_FLOWER_GROWTH); - blockStateModelGenerator.registerMultifaceBlock(ModNatureBlocks.YELLOW_FLOWER_GROWTH); - - blockStateModelGenerator.registerMultifaceBlock(ModNatureBlocks.WEBBING); - - blockStateModelGenerator.registerMultifaceBlock(ModNatureBlocks.MOSS); + blockStateModelGenerator.createMultiface(ModNatureBlocks.AZALEA_FLOWER_GROWTH); + blockStateModelGenerator.createMultiface(ModNatureBlocks.DRY_GROWTH); + blockStateModelGenerator.createMultiface(ModNatureBlocks.FROZEN_GROWTH); + blockStateModelGenerator.createMultiface(ModNatureBlocks.GREEN_GROWTH); + blockStateModelGenerator.createMultiface(ModNatureBlocks.IVY_GROWTH); + blockStateModelGenerator.createMultiface(ModNatureBlocks.LILAC_FLOWER_GROWTH); + blockStateModelGenerator.createMultiface(ModNatureBlocks.PINK_FLOWER_GROWTH); + blockStateModelGenerator.createMultiface(ModNatureBlocks.RED_FLOWER_GROWTH); + blockStateModelGenerator.createMultiface(ModNatureBlocks.THORNY_GROWTH); + blockStateModelGenerator.createMultiface(ModNatureBlocks.WHITE_FLOWER_GROWTH); + blockStateModelGenerator.createMultiface(ModNatureBlocks.YELLOW_FLOWER_GROWTH); + + blockStateModelGenerator.createMultiface(ModNatureBlocks.WEBBING); + + blockStateModelGenerator.createMultiface(ModNatureBlocks.MOSS); registerMultifaceBlock(blockStateModelGenerator, ModNatureBlocks.FOREST_MOSS); - blockStateModelGenerator.registerMultifaceBlock(ModNatureBlocks.CORRUPTED_MOSS); + blockStateModelGenerator.createMultiface(ModNatureBlocks.CORRUPTED_MOSS); - blockStateModelGenerator.registerMultifaceBlock(ModNatureBlocks.MORGUL_IVY); + blockStateModelGenerator.createMultiface(ModNatureBlocks.MORGUL_IVY); - blockStateModelGenerator.registerMultifaceBlock(ModNatureBlocks.STICKY_SNOW); - blockStateModelGenerator.registerMultifaceBlock(ModNatureBlocks.STICKY_ICE); + blockStateModelGenerator.createMultiface(ModNatureBlocks.STICKY_SNOW); + blockStateModelGenerator.createMultiface(ModNatureBlocks.STICKY_ICE); registerPointedBlock(blockStateModelGenerator, ModBlocks.POINTED_DOLOMITE); registerPointedBlock(blockStateModelGenerator, ModBlocks.POINTED_GALONN); @@ -830,8 +888,8 @@ public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGen registerHangingMoss(blockStateModelGenerator, ModNatureBlocks.WILLOW_VINES); - blockStateModelGenerator.registerHangingMoss(ModNatureBlocks.MIRKWOOD_VINES); - blockStateModelGenerator.registerHangingMoss(ModNatureBlocks.HANGING_WEBS); + registerHangingMoss(blockStateModelGenerator, ModNatureBlocks.MIRKWOOD_VINES); + registerHangingMoss(blockStateModelGenerator, ModNatureBlocks.HANGING_WEBS); registerFarmland(blockStateModelGenerator, ModBlocks.CHALKSOIL, ModBlocks.CHALKSOIL_FARMLAND); registerFarmland(blockStateModelGenerator, ModBlocks.LOAM, ModBlocks.LOAM_FARMLAND); @@ -844,65 +902,62 @@ public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGen registerDirtPath(blockStateModelGenerator, ModBlocks.SILT, ModBlocks.SILT_PATH); } - @Override - public void generateItemModels(ItemModelGenerator itemModelGenerator) {} - - public final void registerFanModel(BlockStateModelGenerator blockStateCollector, Block coralFanBlock) { + public final void registerFanModel(GenerationContext blockStateCollector, Block coralFanBlock) { TexturedModel texturedModel = TexturedModel.CORAL_FAN.get(coralFanBlock); - Identifier identifier = texturedModel.upload(coralFanBlock, blockStateCollector.modelCollector); - WeightedVariant weightedVariant = createWeightedVariant(identifier); - blockStateCollector.blockStateCollector.accept(BlockStateModelGenerator.createSingletonBlockState(coralFanBlock, weightedVariant)); - blockStateCollector.registerItemModel(coralFanBlock); + ResourceLocation identifier = texturedModel.create(coralFanBlock, blockStateCollector.modelOutput); + Variant weightedVariant = plainVariant(identifier); + blockStateCollector.blockStateOutput.accept(BlockModelProvider.createSimpleBlock(coralFanBlock, weightedVariant)); + blockStateCollector.registerSimpleFlatItemModel(coralFanBlock); } - public final void registerTintableLargePlant(BlockStateModelGenerator blockStateModelGenerator, Block plantBlock) { - Identifier identifier = MEModels.TINTED_LARGE_PLANT.upload(plantBlock, TextureMap.of(TextureKey.ALL, Identifier.of(Registries.BLOCK.getId(plantBlock).getNamespace(), "block/" + Registries.BLOCK.getId(plantBlock).getPath())), blockStateModelGenerator.modelCollector); - WeightedVariant weightedVariant = createWeightedVariant(identifier); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createSingletonBlockState(plantBlock, weightedVariant)); - blockStateModelGenerator.registerTintedItemModel(plantBlock, Models.GENERATED.upload(ModelIds.getItemModelId(plantBlock.asItem()), TextureMap.layer0(plantBlock.asItem()), blockStateModelGenerator.modelCollector), new GrassTintSource()); + public final void registerTintableLargePlant(GenerationContext blockStateModelGenerator, Block plantBlock) { + ResourceLocation identifier = MEModels.TINTED_LARGE_PLANT.create(plantBlock, TextureMapping.singleSlot(TextureSlot.ALL, ResourceLocation.fromNamespaceAndPath(BuiltInRegistries.BLOCK.getKey(plantBlock).getNamespace(), "block/" + BuiltInRegistries.BLOCK.getKey(plantBlock).getPath())), blockStateModelGenerator.modelOutput); + Variant weightedVariant = plainVariant(identifier); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider.createSimpleBlock(plantBlock, weightedVariant)); + blockStateModelGenerator.registerSimpleTintedItemModel(plantBlock, ModelTemplates.FLAT_ITEM.create(ModelLocationUtils.getModelLocation(plantBlock.asItem()), TextureMapping.layer0(plantBlock.asItem()), blockStateModelGenerator.modelOutput), null); } - public final void registerLargePlant(BlockStateModelGenerator blockStateModelGenerator, Block plantBlock) { - Identifier identifier = MEModels.LARGE_PLANT.upload(plantBlock, TextureMap.of(TextureKey.ALL,Identifier.of(Registries.BLOCK.getId(plantBlock).getNamespace(), "block/" + Registries.BLOCK.getId(plantBlock).getPath())), blockStateModelGenerator.modelCollector); - WeightedVariant weightedVariant = createWeightedVariant(identifier); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createSingletonBlockState(plantBlock, weightedVariant)); - blockStateModelGenerator.registerItemModel(plantBlock.asItem()); + public final void registerLargePlant(GenerationContext blockStateModelGenerator, Block plantBlock) { + ResourceLocation identifier = MEModels.LARGE_PLANT.create(plantBlock, TextureMapping.singleSlot(TextureSlot.ALL,ResourceLocation.fromNamespaceAndPath(BuiltInRegistries.BLOCK.getKey(plantBlock).getNamespace(), "block/" + BuiltInRegistries.BLOCK.getKey(plantBlock).getPath())), blockStateModelGenerator.modelOutput); + Variant weightedVariant = plainVariant(identifier); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider.createSimpleBlock(plantBlock, weightedVariant)); + blockStateModelGenerator.registerSimpleFlatItemModel(plantBlock.asItem()); } - public final void registerFlowerPotPlant(BlockStateModelGenerator blockStateModelGenerator, Block plantBlock, Block flowerPotBlock, BlockStateModelGenerator.CrossType tintType) { - TextureMap textureMap = TextureMap.plant(plantBlock); - Identifier identifier = tintType.getFlowerPotCrossModel().upload(flowerPotBlock, textureMap, blockStateModelGenerator.modelCollector); - WeightedVariant weightedVariant = createWeightedVariant(identifier); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createSingletonBlockState(flowerPotBlock, weightedVariant)); + public final void registerFlowerPotPlant(GenerationContext blockStateModelGenerator, Block plantBlock, Block flowerPotBlock, GenerationContext.PlantType tintType) { + TextureMapping textureMap = TextureMapping.plant(plantBlock); + ResourceLocation identifier = tintType.getCrossPot().create(flowerPotBlock, textureMap, blockStateModelGenerator.modelOutput); + Variant weightedVariant = plainVariant(identifier); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider.createSimpleBlock(flowerPotBlock, weightedVariant)); } - public void registerVanillaVerticalSlabModelBlockStates(BlockStateModelGenerator blockStateModelGenerator, Block block, Block origin, String slabPath) { - Identifier fullBlockId = ModelIds.getBlockModelId(origin); + public void registerVanillaVerticalSlabModelBlockStates(GenerationContext blockStateModelGenerator, Block block, Block origin, String slabPath) { + ResourceLocation fullBlockId = ModelLocationUtils.getModelLocation(origin); - WeightedVariant variantId = createWeightedVariant(MEModels.VERTICAL_SLAB.upload(block, - TextureMap.of(TextureKey.ALL, Identifier.of("minecraft", "block/" + slabPath)), - blockStateModelGenerator.modelCollector)); + Variant variantId = plainVariant(MEModels.VERTICAL_SLAB.create(block, + TextureMapping.singleSlot(TextureSlot.ALL, ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + slabPath)), + blockStateModelGenerator.modelOutput)); - WeightedVariant inner = createWeightedVariant(MEModels.VERTICAL_SLAB_INNER.upload(block, TextureMap.of(TextureKey.ALL, Identifier.of("minecraft", "block/" + slabPath)), blockStateModelGenerator.modelCollector)); - WeightedVariant outer = createWeightedVariant(MEModels.VERTICAL_SLAB_OUTER.upload(block, TextureMap.of(TextureKey.ALL, Identifier.of("minecraft", "block/" + slabPath)), blockStateModelGenerator.modelCollector)); + Variant inner = plainVariant(MEModels.VERTICAL_SLAB_INNER.create(block, TextureMapping.singleSlot(TextureSlot.ALL, ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + slabPath)), blockStateModelGenerator.modelOutput)); + Variant outer = plainVariant(MEModels.VERTICAL_SLAB_OUTER.create(block, TextureMapping.singleSlot(TextureSlot.ALL, ResourceLocation.fromNamespaceAndPath("minecraft", "block/" + slabPath)), blockStateModelGenerator.modelOutput)); registerVerticalSlab(blockStateModelGenerator, block, fullBlockId, variantId, inner, outer); } - public void registerVerticalSlabModelBlockStates(BlockStateModelGenerator blockStateModelGenerator, Block verticalSlab, Block block, String slabPath) { - Identifier fullBlockId = ModelIds.getBlockModelId(block); + public void registerVerticalSlabModelBlockStates(GenerationContext blockStateModelGenerator, Block verticalSlab, Block block, String slabPath) { + ResourceLocation fullBlockId = ModelLocationUtils.getModelLocation(block); - WeightedVariant variantId = createWeightedVariant(MEModels.VERTICAL_SLAB.upload(verticalSlab, - TextureMap.of(TextureKey.ALL, Identifier.of(Registries.BLOCK.getId(block).getNamespace(), "block/" + slabPath)), - blockStateModelGenerator.modelCollector)); + Variant variantId = plainVariant(MEModels.VERTICAL_SLAB.create(verticalSlab, + TextureMapping.singleSlot(TextureSlot.ALL, ResourceLocation.fromNamespaceAndPath(BuiltInRegistries.BLOCK.getKey(block).getNamespace(), "block/" + slabPath)), + blockStateModelGenerator.modelOutput)); - WeightedVariant inner = createWeightedVariant(MEModels.VERTICAL_SLAB_INNER.upload(verticalSlab, TextureMap.of(TextureKey.ALL, Identifier.of(Registries.BLOCK.getId(block).getNamespace(), "block/" + slabPath)), blockStateModelGenerator.modelCollector)); - WeightedVariant outer = createWeightedVariant(MEModels.VERTICAL_SLAB_OUTER.upload(verticalSlab, TextureMap.of(TextureKey.ALL, Identifier.of(Registries.BLOCK.getId(block).getNamespace(), "block/" + slabPath)), blockStateModelGenerator.modelCollector)); + Variant inner = plainVariant(MEModels.VERTICAL_SLAB_INNER.create(verticalSlab, TextureMapping.singleSlot(TextureSlot.ALL, ResourceLocation.fromNamespaceAndPath(BuiltInRegistries.BLOCK.getKey(block).getNamespace(), "block/" + slabPath)), blockStateModelGenerator.modelOutput)); + Variant outer = plainVariant(MEModels.VERTICAL_SLAB_OUTER.create(verticalSlab, TextureMapping.singleSlot(TextureSlot.ALL, ResourceLocation.fromNamespaceAndPath(BuiltInRegistries.BLOCK.getKey(block).getNamespace(), "block/" + slabPath)), blockStateModelGenerator.modelOutput)); registerVerticalSlab(blockStateModelGenerator, verticalSlab, fullBlockId, variantId, inner, outer); } - public void registerColumnWallModelBlockStates(BlockStateModelGenerator blockStateModelGenerator, Block block, Block origin, + public void registerColumnWallModelBlockStates(GenerationContext blockStateModelGenerator, Block block, Block origin, String modId, String topTexturePath, String bottomTexturePath, String sideTexturePath) { String modIdTopBottom = modId; if (sideTexturePath.contains("deepslate_carved_window")){ @@ -937,44 +992,44 @@ public void registerColumnWallModelBlockStates(BlockStateModelGenerator blockSta bottomTexturePath = sideTexturePath; } - Identifier sideTexture = Identifier.of(modId, "block/" + sideTexturePath); + ResourceLocation sideTexture = ResourceLocation.fromNamespaceAndPath(modId, "block/" + sideTexturePath); - WeightedVariant post = createWeightedVariant(MEModels.COLUMN_WALL_POST.upload(block, (new TextureMap()) - .put(TextureKey.TOP, Identifier.of(modIdTopBottom, "block/" + topTexturePath)) - .put(TextureKey.BOTTOM, Identifier.of(modIdTopBottom, "block/" + bottomTexturePath)) - .put(TextureKey.WALL, sideTexture) - .put(TextureKey.PARTICLE, sideTexture), - blockStateModelGenerator.modelCollector)); + Variant post = plainVariant(MEModels.COLUMN_WALL_POST.create(block, (new TextureMapping()) + .put(TextureSlot.TOP, ResourceLocation.fromNamespaceAndPath(modIdTopBottom, "block/" + topTexturePath)) + .put(TextureSlot.BOTTOM, ResourceLocation.fromNamespaceAndPath(modIdTopBottom, "block/" + bottomTexturePath)) + .put(TextureSlot.WALL, sideTexture) + .put(TextureSlot.PARTICLE, sideTexture), + blockStateModelGenerator.modelOutput)); - WeightedVariant low = createWeightedVariant(MEModels.COLUMN_WALL_SIDE.upload(block, (new TextureMap()) - .put(TextureKey.TOP, Identifier.of(modIdTopBottom, "block/" + topTexturePath)) - .put(TextureKey.BOTTOM, Identifier.of(modIdTopBottom, "block/" + bottomTexturePath)) - .put(TextureKey.WALL, sideTexture) - .put(TextureKey.PARTICLE, sideTexture), - blockStateModelGenerator.modelCollector)); + Variant low = plainVariant(MEModels.COLUMN_WALL_SIDE.create(block, (new TextureMapping()) + .put(TextureSlot.TOP, ResourceLocation.fromNamespaceAndPath(modIdTopBottom, "block/" + topTexturePath)) + .put(TextureSlot.BOTTOM, ResourceLocation.fromNamespaceAndPath(modIdTopBottom, "block/" + bottomTexturePath)) + .put(TextureSlot.WALL, sideTexture) + .put(TextureSlot.PARTICLE, sideTexture), + blockStateModelGenerator.modelOutput)); - WeightedVariant tall = createWeightedVariant(MEModels.COLUMN_WALL_SIDE_TALL.upload(block, (new TextureMap()) - .put(TextureKey.TOP, Identifier.of(modIdTopBottom, "block/" + topTexturePath)) - .put(TextureKey.BOTTOM, Identifier.of(modIdTopBottom, "block/" + bottomTexturePath)) - .put(TextureKey.WALL, sideTexture) - .put(TextureKey.PARTICLE, sideTexture), - blockStateModelGenerator.modelCollector)); + Variant tall = plainVariant(MEModels.COLUMN_WALL_SIDE_TALL.create(block, (new TextureMapping()) + .put(TextureSlot.TOP, ResourceLocation.fromNamespaceAndPath(modIdTopBottom, "block/" + topTexturePath)) + .put(TextureSlot.BOTTOM, ResourceLocation.fromNamespaceAndPath(modIdTopBottom, "block/" + bottomTexturePath)) + .put(TextureSlot.WALL, sideTexture) + .put(TextureSlot.PARTICLE, sideTexture), + blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator - .createWallBlockState(block, post, low, tall)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider + .createWall(block, post, low, tall)); - Identifier inventory = MEModels.COLUMN_WALL_INVENTORY.upload(block, (new TextureMap()) - .put(TextureKey.TOP, Identifier.of(modIdTopBottom, "block/" + topTexturePath)) - .put(TextureKey.BOTTOM, Identifier.of(modIdTopBottom, "block/" + bottomTexturePath)) - .put(TextureKey.WALL, sideTexture) - .put(TextureKey.PARTICLE, sideTexture), blockStateModelGenerator.modelCollector); + ResourceLocation inventory = MEModels.COLUMN_WALL_INVENTORY.create(block, (new TextureMapping()) + .put(TextureSlot.TOP, ResourceLocation.fromNamespaceAndPath(modIdTopBottom, "block/" + topTexturePath)) + .put(TextureSlot.BOTTOM, ResourceLocation.fromNamespaceAndPath(modIdTopBottom, "block/" + bottomTexturePath)) + .put(TextureSlot.WALL, sideTexture) + .put(TextureSlot.PARTICLE, sideTexture), blockStateModelGenerator.modelOutput); - blockStateModelGenerator.registerParentedItemModel(block, inventory); + blockStateModelGenerator.registerSimpleItemModel(block, inventory); } - public void registerColumnVerticalSlabModelBlockStates(BlockStateModelGenerator blockStateModelGenerator, Block block, Block origin, + public void registerColumnVerticalSlabModelBlockStates(GenerationContext blockStateModelGenerator, Block block, Block origin, String modId, String topTexturePath, String bottomTexturePath, String sideTexturePath) { - Identifier fullBlockId = ModelIds.getBlockModelId(origin); + ResourceLocation fullBlockId = ModelLocationUtils.getModelLocation(origin); String modIdTopBottom = modId; if (sideTexturePath.contains("deepslate_carved_window") || sideTexturePath.contains("calcite_carved_window")){ modIdTopBottom = "minecraft"; @@ -1008,226 +1063,226 @@ public void registerColumnVerticalSlabModelBlockStates(BlockStateModelGenerator bottomTexturePath = sideTexturePath; } - Identifier sideTexture = Identifier.of(modId, "block/" + sideTexturePath); - - WeightedVariant variantId = createWeightedVariant(MEModels.VERTICAL_COLUMN_SLAB.upload(block, (new TextureMap()) - .put(TextureKey.TOP, Identifier.of(modIdTopBottom, "block/" + topTexturePath)) - .put(TextureKey.BOTTOM, Identifier.of(modIdTopBottom, "block/" + bottomTexturePath)) - .put(TextureKey.SIDE, sideTexture) - .put(TextureKey.PARTICLE, sideTexture), - blockStateModelGenerator.modelCollector)); - - WeightedVariant inner = createWeightedVariant(MEModels.VERTICAL_COLUMN_SLAB_INNER.upload(block, (new TextureMap()) - .put(TextureKey.TOP, Identifier.of(modIdTopBottom, "block/" + topTexturePath)) - .put(TextureKey.BOTTOM, Identifier.of(modIdTopBottom, "block/" + bottomTexturePath)) - .put(TextureKey.SIDE, sideTexture) - .put(TextureKey.PARTICLE, sideTexture), - blockStateModelGenerator.modelCollector)); - - WeightedVariant outer = createWeightedVariant(MEModels.VERTICAL_COLUMN_SLAB_OUTER.upload(block, (new TextureMap()) - .put(TextureKey.TOP, Identifier.of(modIdTopBottom, "block/" + topTexturePath)) - .put(TextureKey.BOTTOM, Identifier.of(modIdTopBottom, "block/" + bottomTexturePath)) - .put(TextureKey.SIDE, sideTexture) - .put(TextureKey.PARTICLE, sideTexture), - blockStateModelGenerator.modelCollector)); + ResourceLocation sideTexture = ResourceLocation.fromNamespaceAndPath(modId, "block/" + sideTexturePath); + + Variant variantId = plainVariant(MEModels.VERTICAL_COLUMN_SLAB.create(block, (new TextureMapping()) + .put(TextureSlot.TOP, ResourceLocation.fromNamespaceAndPath(modIdTopBottom, "block/" + topTexturePath)) + .put(TextureSlot.BOTTOM, ResourceLocation.fromNamespaceAndPath(modIdTopBottom, "block/" + bottomTexturePath)) + .put(TextureSlot.SIDE, sideTexture) + .put(TextureSlot.PARTICLE, sideTexture), + blockStateModelGenerator.modelOutput)); + + Variant inner = plainVariant(MEModels.VERTICAL_COLUMN_SLAB_INNER.create(block, (new TextureMapping()) + .put(TextureSlot.TOP, ResourceLocation.fromNamespaceAndPath(modIdTopBottom, "block/" + topTexturePath)) + .put(TextureSlot.BOTTOM, ResourceLocation.fromNamespaceAndPath(modIdTopBottom, "block/" + bottomTexturePath)) + .put(TextureSlot.SIDE, sideTexture) + .put(TextureSlot.PARTICLE, sideTexture), + blockStateModelGenerator.modelOutput)); + + Variant outer = plainVariant(MEModels.VERTICAL_COLUMN_SLAB_OUTER.create(block, (new TextureMapping()) + .put(TextureSlot.TOP, ResourceLocation.fromNamespaceAndPath(modIdTopBottom, "block/" + topTexturePath)) + .put(TextureSlot.BOTTOM, ResourceLocation.fromNamespaceAndPath(modIdTopBottom, "block/" + bottomTexturePath)) + .put(TextureSlot.SIDE, sideTexture) + .put(TextureSlot.PARTICLE, sideTexture), + blockStateModelGenerator.modelOutput)); registerVerticalSlab(blockStateModelGenerator, block, fullBlockId, variantId, inner, outer); } - private void registerVerticalSlab(BlockStateModelGenerator blockStateModelGenerator, Block block, Identifier fullBlock, WeightedVariant regular, WeightedVariant inner, WeightedVariant outer) { - WeightedVariant fullBlockVariant; - if (Registries.BLOCK.getId(block).getPath().contains("waxed_") && Registries.BLOCK.getId(block).getPath().contains("copper")) { - fullBlockVariant = createWeightedVariant(Identifier.ofVanilla(fullBlock.getPath().replaceAll("waxed_", ""))); + private void registerVerticalSlab(GenerationContext blockStateModelGenerator, Block block, ResourceLocation fullBlock, Variant regular, Variant inner, Variant outer) { + Variant fullBlockVariant; + if (BuiltInRegistries.BLOCK.getKey(block).getPath().contains("waxed_") && BuiltInRegistries.BLOCK.getKey(block).getPath().contains("copper")) { + fullBlockVariant = plainVariant(ResourceLocation.withDefaultNamespace(fullBlock.getPath().replaceAll("waxed_", ""))); } else if (fullBlock.getNamespace().contains("minecraft")) { - fullBlockVariant = createWeightedVariant(Identifier.ofVanilla(fullBlock.getPath())); + fullBlockVariant = plainVariant(ResourceLocation.withDefaultNamespace(fullBlock.getPath())); }else { - fullBlockVariant = createWeightedVariant(Identifier.of(MiddleEarth.MOD_ID, fullBlock.getPath())); - } - - VariantsBlockModelDefinitionCreator blockstate = VariantsBlockModelDefinitionCreator.of(block).with( - BlockStateVariantMap.models(Properties.HORIZONTAL_FACING, VerticalSlabBlock.DOUBLE, VerticalSlabBlock.SHAPE) - .register(Direction.EAST, false, VerticalSlabShape.STRAIGHT, regular.apply(ROTATE_Y_90).apply(UV_LOCK)) - .register(Direction.WEST, false, VerticalSlabShape.STRAIGHT, regular.apply(ROTATE_Y_270).apply(UV_LOCK)) - .register(Direction.SOUTH, false, VerticalSlabShape.STRAIGHT, regular.apply(ROTATE_Y_180).apply(UV_LOCK)) - .register(Direction.NORTH, false, VerticalSlabShape.STRAIGHT, regular.apply(UV_LOCK)) - .register(Direction.EAST, false, VerticalSlabShape.OUTER_RIGHT, outer.apply(ROTATE_Y_180).apply(UV_LOCK)) - .register(Direction.WEST, false, VerticalSlabShape.OUTER_RIGHT, outer.apply(UV_LOCK)) - .register(Direction.SOUTH, false, VerticalSlabShape.OUTER_RIGHT, outer.apply(ROTATE_Y_270).apply(UV_LOCK)) - .register(Direction.NORTH, false, VerticalSlabShape.OUTER_RIGHT, outer.apply(ROTATE_Y_90).apply(UV_LOCK)) - .register(Direction.EAST, false, VerticalSlabShape.OUTER_LEFT, outer.apply(ROTATE_Y_90).apply(UV_LOCK)) - .register(Direction.WEST, false, VerticalSlabShape.OUTER_LEFT, outer.apply(ROTATE_Y_270).apply(UV_LOCK)) - .register(Direction.SOUTH, false, VerticalSlabShape.OUTER_LEFT, outer.apply(ROTATE_Y_180).apply(UV_LOCK)) - .register(Direction.NORTH, false, VerticalSlabShape.OUTER_LEFT, outer.apply(UV_LOCK)) - .register(Direction.EAST, false, VerticalSlabShape.INNER_RIGHT, inner.apply(ROTATE_Y_180).apply(UV_LOCK)) - .register(Direction.WEST, false, VerticalSlabShape.INNER_RIGHT, inner.apply(UV_LOCK)) - .register(Direction.SOUTH, false, VerticalSlabShape.INNER_RIGHT, inner.apply(ROTATE_Y_270).apply(UV_LOCK)) - .register(Direction.NORTH, false, VerticalSlabShape.INNER_RIGHT, inner.apply(ROTATE_Y_90).apply(UV_LOCK)) - .register(Direction.EAST, false, VerticalSlabShape.INNER_LEFT, inner.apply(ROTATE_Y_90).apply(UV_LOCK)) - .register(Direction.WEST, false, VerticalSlabShape.INNER_LEFT, inner.apply(ROTATE_Y_270).apply(UV_LOCK)) - .register(Direction.SOUTH, false, VerticalSlabShape.INNER_LEFT, inner.apply(ROTATE_Y_180).apply(UV_LOCK)) - .register(Direction.NORTH, false, VerticalSlabShape.INNER_LEFT, inner.apply(UV_LOCK)) - - .register(Direction.EAST, true, VerticalSlabShape.STRAIGHT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.WEST, true, VerticalSlabShape.STRAIGHT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.SOUTH, true, VerticalSlabShape.STRAIGHT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.NORTH, true, VerticalSlabShape.STRAIGHT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.EAST, true, VerticalSlabShape.OUTER_RIGHT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.WEST, true, VerticalSlabShape.OUTER_RIGHT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.SOUTH, true, VerticalSlabShape.OUTER_RIGHT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.NORTH, true, VerticalSlabShape.OUTER_RIGHT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.EAST, true, VerticalSlabShape.OUTER_LEFT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.WEST, true, VerticalSlabShape.OUTER_LEFT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.SOUTH, true, VerticalSlabShape.OUTER_LEFT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.NORTH, true, VerticalSlabShape.OUTER_LEFT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.EAST, true, VerticalSlabShape.INNER_RIGHT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.WEST, true, VerticalSlabShape.INNER_RIGHT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.SOUTH, true, VerticalSlabShape.INNER_RIGHT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.NORTH, true, VerticalSlabShape.INNER_RIGHT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.EAST, true, VerticalSlabShape.INNER_LEFT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.WEST, true, VerticalSlabShape.INNER_LEFT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.SOUTH, true, VerticalSlabShape.INNER_LEFT, fullBlockVariant.apply(UV_LOCK)) - .register(Direction.NORTH, true, VerticalSlabShape.INNER_LEFT, fullBlockVariant.apply(UV_LOCK))); - - blockStateModelGenerator.registerParentedItemModel(block, ModelIds.getBlockModelId(block)); - blockStateModelGenerator.blockStateCollector.accept(blockstate); - } - - public void registerWoodStoolModelBlockStates(BlockStateModelGenerator blockStateModelGenerator, Block block){ - Identifier texture = Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(block).getPath().replaceAll("stool", "chair")); - WeightedVariant weightedVariant = BlockStateModelGenerator.createWeightedVariant(MEModels.WOOD_STOOL.upload(block, - new TextureMap().put(TextureKey.ALL, texture).put(TextureKey.PARTICLE, texture), blockStateModelGenerator.modelCollector)); - - VariantsBlockModelDefinitionCreator blockstate = VariantsBlockModelDefinitionCreator.of(block).with( - BlockStateVariantMap.models(Properties.HORIZONTAL_FACING) - .register(Direction.NORTH, weightedVariant) - .register(Direction.EAST, weightedVariant.apply(ROTATE_Y_90)) - .register(Direction.SOUTH, weightedVariant.apply(ROTATE_Y_180)) - .register(Direction.WEST, weightedVariant.apply(ROTATE_Y_270))); - - blockStateModelGenerator.registerParentedItemModel(block, ModelIds.getBlockModelId(block)); - blockStateModelGenerator.blockStateCollector.accept(blockstate); - } - - public void registerWoodBenchModelBlockStates(BlockStateModelGenerator blockStateModelGenerator, Block block){ - Identifier texture = Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(block).getPath()); - WeightedVariant weightedVariant = BlockStateModelGenerator.createWeightedVariant(MEModels.WOOD_BENCH.upload(block, - new TextureMap().put(TextureKey.ALL, texture).put(TextureKey.PARTICLE, texture), blockStateModelGenerator.modelCollector)); - - VariantsBlockModelDefinitionCreator blockstate = VariantsBlockModelDefinitionCreator.of(block).with( - BlockStateVariantMap.models(Properties.HORIZONTAL_FACING) - .register(Direction.NORTH, weightedVariant) - .register(Direction.EAST, weightedVariant.apply(ROTATE_Y_90)) - .register(Direction.SOUTH, weightedVariant.apply(ROTATE_Y_180)) - .register(Direction.WEST, weightedVariant.apply(ROTATE_Y_270))); - - blockStateModelGenerator.registerParentedItemModel(block, ModelIds.getBlockModelId(block)); - blockStateModelGenerator.blockStateCollector.accept(blockstate); - } - - public void registerWoodTableModelBlockStates(BlockStateModelGenerator blockStateModelGenerator, Block block){ - Identifier texture = Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(block).getPath()); - WeightedVariant weightedVariant = BlockStateModelGenerator.createWeightedVariant(MEModels.WOOD_TABLE.upload(block, - new TextureMap().put(TextureKey.ALL, texture).put(TextureKey.PARTICLE, texture), blockStateModelGenerator.modelCollector)); - - blockStateModelGenerator.registerParentedItemModel(block, ModelIds.getBlockModelId(block)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createSingletonBlockState(block, weightedVariant)); - } - - public void registerWoodChairModelBlockStates(BlockStateModelGenerator blockStateModelGenerator, Block block){ - Identifier texture = Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(block).getPath()); - WeightedVariant weightedVariant = BlockStateModelGenerator.createWeightedVariant(MEModels.WOOD_CHAIR.upload(block, - new TextureMap().put(TextureKey.ALL, texture).put(TextureKey.PARTICLE, texture), blockStateModelGenerator.modelCollector)); - - VariantsBlockModelDefinitionCreator blockstate = VariantsBlockModelDefinitionCreator.of(block).with( - BlockStateVariantMap.models(Properties.HORIZONTAL_FACING) - .register(Direction.NORTH, weightedVariant) - .register(Direction.EAST, weightedVariant.apply(ROTATE_Y_90)) - .register(Direction.SOUTH, weightedVariant.apply(ROTATE_Y_180)) - .register(Direction.WEST, weightedVariant.apply(ROTATE_Y_270))); - - blockStateModelGenerator.registerParentedItemModel(block, ModelIds.getBlockModelId(block)); - blockStateModelGenerator.blockStateCollector.accept(blockstate); - } - - public void registerStoneStoolModelBlockStates(BlockStateModelGenerator blockStateModelGenerator, Block block, Identifier texture) { - WeightedVariant weightedVariant = BlockStateModelGenerator.createWeightedVariant(MEModels.STONE_STOOL.upload(block, - new TextureMap().put(TextureKey.ALL, texture).put(TextureKey.PARTICLE, texture), blockStateModelGenerator.modelCollector)); - - VariantsBlockModelDefinitionCreator blockstate = VariantsBlockModelDefinitionCreator.of(block).with( - BlockStateVariantMap.models(Properties.HORIZONTAL_FACING) - .register(Direction.NORTH, weightedVariant) - .register(Direction.EAST, weightedVariant.apply(ROTATE_Y_90)) - .register(Direction.SOUTH, weightedVariant.apply(ROTATE_Y_180)) - .register(Direction.WEST, weightedVariant.apply(ROTATE_Y_270))); - - blockStateModelGenerator.registerParentedItemModel(block, ModelIds.getBlockModelId(block)); - blockStateModelGenerator.blockStateCollector.accept(blockstate); - } - - public void registerStoneTableModelBlockStates(BlockStateModelGenerator blockStateModelGenerator, Block block, Identifier texture) { - WeightedVariant weightedVariant = BlockStateModelGenerator.createWeightedVariant(MEModels.STONE_TABLE.upload(block, - new TextureMap().put(TextureKey.ALL, texture).put(TextureKey.PARTICLE, texture), blockStateModelGenerator.modelCollector)); - - blockStateModelGenerator.registerParentedItemModel(block, ModelIds.getBlockModelId(block)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createSingletonBlockState(block, weightedVariant)); + fullBlockVariant = plainVariant(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, fullBlock.getPath())); + } + + MultiVariantGenerator blockstate = MultiVariantGenerator.multiVariant(block).with( + PropertyDispatch.properties(BlockStateProperties.HORIZONTAL_FACING, VerticalSlabBlock.DOUBLE, VerticalSlabBlock.SHAPE) + .select(Direction.EAST, false, VerticalSlabShape.STRAIGHT, copyVariant(regular).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90).with(VariantProperties.UV_LOCK, true)) + .select(Direction.WEST, false, VerticalSlabShape.STRAIGHT, copyVariant(regular).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270).with(VariantProperties.UV_LOCK, true)) + .select(Direction.SOUTH, false, VerticalSlabShape.STRAIGHT, copyVariant(regular).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180).with(VariantProperties.UV_LOCK, true)) + .select(Direction.NORTH, false, VerticalSlabShape.STRAIGHT, copyVariant(regular).with(VariantProperties.UV_LOCK, true)) + .select(Direction.EAST, false, VerticalSlabShape.OUTER_RIGHT, copyVariant(outer).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180).with(VariantProperties.UV_LOCK, true)) + .select(Direction.WEST, false, VerticalSlabShape.OUTER_RIGHT, copyVariant(outer).with(VariantProperties.UV_LOCK, true)) + .select(Direction.SOUTH, false, VerticalSlabShape.OUTER_RIGHT, copyVariant(outer).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270).with(VariantProperties.UV_LOCK, true)) + .select(Direction.NORTH, false, VerticalSlabShape.OUTER_RIGHT, copyVariant(outer).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90).with(VariantProperties.UV_LOCK, true)) + .select(Direction.EAST, false, VerticalSlabShape.OUTER_LEFT, copyVariant(outer).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90).with(VariantProperties.UV_LOCK, true)) + .select(Direction.WEST, false, VerticalSlabShape.OUTER_LEFT, copyVariant(outer).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270).with(VariantProperties.UV_LOCK, true)) + .select(Direction.SOUTH, false, VerticalSlabShape.OUTER_LEFT, copyVariant(outer).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180).with(VariantProperties.UV_LOCK, true)) + .select(Direction.NORTH, false, VerticalSlabShape.OUTER_LEFT, copyVariant(outer).with(VariantProperties.UV_LOCK, true)) + .select(Direction.EAST, false, VerticalSlabShape.INNER_RIGHT, copyVariant(inner).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180).with(VariantProperties.UV_LOCK, true)) + .select(Direction.WEST, false, VerticalSlabShape.INNER_RIGHT, copyVariant(inner).with(VariantProperties.UV_LOCK, true)) + .select(Direction.SOUTH, false, VerticalSlabShape.INNER_RIGHT, copyVariant(inner).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270).with(VariantProperties.UV_LOCK, true)) + .select(Direction.NORTH, false, VerticalSlabShape.INNER_RIGHT, copyVariant(inner).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90).with(VariantProperties.UV_LOCK, true)) + .select(Direction.EAST, false, VerticalSlabShape.INNER_LEFT, copyVariant(inner).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90).with(VariantProperties.UV_LOCK, true)) + .select(Direction.WEST, false, VerticalSlabShape.INNER_LEFT, copyVariant(inner).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270).with(VariantProperties.UV_LOCK, true)) + .select(Direction.SOUTH, false, VerticalSlabShape.INNER_LEFT, copyVariant(inner).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180).with(VariantProperties.UV_LOCK, true)) + .select(Direction.NORTH, false, VerticalSlabShape.INNER_LEFT, copyVariant(inner).with(VariantProperties.UV_LOCK, true)) + + .select(Direction.EAST, true, VerticalSlabShape.STRAIGHT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.WEST, true, VerticalSlabShape.STRAIGHT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.SOUTH, true, VerticalSlabShape.STRAIGHT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.NORTH, true, VerticalSlabShape.STRAIGHT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.EAST, true, VerticalSlabShape.OUTER_RIGHT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.WEST, true, VerticalSlabShape.OUTER_RIGHT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.SOUTH, true, VerticalSlabShape.OUTER_RIGHT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.NORTH, true, VerticalSlabShape.OUTER_RIGHT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.EAST, true, VerticalSlabShape.OUTER_LEFT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.WEST, true, VerticalSlabShape.OUTER_LEFT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.SOUTH, true, VerticalSlabShape.OUTER_LEFT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.NORTH, true, VerticalSlabShape.OUTER_LEFT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.EAST, true, VerticalSlabShape.INNER_RIGHT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.WEST, true, VerticalSlabShape.INNER_RIGHT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.SOUTH, true, VerticalSlabShape.INNER_RIGHT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.NORTH, true, VerticalSlabShape.INNER_RIGHT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.EAST, true, VerticalSlabShape.INNER_LEFT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.WEST, true, VerticalSlabShape.INNER_LEFT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.SOUTH, true, VerticalSlabShape.INNER_LEFT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true)) + .select(Direction.NORTH, true, VerticalSlabShape.INNER_LEFT, copyVariant(fullBlockVariant).with(VariantProperties.UV_LOCK, true))); + + blockStateModelGenerator.registerSimpleItemModel(block, ModelLocationUtils.getModelLocation(block)); + blockStateModelGenerator.blockStateOutput.accept(blockstate); + } + + public void registerWoodStoolModelBlockStates(GenerationContext blockStateModelGenerator, Block block){ + ResourceLocation texture = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(block).getPath().replaceAll("stool", "chair")); + Variant weightedVariant = plainVariant(MEModels.WOOD_STOOL.create(block, + new TextureMapping().put(TextureSlot.ALL, texture).put(TextureSlot.PARTICLE, texture), blockStateModelGenerator.modelOutput)); + + MultiVariantGenerator blockstate = MultiVariantGenerator.multiVariant(block).with( + PropertyDispatch.property(BlockStateProperties.HORIZONTAL_FACING) + .select(Direction.NORTH, weightedVariant) + .select(Direction.EAST, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) + .select(Direction.SOUTH, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)) + .select(Direction.WEST, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270))); + + blockStateModelGenerator.registerSimpleItemModel(block, ModelLocationUtils.getModelLocation(block)); + blockStateModelGenerator.blockStateOutput.accept(blockstate); + } + + public void registerWoodBenchModelBlockStates(GenerationContext blockStateModelGenerator, Block block){ + ResourceLocation texture = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(block).getPath()); + Variant weightedVariant = plainVariant(MEModels.WOOD_BENCH.create(block, + new TextureMapping().put(TextureSlot.ALL, texture).put(TextureSlot.PARTICLE, texture), blockStateModelGenerator.modelOutput)); + + MultiVariantGenerator blockstate = MultiVariantGenerator.multiVariant(block).with( + PropertyDispatch.property(BlockStateProperties.HORIZONTAL_FACING) + .select(Direction.NORTH, weightedVariant) + .select(Direction.EAST, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) + .select(Direction.SOUTH, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)) + .select(Direction.WEST, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270))); + + blockStateModelGenerator.registerSimpleItemModel(block, ModelLocationUtils.getModelLocation(block)); + blockStateModelGenerator.blockStateOutput.accept(blockstate); + } + + public void registerWoodTableModelBlockStates(GenerationContext blockStateModelGenerator, Block block){ + ResourceLocation texture = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(block).getPath()); + Variant weightedVariant = plainVariant(MEModels.WOOD_TABLE.create(block, + new TextureMapping().put(TextureSlot.ALL, texture).put(TextureSlot.PARTICLE, texture), blockStateModelGenerator.modelOutput)); + + blockStateModelGenerator.registerSimpleItemModel(block, ModelLocationUtils.getModelLocation(block)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider.createSimpleBlock(block, weightedVariant)); } - public void registerStoneChairModelBlockStates(BlockStateModelGenerator blockStateModelGenerator, Block block, Identifier texture) { - WeightedVariant weightedVariant = BlockStateModelGenerator.createWeightedVariant(MEModels.STONE_CHAIR.upload(block, - new TextureMap().put(TextureKey.ALL, texture).put(TextureKey.PARTICLE, texture), blockStateModelGenerator.modelCollector)); + public void registerWoodChairModelBlockStates(GenerationContext blockStateModelGenerator, Block block){ + ResourceLocation texture = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(block).getPath()); + Variant weightedVariant = plainVariant(MEModels.WOOD_CHAIR.create(block, + new TextureMapping().put(TextureSlot.ALL, texture).put(TextureSlot.PARTICLE, texture), blockStateModelGenerator.modelOutput)); - VariantsBlockModelDefinitionCreator blockstate = VariantsBlockModelDefinitionCreator.of(block).with( - BlockStateVariantMap.models(Properties.HORIZONTAL_FACING) - .register(Direction.NORTH, weightedVariant) - .register(Direction.EAST, weightedVariant.apply(ROTATE_Y_90)) - .register(Direction.SOUTH, weightedVariant.apply(ROTATE_Y_180)) - .register(Direction.WEST, weightedVariant.apply(ROTATE_Y_270))); + MultiVariantGenerator blockstate = MultiVariantGenerator.multiVariant(block).with( + PropertyDispatch.property(BlockStateProperties.HORIZONTAL_FACING) + .select(Direction.NORTH, weightedVariant) + .select(Direction.EAST, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) + .select(Direction.SOUTH, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)) + .select(Direction.WEST, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270))); - blockStateModelGenerator.registerParentedItemModel(block, ModelIds.getBlockModelId(block)); - blockStateModelGenerator.blockStateCollector.accept(blockstate); + blockStateModelGenerator.registerSimpleItemModel(block, ModelLocationUtils.getModelLocation(block)); + blockStateModelGenerator.blockStateOutput.accept(blockstate); } - public final void registerDoubleBlock(BlockStateModelGenerator blockStateModelGenerator, Block doubleBlock, BlockStateModelGenerator.CrossType tintType) { - blockStateModelGenerator.registerItemModel(doubleBlock, "_top"); - WeightedVariant identifier = createWeightedVariant(blockStateModelGenerator.createSubModel(doubleBlock, "_top", tintType.getCrossModel(), TextureMap::cross)); - WeightedVariant identifier2 = createWeightedVariant(blockStateModelGenerator.createSubModel(doubleBlock, "_bottom", tintType.getCrossModel(), TextureMap::cross)); - blockStateModelGenerator.registerDoubleBlock(doubleBlock, identifier, identifier2); + public void registerStoneStoolModelBlockStates(GenerationContext blockStateModelGenerator, Block block, ResourceLocation texture) { + Variant weightedVariant = plainVariant(MEModels.STONE_STOOL.create(block, + new TextureMapping().put(TextureSlot.ALL, texture).put(TextureSlot.PARTICLE, texture), blockStateModelGenerator.modelOutput)); + + MultiVariantGenerator blockstate = MultiVariantGenerator.multiVariant(block).with( + PropertyDispatch.property(BlockStateProperties.HORIZONTAL_FACING) + .select(Direction.NORTH, weightedVariant) + .select(Direction.EAST, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) + .select(Direction.SOUTH, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)) + .select(Direction.WEST, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270))); + + blockStateModelGenerator.registerSimpleItemModel(block, ModelLocationUtils.getModelLocation(block)); + blockStateModelGenerator.blockStateOutput.accept(blockstate); } - public final void registerPointedBlock(BlockStateModelGenerator blockStateModelGenerator, Block pointedBlock) { - Identifier inventory = Models.GENERATED.upload(pointedBlock.asItem(), TextureMap.layer0(TextureMap.getId(pointedBlock.asItem())), blockStateModelGenerator.modelCollector); - blockStateModelGenerator.registerItemModel(pointedBlock.asItem(), inventory); + public void registerStoneTableModelBlockStates(GenerationContext blockStateModelGenerator, Block block, ResourceLocation texture) { + Variant weightedVariant = plainVariant(MEModels.STONE_TABLE.create(block, + new TextureMapping().put(TextureSlot.ALL, texture).put(TextureSlot.PARTICLE, texture), blockStateModelGenerator.modelOutput)); - BlockStateVariantMap.DoubleProperty doubleProperty = BlockStateVariantMap.models(Properties.VERTICAL_DIRECTION, Properties.THICKNESS); - Thickness[] var2 = Thickness.values(); + blockStateModelGenerator.registerSimpleItemModel(block, ModelLocationUtils.getModelLocation(block)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider.createSimpleBlock(block, weightedVariant)); + } + + public void registerStoneChairModelBlockStates(GenerationContext blockStateModelGenerator, Block block, ResourceLocation texture) { + Variant weightedVariant = plainVariant(MEModels.STONE_CHAIR.create(block, + new TextureMapping().put(TextureSlot.ALL, texture).put(TextureSlot.PARTICLE, texture), blockStateModelGenerator.modelOutput)); + + MultiVariantGenerator blockstate = MultiVariantGenerator.multiVariant(block).with( + PropertyDispatch.property(BlockStateProperties.HORIZONTAL_FACING) + .select(Direction.NORTH, weightedVariant) + .select(Direction.EAST, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) + .select(Direction.SOUTH, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)) + .select(Direction.WEST, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270))); + + blockStateModelGenerator.registerSimpleItemModel(block, ModelLocationUtils.getModelLocation(block)); + blockStateModelGenerator.blockStateOutput.accept(blockstate); + } + + public final void registerDoubleBlock(GenerationContext blockStateModelGenerator, Block doubleBlock, GenerationContext.PlantType tintType) { + blockStateModelGenerator.registerSimpleFlatItemModel(doubleBlock, "_top"); + Variant identifier = plainVariant(blockStateModelGenerator.createSuffixedVariant(doubleBlock, "_top", tintType.getCross(), TextureMapping::cross)); + Variant identifier2 = plainVariant(blockStateModelGenerator.createSuffixedVariant(doubleBlock, "_bottom", tintType.getCross(), TextureMapping::cross)); + blockStateModelGenerator.createDoubleBlock(doubleBlock, identifier, identifier2); + } + + public final void registerPointedBlock(GenerationContext blockStateModelGenerator, Block pointedBlock) { + ResourceLocation inventory = ModelTemplates.FLAT_ITEM.create(ModelLocationUtils.getModelLocation(pointedBlock.asItem()), TextureMapping.layer0(TextureMapping.getItemTexture(pointedBlock.asItem())), blockStateModelGenerator.modelOutput); + blockStateModelGenerator.registerSimpleItemModel(pointedBlock.asItem(), inventory); + + PropertyDispatch.C2 doubleProperty = PropertyDispatch.properties(BlockStateProperties.VERTICAL_DIRECTION, BlockStateProperties.DRIPSTONE_THICKNESS); + DripstoneThickness[] var2 = DripstoneThickness.values(); int var3 = var2.length; int var4; - Thickness thickness; + DripstoneThickness thickness; for(var4 = 0; var4 < var3; ++var4) { thickness = var2[var4]; - doubleProperty.register(Direction.UP, thickness, getPointedVariant(blockStateModelGenerator, Direction.UP, thickness, pointedBlock)); + doubleProperty.select(Direction.UP, thickness, getPointedVariant(blockStateModelGenerator, Direction.UP, thickness, pointedBlock)); } - var2 = Thickness.values(); + var2 = DripstoneThickness.values(); var3 = var2.length; for(var4 = 0; var4 < var3; ++var4) { thickness = var2[var4]; - doubleProperty.register(Direction.DOWN, thickness, getPointedVariant(blockStateModelGenerator, Direction.DOWN, thickness, pointedBlock)); + doubleProperty.select(Direction.DOWN, thickness, getPointedVariant(blockStateModelGenerator, Direction.DOWN, thickness, pointedBlock)); } - blockStateModelGenerator.blockStateCollector.accept(VariantsBlockModelDefinitionCreator.of(pointedBlock).with(doubleProperty)); + blockStateModelGenerator.blockStateOutput.accept(MultiVariantGenerator.multiVariant(pointedBlock).with(doubleProperty)); } - public final WeightedVariant getPointedVariant(BlockStateModelGenerator blockStateModelGenerator, Direction direction, Thickness thickness, Block pointedBlock) { - String var10000 = direction.asString(); - String string = "_" + var10000 + "_" + thickness.asString(); - TextureMap textureMap = TextureMap.cross(TextureMap.getSubId(pointedBlock, string)); - return createWeightedVariant(Models.POINTED_DRIPSTONE.upload(pointedBlock, string, textureMap, blockStateModelGenerator.modelCollector)); + public final Variant getPointedVariant(GenerationContext blockStateModelGenerator, Direction direction, DripstoneThickness thickness, Block pointedBlock) { + String var10000 = direction.getSerializedName(); + String string = "_" + var10000 + "_" + thickness.getSerializedName(); + TextureMapping textureMap = TextureMapping.cross(TextureMapping.getBlockTexture(pointedBlock, string)); + return plainVariant(ModelTemplates.POINTED_DRIPSTONE.createWithSuffix(pointedBlock, string, textureMap, blockStateModelGenerator.modelOutput)); } - public final void registerLargeDoor(BlockStateModelGenerator blockStateModelGenerator, LargeDoorBlock largeDoor, IntProperty part) { - var statesMap = BlockStateVariantMap.models(Properties.HORIZONTAL_FACING, Properties.OPEN, Properties.DOOR_HINGE, part); + public final void registerLargeDoor(GenerationContext blockStateModelGenerator, LargeDoorBlock largeDoor, IntegerProperty part) { + var statesMap = PropertyDispatch.properties(BlockStateProperties.HORIZONTAL_FACING, BlockStateProperties.OPEN, BlockStateProperties.DOOR_HINGE, part); int rot = 0; for (int i = 0; i < largeDoor.getDoorWidth() * largeDoor.getDoorHeight(); i++) { for (int k = 2; k < 6; k++) { @@ -1239,53 +1294,53 @@ public final void registerLargeDoor(BlockStateModelGenerator blockStateModelGene default -> rot; }; - WeightedVariant weightedVariantLeft = createWeightedVariant(Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_left_" + i)); - WeightedVariant weightedVariantLeftOpen = createWeightedVariant(Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_left_open_" + i)); - WeightedVariant weightedVarianRight = createWeightedVariant(Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_right_" + i)); - WeightedVariant weightedVarianRightOpen = createWeightedVariant(Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_right_open_" + i)); + Variant weightedVariantLeft = plainVariant(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_left_" + i)); + Variant weightedVariantLeftOpen = plainVariant(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_left_open_" + i)); + Variant weightedVarianRight = plainVariant(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_right_" + i)); + Variant weightedVarianRightOpen = plainVariant(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_right_open_" + i)); - statesMap.register(Direction.byIndex(k), false, DoorHinge.LEFT, i, - weightedVariantLeft.apply(ModelVariantOperator.ROTATION_Y.withValue(AxisRotation.valueOf("R" + rot)))); + statesMap.select(Direction.from3DDataValue(k), false, DoorHingeSide.LEFT, i, + copyVariant(weightedVariantLeft).with(VariantProperties.Y_ROT, VariantProperties.Rotation.valueOf("R" + rot))); - statesMap.register(Direction.byIndex(k), true, DoorHinge.LEFT, i, - weightedVariantLeftOpen.apply(ModelVariantOperator.ROTATION_Y.withValue(AxisRotation.valueOf("R" + rot)))); + statesMap.select(Direction.from3DDataValue(k), true, DoorHingeSide.LEFT, i, + copyVariant(weightedVariantLeftOpen).with(VariantProperties.Y_ROT, VariantProperties.Rotation.valueOf("R" + rot))); - statesMap.register(Direction.byIndex(k), false, DoorHinge.RIGHT, i, - weightedVarianRight.apply(ModelVariantOperator.ROTATION_Y.withValue(AxisRotation.valueOf("R" + rot)))); + statesMap.select(Direction.from3DDataValue(k), false, DoorHingeSide.RIGHT, i, + copyVariant(weightedVarianRight).with(VariantProperties.Y_ROT, VariantProperties.Rotation.valueOf("R" + rot))); - statesMap.register(Direction.byIndex(k), true, DoorHinge.RIGHT, i, - weightedVarianRightOpen.apply(ModelVariantOperator.ROTATION_Y.withValue(AxisRotation.valueOf("R" + rot)))); + statesMap.select(Direction.from3DDataValue(k), true, DoorHingeSide.RIGHT, i, + copyVariant(weightedVarianRightOpen).with(VariantProperties.Y_ROT, VariantProperties.Rotation.valueOf("R" + rot))); if (k == 2) { - MEModels.LARGE_DOOR_LEFT.upload(largeDoor, "_left_" + i, - (new TextureMap()).put(TextureKey.ALL, Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_" + i)) - .put(TextureKey.PARTICLE, Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_" + i)), - blockStateModelGenerator.modelCollector); - - MEModels.LARGE_DOOR_LEFT_OPEN.upload(largeDoor, "_left_open_" + i, - (new TextureMap()).put(TextureKey.ALL, Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_" + i)) - .put(TextureKey.PARTICLE, Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_" + i)), - blockStateModelGenerator.modelCollector); - - MEModels.LARGE_DOOR_RIGHT.upload(largeDoor, "_right_" + i, - (new TextureMap()).put(TextureKey.ALL, Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_" + i)) - .put(TextureKey.PARTICLE, Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_" + i)), - blockStateModelGenerator.modelCollector); - - MEModels.LARGE_DOOR_RIGHT_OPEN.upload(largeDoor, "_right_open_" + i, - (new TextureMap()).put(TextureKey.ALL, Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_" + i)) - .put(TextureKey.PARTICLE, Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_" + i)), - blockStateModelGenerator.modelCollector); + MEModels.LARGE_DOOR_LEFT.createWithSuffix(largeDoor, "_left_" + i, + (new TextureMapping()).put(TextureSlot.ALL, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_" + i)) + .put(TextureSlot.PARTICLE, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_" + i)), + blockStateModelGenerator.modelOutput); + + MEModels.LARGE_DOOR_LEFT_OPEN.createWithSuffix(largeDoor, "_left_open_" + i, + (new TextureMapping()).put(TextureSlot.ALL, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_" + i)) + .put(TextureSlot.PARTICLE, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_" + i)), + blockStateModelGenerator.modelOutput); + + MEModels.LARGE_DOOR_RIGHT.createWithSuffix(largeDoor, "_right_" + i, + (new TextureMapping()).put(TextureSlot.ALL, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_" + i)) + .put(TextureSlot.PARTICLE, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_" + i)), + blockStateModelGenerator.modelOutput); + + MEModels.LARGE_DOOR_RIGHT_OPEN.createWithSuffix(largeDoor, "_right_open_" + i, + (new TextureMapping()).put(TextureSlot.ALL, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_" + i)) + .put(TextureSlot.PARTICLE, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_" + i)), + blockStateModelGenerator.modelOutput); } } } - VariantsBlockModelDefinitionCreator blockstate = VariantsBlockModelDefinitionCreator.of(largeDoor).with(statesMap); - blockStateModelGenerator.blockStateCollector.accept(blockstate); - blockStateModelGenerator.registerItemModel(largeDoor.asItem()); + MultiVariantGenerator blockstate = MultiVariantGenerator.multiVariant(largeDoor).with(statesMap); + blockStateModelGenerator.blockStateOutput.accept(blockstate); + blockStateModelGenerator.registerSimpleFlatItemModel(largeDoor.asItem()); } - public final void registerThickLargeDoor(BlockStateModelGenerator blockStateModelGenerator, LargeDoorBlock largeDoor, IntProperty part) { - var statesMap = BlockStateVariantMap.models(Properties.HORIZONTAL_FACING, Properties.OPEN, Properties.DOOR_HINGE, part); + public final void registerThickLargeDoor(GenerationContext blockStateModelGenerator, LargeDoorBlock largeDoor, IntegerProperty part) { + var statesMap = PropertyDispatch.properties(BlockStateProperties.HORIZONTAL_FACING, BlockStateProperties.OPEN, BlockStateProperties.DOOR_HINGE, part); int rot = 0; for (int i = 0; i < largeDoor.getDoorWidth() * largeDoor.getDoorHeight(); i++) { for (int k = 2; k < 6; k++) { @@ -1297,58 +1352,58 @@ public final void registerThickLargeDoor(BlockStateModelGenerator blockStateMode default -> rot; }; - WeightedVariant weightedVariantLeft = createWeightedVariant(Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_left_" + i)); - WeightedVariant weightedVariantLeftOpen = createWeightedVariant(Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_left_open_" + i)); - WeightedVariant weightedVarianRight = createWeightedVariant(Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_right_" + i)); - WeightedVariant weightedVarianRightOpen = createWeightedVariant(Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_right_open_" + i)); + Variant weightedVariantLeft = plainVariant(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_left_" + i)); + Variant weightedVariantLeftOpen = plainVariant(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_left_open_" + i)); + Variant weightedVarianRight = plainVariant(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_right_" + i)); + Variant weightedVarianRightOpen = plainVariant(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_right_open_" + i)); - statesMap.register(Direction.byIndex(k), false, DoorHinge.LEFT, i, - weightedVariantLeft.apply(ModelVariantOperator.ROTATION_Y.withValue(AxisRotation.valueOf("R" + rot)))); + statesMap.select(Direction.from3DDataValue(k), false, DoorHingeSide.LEFT, i, + copyVariant(weightedVariantLeft).with(VariantProperties.Y_ROT, VariantProperties.Rotation.valueOf("R" + rot))); - statesMap.register(Direction.byIndex(k), true, DoorHinge.LEFT, i, - weightedVariantLeftOpen.apply(ModelVariantOperator.ROTATION_Y.withValue(AxisRotation.valueOf("R" + rot)))); + statesMap.select(Direction.from3DDataValue(k), true, DoorHingeSide.LEFT, i, + copyVariant(weightedVariantLeftOpen).with(VariantProperties.Y_ROT, VariantProperties.Rotation.valueOf("R" + rot))); - statesMap.register(Direction.byIndex(k), false, DoorHinge.RIGHT, i, - weightedVarianRight.apply(ModelVariantOperator.ROTATION_Y.withValue(AxisRotation.valueOf("R" + rot)))); + statesMap.select(Direction.from3DDataValue(k), false, DoorHingeSide.RIGHT, i, + copyVariant(weightedVarianRight).with(VariantProperties.Y_ROT, VariantProperties.Rotation.valueOf("R" + rot))); - statesMap.register(Direction.byIndex(k), true, DoorHinge.RIGHT, i, - weightedVarianRightOpen.apply(ModelVariantOperator.ROTATION_Y.withValue(AxisRotation.valueOf("R" + rot)))); + statesMap.select(Direction.from3DDataValue(k), true, DoorHingeSide.RIGHT, i, + copyVariant(weightedVarianRightOpen).with(VariantProperties.Y_ROT, VariantProperties.Rotation.valueOf("R" + rot))); if (k == 2) { - MEModels.LARGE_THICK_DOOR_LEFT.upload(largeDoor, "_left_" + i, - (new TextureMap()).put(TextureKey.ALL, Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_" + i)) - .put(TextureKey.PARTICLE, Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_" + i)), - blockStateModelGenerator.modelCollector); - - MEModels.LARGE_THICK_DOOR_LEFT_OPEN.upload(largeDoor, "_left_open_" + i, - (new TextureMap()).put(TextureKey.ALL, Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_" + i)) - .put(TextureKey.PARTICLE, Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_" + i)), - blockStateModelGenerator.modelCollector); - - MEModels.LARGE_THICK_DOOR_RIGHT.upload(largeDoor, "_right_" + i, - (new TextureMap()).put(TextureKey.ALL, Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_" + i)) - .put(TextureKey.PARTICLE, Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_" + i)), - blockStateModelGenerator.modelCollector); - - MEModels.LARGE_THICK_DOOR_RIGHT_OPEN.upload(largeDoor, "_right_open_" + i, - (new TextureMap()).put(TextureKey.ALL, Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_" + i)) - .put(TextureKey.PARTICLE, Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(largeDoor).getPath() + "_" + i)), - blockStateModelGenerator.modelCollector); + MEModels.LARGE_THICK_DOOR_LEFT.createWithSuffix(largeDoor, "_left_" + i, + (new TextureMapping()).put(TextureSlot.ALL, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_" + i)) + .put(TextureSlot.PARTICLE, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_" + i)), + blockStateModelGenerator.modelOutput); + + MEModels.LARGE_THICK_DOOR_LEFT_OPEN.createWithSuffix(largeDoor, "_left_open_" + i, + (new TextureMapping()).put(TextureSlot.ALL, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_" + i)) + .put(TextureSlot.PARTICLE, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_" + i)), + blockStateModelGenerator.modelOutput); + + MEModels.LARGE_THICK_DOOR_RIGHT.createWithSuffix(largeDoor, "_right_" + i, + (new TextureMapping()).put(TextureSlot.ALL, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_" + i)) + .put(TextureSlot.PARTICLE, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_" + i)), + blockStateModelGenerator.modelOutput); + + MEModels.LARGE_THICK_DOOR_RIGHT_OPEN.createWithSuffix(largeDoor, "_right_open_" + i, + (new TextureMapping()).put(TextureSlot.ALL, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_" + i)) + .put(TextureSlot.PARTICLE, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(largeDoor).getPath() + "_" + i)), + blockStateModelGenerator.modelOutput); } } } - VariantsBlockModelDefinitionCreator blockstate = VariantsBlockModelDefinitionCreator.of(largeDoor).with(statesMap); - blockStateModelGenerator.blockStateCollector.accept(blockstate); - blockStateModelGenerator.registerItemModel(largeDoor.asItem()); + MultiVariantGenerator blockstate = MultiVariantGenerator.multiVariant(largeDoor).with(statesMap); + blockStateModelGenerator.blockStateOutput.accept(blockstate); + blockStateModelGenerator.registerSimpleFlatItemModel(largeDoor.asItem()); } - public final void registerGlassAndPane(BlockStateModelGenerator blockStateModelGenerator, Block glass, Block glassPane) { - TextureMap textureMap; - String blockId = Registries.BLOCK.getId(glassPane).getPath(); + public final void registerGlassAndPane(GenerationContext blockStateModelGenerator, Block glass, Block glassPane) { + TextureMapping textureMap; + String blockId = BuiltInRegistries.BLOCK.getKey(glassPane).getPath(); if (blockId.contains("lead_glass")){ - textureMap = TextureMap.paneAndTopForEdge(glass, ModDecorativeBlocks.LEAD_GLASS_PANE); + textureMap = TextureMapping.pane(glass, ModDecorativeBlocks.LEAD_GLASS_PANE); } else if (blockId.contains("plaster")){ textureMap = paneAndTopForEdgeCustom(glass, GenericBlockSets.PLASTER.blockSet.base()); } else if (blockId.contains("white_daub")){ @@ -1362,44 +1417,46 @@ public final void registerGlassAndPane(BlockStateModelGenerator blockStateModelG } else if (blockId.contains("wattle") && !blockId.contains("black") && !blockId.contains("dark") && !blockId.contains("brick")){ textureMap = paneAndTopForEdgeCustom(glass, glass); } else { - textureMap = TextureMap.paneAndTopForEdge(glass, glassPane); + textureMap = TextureMapping.pane(glass, glassPane); } - WeightedVariant weightedVariant = createWeightedVariant(Models.TEMPLATE_GLASS_PANE_POST.upload(glassPane, textureMap, blockStateModelGenerator.modelCollector)); - WeightedVariant weightedVariant2 = createWeightedVariant(Models.TEMPLATE_GLASS_PANE_SIDE.upload(glassPane, textureMap, blockStateModelGenerator.modelCollector)); - WeightedVariant weightedVariant3 = createWeightedVariant(Models.TEMPLATE_GLASS_PANE_SIDE_ALT.upload(glassPane, textureMap, blockStateModelGenerator.modelCollector)); - WeightedVariant weightedVariant4 = createWeightedVariant(Models.TEMPLATE_GLASS_PANE_NOSIDE.upload(glassPane, textureMap, blockStateModelGenerator.modelCollector)); - WeightedVariant weightedVariant5 = createWeightedVariant(Models.TEMPLATE_GLASS_PANE_NOSIDE_ALT.upload(glassPane, textureMap, blockStateModelGenerator.modelCollector)); + Variant weightedVariant = plainVariant(ModelTemplates.STAINED_GLASS_PANE_POST.create(glassPane, textureMap, blockStateModelGenerator.modelOutput)); + Variant weightedVariant2 = plainVariant(ModelTemplates.STAINED_GLASS_PANE_SIDE.create(glassPane, textureMap, blockStateModelGenerator.modelOutput)); + Variant weightedVariant3 = plainVariant(ModelTemplates.STAINED_GLASS_PANE_SIDE_ALT.create(glassPane, textureMap, blockStateModelGenerator.modelOutput)); + Variant weightedVariant4 = plainVariant(ModelTemplates.STAINED_GLASS_PANE_NOSIDE.create(glassPane, textureMap, blockStateModelGenerator.modelOutput)); + Variant weightedVariant5 = plainVariant(ModelTemplates.STAINED_GLASS_PANE_NOSIDE_ALT.create(glassPane, textureMap, blockStateModelGenerator.modelOutput)); Item item = glassPane.asItem(); - blockStateModelGenerator.registerItemModel(item, blockStateModelGenerator.uploadBlockItemModel(item, glass)); - blockStateModelGenerator.blockStateCollector.accept(MultipartBlockModelDefinitionCreator.create(glassPane).with(weightedVariant).with(createMultipartConditionBuilder().put(Properties.NORTH, true), weightedVariant2).with(createMultipartConditionBuilder().put(Properties.EAST, true), weightedVariant2.apply(ROTATE_Y_90)).with(createMultipartConditionBuilder().put(Properties.SOUTH, true), weightedVariant3).with(createMultipartConditionBuilder().put(Properties.WEST, true), weightedVariant3.apply(ROTATE_Y_90)).with(createMultipartConditionBuilder().put(Properties.NORTH, false), weightedVariant4).with(createMultipartConditionBuilder().put(Properties.EAST, false), weightedVariant5).with(createMultipartConditionBuilder().put(Properties.SOUTH, false), weightedVariant5.apply(ROTATE_Y_90)).with(createMultipartConditionBuilder().put(Properties.WEST, false), weightedVariant4.apply(ROTATE_Y_270))); + blockStateModelGenerator.registerSimpleItemModel(item, blockStateModelGenerator.createFlatItemModelWithBlockTexture(item, glass)); + blockStateModelGenerator.blockStateOutput.accept(MultiPartGenerator.multiPart(glassPane).with(weightedVariant).with(condition().term(BlockStateProperties.NORTH, true), weightedVariant2).with(condition().term(BlockStateProperties.EAST, true), copyVariant(weightedVariant2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)).with(condition().term(BlockStateProperties.SOUTH, true), weightedVariant3).with(condition().term(BlockStateProperties.WEST, true), copyVariant(weightedVariant3).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)).with(condition().term(BlockStateProperties.NORTH, false), weightedVariant4).with(condition().term(BlockStateProperties.EAST, false), weightedVariant5).with(condition().term(BlockStateProperties.SOUTH, false), copyVariant(weightedVariant5).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)).with(condition().term(BlockStateProperties.WEST, false), copyVariant(weightedVariant4).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270))); } - public final void registerPaneModel(BlockStateModelGenerator blockStateModelGenerator, Block pane) { - TextureMap textureMap = TextureMap.paneAndTopForEdge(pane, pane); - WeightedVariant weightedVariant = createWeightedVariant(Models.TEMPLATE_GLASS_PANE_POST.upload(pane, textureMap, blockStateModelGenerator.modelCollector)); - WeightedVariant weightedVariant2 = createWeightedVariant(Models.TEMPLATE_GLASS_PANE_SIDE.upload(pane, textureMap, blockStateModelGenerator.modelCollector)); - WeightedVariant weightedVariant3 = createWeightedVariant(Models.TEMPLATE_GLASS_PANE_SIDE_ALT.upload(pane, textureMap, blockStateModelGenerator.modelCollector)); - WeightedVariant weightedVariant4 = createWeightedVariant(Models.TEMPLATE_GLASS_PANE_NOSIDE.upload(pane, textureMap, blockStateModelGenerator.modelCollector)); - WeightedVariant weightedVariant5 = createWeightedVariant(Models.TEMPLATE_GLASS_PANE_NOSIDE_ALT.upload(pane, textureMap, blockStateModelGenerator.modelCollector)); + public final void registerPaneModel(GenerationContext blockStateModelGenerator, Block pane) { + TextureMapping textureMap = TextureMapping.pane(pane, pane); + Variant weightedVariant = plainVariant(ModelTemplates.STAINED_GLASS_PANE_POST.create(pane, textureMap, blockStateModelGenerator.modelOutput)); + Variant weightedVariant2 = plainVariant(ModelTemplates.STAINED_GLASS_PANE_SIDE.create(pane, textureMap, blockStateModelGenerator.modelOutput)); + Variant weightedVariant3 = plainVariant(ModelTemplates.STAINED_GLASS_PANE_SIDE_ALT.create(pane, textureMap, blockStateModelGenerator.modelOutput)); + Variant weightedVariant4 = plainVariant(ModelTemplates.STAINED_GLASS_PANE_NOSIDE.create(pane, textureMap, blockStateModelGenerator.modelOutput)); + Variant weightedVariant5 = plainVariant(ModelTemplates.STAINED_GLASS_PANE_NOSIDE_ALT.create(pane, textureMap, blockStateModelGenerator.modelOutput)); Item item = pane.asItem(); - blockStateModelGenerator.registerItemModel(item, blockStateModelGenerator.uploadBlockItemModel(item, pane)); - blockStateModelGenerator.blockStateCollector.accept(MultipartBlockModelDefinitionCreator.create(pane).with(weightedVariant).with(createMultipartConditionBuilder().put(Properties.NORTH, true), weightedVariant2).with(createMultipartConditionBuilder().put(Properties.EAST, true), weightedVariant2.apply(ROTATE_Y_90)).with(createMultipartConditionBuilder().put(Properties.SOUTH, true), weightedVariant3).with(createMultipartConditionBuilder().put(Properties.WEST, true), weightedVariant3.apply(ROTATE_Y_90)).with(createMultipartConditionBuilder().put(Properties.NORTH, false), weightedVariant4).with(createMultipartConditionBuilder().put(Properties.EAST, false), weightedVariant5).with(createMultipartConditionBuilder().put(Properties.SOUTH, false), weightedVariant5.apply(ROTATE_Y_90)).with(createMultipartConditionBuilder().put(Properties.WEST, false), weightedVariant4.apply(ROTATE_Y_270))); + blockStateModelGenerator.registerSimpleItemModel(item, blockStateModelGenerator.createFlatItemModelWithBlockTexture(item, pane)); + blockStateModelGenerator.blockStateOutput.accept(MultiPartGenerator.multiPart(pane).with(weightedVariant).with(condition().term(BlockStateProperties.NORTH, true), weightedVariant2).with(condition().term(BlockStateProperties.EAST, true), copyVariant(weightedVariant2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)).with(condition().term(BlockStateProperties.SOUTH, true), weightedVariant3).with(condition().term(BlockStateProperties.WEST, true), copyVariant(weightedVariant3).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)).with(condition().term(BlockStateProperties.NORTH, false), weightedVariant4).with(condition().term(BlockStateProperties.EAST, false), weightedVariant5).with(condition().term(BlockStateProperties.SOUTH, false), copyVariant(weightedVariant5).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)).with(condition().term(BlockStateProperties.WEST, false), copyVariant(weightedVariant4).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270))); } - private void registerLayers(BlockStateModelGenerator blockStateModelGenerator, Block layers, Block origin, Boolean isVanilla) { - TextureMap textureMap = TextureMap.all(origin); - WeightedVariant weightedVariant; + private void registerLayers(GenerationContext blockStateModelGenerator, Block layers, Block origin, Boolean isVanilla) { + TextureMapping textureMap = TextureMapping.cube(origin); + Variant weightedVariant; if (!isVanilla){ - weightedVariant = createWeightedVariant(Models.CUBE_ALL.upload(origin, textureMap, blockStateModelGenerator.modelCollector)); + weightedVariant = plainVariant(ModelTemplates.CUBE_ALL.create(origin, textureMap, blockStateModelGenerator.modelOutput)); } else { - weightedVariant = createWeightedVariant(Identifier.ofVanilla(Registries.BLOCK.getId(origin).getPath())); + weightedVariant = plainVariant(ResourceLocation.withDefaultNamespace( + "block/" + BuiltInRegistries.BLOCK.getKey(origin).getPath() + )); } - blockStateModelGenerator.blockStateCollector.accept(VariantsBlockModelDefinitionCreator.of(layers).with(BlockStateVariantMap.models(Properties.LAYERS).generate((integer) -> { - WeightedVariant var2; + blockStateModelGenerator.blockStateOutput.accept(MultiVariantGenerator.multiVariant(layers).with(PropertyDispatch.property(BlockStateProperties.LAYERS).generate((integer) -> { + Variant var2; if (integer < 8) { int var10001 = integer; - var2 = createWeightedVariant(Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(origin).getPath() + "_layer_height" + var10001 * 2)); + var2 = plainVariant(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(origin).getPath() + "_layer_height" + var10001 * 2)); } else { var2 = weightedVariant; } @@ -1407,152 +1464,645 @@ private void registerLayers(BlockStateModelGenerator blockStateModelGenerator, B return var2; }))); if (!isVanilla){ - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createSingletonBlockState(origin, weightedVariant)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider.createSimpleBlock(origin, weightedVariant)); } - blockStateModelGenerator.registerParentedItemModel(layers, ModelIds.getBlockSubModelId(layers, "_height2")); + blockStateModelGenerator.registerSimpleItemModel(layers, ModelLocationUtils.getModelLocation(layers, "_height2")); } - private void registerTopWaterblock(BlockStateModelGenerator blockStateModelGenerator, Block block) { - blockStateModelGenerator.registerItemModel(block); - ModelVariant modelVariant = createModelVariant(ModelIds.getBlockModelId(block)); - blockStateModelGenerator.blockStateCollector.accept(VariantsBlockModelDefinitionCreator.of(block, modelWithYRotation(modelVariant))); + private void registerTopWaterblock(GenerationContext blockStateModelGenerator, Block block) { + blockStateModelGenerator.registerSimpleFlatItemModel(block); + Variant modelVariant = plainModel(ModelLocationUtils.getModelLocation(block)); + blockStateModelGenerator.blockStateOutput.accept(MultiVariantGenerator.multiVariant(block, createRotatedVariants(modelVariant))); } - public void registerRocksBlock(BlockStateModelGenerator blockStateModelGenerator, Block rocksBlock, Block origin) { - Identifier id = Identifier.of(Registries.BLOCK.getId(origin).getNamespace(), "block/" + Registries.BLOCK.getId(origin).getPath()); + public void registerRocksBlock(GenerationContext blockStateModelGenerator, Block rocksBlock, Block origin) { + ResourceLocation id = ResourceLocation.fromNamespaceAndPath(BuiltInRegistries.BLOCK.getKey(origin).getNamespace(), "block/" + BuiltInRegistries.BLOCK.getKey(origin).getPath()); if (origin == Blocks.BASALT || origin == Blocks.POLISHED_BASALT) { - id = id.withSuffixedPath("_side"); - } - WeightedVariant stage0 = createWeightedVariant(MEModels.ROCKS_STAGE_0.upload(rocksBlock, - TextureMap.of(TextureKey.ALL, id), - blockStateModelGenerator.modelCollector)); - WeightedVariant stage1 = createWeightedVariant(MEModels.ROCKS_STAGE_1.upload(rocksBlock, - TextureMap.of(TextureKey.ALL, id), - blockStateModelGenerator.modelCollector)); - WeightedVariant stage2 = createWeightedVariant(MEModels.ROCKS_STAGE_2.upload(rocksBlock, - TextureMap.of(TextureKey.ALL, id), - blockStateModelGenerator.modelCollector)); - WeightedVariant stage3 = createWeightedVariant(MEModels.ROCKS_STAGE_3.upload(rocksBlock, - TextureMap.of(TextureKey.ALL, id), - blockStateModelGenerator.modelCollector)); - - VariantsBlockModelDefinitionCreator blockstate = VariantsBlockModelDefinitionCreator.of(rocksBlock) - .with(BlockStateVariantMap.models(Properties.HORIZONTAL_FACING, RocksBlock.STAGE) - .register(Direction.EAST, 0, stage0.apply(ROTATE_Y_90).apply(UV_LOCK)) - .register(Direction.WEST, 0, stage0.apply(ROTATE_Y_270).apply(UV_LOCK)) - .register(Direction.SOUTH, 0, stage0.apply(ROTATE_Y_180).apply(UV_LOCK)) - .register(Direction.NORTH, 0, stage0.apply(UV_LOCK)) - - .register(Direction.EAST, 1, stage1.apply(ROTATE_Y_90).apply(UV_LOCK)) - .register(Direction.WEST, 1, stage1.apply(ROTATE_Y_270).apply(UV_LOCK)) - .register(Direction.SOUTH, 1, stage1.apply(ROTATE_Y_180).apply(UV_LOCK)) - .register(Direction.NORTH, 1, stage1.apply(UV_LOCK)) - - .register(Direction.EAST, 2, stage2.apply(ROTATE_Y_90).apply(UV_LOCK)) - .register(Direction.WEST, 2, stage2.apply(ROTATE_Y_270).apply(UV_LOCK)) - .register(Direction.SOUTH, 2, stage2.apply(ROTATE_Y_180).apply(UV_LOCK)) - .register(Direction.NORTH, 2, stage2.apply(UV_LOCK)) - - .register(Direction.EAST, 3, stage3.apply(ROTATE_Y_90).apply(UV_LOCK)) - .register(Direction.WEST, 3, stage3.apply(ROTATE_Y_270).apply(UV_LOCK)) - .register(Direction.SOUTH, 3, stage3.apply(ROTATE_Y_180).apply(UV_LOCK)) - .register(Direction.NORTH, 3, stage3.apply(UV_LOCK))); - - blockStateModelGenerator.registerParentedItemModel(rocksBlock, ModelIds.getBlockModelId(rocksBlock)); - blockStateModelGenerator.blockStateCollector.accept(blockstate); - } - - public void registerTrapdoor(BlockStateModelGenerator blockStateModelGenerator, Block trapdoorBlock, Block block, boolean orientable) { - TextureMap textureMap; - - String modid = Registries.BLOCK.getId(block).getNamespace(); - - WeightedVariant identifier; - Identifier identifier2; - WeightedVariant identifier3; + id = id.withSuffix("_side"); + } + Variant stage0 = plainVariant(MEModels.ROCKS_STAGE_0.create(rocksBlock, + TextureMapping.singleSlot(TextureSlot.ALL, id), + blockStateModelGenerator.modelOutput)); + Variant stage1 = plainVariant(MEModels.ROCKS_STAGE_1.create(rocksBlock, + TextureMapping.singleSlot(TextureSlot.ALL, id), + blockStateModelGenerator.modelOutput)); + Variant stage2 = plainVariant(MEModels.ROCKS_STAGE_2.create(rocksBlock, + TextureMapping.singleSlot(TextureSlot.ALL, id), + blockStateModelGenerator.modelOutput)); + Variant stage3 = plainVariant(MEModels.ROCKS_STAGE_3.create(rocksBlock, + TextureMapping.singleSlot(TextureSlot.ALL, id), + blockStateModelGenerator.modelOutput)); + + MultiVariantGenerator blockstate = MultiVariantGenerator.multiVariant(rocksBlock) + .with(PropertyDispatch.properties(BlockStateProperties.HORIZONTAL_FACING, RocksBlock.STAGE) + .select(Direction.EAST, 0, copyVariant(stage0).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90).with(VariantProperties.UV_LOCK, true)) + .select(Direction.WEST, 0, copyVariant(stage0).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270).with(VariantProperties.UV_LOCK, true)) + .select(Direction.SOUTH, 0, copyVariant(stage0).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180).with(VariantProperties.UV_LOCK, true)) + .select(Direction.NORTH, 0, copyVariant(stage0).with(VariantProperties.UV_LOCK, true)) + + .select(Direction.EAST, 1, copyVariant(stage1).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90).with(VariantProperties.UV_LOCK, true)) + .select(Direction.WEST, 1, copyVariant(stage1).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270).with(VariantProperties.UV_LOCK, true)) + .select(Direction.SOUTH, 1, copyVariant(stage1).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180).with(VariantProperties.UV_LOCK, true)) + .select(Direction.NORTH, 1, copyVariant(stage1).with(VariantProperties.UV_LOCK, true)) + + .select(Direction.EAST, 2, copyVariant(stage2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90).with(VariantProperties.UV_LOCK, true)) + .select(Direction.WEST, 2, copyVariant(stage2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270).with(VariantProperties.UV_LOCK, true)) + .select(Direction.SOUTH, 2, copyVariant(stage2).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180).with(VariantProperties.UV_LOCK, true)) + .select(Direction.NORTH, 2, copyVariant(stage2).with(VariantProperties.UV_LOCK, true)) + + .select(Direction.EAST, 3, copyVariant(stage3).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90).with(VariantProperties.UV_LOCK, true)) + .select(Direction.WEST, 3, copyVariant(stage3).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270).with(VariantProperties.UV_LOCK, true)) + .select(Direction.SOUTH, 3, copyVariant(stage3).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180).with(VariantProperties.UV_LOCK, true)) + .select(Direction.NORTH, 3, copyVariant(stage3).with(VariantProperties.UV_LOCK, true))); + + blockStateModelGenerator.registerSimpleItemModel(rocksBlock, ModelLocationUtils.getModelLocation(rocksBlock)); + blockStateModelGenerator.blockStateOutput.accept(blockstate); + } + + public void registerTrapdoor(GenerationContext blockStateModelGenerator, Block trapdoorBlock, Block block, boolean orientable) { + TextureMapping textureMap; + + String modid = BuiltInRegistries.BLOCK.getKey(block).getNamespace(); + + Variant identifier; + ResourceLocation identifier2; + Variant identifier3; if (orientable){ - textureMap = TextureMap.texture(Identifier.of(modid, "block/" + Registries.BLOCK.getId(trapdoorBlock).getPath())); - identifier = createWeightedVariant(Models.TEMPLATE_ORIENTABLE_TRAPDOOR_TOP.upload(trapdoorBlock, textureMap, blockStateModelGenerator.modelCollector)); - identifier2 = Models.TEMPLATE_ORIENTABLE_TRAPDOOR_BOTTOM.upload(trapdoorBlock, textureMap, blockStateModelGenerator.modelCollector); - identifier3 = createWeightedVariant(Models.TEMPLATE_ORIENTABLE_TRAPDOOR_OPEN.upload(trapdoorBlock, textureMap, blockStateModelGenerator.modelCollector)); + textureMap = TextureMapping.defaultTexture(ResourceLocation.fromNamespaceAndPath(modid, "block/" + BuiltInRegistries.BLOCK.getKey(trapdoorBlock).getPath())); + identifier = plainVariant(ModelTemplates.ORIENTABLE_TRAPDOOR_TOP.create(trapdoorBlock, textureMap, blockStateModelGenerator.modelOutput)); + identifier2 = ModelTemplates.ORIENTABLE_TRAPDOOR_BOTTOM.create(trapdoorBlock, textureMap, blockStateModelGenerator.modelOutput); + identifier3 = plainVariant(ModelTemplates.ORIENTABLE_TRAPDOOR_OPEN.create(trapdoorBlock, textureMap, blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createOrientableTrapdoorBlockState(trapdoorBlock, identifier, createWeightedVariant(identifier2), identifier3)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider.createOrientableTrapdoor(trapdoorBlock, identifier, plainVariant(identifier2), identifier3)); } else { if (block == Blocks.BASALT) { - textureMap = TextureMap.texture(Identifier.of(modid, "block/" + Registries.BLOCK.getId(block).getPath() + "_side")); + textureMap = TextureMapping.defaultTexture(ResourceLocation.fromNamespaceAndPath(modid, "block/" + BuiltInRegistries.BLOCK.getKey(block).getPath() + "_side")); } else { - textureMap = TextureMap.texture(Identifier.of(modid, "block/" + Registries.BLOCK.getId(block).getPath().replaceAll("_trapdoor", ""))); + textureMap = TextureMapping.defaultTexture(ResourceLocation.fromNamespaceAndPath(modid, "block/" + BuiltInRegistries.BLOCK.getKey(block).getPath().replaceAll("_trapdoor", ""))); } - identifier = createWeightedVariant(Models.TEMPLATE_TRAPDOOR_TOP.upload(trapdoorBlock, textureMap, blockStateModelGenerator.modelCollector)); - identifier2 = Models.TEMPLATE_TRAPDOOR_BOTTOM.upload(trapdoorBlock, textureMap, blockStateModelGenerator.modelCollector); - identifier3 = createWeightedVariant(Models.TEMPLATE_TRAPDOOR_OPEN.upload(trapdoorBlock, textureMap, blockStateModelGenerator.modelCollector)); + identifier = plainVariant(ModelTemplates.TRAPDOOR_TOP.create(trapdoorBlock, textureMap, blockStateModelGenerator.modelOutput)); + identifier2 = ModelTemplates.TRAPDOOR_BOTTOM.create(trapdoorBlock, textureMap, blockStateModelGenerator.modelOutput); + identifier3 = plainVariant(ModelTemplates.TRAPDOOR_OPEN.create(trapdoorBlock, textureMap, blockStateModelGenerator.modelOutput)); - blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createTrapdoorBlockState(trapdoorBlock, identifier, createWeightedVariant(identifier2), identifier3)); + blockStateModelGenerator.blockStateOutput.accept(BlockModelProvider.createTrapdoor(trapdoorBlock, identifier, plainVariant(identifier2), identifier3)); } - blockStateModelGenerator.registerParentedItemModel(trapdoorBlock, identifier2); + blockStateModelGenerator.registerSimpleItemModel(trapdoorBlock, identifier2); } - public void registerOrientableThickLadder(BlockStateModelGenerator blockStateModelGenerator, Block ladderBlock) { - Identifier texture = Identifier.of(MiddleEarth.MOD_ID, "block/" + Registries.BLOCK.getId(ladderBlock).getPath()); + public void registerOrientableThickLadder(GenerationContext blockStateModelGenerator, Block ladderBlock) { + ResourceLocation texture = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "block/" + BuiltInRegistries.BLOCK.getKey(ladderBlock).getPath()); - WeightedVariant weightedVariant = createWeightedVariant(MEModels.THICK_LADDER.upload(ladderBlock, TextureMap.of(TextureKey.ALL, texture), blockStateModelGenerator.modelCollector)); + Variant weightedVariant = plainVariant(MEModels.THICK_LADDER.create(ladderBlock, TextureMapping.singleSlot(TextureSlot.ALL, texture), blockStateModelGenerator.modelOutput)); - VariantsBlockModelDefinitionCreator blockstate = VariantsBlockModelDefinitionCreator.of(ladderBlock) - .with(BlockStateVariantMap.models(Properties.BLOCK_FACE, Properties.HORIZONTAL_FACING) - .register(BlockFace.FLOOR, Direction.NORTH, weightedVariant) - .register(BlockFace.FLOOR, Direction.EAST, weightedVariant.apply(ROTATE_Y_90)) - .register(BlockFace.FLOOR, Direction.SOUTH, weightedVariant.apply(ROTATE_Y_180)) - .register(BlockFace.FLOOR, Direction.WEST, weightedVariant.apply(ROTATE_Y_270)) + MultiVariantGenerator blockstate = MultiVariantGenerator.multiVariant(ladderBlock) + .with(PropertyDispatch.properties(BlockStateProperties.ATTACH_FACE, BlockStateProperties.HORIZONTAL_FACING) + .select(AttachFace.FLOOR, Direction.NORTH, weightedVariant) + .select(AttachFace.FLOOR, Direction.EAST, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) + .select(AttachFace.FLOOR, Direction.SOUTH, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)) + .select(AttachFace.FLOOR, Direction.WEST, copyVariant(weightedVariant).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270)) - .register(BlockFace.WALL, Direction.NORTH, weightedVariant.apply(ROTATE_X_90)) - .register(BlockFace.WALL, Direction.EAST, weightedVariant.apply(ROTATE_X_90).apply(ROTATE_Y_90)) - .register(BlockFace.WALL, Direction.SOUTH, weightedVariant.apply(ROTATE_X_90).apply(ROTATE_Y_180)) - .register(BlockFace.WALL, Direction.WEST, weightedVariant.apply(ROTATE_X_90).apply(ROTATE_Y_270)) + .select(AttachFace.WALL, Direction.NORTH, copyVariant(weightedVariant).with(VariantProperties.X_ROT, VariantProperties.Rotation.R90)) + .select(AttachFace.WALL, Direction.EAST, copyVariant(weightedVariant).with(VariantProperties.X_ROT, VariantProperties.Rotation.R90).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) + .select(AttachFace.WALL, Direction.SOUTH, copyVariant(weightedVariant).with(VariantProperties.X_ROT, VariantProperties.Rotation.R90).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)) + .select(AttachFace.WALL, Direction.WEST, copyVariant(weightedVariant).with(VariantProperties.X_ROT, VariantProperties.Rotation.R90).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270)) - .register(BlockFace.CEILING, Direction.SOUTH, weightedVariant.apply(ROTATE_X_180)) - .register(BlockFace.CEILING, Direction.WEST, weightedVariant.apply(ROTATE_X_180).apply(ROTATE_Y_90)) - .register(BlockFace.CEILING, Direction.NORTH, weightedVariant.apply(ROTATE_X_180).apply(ROTATE_Y_180)) - .register(BlockFace.CEILING, Direction.EAST, weightedVariant.apply(ROTATE_X_180).apply(ROTATE_Y_270))); + .select(AttachFace.CEILING, Direction.SOUTH, copyVariant(weightedVariant).with(VariantProperties.X_ROT, VariantProperties.Rotation.R180)) + .select(AttachFace.CEILING, Direction.WEST, copyVariant(weightedVariant).with(VariantProperties.X_ROT, VariantProperties.Rotation.R180).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R90)) + .select(AttachFace.CEILING, Direction.NORTH, copyVariant(weightedVariant).with(VariantProperties.X_ROT, VariantProperties.Rotation.R180).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R180)) + .select(AttachFace.CEILING, Direction.EAST, copyVariant(weightedVariant).with(VariantProperties.X_ROT, VariantProperties.Rotation.R180).with(VariantProperties.Y_ROT, VariantProperties.Rotation.R270))); + + blockStateModelGenerator.registerSimpleItemModel(ladderBlock, ModelLocationUtils.getModelLocation(ladderBlock)); + blockStateModelGenerator.blockStateOutput.accept(blockstate); + } - blockStateModelGenerator.registerParentedItemModel(ladderBlock, ModelIds.getBlockModelId(ladderBlock)); - blockStateModelGenerator.blockStateCollector.accept(blockstate); + private void registerFarmland(GenerationContext blockStateModelGenerator, Block dirtBlock, Block farmland) { + TextureMapping textureMap = (new TextureMapping()).put(TextureSlot.DIRT, TextureMapping.getBlockTexture(dirtBlock)).put(TextureSlot.TOP, TextureMapping.getBlockTexture(farmland)); + TextureMapping textureMap2 = (new TextureMapping()).put(TextureSlot.DIRT, TextureMapping.getBlockTexture(dirtBlock)).put(TextureSlot.TOP, TextureMapping.getBlockTexture(farmland, "_moist")); + Variant weightedVariant = plainVariant(ModelTemplates.FARMLAND.create(farmland, textureMap, blockStateModelGenerator.modelOutput)); + Variant weightedVariant2 = plainVariant(ModelTemplates.FARMLAND.create(TextureMapping.getBlockTexture(farmland, "_moist"), textureMap2, blockStateModelGenerator.modelOutput)); + blockStateModelGenerator.blockStateOutput.accept(MultiVariantGenerator.multiVariant(farmland).with(createEmptyOrFullDispatch(BlockStateProperties.MOISTURE, 7, weightedVariant2, weightedVariant))); } - private void registerFarmland(BlockStateModelGenerator blockStateModelGenerator, Block dirtBlock, Block farmland) { - TextureMap textureMap = (new TextureMap()).put(TextureKey.DIRT, TextureMap.getId(dirtBlock)).put(TextureKey.TOP, TextureMap.getId(farmland)); - TextureMap textureMap2 = (new TextureMap()).put(TextureKey.DIRT, TextureMap.getId(dirtBlock)).put(TextureKey.TOP, TextureMap.getSubId(farmland, "_moist")); - WeightedVariant weightedVariant = createWeightedVariant(Models.TEMPLATE_FARMLAND.upload(farmland, textureMap, blockStateModelGenerator.modelCollector)); - WeightedVariant weightedVariant2 = createWeightedVariant(Models.TEMPLATE_FARMLAND.upload(TextureMap.getSubId(farmland, "_moist"), textureMap2, blockStateModelGenerator.modelCollector)); - blockStateModelGenerator.blockStateCollector.accept(VariantsBlockModelDefinitionCreator.of(farmland).with(createValueFencedModelMap(Properties.MOISTURE, 7, weightedVariant2, weightedVariant))); + private void registerDirtPath(GenerationContext blockStateModelGenerator, Block dirtBlock, Block pathBlock) { + TextureMapping textureMap = new TextureMapping() + .put(TextureSlot.PARTICLE, TextureMapping.getBlockTexture(dirtBlock)) + .put(TextureSlot.TOP, TextureMapping.getBlockTexture(pathBlock).withSuffix("_top")) + .put(TextureSlot.SIDE, TextureMapping.getBlockTexture(pathBlock).withSuffix("_side")) + .put(TextureSlot.BOTTOM, TextureMapping.getBlockTexture(dirtBlock)); + Variant weightedVariant = plainVariant(MEModels.PATH_BLOCK.create(pathBlock, textureMap, blockStateModelGenerator.modelOutput)); + blockStateModelGenerator.blockStateOutput.accept(MultiVariantGenerator.multiVariant(pathBlock, weightedVariant)); } - private void registerDirtPath(BlockStateModelGenerator blockStateModelGenerator, Block dirtBlock, Block pathBlock) { - TextureMap textureMap = new TextureMap() - .put(TextureKey.PARTICLE, TextureMap.getId(dirtBlock)) - .put(TextureKey.TOP, TextureMap.getId(pathBlock).withSuffixedPath("_top")) - .put(TextureKey.SIDE, TextureMap.getId(pathBlock).withSuffixedPath("_side")) - .put(TextureKey.BOTTOM, TextureMap.getId(dirtBlock)); - WeightedVariant weightedVariant = createWeightedVariant(MEModels.PATH_BLOCK.upload(pathBlock, textureMap, blockStateModelGenerator.modelCollector)); - blockStateModelGenerator.blockStateCollector.accept(VariantsBlockModelDefinitionCreator.of(pathBlock, weightedVariant)); + public final void registerMultifaceBlock(GenerationContext blockStateModelGenerator, Block block) { + blockStateModelGenerator.createMultifaceBlockStates(block); } - public final void registerMultifaceBlock(BlockStateModelGenerator blockStateModelGenerator, Block block) { - blockStateModelGenerator.registerTintedItemModel(block, blockStateModelGenerator.uploadBlockItemModel(block.asItem(), block), new GrassTintSource()); - blockStateModelGenerator.registerMultifaceBlockModel(block); + private void registerCrossBlockWithTexture(GenerationContext context, Block block, ResourceLocation texture) { + registerCrossBlockWithTexture(context, block, texture, GenerationContext.PlantType.NOT_TINTED); } - public final void registerHangingMoss(BlockStateModelGenerator blockStateModelGenerator, Block block) { - blockStateModelGenerator.registerItemModel(block); - blockStateModelGenerator.blockStateCollector.accept(VariantsBlockModelDefinitionCreator.of(block).with(BlockStateVariantMap.models(HangingMossBlock.TIP).generate((tip) -> { + private void registerCrossBlockWithTexture( + GenerationContext context, + Block block, + ResourceLocation texture, + GenerationContext.PlantType plantType + ) { + ResourceLocation model = plantType.getCross().create( + block, + TextureMapping.cross(texture), + context.modelOutput); + context.blockStateOutput.accept(createSimpleBlock(block, plainVariant(model))); + ModelTemplates.FLAT_ITEM.create( + ModelLocationUtils.getModelLocation(block.asItem()), + TextureMapping.layer0(texture), + context.modelOutput); + } + + public final void registerHangingMoss(GenerationContext blockStateModelGenerator, Block block) { + blockStateModelGenerator.registerSimpleFlatItemModel(block); + blockStateModelGenerator.blockStateOutput.accept(MultiVariantGenerator.multiVariant(block).with(PropertyDispatch.property(booleanProperty(block, "tip")).generate((tip) -> { String string = tip ? "_tip" : ""; - TextureMap textureMap = TextureMap.crop(TextureMap.getSubId(block, string)); - return createWeightedVariant(MEModels.CROP_VINE.upload(block, string, textureMap, blockStateModelGenerator.modelCollector)); + TextureMapping textureMap = TextureMapping.crop(TextureMapping.getBlockTexture(block, string)); + return plainVariant(MEModels.CROP_VINE.createWithSuffix(block, string, textureMap, blockStateModelGenerator.modelOutput)); }))); } - public static TextureMap paneAndTopForEdgeCustom(Block block, Block top) { - return (new TextureMap()).put(TextureKey.PANE, TextureMap.getId(block)).put(TextureKey.EDGE, TextureMap.getId(top)); + @Override + public CompletableFuture run(CachedOutput cachedOutput) { + Map blockStates = new HashMap<>(); + Map> models = new HashMap<>(); + Set definedModels = new HashSet<>(); + Set skippedAutoModels = new HashSet<>(); + + Consumer blockStateOutput = generator -> { + BlockStateGenerator previous = blockStates.put(generator.getBlock(), generator); + if (previous != null) { + throw new IllegalStateException("Duplicate blockstate definition for " + generator.getBlock()); + } + }; + BiConsumer> modelOutput = (id, supplier) -> { + if (!definedModels.add(id)) { + throw new IllegalStateException("Duplicate model definition for " + id); + } + if (!hasAuthoredItemModel(id)) { + models.put(id, supplier); + } + }; + + generateBlockStateModels(new GenerationContext(blockStateOutput, modelOutput, skippedAutoModels::add)); + replacePaleOakBlockTextures(models); + replacePaleOakDoorItemTexture(models); + addAutomaticBlockItemModels(blockStates.keySet(), models, skippedAutoModels); + + return CompletableFuture.allOf( + saveCollection(cachedOutput, blockStates, + block -> blockStatePathProvider.json(block.builtInRegistryHolder().key().location())), + saveCollection(cachedOutput, models, modelPathProvider::json)); + } + + private static void replacePaleOakBlockTextures( + Map> models + ) { + models.replaceAll((id, modelSupplier) -> { + if (!id.getPath().contains("pale_oak")) { + return modelSupplier; + } + return () -> { + JsonElement model = modelSupplier.get().deepCopy(); + if (!model.isJsonObject()) { + return model; + } + JsonObject textures = model.getAsJsonObject().getAsJsonObject("textures"); + if (textures == null) { + return model; + } + Map replacements = new HashMap<>(); + textures.entrySet().forEach(texture -> { + if (texture.getValue().isJsonPrimitive()) { + String fallback = PALE_OAK_TEXTURE_FALLBACKS.get(texture.getValue().getAsString()); + if (fallback != null) { + replacements.put(texture.getKey(), fallback); + } + } + }); + replacements.forEach(textures::addProperty); + return model; + }; + }); + } + + private static void replacePaleOakDoorItemTexture( + Map> models + ) { + ResourceLocation modelId = + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "item/pale_oak_door"); + if (!models.containsKey(modelId)) { + return; + } + + models.put(modelId, () -> { + JsonObject model = new JsonObject(); + model.addProperty("parent", "minecraft:item/generated"); + JsonObject textures = new JsonObject(); + textures.addProperty("layer0", "minecraft:item/birch_door"); + model.add("textures", textures); + return model; + }); + } + + private void addAutomaticBlockItemModels( + Set blocks, + Map> models, + Set skippedAutoModels + ) { + for (Block block : blocks) { + Item item = Item.BY_BLOCK.get(block); + ResourceLocation itemModel = item == null ? null : ModelLocationUtils.getModelLocation(item); + if (item != null && !skippedAutoModels.contains(item) && !hasAuthoredItemModel(itemModel)) { + models.putIfAbsent( + itemModel, + new DelegatedModel(ModelLocationUtils.getModelLocation(block)) + ); + } + } + } + + private boolean hasAuthoredItemModel(ResourceLocation id) { + return id != null + && id.getNamespace().equals(MiddleEarth.MOD_ID) + && id.getPath().startsWith("item/") + && Files.isRegularFile(authoredModelsRoot.resolve(id.getPath() + ".json")); + } + + private static CompletableFuture saveCollection( + CachedOutput cachedOutput, + Map> values, + Function pathFactory + ) { + CompletableFuture[] futures = values.entrySet().stream() + .map(entry -> DataProvider.saveStable(cachedOutput, entry.getValue().get(), pathFactory.apply(entry.getKey()))) + .toArray(CompletableFuture[]::new); + return CompletableFuture.allOf(futures); + } + + private static Variant plainVariant(ResourceLocation model) { + return Variant.variant().with(VariantProperties.MODEL, model); + } + + private static Variant plainVariant(Variant variant) { + return variant; + } + + private static Variant plainModel(ResourceLocation model) { + return plainVariant(model); + } + + @SuppressWarnings("unchecked") + private static net.minecraft.world.level.block.state.properties.Property booleanProperty( + Block block, + String name + ) { + return (net.minecraft.world.level.block.state.properties.Property) block.getStateDefinition() + .getProperty(name); + } + + private static ResourceLocation modelLocation(Variant variant) { + return ResourceLocation.parse(variant.get().getAsJsonObject().get("model").getAsString()); + } + + private static BlockStateGenerator createSimpleBlock(Block block, Variant model) { + return MultiVariantGenerator.multiVariant(block, model); + } + + private static BlockStateGenerator createAxisAlignedPillarBlock(Block block, Variant model) { + return invokeGeneratorStatic("createAxisAlignedPillarBlock", block, modelLocation(model)); + } + + private static BlockStateGenerator createSlab(Block block, Variant bottom, Variant top, Variant doubleSlab) { + return invokeGeneratorStatic( + "createSlab", + block, + modelLocation(bottom), + modelLocation(top), + modelLocation(doubleSlab) + ); + } + + private static BlockStateGenerator createStairs(Block block, Variant inner, Variant straight, Variant outer) { + return invokeGeneratorStatic( + "createStairs", + block, + modelLocation(inner), + modelLocation(straight), + modelLocation(outer) + ); + } + + private static BlockStateGenerator createWall(Block block, Variant post, Variant low, Variant tall) { + return invokeGeneratorStatic( + "createWall", + block, + modelLocation(post), + modelLocation(low), + modelLocation(tall) + ); + } + + private static BlockStateGenerator createFence(Block block, Variant post, Variant side) { + return invokeGeneratorStatic("createFence", block, modelLocation(post), modelLocation(side)); + } + + private static BlockStateGenerator createFenceGate( + Block block, + Variant open, + Variant closed, + Variant openWall, + Variant closedWall, + boolean uvLock + ) { + return invokeGeneratorStatic( + "createFenceGate", + block, + modelLocation(open), + modelLocation(closed), + modelLocation(openWall), + modelLocation(closedWall), + uvLock + ); + } + + private static BlockStateGenerator createButton(Block block, Variant unpressed, Variant pressed) { + return invokeGeneratorStatic("createButton", block, modelLocation(unpressed), modelLocation(pressed)); + } + + private static BlockStateGenerator createPressurePlate(Block block, Variant up, Variant down) { + return invokeGeneratorStatic("createPressurePlate", block, modelLocation(up), modelLocation(down)); + } + + private static BlockStateGenerator createOrientableTrapdoor( + Block block, + Variant bottom, + Variant top, + Variant open + ) { + return invokeGeneratorStatic( + "createOrientableTrapdoor", + block, + modelLocation(bottom), + modelLocation(top), + modelLocation(open) + ); + } + + private static BlockStateGenerator createTrapdoor(Block block, Variant bottom, Variant top, Variant open) { + return invokeGeneratorStatic( + "createTrapdoor", + block, + modelLocation(bottom), + modelLocation(top), + modelLocation(open) + ); + } + + private static Variant[] createRotatedVariants(Variant model) { + return invokeGeneratorStatic("createRotatedVariants", modelLocation(model)); + } + + private static > PropertyDispatch createEmptyOrFullDispatch( + net.minecraft.world.level.block.state.properties.Property property, + T fullValue, + Variant fullModel, + Variant emptyModel + ) { + return invokeGeneratorStatic( + "createEmptyOrFullDispatch", + property, + fullValue, + modelLocation(fullModel), + modelLocation(emptyModel) + ); + } + + @SuppressWarnings("unchecked") + private static T invokeGeneratorStatic(String name, Object... arguments) { + return (T) invokeGenerator(null, name, arguments); + } + + private static Object invokeGenerator(BlockModelGenerators target, String name, Object... arguments) { + for (Method method : BlockModelGenerators.class.getDeclaredMethods()) { + if (!method.getName().equals(name) + || method.getParameterCount() != arguments.length + || (target == null) != Modifier.isStatic(method.getModifiers()) + || !parametersMatch(method.getParameterTypes(), arguments)) { + continue; + } + + try { + method.setAccessible(true); + return method.invoke(target, arguments); + } catch (ReflectiveOperationException exception) { + throw new IllegalStateException("Failed to invoke BlockModelGenerators." + name, exception); + } + } + throw new IllegalStateException("No matching BlockModelGenerators." + name + " overload"); + } + + private static boolean parametersMatch(Class[] parameterTypes, Object[] arguments) { + for (int i = 0; i < parameterTypes.length; i++) { + if (arguments[i] == null) { + continue; + } + Class parameterType = parameterTypes[i].isPrimitive() + ? primitiveWrapper(parameterTypes[i]) + : parameterTypes[i]; + if (!parameterType.isInstance(arguments[i])) { + return false; + } + } + return true; + } + + private static Class primitiveWrapper(Class type) { + if (type == boolean.class) return Boolean.class; + if (type == int.class) return Integer.class; + if (type == long.class) return Long.class; + if (type == float.class) return Float.class; + if (type == double.class) return Double.class; + if (type == byte.class) return Byte.class; + if (type == short.class) return Short.class; + if (type == char.class) return Character.class; + return type; + } + + public static final class GenerationContext extends BlockModelGenerators { + public final Consumer blockStateOutput; + public final BiConsumer> modelOutput; + + private GenerationContext( + Consumer blockStateOutput, + BiConsumer> modelOutput, + Consumer skippedAutoModelsOutput + ) { + super(blockStateOutput, modelOutput, skippedAutoModelsOutput); + this.blockStateOutput = blockStateOutput; + this.modelOutput = modelOutput; + } + + public void createTintedLeaves(Block block, TexturedModel.Provider model, int ignoredTint) { + createTrivialBlock(block, model); + } + + public void createRotatedPillarWithHorizontalVariant( + Block block, + TexturedModel.Provider vertical, + TexturedModel.Provider horizontal + ) { + invokeGenerator(this, "createRotatedPillarWithHorizontalVariant", block, vertical, horizontal); + } + + public void createDoor(Block block) { + invokeGenerator(this, "createDoor", block); + } + + public void createCrossBlockWithDefaultItem(Block block, PlantType tint) { + invokeGenerator(this, "createCrossBlockWithDefaultItem", block, tint.vanillaValue()); + } + + public void createGrowingPlant(Block body, Block head, PlantType tint) { + invokeGenerator(this, "createGrowingPlant", body, head, tint.vanillaValue()); + } + + public void createCrossBlock(Block block, PlantType tint) { + invokeGenerator(this, "createCrossBlock", block, tint.vanillaValue()); + } + + public void createFlowerBed(Block block) { + invokeGenerator(this, "createFlowerBed", block); + } + + public void createMushroomBlock(Block block) { + invokeGenerator(this, "createMushroomBlock", block); + } + + public void createCropBlock(Block block, IntegerProperty ageProperty, int... ages) { + invokeGenerator(this, "createCropBlock", block, ageProperty, ages); + } + + public void createAmethystCluster(Block block) { + invokeGenerator(this, "createAmethystCluster", block); + } + + public void createMultiface(Block block) { + invokeGenerator(this, "createMultiface", block); + } + + public void createMultifaceBlockStates(Block block) { + createMultiface(block); + } + + public ResourceLocation createSuffixedVariant( + Block block, + String suffix, + ModelTemplate model, + Function textureFactory + ) { + return model.createWithSuffix( + block, + suffix, + textureFactory.apply(TextureMapping.getBlockTexture(block, suffix)), + modelOutput + ); + } + + public void createDoubleBlock(Block block, Variant top, Variant bottom) { + invokeGenerator(this, "createDoubleBlock", block, modelLocation(top), modelLocation(bottom)); + } + + public ResourceLocation createFlatItemModelWithBlockTexture(Item item, Block block) { + return ModelTemplates.FLAT_ITEM.create( + ModelLocationUtils.getModelLocation(item), + TextureMapping.layer0(TextureMapping.getBlockTexture(block)), + modelOutput + ); + } + + public void registerSimpleItemModel(Object itemOrBlock, ResourceLocation model) { + Item item = itemOrBlock instanceof Block block ? block.asItem() : (Item) itemOrBlock; + if (ModelLocationUtils.getModelLocation(item).equals(model)) { + return; + } + modelOutput.accept(ModelLocationUtils.getModelLocation(item), new DelegatedModel(model)); + } + + public void registerSimpleTintedItemModel( + Object itemOrBlock, + ResourceLocation model, + Object ignoredTint + ) { + Item item = itemOrBlock instanceof Block block ? block.asItem() : (Item) itemOrBlock; + if (ModelLocationUtils.getModelLocation(item).equals(model)) { + return; + } + registerSimpleItemModel(itemOrBlock, model); + } + + public void registerSimpleFlatItemModel(Object itemOrBlock) { + registerSimpleFlatItemModel(itemOrBlock, ""); + } + + public void registerSimpleFlatItemModel(Object itemOrBlock, String textureSuffix) { + Item item = itemOrBlock instanceof Block block ? block.asItem() : (Item) itemOrBlock; + ResourceLocation texture = itemOrBlock instanceof Block block + ? TextureMapping.getBlockTexture(block, textureSuffix) + : TextureMapping.getItemTexture(item, textureSuffix); + ModelTemplates.FLAT_ITEM.create( + ModelLocationUtils.getModelLocation(item), + TextureMapping.layer0(texture), + modelOutput + ); + } + + public enum PlantType { + TINTED(ModelTemplates.TINTED_CROSS, ModelTemplates.TINTED_FLOWER_POT_CROSS), + NOT_TINTED(ModelTemplates.CROSS, ModelTemplates.FLOWER_POT_CROSS); + + private final ModelTemplate cross; + private final ModelTemplate crossPot; + + PlantType(ModelTemplate cross, ModelTemplate crossPot) { + this.cross = cross; + this.crossPot = crossPot; + } + + public ModelTemplate getCross() { + return cross; + } + + public ModelTemplate getCrossPot() { + return crossPot; + } + + @SuppressWarnings({"rawtypes", "unchecked"}) + private Object vanillaValue() { + try { + Class type = (Class) Class.forName( + "net.minecraft.data.models.BlockModelGenerators$TintState" + ); + return Enum.valueOf(type, name()); + } catch (ClassNotFoundException exception) { + throw new IllegalStateException("Missing BlockModelGenerators.TintState", exception); + } + } + } + } + + private static Variant copyVariant(Variant variant) { + return Variant.merge(variant, Variant.variant()); + } + + public static TextureMapping paneAndTopForEdgeCustom(Block block, Block top) { + return (new TextureMapping()).put(TextureSlot.PANE, TextureMapping.getBlockTexture(block)).put(TextureSlot.EDGE, TextureMapping.getBlockTexture(top)); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/models/ItemModelProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/models/ItemModelProvider.java index 1dcefd4027..a399614f25 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/models/ItemModelProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/models/ItemModelProvider.java @@ -1,432 +1,504 @@ package net.sevenstars.middleearth.datageneration.providers.models; -import net.fabricmc.fabric.api.client.datagen.v1.provider.FabricModelProvider; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.minecraft.client.data.*; -import net.minecraft.client.render.item.model.ItemModel; -import net.minecraft.client.render.item.model.RangeDispatchItemModel; -import net.minecraft.client.render.item.model.SelectItemModel; -import net.minecraft.client.render.item.property.bool.BrokenProperty; -import net.minecraft.client.render.item.property.bool.UsingItemProperty; -import net.minecraft.client.render.item.property.numeric.CrossbowPullProperty; -import net.minecraft.client.render.item.property.numeric.UseDurationProperty; -import net.minecraft.client.render.item.property.select.*; -import net.minecraft.client.render.item.tint.DyeTintSource; -import net.minecraft.item.CrossbowItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemDisplayContext; -import net.minecraft.item.equipment.trim.ArmorTrimAssets; -import net.minecraft.item.equipment.trim.ArmorTrimMaterial; -import net.minecraft.item.equipment.trim.ArmorTrimMaterials; -import net.minecraft.registry.Registries; -import net.minecraft.registry.RegistryKey; -import net.minecraft.util.Identifier; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.CachedOutput; +import net.minecraft.data.DataProvider; +import net.minecraft.data.PackOutput; +import net.minecraft.data.models.model.ModelLocationUtils; +import net.minecraft.data.models.model.ModelTemplate; +import net.minecraft.data.models.model.ModelTemplates; +import net.minecraft.data.models.model.TextureMapping; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.datageneration.content.CustomItemModels; -import net.sevenstars.middleearth.datageneration.content.models.*; +import net.sevenstars.middleearth.datageneration.content.models.HotMetalsModel; +import net.sevenstars.middleearth.datageneration.content.models.SimpleArtefactModels; +import net.sevenstars.middleearth.datageneration.content.models.SimpleBigItemModel; +import net.sevenstars.middleearth.datageneration.content.models.SimpleBowItemModel; +import net.sevenstars.middleearth.datageneration.content.models.SimpleCrossbowItemModel; +import net.sevenstars.middleearth.datageneration.content.models.SimpleDyeableItemModel; +import net.sevenstars.middleearth.datageneration.content.models.SimpleHandheldItemModel; +import net.sevenstars.middleearth.datageneration.content.models.SimpleItemModel; +import net.sevenstars.middleearth.datageneration.content.models.SimpleSpearModel; import net.sevenstars.middleearth.item.EggItemsME; import net.sevenstars.middleearth.item.ResourceItemsME; import net.sevenstars.middleearth.item.WeaponItemsME; import net.sevenstars.middleearth.item.items.PipeItem; import net.sevenstars.middleearth.item.items.weapons.CustomDaggerWeaponItem; import net.sevenstars.middleearth.item.items.weapons.CustomLongswordWeaponItem; -import net.sevenstars.middleearth.item.items.weapons.HotComponentProperty; -import net.sevenstars.middleearth.item.items.weapons.SneakAttackProperty; -import net.sevenstars.middleearth.item.utils.SmithingTrimMaterialsME; +import net.sevenstars.middleearth.item.items.weapons.artefacts.ArtefactCustomGlowingDaggerWeaponItem; +import net.sevenstars.middleearth.item.items.weapons.artefacts.ArtefactCustomGlowingLongswordWeaponItem; import net.sevenstars.middleearth.registries.content.npctypes.NpcRegistry; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.ArrayList; -import java.util.Iterator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; import java.util.List; -import java.util.Optional; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.CompletableFuture; import java.util.function.BiConsumer; +import java.util.function.Supplier; + +public class ItemModelProvider implements DataProvider { + private static final ResourceLocation PULLING = ResourceLocation.withDefaultNamespace("pulling"); + private static final ResourceLocation PULL = ResourceLocation.withDefaultNamespace("pull"); + private static final ResourceLocation CHARGED = ResourceLocation.withDefaultNamespace("charged"); + private static final ResourceLocation FIREWORK = ResourceLocation.withDefaultNamespace("firework"); + private static final ResourceLocation BLOCKING = ResourceLocation.withDefaultNamespace("blocking"); + private static final ResourceLocation TRIM_TYPE = ResourceLocation.withDefaultNamespace("trim_type"); + private static final ResourceLocation BROKEN = ResourceLocation.withDefaultNamespace("broken"); + private static final ResourceLocation GLOWING = ResourceLocation.withDefaultNamespace("glowing"); + private static final ResourceLocation HOT = MiddleEarth.of("hot_component"); + private static final ResourceLocation SNEAK_ATTACK = MiddleEarth.of("sneak_attack"); + + private static final List TRIM_MATERIALS = List.of( + new TrimMaterialData("jade", 0.001F), + new TrimMaterialData("tin", 0.002F), + new TrimMaterialData("lead", 0.003F), + new TrimMaterialData("silver", 0.004F), + new TrimMaterialData("bronze", 0.005F), + new TrimMaterialData("steel", 0.006F), + new TrimMaterialData("crude", 0.007F), + new TrimMaterialData("burzum_steel", 0.008F), + new TrimMaterialData("edhel_steel", 0.009F), + new TrimMaterialData("khazad_steel", 0.011F), + new TrimMaterialData("mithril", 0.012F), + new TrimMaterialData("quartz", 0.1F), + new TrimMaterialData("iron", 0.2F), + new TrimMaterialData("netherite", 0.3F), + new TrimMaterialData("redstone", 0.4F), + new TrimMaterialData("copper", 0.5F), + new TrimMaterialData("gold", 0.6F), + new TrimMaterialData("emerald", 0.7F), + new TrimMaterialData("diamond", 0.8F), + new TrimMaterialData("lapis", 0.9F), + new TrimMaterialData("amethyst", 1.0F), + new TrimMaterialData("resin", 1.1F) + ); -import static net.minecraft.client.data.ItemModelGenerator.createModelWithInHandVariant; - -public class ItemModelProvider extends FabricModelProvider { - - public ItemModelProvider(FabricDataOutput output) { - super(output); + private final PackOutput.PathProvider modelPathProvider; + private final Path authoredModelsRoot; + private final Set generatedBaseModels = new HashSet<>(); + private BiConsumer> modelOutput; + + public ItemModelProvider(PackOutput output) { + this.modelPathProvider = output.createPathProvider(PackOutput.Target.RESOURCE_PACK, "models"); + this.authoredModelsRoot = output.getOutputFolder() + .resolveSibling("resources") + .resolve("assets") + .resolve(MiddleEarth.MOD_ID) + .resolve("models"); } @Override public String getName() { - return "ItemModelProvider"; + return "Item model definitions"; } @Override - public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) { + public CompletableFuture run(CachedOutput cachedOutput) { + Map> models = new HashMap<>(); + Set definedModels = new HashSet<>(); + modelOutput = (id, supplier) -> { + if (!definedModels.add(id)) { + throw new IllegalStateException("Duplicate model definition for " + id); + } + if (generatedBaseModels.contains(id) || !hasAuthoredItemModel(id)) { + models.put(id, supplier); + } + }; + + generateItemModels(); + + CompletableFuture[] futures = models.entrySet().stream() + .map(entry -> DataProvider.saveStable( + cachedOutput, + entry.getValue().get(), + modelPathProvider.json(entry.getKey()) + )) + .toArray(CompletableFuture[]::new); + return CompletableFuture.allOf(futures); } - private static final List TRIM_MATERIALS = List.of( - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.QUARTZ, ArmorTrimMaterials.QUARTZ), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.IRON, ArmorTrimMaterials.IRON), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.NETHERITE, ArmorTrimMaterials.NETHERITE), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.REDSTONE, ArmorTrimMaterials.REDSTONE), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.COPPER, ArmorTrimMaterials.COPPER), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.GOLD, ArmorTrimMaterials.GOLD), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.EMERALD, ArmorTrimMaterials.EMERALD), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.DIAMOND, ArmorTrimMaterials.DIAMOND), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.LAPIS, ArmorTrimMaterials.LAPIS), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.AMETHYST, ArmorTrimMaterials.AMETHYST), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.RESIN, ArmorTrimMaterials.RESIN), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.of("jade"), SmithingTrimMaterialsME.JADE), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.of("lead"), SmithingTrimMaterialsME.LEAD), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.of("tin"), SmithingTrimMaterialsME.TIN), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.of("bronze"), SmithingTrimMaterialsME.BRONZE), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.of("crude"), SmithingTrimMaterialsME.CRUDE), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.of("silver"), SmithingTrimMaterialsME.SILVER), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.of("steel"), SmithingTrimMaterialsME.STEEL), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.of("khazad_steel"), SmithingTrimMaterialsME.KHAZAD_STEEL), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.of("edhel_steel"), SmithingTrimMaterialsME.EDHEL_STEEL), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.of("burzum_steel"), SmithingTrimMaterialsME.BURZUM_STEEL), - new ItemModelGenerator.TrimMaterial(ArmorTrimAssets.of("mithril"), SmithingTrimMaterialsME.MITHRIL) - ); - - - @Override - public void generateItemModels(ItemModelGenerator itemModelGenerator) { - - for (Item item : SimpleItemModel.items) { - itemModelGenerator.register(item, Models.GENERATED); - } - - for (Item item : SimpleHandheldItemModel.items) { - itemModelGenerator.register(item, Models.HANDHELD); - } - - for (Item item : SimpleHandheldItemModel.daggers) { - registerDaggerItemModels(itemModelGenerator, item); - } - - for (Item item : SimpleBigItemModel.items) { - registerWeaponBigItemModels(itemModelGenerator, item); - } - - for (Item item : SimpleBigItemModel.bigBows) { - registerBigBowItemModels(itemModelGenerator, item); - } - - for (Item item : SimpleBowItemModel.items) { - registerBow(itemModelGenerator, item); - } - - for (Item item : SimpleCrossbowItemModel.items) { - registerCrossbow(itemModelGenerator, item); - } - - for (Item item : SimpleSpearModel.items) { - registerSpearModels(itemModelGenerator, item); - } - - for (Item item : SimpleBigItemModel.genericItems) { - registerGenericBigModels(itemModelGenerator, item); - } + private boolean hasAuthoredItemModel(ResourceLocation id) { + return id.getNamespace().equals(MiddleEarth.MOD_ID) + && id.getPath().startsWith("item/") + && Files.isRegularFile(authoredModelsRoot.resolve(id.getPath() + ".json")); + } - for (Item item : WeaponItemsME.shields) { - registerShield(itemModelGenerator, item); - } + private void generateItemModels() { + SimpleItemModel.items.forEach(item -> createFlatItem(item, ModelTemplates.FLAT_ITEM)); + SimpleHandheldItemModel.items.forEach(item -> createFlatItem(item, ModelTemplates.FLAT_HANDHELD_ITEM)); + SimpleHandheldItemModel.daggers.forEach(this::registerDaggerItemModels); + SimpleBigItemModel.items.forEach(this::registerWeaponBigItemModels); + SimpleBigItemModel.bigBows.forEach(this::registerBigBowItemModels); + SimpleBowItemModel.items.forEach(this::registerBow); + SimpleCrossbowItemModel.items.forEach(this::registerCrossbow); + SimpleSpearModel.items.forEach(this::registerSpearModels); + SimpleBigItemModel.genericItems.forEach(this::registerGenericBigModels); + WeaponItemsME.shields.forEach(this::registerShield); for (SimpleArtefactModels.Artefact artefact : SimpleArtefactModels.artefacts) { - registerArtefact(itemModelGenerator, artefact.artefact(), artefact.dualModel()); + registerArtefact(artefact.artefact(), artefact.dualModel()); } - for (Item item : HotMetalsModel.ingots) { - registerHotIngotsItem(item, itemModelGenerator); + HotMetalsModel.ingots.forEach(this::registerHotIngotItem); + HotMetalsModel.nuggets.forEach(this::registerHotNuggetItem); + HotMetalsModel.nuggies.forEach(this::registerHotItem); + SimpleDyeableItemModel.items.forEach(this::registerDyeableArmor); + + registerPalettedItem(ResourceItemsME.ROD); + registerPalettedItem(ResourceItemsME.LARGE_ROD); + registerPalettedItem(ResourceItemsME.PICKAXE_HEAD); + registerPalettedItem(ResourceItemsME.AXE_HEAD); + registerPalettedItem(ResourceItemsME.SHOVEL_HEAD); + registerPalettedItem(ResourceItemsME.HOE_HEAD); + registerPalettedItem(ResourceItemsME.BLADE); + registerPalettedItem(ResourceItemsME.SHORT_BLADE); + registerPalettedItem(ResourceItemsME.LONG_BLADE); + registerPalettedItem(ResourceItemsME.SWORD_HILT); + registerPalettedItem(ResourceItemsME.MAIL_RING); + registerPalettedItem(ResourceItemsME.MAIL); + registerPalettedItem(ResourceItemsME.SCALE); + registerPalettedItem(ResourceItemsME.SCALE_MAIL); + registerPalettedItem(ResourceItemsME.ARMOR_PLATE); + registerPalettedItem(ResourceItemsME.HELMET_PLATE); + registerPalettedItem(ResourceItemsME.SHIELD_BORDER); + registerPalettedItem(ResourceItemsME.SHIELD_PLATE); + + createFlatItem(EggItemsME.NPC_SPAWN_EGG, ModelTemplates.FLAT_ITEM); + for (var npcType : NpcRegistry.allNpcTypes) { + String id = npcType.location().getPath() + .replace("npc_data.middle-earth.", "") + .replace('.', '_') + "_spawn_egg"; + createFlatModel(MiddleEarth.ofPath("item", id), MiddleEarth.ofPath("item", id), ModelTemplates.FLAT_ITEM); } - - for (Item item : HotMetalsModel.nuggets) { - registerHotNuggetItem(item, itemModelGenerator); - } - - for (Item item : HotMetalsModel.nuggies) { - registerHotItem(item, itemModelGenerator); - } - - // Dyeables needs to be done manually (because of layers) - - SimpleDyeableItemModel.items.forEach(item -> { - registerDyeableArmor(item, itemModelGenerator); - }); - - registerPalettedItem(ResourceItemsME.ROD, itemModelGenerator); - registerPalettedItem(ResourceItemsME.LARGE_ROD, itemModelGenerator); - - registerPalettedItem(ResourceItemsME.PICKAXE_HEAD, itemModelGenerator); - registerPalettedItem(ResourceItemsME.AXE_HEAD, itemModelGenerator); - registerPalettedItem(ResourceItemsME.SHOVEL_HEAD, itemModelGenerator); - registerPalettedItem(ResourceItemsME.HOE_HEAD, itemModelGenerator); - - registerPalettedItem(ResourceItemsME.BLADE, itemModelGenerator); - registerPalettedItem(ResourceItemsME.SHORT_BLADE, itemModelGenerator); - registerPalettedItem(ResourceItemsME.LONG_BLADE, itemModelGenerator); - registerPalettedItem(ResourceItemsME.SWORD_HILT, itemModelGenerator); - - registerPalettedItem(ResourceItemsME.MAIL_RING, itemModelGenerator); - registerPalettedItem(ResourceItemsME.MAIL, itemModelGenerator); - - registerPalettedItem(ResourceItemsME.SCALE, itemModelGenerator); - registerPalettedItem(ResourceItemsME.SCALE_MAIL, itemModelGenerator); - - registerPalettedItem(ResourceItemsME.ARMOR_PLATE, itemModelGenerator); - - registerPalettedItem(ResourceItemsME.HELMET_PLATE, itemModelGenerator); - registerPalettedItem(ResourceItemsME.SHIELD_BORDER, itemModelGenerator); - registerPalettedItem(ResourceItemsME.SHIELD_PLATE, itemModelGenerator); - - List models = new ArrayList<>(List.of()); - - NpcRegistry.allNpcTypes.forEach(npcDataRegistryKey -> { - String id = npcDataRegistryKey.getValue().getPath().replaceAll("npc_data.middle-earth.", "").replaceAll("\\.", "_") + "_spawn_egg"; - - var item = ItemModels.switchCase(id, - ItemModels.basic(Models.GENERATED.upload(MiddleEarth.of("item/" + id), - TextureMap.layer0(MiddleEarth.of( "item/" + id)), - itemModelGenerator.modelCollector - ))); - - if(!models.contains(item)) - models.add(item); - }); - ItemModel.Unbaked fallbackModel = ItemModels.basic(itemModelGenerator.upload(EggItemsME.NPC_SPAWN_EGG, Models.GENERATED)); - - String randomNpcEggId = "npc_random_spawn_egg"; - var randomNpcEgg = ItemModels.switchCase(randomNpcEggId, - ItemModels.basic(Models.GENERATED.upload(MiddleEarth.ofPath( "item", randomNpcEggId), - TextureMap.layer0(MiddleEarth.ofPath( "item", randomNpcEggId)), - itemModelGenerator.modelCollector - ))); - - if(!models.contains(randomNpcEgg)) - models.add(randomNpcEgg); - - itemModelGenerator.output.accept(EggItemsME.NPC_SPAWN_EGG, - new SelectItemModel.Unbaked(new SelectItemModel.UnbakedSwitch(new CustomModelDataStringProperty(0), models), Optional.of(fallbackModel))); + createFlatModel( + MiddleEarth.ofPath("item", "npc_random_spawn_egg"), + MiddleEarth.ofPath("item", "npc_random_spawn_egg"), + ModelTemplates.FLAT_ITEM + ); } - public final void registerDaggerItemModels(ItemModelGenerator itemModelGenerator, Item item) { - ItemModel.Unbaked unbakedHand = ItemModels.basic(itemModelGenerator.upload(item, Models.HANDHELD)); - ItemModel.Unbaked unbakedHandStrike = ItemModels.basic(CustomItemModels.DAGGER_STRIKE.upload(ModelIds.getItemSubModelId(item, "_strike"), - TextureMap.layer0(TextureMap.getId(item)), itemModelGenerator.modelCollector)); - //ItemModels.basic(itemModelGenerator.registerSubModel(item, "_strike", CustomItemModels.DAGGER_STRIKE)); - - itemModelGenerator.output.accept(item, ItemModels.condition(new SneakAttackProperty(), unbakedHandStrike, unbakedHand)); + private void registerDaggerItemModels(Item item) { + ResourceLocation strike = createFlatModel( + ModelLocationUtils.getModelLocation(item, "_strike"), + TextureMapping.getItemTexture(item), + CustomItemModels.DAGGER_STRIKE + ); + createFlatItem( + item, + ModelTemplates.FLAT_HANDHELD_ITEM, + List.of(override(strike, SNEAK_ATTACK, 1.0F)) + ); } - public final void registerWeaponBigItemModels(ItemModelGenerator itemModelGenerator, Item item) { - ItemModel.Unbaked unbakedHand; - if (Registries.ITEM.getId(item).getPath().contains("staff")){ - unbakedHand = ItemModels.basic(itemModelGenerator.upload(item, CustomItemModels.BIG_WEAPON_STAFF)); - } else { - unbakedHand = ItemModels.basic(itemModelGenerator.upload(item, CustomItemModels.BIG_WEAPON)); - } - ItemModel.Unbaked unbakedInventory = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_inventory", Models.GENERATED)); - - if (item instanceof CustomLongswordWeaponItem longswordWeaponItem){ - ItemModel.Unbaked unbakedHandBlocking = ItemModels.basic(CustomItemModels.BIG_WEAPON_BLOCKING.upload(ModelIds.getItemSubModelId(item, "_blocking"), TextureMap.layer0(TextureMap.getId(item)), itemModelGenerator.modelCollector)); - itemModelGenerator.output.accept(longswordWeaponItem, ItemModels.condition(new UsingItemProperty(), - ItemModels.select(new DisplayContextProperty(), unbakedHandBlocking, - ItemModels.switchCase(List.of(ItemDisplayContext.GUI, ItemDisplayContext.GROUND, ItemDisplayContext.FIXED), unbakedInventory)), - ItemModels.select(new DisplayContextProperty(), unbakedHand, - ItemModels.switchCase(List.of(ItemDisplayContext.GUI, ItemDisplayContext.GROUND, ItemDisplayContext.FIXED), unbakedInventory)))); - } else { - itemModelGenerator.output.accept(item, createModelWithInHandVariant(unbakedInventory, unbakedHand)); + private void registerWeaponBigItemModels(Item item) { + ModelTemplate handModel = BuiltInRegistries.ITEM.getKey(item).getPath().contains("staff") + ? CustomItemModels.BIG_WEAPON_STAFF + : CustomItemModels.BIG_WEAPON; + createFlatItem(item, "_inventory", ModelTemplates.FLAT_ITEM); + + List overrides = List.of(); + if (item instanceof CustomLongswordWeaponItem) { + ResourceLocation blocking = createFlatModel( + ModelLocationUtils.getModelLocation(item, "_blocking"), + TextureMapping.getItemTexture(item), + CustomItemModels.BIG_WEAPON_BLOCKING + ); + overrides = List.of(override(blocking, BLOCKING, 1.0F)); } + createFlatItem(item, handModel, overrides); } - public final void registerGenericBigModels(ItemModelGenerator itemModelGenerator, Item item) { + private void registerGenericBigModels(Item item) { + createFlatItem(item, "_inventory", ModelTemplates.FLAT_ITEM); if (item instanceof PipeItem) { - registerPipeItemModels(itemModelGenerator, item); - return; + createFlatModel( + MiddleEarth.ofPath("item", "smoking_" + BuiltInRegistries.ITEM.getKey(item).getPath()), + MiddleEarth.ofPath("item", "smoking_" + BuiltInRegistries.ITEM.getKey(item).getPath()), + ModelTemplates.FLAT_HANDHELD_ITEM + ); } - - ItemModel.Unbaked unbakedHand = ItemModels.basic(ModelIds.getItemModelId(item)); - ItemModel.Unbaked unbakedInventory = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_inventory", Models.GENERATED)); - - itemModelGenerator.output.accept(item, createModelWithInHandVariant(unbakedInventory, unbakedHand)); } - public final void registerPipeItemModels(ItemModelGenerator itemModelGenerator, Item item) { - String path = Registries.ITEM.getId(item).getPath(); - ItemModel.Unbaked unbakedHand = ItemModels.basic(ModelIds.getItemModelId(item)); - ItemModel.Unbaked unbakedSmokingHand = ItemModels.basic(Identifier.of(MiddleEarth.MOD_ID, "item/smoking_" + path)); - ItemModel.Unbaked unbakedInventory = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_inventory", Models.GENERATED)); - - itemModelGenerator.output.accept(item, ItemModels.select(new DisplayContextProperty(), - ItemModels.condition(ItemModels.usingItemProperty(), unbakedSmokingHand, unbakedHand), - ItemModels.switchCase(List.of(ItemDisplayContext.GUI, ItemDisplayContext.GROUND, ItemDisplayContext.FIXED), unbakedInventory))); - } + private void registerArtefact(Item item, boolean dualModel) { + if (item instanceof CustomDaggerWeaponItem) { + ResourceLocation strike = createFlatModel( + ModelLocationUtils.getModelLocation(item, "_strike"), + TextureMapping.getItemTexture(item), + CustomItemModels.DAGGER_STRIKE + ); + ResourceLocation broken = createFlatItem(item, "_broken", ModelTemplates.FLAT_HANDHELD_ITEM); + List overrides = new ArrayList<>(); + overrides.add(override(broken, BROKEN, 1.0F)); + if (item instanceof ArtefactCustomGlowingDaggerWeaponItem) { + ResourceLocation glowing = createFlatItem(item, "_glowing", ModelTemplates.FLAT_HANDHELD_ITEM); + overrides.add(override(glowing, GLOWING, 1.0F)); + } + overrides.add(override(strike, SNEAK_ATTACK, 1.0F)); + createFlatItem( + item, + ModelTemplates.FLAT_HANDHELD_ITEM, + overrides + ); + return; + } - public final void registerArtefact(ItemModelGenerator itemModelGenerator, Item item, Boolean dualModel) { - if(item instanceof CustomDaggerWeaponItem) { - ItemModel.Unbaked unbakedHand = ItemModels.basic(itemModelGenerator.upload(item, Models.HANDHELD)); - ItemModel.Unbaked unbakedBroken = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_broken", Models.HANDHELD)); - ItemModel.Unbaked unbakedHandStrike = ItemModels.basic(CustomItemModels.DAGGER_STRIKE.upload(ModelIds.getItemSubModelId(item, "_strike"), - TextureMap.layer0(TextureMap.getId(item)), itemModelGenerator.modelCollector)); - - itemModelGenerator.output.accept(item, ItemModels.condition(new SneakAttackProperty(), unbakedHandStrike, - ItemModels.condition(new BrokenProperty(), unbakedBroken, unbakedHand))); - } else if (dualModel) { - ItemModel.Unbaked unbakedHand = ItemModels.basic(itemModelGenerator.upload(item, CustomItemModels.BIG_WEAPON)); - ItemModel.Unbaked unbakedInventory = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_inventory", Models.GENERATED)); - ItemModel.Unbaked unbakedHandBlocking = ItemModels.basic(CustomItemModels.BIG_WEAPON_BLOCKING.upload(ModelIds.getItemSubModelId(item, "_blocking"), TextureMap.layer0(TextureMap.getId(item)), itemModelGenerator.modelCollector)); - - ItemModel.Unbaked unbakedBrokenHand = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_broken", CustomItemModels.BIG_WEAPON)); - ItemModel.Unbaked unbakedBrokenInventory = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_broken_inventory", Models.GENERATED)); - ItemModel.Unbaked unbakedBrokenHandBlocking = ItemModels.basic(CustomItemModels.BIG_WEAPON_BLOCKING.upload( - ModelIds.getItemSubModelId(item, "_broken_blocking"), TextureMap.layer0(TextureMap.getId(item)), itemModelGenerator.modelCollector)); - - itemModelGenerator.output.accept(item, ItemModels.condition(new BrokenProperty(), - ItemModels.select(new DisplayContextProperty(), ItemModels.condition(new UsingItemProperty(), unbakedBrokenHandBlocking, unbakedBrokenHand), - ItemModels.switchCase(List.of(ItemDisplayContext.GUI, ItemDisplayContext.GROUND, ItemDisplayContext.FIXED), unbakedBrokenInventory)), - ItemModels.select(new DisplayContextProperty(), ItemModels.condition(new UsingItemProperty(), unbakedHandBlocking, unbakedHand), - ItemModels.switchCase(List.of(ItemDisplayContext.GUI, ItemDisplayContext.GROUND, ItemDisplayContext.FIXED), unbakedInventory)))); + if (dualModel) { + ResourceLocation broken = createFlatItem(item, "_broken", CustomItemModels.BIG_WEAPON); + createFlatItem(item, "_inventory", ModelTemplates.FLAT_ITEM); + createFlatItem(item, "_broken_inventory", ModelTemplates.FLAT_ITEM); + List overrides = new ArrayList<>(); + ResourceLocation blocking = createFlatModel( + ModelLocationUtils.getModelLocation(item, "_blocking"), + TextureMapping.getItemTexture(item), + CustomItemModels.BIG_WEAPON_BLOCKING + ); + ResourceLocation brokenBlocking = createFlatModel( + ModelLocationUtils.getModelLocation(item, "_broken_blocking"), + TextureMapping.getItemTexture(item), + CustomItemModels.BIG_WEAPON_BLOCKING + ); + ResourceLocation glowing = null; + ResourceLocation glowingBlocking = null; + if (item instanceof ArtefactCustomGlowingLongswordWeaponItem) { + glowing = createFlatItem(item, "_glowing", CustomItemModels.BIG_WEAPON); + createFlatItem(item, "_glowing_inventory", ModelTemplates.FLAT_ITEM); + glowingBlocking = createFlatModel( + ModelLocationUtils.getModelLocation(item, "_glowing_blocking"), + TextureMapping.getItemTexture(item, "_glowing"), + CustomItemModels.BIG_WEAPON_BLOCKING + ); + overrides.add(override(glowing, GLOWING, 1.0F)); + } + overrides.add(override(broken, BROKEN, 1.0F)); + overrides.add(override(blocking, BLOCKING, 1.0F)); + if (glowingBlocking != null) { + overrides.add(override(glowingBlocking, GLOWING, 1.0F, BLOCKING, 1.0F)); + } + overrides.add(override(brokenBlocking, BROKEN, 1.0F, BLOCKING, 1.0F)); + createFlatItem( + item, + CustomItemModels.BIG_WEAPON, + overrides + ); } else { - ItemModel.Unbaked unbaked = ItemModels.basic(itemModelGenerator.upload(item, Models.HANDHELD)); - ItemModel.Unbaked unbakedBroken = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_broken", Models.HANDHELD)); - - itemModelGenerator.registerCondition(item, new BrokenProperty(), unbakedBroken, unbaked); + ResourceLocation broken = createFlatItem(item, "_broken", ModelTemplates.FLAT_HANDHELD_ITEM); + createFlatItem( + item, + ModelTemplates.FLAT_HANDHELD_ITEM, + List.of(override(broken, BROKEN, 1.0F)) + ); } - } - public final void registerSpearModels(ItemModelGenerator itemModelGenerator, Item item) { - ItemModel.Unbaked unbakedHand = ItemModels.basic(ModelIds.getItemModelId(item)); - ItemModel.Unbaked unbakedInventory = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_inventory", Models.GENERATED)); - ItemModel.Unbaked unbakedHolding = ItemModels.basic(ModelIds.getItemModelId(item).withSuffixedPath("_holding")); - - itemModelGenerator.output.accept(item, ItemModels.select(new DisplayContextProperty(), unbakedHand, - ItemModels.switchCase(List.of(ItemDisplayContext.GUI, ItemDisplayContext.GROUND, ItemDisplayContext.FIXED), unbakedInventory))); + private void registerSpearModels(Item item) { + createFlatItem(item, "_inventory", ModelTemplates.FLAT_ITEM); } - public final void registerShield(ItemModelGenerator itemModelGenerator, Item item) { - ItemModel.Unbaked unbaked = ItemModels.basic(ModelIds.getItemModelId(item)); - ItemModel.Unbaked unbaked2 = ItemModels.basic(ModelIds.getItemSubModelId(item, "_blocking")); - itemModelGenerator.registerCondition(item, ItemModels.usingItemProperty(), unbaked2, unbaked); + private void registerShield(Item item) { + ResourceLocation blocking = ModelLocationUtils.getModelLocation(item, "_blocking"); + createFlatItem( + item, + ModelTemplates.FLAT_HANDHELD_ITEM, + List.of(override(blocking, BLOCKING, 1.0F)) + ); } - public final void registerBigBowItemModels(ItemModelGenerator itemModelGenerator, Item item) { - ItemModel.Unbaked unbakedHand = ItemModels.basic(itemModelGenerator.upload(item, CustomItemModels.LONGBOW)); - ItemModel.Unbaked unbakedHand2 = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_pulling_0", CustomItemModels.LONGBOW)); - ItemModel.Unbaked unbakedHand3 = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_pulling_1", CustomItemModels.LONGBOW)); - ItemModel.Unbaked unbakedHand4 = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_pulling_2", CustomItemModels.LONGBOW)); - - ItemModel.Unbaked unbakedIventory = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_inventory", Models.GENERATED)); - ItemModel.Unbaked unbakedIventory2 = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_pulling_0_inventory", Models.GENERATED)); - ItemModel.Unbaked unbakedIventory3 = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_pulling_1_inventory", Models.GENERATED)); - ItemModel.Unbaked unbakedIventory4 = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_pulling_2_inventory", Models.GENERATED)); - - - itemModelGenerator.output.accept(item, ItemModels.select(new DisplayContextProperty(), ItemModels.condition(ItemModels.usingItemProperty(), - ItemModels.rangeDispatch( - new UseDurationProperty(false), 0.05F, unbakedHand2, - ItemModels.rangeDispatchEntry(unbakedHand3, 0.65F), - ItemModels.rangeDispatchEntry(unbakedHand4, 0.9F)), unbakedHand), ItemModels.switchCase(List.of(ItemDisplayContext.GUI, ItemDisplayContext.GROUND, ItemDisplayContext.FIXED), ItemModels.condition(ItemModels.usingItemProperty(), - ItemModels.rangeDispatch( - new UseDurationProperty(false), 0.05F, unbakedIventory2, - ItemModels.rangeDispatchEntry(unbakedIventory3, 0.65F), - ItemModels.rangeDispatchEntry(unbakedIventory4, 0.9F)), unbakedIventory)))); - + private void registerBigBowItemModels(Item item) { + ResourceLocation pulling0 = createFlatItem(item, "_pulling_0", CustomItemModels.LONGBOW); + ResourceLocation pulling1 = createFlatItem(item, "_pulling_1", CustomItemModels.LONGBOW); + ResourceLocation pulling2 = createFlatItem(item, "_pulling_2", CustomItemModels.LONGBOW); + createFlatItem(item, "_inventory", ModelTemplates.FLAT_ITEM); + createFlatItem(item, "_pulling_0_inventory", ModelTemplates.FLAT_ITEM); + createFlatItem(item, "_pulling_1_inventory", ModelTemplates.FLAT_ITEM); + createFlatItem(item, "_pulling_2_inventory", ModelTemplates.FLAT_ITEM); + createFlatItem(item, CustomItemModels.LONGBOW, bowOverrides(pulling0, pulling1, pulling2)); } - public final void registerBow(ItemModelGenerator itemModelGenerator, Item item) { - ItemModel.Unbaked unbaked = ItemModels.basic(itemModelGenerator.upload(item, CustomItemModels.BOW)); - ItemModel.Unbaked unbaked2 = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_pulling_0", Models.BOW)); - ItemModel.Unbaked unbaked3 = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_pulling_1", Models.BOW)); - ItemModel.Unbaked unbaked4 = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_pulling_2", Models.BOW)); - itemModelGenerator.output.accept(item, ItemModels.condition(ItemModels.usingItemProperty(), ItemModels.rangeDispatch(new UseDurationProperty(false), 0.05F, unbaked2, new RangeDispatchItemModel.Entry[]{ItemModels.rangeDispatchEntry(unbaked3, 0.65F), ItemModels.rangeDispatchEntry(unbaked4, 0.9F)}), unbaked)); + private void registerBow(Item item) { + ResourceLocation pulling0 = createFlatItem(item, "_pulling_0", CustomItemModels.BOW); + ResourceLocation pulling1 = createFlatItem(item, "_pulling_1", CustomItemModels.BOW); + ResourceLocation pulling2 = createFlatItem(item, "_pulling_2", CustomItemModels.BOW); + createFlatItem(item, CustomItemModels.BOW, bowOverrides(pulling0, pulling1, pulling2)); } - public final void registerCrossbow(ItemModelGenerator itemModelGenerator, Item item) { - ItemModel.Unbaked unbaked = ItemModels.basic(itemModelGenerator.upload(item, CustomItemModels.CROSSBOW)); - ItemModel.Unbaked unbaked2 = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_pulling_0", Models.CROSSBOW)); - ItemModel.Unbaked unbaked3 = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_pulling_1", Models.CROSSBOW)); - ItemModel.Unbaked unbaked4 = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_pulling_2", Models.CROSSBOW)); - ItemModel.Unbaked unbaked5 = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_arrow", Models.CROSSBOW)); - ItemModel.Unbaked unbaked6 = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_firework", Models.CROSSBOW)); - itemModelGenerator.output.accept(item, ItemModels.select(new ChargeTypeProperty(), ItemModels.condition(ItemModels.usingItemProperty(), ItemModels.rangeDispatch(new CrossbowPullProperty(), unbaked2, new RangeDispatchItemModel.Entry[]{ItemModels.rangeDispatchEntry(unbaked3, 0.58F), ItemModels.rangeDispatchEntry(unbaked4, 1.0F)}), unbaked), new SelectItemModel.SwitchCase[]{ItemModels.switchCase(CrossbowItem.ChargeType.ARROW, unbaked5), ItemModels.switchCase(CrossbowItem.ChargeType.ROCKET, unbaked6)})); + private List bowOverrides( + ResourceLocation pulling0, + ResourceLocation pulling1, + ResourceLocation pulling2 + ) { + return List.of( + override(pulling0, PULLING, 1.0F), + override(pulling1, PULLING, 1.0F, PULL, 0.65F), + override(pulling2, PULLING, 1.0F, PULL, 0.9F) + ); } - public final Identifier registerSubModelWithSingletonTexture(Item item, String suffix, Model model, BiConsumer modelCollector) { - return model.upload(ModelIds.getItemSubModelId(item, suffix), TextureMap.layer0(TextureMap.getId(item)), modelCollector); + private void registerCrossbow(Item item) { + ResourceLocation pulling0 = createFlatItem(item, "_pulling_0", CustomItemModels.CROSSBOW); + ResourceLocation pulling1 = createFlatItem(item, "_pulling_1", CustomItemModels.CROSSBOW); + ResourceLocation pulling2 = createFlatItem(item, "_pulling_2", CustomItemModels.CROSSBOW); + ResourceLocation arrow = createFlatItem(item, "_arrow", CustomItemModels.CROSSBOW); + ResourceLocation firework = createFlatModel( + ModelLocationUtils.getModelLocation(item, "_firework"), + TextureMapping.getItemTexture(item, "_arrow"), + CustomItemModels.CROSSBOW + ); + createFlatItem( + item, + CustomItemModels.CROSSBOW, + List.of( + override(pulling0, PULLING, 1.0F), + override(pulling1, PULLING, 1.0F, PULL, 0.58F), + override(pulling2, PULLING, 1.0F, PULL, 1.0F), + override(arrow, CHARGED, 1.0F), + override(firework, CHARGED, 1.0F, FIREWORK, 1.0F) + ) + ); } - //TODO might need a rework cause of new tint thingy - public final void registerDyeableArmor(Item armor, ItemModelGenerator itemModelGenerator) { - Identifier identifier = ModelIds.getItemModelId(armor); - Identifier identifier2 = TextureMap.getId(armor); - Identifier identifier3 = TextureMap.getSubId(armor, "_overlay"); - - Models.GENERATED_TWO_LAYERS.upload(identifier, TextureMap.layered(identifier2, identifier3), itemModelGenerator.modelCollector); - ItemModel.Unbaked unbaked2 = ItemModels.tinted(identifier, new DyeTintSource(-6265536)); - - itemModelGenerator.output.accept(armor, unbaked2); + private void registerDyeableArmor(Item item) { + ModelTemplates.TWO_LAYERED_ITEM.create( + ModelLocationUtils.getModelLocation(item), + TextureMapping.layered( + TextureMapping.getItemTexture(item), + TextureMapping.getItemTexture(item, "_overlay") + ), + modelOutput + ); } - public final void registerPalettedItem(Item item, ItemModelGenerator itemModelGenerator) { - Identifier identifierItem = Identifier.of(MiddleEarth.MOD_ID, "item/" + Registries.ITEM.getId(item).getPath()); - - Identifier identifier2 = TextureMap.getId(item); - - List>> list = new ArrayList<>(TRIM_MATERIALS.size()); - ItemModelGenerator.TrimMaterial trimMaterial; - ItemModel.Unbaked unbaked; + private void registerPalettedItem(Item item) { + ResourceLocation baseModel = ModelLocationUtils.getModelLocation(item); + generatedBaseModels.add(baseModel); + ResourceLocation baseTexture = TextureMapping.getItemTexture(item); + List overrides = new ArrayList<>(); + + for (TrimMaterialData material : TRIM_MATERIALS) { + ResourceLocation trimModel = baseModel.withSuffix("_" + material.name() + "_trim"); + ResourceLocation trimTexture = MiddleEarth.of( + "trims/items/" + BuiltInRegistries.ITEM.getKey(item).getPath() + + "_trim_" + material.name() + ); + ModelTemplates.TWO_LAYERED_ITEM.create( + trimModel, + TextureMapping.layered(baseTexture, trimTexture), + modelOutput + ); + overrides.add(override(trimModel, TRIM_TYPE, material.modelIndex())); + } - for (Iterator var9 = TRIM_MATERIALS.iterator(); var9.hasNext(); list.add(ItemModels.switchCase(trimMaterial.materialKey(), unbaked))) { - trimMaterial = var9.next(); - Identifier identifier4 = identifierItem.withSuffixedPath("_" + trimMaterial.assets().base().suffix() + "_trim"); + ResourceLocation hotModel = createFlatItem(item, "_hot", ModelTemplates.FLAT_ITEM); + overrides.add(override(hotModel, HOT, 1.0F)); + createFlatItem(item, ModelTemplates.FLAT_ITEM, overrides); + } - itemModelGenerator.uploadArmor(identifier4, identifier2, - Identifier.of(MiddleEarth.MOD_ID, "trims/" + identifierItem.getPath().replaceAll("item", "items") + "_trim" + "_" + trimMaterial.assets().base().suffix())); - unbaked = ItemModels.basic(identifier4); + private void registerHotIngotItem(Item item) { + String textureName = "ingot_hot"; + if (item == ResourceItemsME.BRONZE_INGOT) { + textureName = "medium_ingot_hot"; + } else if (item == ResourceItemsME.TIN_INGOT) { + textureName = "cube_ingot_hot"; + } else if (item == ResourceItemsME.LEAD_INGOT) { + textureName = "tall_small_ingot_hot"; + } else if (item == ResourceItemsME.EDHEL_STEEL_INGOT || item == ResourceItemsME.MITHRIL_INGOT) { + textureName = "small_ingot_hot"; + } else if (item == ResourceItemsME.KHAZAD_STEEL_INGOT) { + textureName = "tall_ingot_hot"; + } else if (item == ResourceItemsME.BURZUM_STEEL_INGOT) { + textureName = "thick_ingot_hot"; } - ItemModel.Unbaked unbaked2; - Models.GENERATED.upload(identifierItem, TextureMap.layer0(identifier2), itemModelGenerator.modelCollector); - unbaked2 = ItemModels.basic(identifierItem); - - ItemModel.Unbaked unbakedHotItem = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_hot", Models.GENERATED)); + ResourceLocation hotModel = createFlatModel( + ModelLocationUtils.getModelLocation(item, "_hot"), + MiddleEarth.ofPath("item", textureName), + ModelTemplates.FLAT_ITEM + ); + createFlatItem(item, ModelTemplates.FLAT_ITEM, List.of(override(hotModel, HOT, 1.0F))); + } - itemModelGenerator.output.accept(item, ItemModels.condition(new HotComponentProperty(), unbakedHotItem, ItemModels.select(new TrimMaterialProperty(), unbaked2, list))); + private void registerHotNuggetItem(Item item) { + ResourceLocation hotModel = createFlatModel( + ModelLocationUtils.getModelLocation(item, "_hot"), + MiddleEarth.ofPath("item", "nugget_hot"), + ModelTemplates.FLAT_ITEM + ); + createFlatItem(item, ModelTemplates.FLAT_ITEM, List.of(override(hotModel, HOT, 1.0F))); } - public final void registerHotIngotsItem(Item item, ItemModelGenerator itemModelGenerator) { - ItemModel.Unbaked unbakedItem = ItemModels.basic(itemModelGenerator.upload(item, Models.GENERATED)); - String idPath = "ingot_hot"; - if(item == ResourceItemsME.BRONZE_INGOT) { - idPath = "medium_ingot_hot"; - } else if(item == ResourceItemsME.TIN_INGOT) { - idPath = "cube_ingot_hot"; - } else if(item == ResourceItemsME.LEAD_INGOT) { - idPath = "tall_small_ingot_hot"; - } else if(item == ResourceItemsME.EDHEL_STEEL_INGOT || item == ResourceItemsME.MITHRIL_INGOT) { - idPath = "small_ingot_hot"; - } else if(item == ResourceItemsME.KHAZAD_STEEL_INGOT) { - idPath = "tall_ingot_hot"; - } else if(item == ResourceItemsME.BURZUM_STEEL_INGOT) { - idPath = "thick_ingot_hot"; - } + private void registerHotItem(Item item) { + ResourceLocation hotModel = createFlatItem(item, "_hot", ModelTemplates.FLAT_ITEM); + createFlatItem(item, ModelTemplates.FLAT_ITEM, List.of(override(hotModel, HOT, 1.0F))); + } - Identifier textureId = MiddleEarth.ofPath( "item", idPath); - ItemModel.Unbaked unbakedHotItem = ItemModels.basic(Models.GENERATED.upload(ModelIds.getItemSubModelId(item, "_hot"), - TextureMap.layer0(textureId), itemModelGenerator.modelCollector)); + private ResourceLocation createFlatItem(Item item, ModelTemplate template) { + return createFlatItem(item, template, List.of()); + } - itemModelGenerator.output.accept(item, ItemModels.condition(new HotComponentProperty(), unbakedHotItem, unbakedItem)); + private ResourceLocation createFlatItem(Item item, String suffix, ModelTemplate template) { + return createFlatModel( + ModelLocationUtils.getModelLocation(item, suffix), + TextureMapping.getItemTexture(item, suffix), + template + ); } - public final void registerHotNuggetItem(Item item, ItemModelGenerator itemModelGenerator) { - ItemModel.Unbaked unbakedItem = ItemModels.basic(itemModelGenerator.upload(item, Models.GENERATED)); - ItemModel.Unbaked unbakedHotItem = ItemModels.basic(Models.GENERATED.upload(ModelIds.getItemSubModelId(item, "_hot"), - TextureMap.layer0(MiddleEarth.ofPath( "item", "nugget_hot")), itemModelGenerator.modelCollector)); + private ResourceLocation createFlatItem( + Item item, + ModelTemplate template, + List overrides + ) { + ResourceLocation id = ModelLocationUtils.getModelLocation(item); + TextureMapping textures = TextureMapping.layer0(TextureMapping.getItemTexture(item)); + if (overrides.isEmpty()) { + return template.create(id, textures, modelOutput); + } + return template.create(id, textures, modelOutput, (modelId, textureMap) -> { + JsonObject json = template.createBaseTemplate(modelId, textureMap); + JsonArray overrideArray = new JsonArray(); + overrides.forEach(override -> overrideArray.add(override.toJson())); + json.add("overrides", overrideArray); + return json; + }); + } - itemModelGenerator.output.accept(item, ItemModels.condition(new HotComponentProperty(), unbakedHotItem, unbakedItem)); + private ResourceLocation createFlatModel( + ResourceLocation id, + ResourceLocation texture, + ModelTemplate template + ) { + return template.create(id, TextureMapping.layer0(texture), modelOutput); } - public final void registerHotItem(Item item, ItemModelGenerator itemModelGenerator) { - ItemModel.Unbaked unbakedItem = ItemModels.basic(itemModelGenerator.upload(item, Models.GENERATED)); - ItemModel.Unbaked unbakedHotItem = ItemModels.basic(itemModelGenerator.registerSubModel(item, "_hot", Models.GENERATED)); + private static ModelOverride override(ResourceLocation model, Object... predicatePairs) { + Map predicates = new LinkedHashMap<>(); + for (int i = 0; i < predicatePairs.length; i += 2) { + predicates.put((ResourceLocation) predicatePairs[i], (Float) predicatePairs[i + 1]); + } + return new ModelOverride(predicates, model); + } - itemModelGenerator.output.accept(item, ItemModels.condition(new HotComponentProperty(), unbakedHotItem, unbakedItem)); + private record TrimMaterialData(String name, float modelIndex) { } + private record ModelOverride(Map predicates, ResourceLocation model) { + private JsonObject toJson() { + JsonObject json = new JsonObject(); + JsonObject predicateJson = new JsonObject(); + predicates.forEach((id, value) -> predicateJson.addProperty(id.toString(), value)); + json.add("predicate", predicateJson); + json.addProperty("model", model.toString()); + return json; + } + } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/ArtisanTableArmorRecipeProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/ArtisanTableArmorRecipeProvider.java index 9abdee6074..cfe47a7e48 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/ArtisanTableArmorRecipeProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/ArtisanTableArmorRecipeProvider.java @@ -1,24 +1,24 @@ package net.sevenstars.middleearth.datageneration.providers.recipes; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.impl.recipe.ingredient.builtin.ComponentsIngredient; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.data.recipe.RecipeExporter; -import net.minecraft.data.recipe.RecipeGenerator; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.equipment.trim.ArmorTrim; -import net.minecraft.item.equipment.trim.ArmorTrimMaterial; -import net.minecraft.item.equipment.trim.ArmorTrimPattern; -import net.minecraft.recipe.Ingredient; -import net.minecraft.recipe.book.RecipeCategory; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.util.Identifier; +import net.neoforged.neoforge.common.crafting.DataComponentIngredient; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.PackOutput; +import net.minecraft.data.recipes.RecipeCategory; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.data.recipes.RecipeProvider; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.armortrim.ArmorTrim; +import net.minecraft.world.item.armortrim.TrimMaterial; +import net.minecraft.world.item.armortrim.TrimPattern; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.forge.MetalTypes; import net.sevenstars.middleearth.datageneration.content.tags.ArmorTags; @@ -38,201 +38,193 @@ public class ArtisanTableArmorRecipeProvider extends RecipeProvider { private static final int XP_STEEL_ITEM = 3; private static final int XP_NOBLE_ITEM = 5; - private final CompletableFuture registryLookup; + private final CompletableFuture registryLookup; - public ArtisanTableArmorRecipeProvider(FabricDataOutput output, CompletableFuture registriesFuture) { + public ArtisanTableArmorRecipeProvider(PackOutput output, CompletableFuture registriesFuture) { super(output, registriesFuture); this.registryLookup = registriesFuture; } - @Override - public String getName() { - return "ArtisanTableArmorRecipes"; - } - - public RegistryWrapper.Impl getArmorTrimMaterialsRegistry(){ - RegistryWrapper.Impl armorTrimMaterialsRegistry; + public HolderLookup.RegistryLookup getArmorTrimMaterialsRegistry(){ + HolderLookup.RegistryLookup armorTrimMaterialsRegistry; try { - armorTrimMaterialsRegistry = this.registryLookup.get().getOrThrow(RegistryKeys.TRIM_MATERIAL); + armorTrimMaterialsRegistry = this.registryLookup.get().lookupOrThrow(Registries.TRIM_MATERIAL); } catch (Exception ignored) { throw new IllegalStateException("Data generation without registries failed!"); } return armorTrimMaterialsRegistry; } - public RegistryWrapper.Impl getArmorTrimPatternsRegistry(){ - RegistryWrapper.Impl armorTrimPatternsRegistry; + public HolderLookup.RegistryLookup getArmorTrimPatternsRegistry(){ + HolderLookup.RegistryLookup armorTrimPatternsRegistry; try { - armorTrimPatternsRegistry = this.registryLookup.get().getOrThrow(RegistryKeys.TRIM_PATTERN); + armorTrimPatternsRegistry = this.registryLookup.get().lookupOrThrow(Registries.TRIM_PATTERN); } catch (Exception ignored) { throw new IllegalStateException("Data generation without registries failed!"); } return armorTrimPatternsRegistry; } - public RegistryEntry getPattern(){ + public Holder getPattern(){ return getArmorTrimPatternsRegistry().getOrThrow(SmithingTrimPatternsME.SMITHING_PART); } - public Identifier getMetalIdentifier(MetalTypes metal){ + public ResourceLocation getMetalIdentifier(MetalTypes metal){ if (metal.isVanilla()){ - return Identifier.of(metal.getName()); + return ResourceLocation.parse(metal.getName()); } else { - return Identifier.of(MiddleEarth.MOD_ID, metal.getName()); + return ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, metal.getName()); } } @Override - protected RecipeGenerator getRecipeGenerator(RegistryWrapper.WrapperLookup wrapperLookup, RecipeExporter recipeExporter) { + protected void buildRecipes(RecipeOutput output, HolderLookup.Provider registries) { ItemStack goldArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - goldArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.GOLD.getName()))), getPattern())); + goldArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.GOLD.getName()))), getPattern())); ItemStack silverArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - silverArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.SILVER.getName()))), getPattern())); + silverArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.SILVER.getName()))), getPattern())); ItemStack steelArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - steelArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); + steelArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); ItemStack steelHelmetPlate = new ItemStack(ResourceItemsME.HELMET_PLATE); - steelHelmetPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); + steelHelmetPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); ItemStack steelChainmail = new ItemStack(ResourceItemsME.MAIL); - steelChainmail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); + steelChainmail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); ItemStack steelScaleMail = new ItemStack(ResourceItemsME.SCALE_MAIL); - steelScaleMail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); + steelScaleMail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); ItemStack edhelSteelArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - edhelSteelArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); + edhelSteelArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); ItemStack edhelSteelHelmetPlate = new ItemStack(ResourceItemsME.HELMET_PLATE); - edhelSteelHelmetPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); + edhelSteelHelmetPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); ItemStack edhelSteelChainmail = new ItemStack(ResourceItemsME.MAIL); - edhelSteelChainmail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); + edhelSteelChainmail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); ItemStack edhelSteelScaleMail = new ItemStack(ResourceItemsME.SCALE_MAIL); - edhelSteelScaleMail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); + edhelSteelScaleMail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); ItemStack khazadSteelArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - khazadSteelArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); + khazadSteelArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); ItemStack khazadSteelHelmetPlate = new ItemStack(ResourceItemsME.HELMET_PLATE); - khazadSteelHelmetPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); + khazadSteelHelmetPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); ItemStack khazadSteelChainmail = new ItemStack(ResourceItemsME.MAIL); - khazadSteelChainmail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); + khazadSteelChainmail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); ItemStack khazadSteelScaleMail = new ItemStack(ResourceItemsME.SCALE_MAIL); - khazadSteelScaleMail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); + khazadSteelScaleMail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); ItemStack burzumSteelArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - burzumSteelArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); + burzumSteelArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); ItemStack burzumSteelHelmetPlate = new ItemStack(ResourceItemsME.HELMET_PLATE); - burzumSteelHelmetPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); + burzumSteelHelmetPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); ItemStack burzumSteelChainmail = new ItemStack(ResourceItemsME.MAIL); - burzumSteelChainmail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); + burzumSteelChainmail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); ItemStack burzumSteelScaleMail = new ItemStack(ResourceItemsME.SCALE_MAIL); - burzumSteelScaleMail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); + burzumSteelScaleMail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); ItemStack ironArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - ironArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.IRON.getName()))), getPattern())); + ironArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.IRON.getName()))), getPattern())); ItemStack ironHelmetPlate = new ItemStack(ResourceItemsME.HELMET_PLATE); - ironHelmetPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.IRON.getName()))), getPattern())); + ironHelmetPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.IRON.getName()))), getPattern())); ItemStack ironChainmail = new ItemStack(ResourceItemsME.MAIL); - ironChainmail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.IRON.getName()))), getPattern())); + ironChainmail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.IRON.getName()))), getPattern())); ItemStack bronzeArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - bronzeArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.BRONZE.getName()))), getPattern())); + bronzeArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.BRONZE.getName()))), getPattern())); ItemStack crudeArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - crudeArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.CRUDE.getName()))), getPattern())); + crudeArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.CRUDE.getName()))), getPattern())); - return new RecipeGenerator(wrapperLookup, recipeExporter) { - @Override - public void generate() { - RegistryWrapper.Impl itemLookup = registries.getOrThrow(RegistryKeys.ITEM); + HolderLookup.RegistryLookup itemLookup = registries.lookupOrThrow(Registries.ITEM); //region MEN //region GONDOR //T2 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_BOOTS.getDefaultStack(), "boots", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_BOOTS.getDefaultInstance(), "boots", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); //T3 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CABASSET_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_LEATHER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CABASSET_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_LEATHER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK), + has(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_LEATHER_CUIRASS.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_LEATHER_CUIRASS.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK), + has(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_TABBARD.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_TABBARD.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) @@ -241,214 +233,214 @@ public void generate() { .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK), + has(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_MAIL_COAT.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_MAIL_COAT.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); //T4 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_SOLDIER_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelHelmetPlate.getItem()), steelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(steelHelmetPlate.getItem()), - conditionsFromItem(steelHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_SOLDIER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_SOLDIER_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelHelmetPlate.getComponents(), steelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(steelHelmetPlate.getItem()), + has(steelHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_SOLDIER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK), + has(EquipmentItemsME.GONDORIAN_MAIL_HAUBERK)) + .save(output); //T5 PLATE - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) .input(EquipmentItemsME.GONDORIAN_SOLDIER_CHESTPLATE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GONDORIAN_SOLDIER_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.GONDORIAN_SOLDIER_CHESTPLATE)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_PLATE_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GONDORIAN_SOLDIER_CHESTPLATE), + has(EquipmentItemsME.GONDORIAN_SOLDIER_CHESTPLATE)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_PLATE_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) .input(EquipmentItemsME.GONDORIAN_MAIL_COAT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GONDORIAN_MAIL_COAT), - conditionsFromItem(EquipmentItemsME.GONDORIAN_MAIL_COAT)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GONDORIAN_MAIL_COAT), + has(EquipmentItemsME.GONDORIAN_MAIL_COAT)) + .save(output); //T5 CAPTAIN - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CAPTAIN_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CAPTAIN_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) .input(EquipmentItemsME.GONDORIAN_PLATE_HELMET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GONDORIAN_PLATE_HELMET), - conditionsFromItem(EquipmentItemsME.GONDORIAN_PLATE_HELMET)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GONDORIAN_PLATE_HELMET), + has(EquipmentItemsME.GONDORIAN_PLATE_HELMET)) + .save(output); //T5 KING'S GUARD - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_KINGS_GUARD_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T5) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_KINGS_GUARD_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T5) .input(Items.FEATHER) .input(EquipmentItemsME.GONDORIAN_PLATE_HELMET) .input(Items.FEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GONDORIAN_PLATE_HELMET), - conditionsFromItem(EquipmentItemsME.GONDORIAN_PLATE_HELMET)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GONDORIAN_PLATE_HELMET), + has(EquipmentItemsME.GONDORIAN_PLATE_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_KINGS_GUARD_CHESTKPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_KINGS_GUARD_CHESTKPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE), + has(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_KINGS_GUARD_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_KINGS_GUARD_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) .input(EquipmentItemsME.GONDORIAN_PLATE_LEGGINGS) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.GONDORIAN_PLATE_LEGGINGS), - conditionsFromItem(EquipmentItemsME.GONDORIAN_PLATE_LEGGINGS)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.GONDORIAN_PLATE_LEGGINGS), + has(EquipmentItemsME.GONDORIAN_PLATE_LEGGINGS)) + .save(output); //T5 CITADEL GUARD - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CITADEL_GUARD_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CITADEL_GUARD_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) .input(EquipmentItemsME.GONDORIAN_PLATE_HELMET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GONDORIAN_PLATE_HELMET), - conditionsFromItem(EquipmentItemsME.GONDORIAN_PLATE_HELMET)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GONDORIAN_PLATE_HELMET), + has(EquipmentItemsME.GONDORIAN_PLATE_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CITADEL_GUARD_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CITADEL_GUARD_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE), + has(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CITADEL_GUARD_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CITADEL_GUARD_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) .input(EquipmentItemsME.GONDORIAN_PLATE_LEGGINGS) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.GONDORIAN_PLATE_LEGGINGS), - conditionsFromItem(EquipmentItemsME.GONDORIAN_PLATE_LEGGINGS)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.GONDORIAN_PLATE_LEGGINGS), + has(EquipmentItemsME.GONDORIAN_PLATE_LEGGINGS)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CITADEL_GUARD_BOOTS.getDefaultStack(), "boots", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .criterion(hasItem(goldArmorPlate.getItem()), - conditionsFromItem(goldArmorPlate.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CITADEL_GUARD_BOOTS.getDefaultInstance(), "boots", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .unlockedBy(getHasName(goldArmorPlate.getItem()), + has(goldArmorPlate.getItem())) + .save(output); //T5 FOUNTAIN GUARD - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_FOUNTAIN_GUARD_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T5) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_FOUNTAIN_GUARD_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T5) .input(ResourceItemsME.MITHRIL_NUGGET) .input(EquipmentItemsME.GONDORIAN_CAPTAIN_HELMET) .input(ResourceItemsME.MITHRIL_NUGGET) .input(ResourceItemsME.SWAN_FEATHER) .input(ResourceItemsME.SWAN_FEATHER) - .criterion(hasItem(EquipmentItemsME.GONDORIAN_CAPTAIN_HELMET), - conditionsFromItem(EquipmentItemsME.GONDORIAN_CAPTAIN_HELMET)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.GONDORIAN_CAPTAIN_HELMET), + has(EquipmentItemsME.GONDORIAN_CAPTAIN_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_FOUNTAIN_GUARD_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_FOUNTAIN_GUARD_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE), + has(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_FOUNTAIN_GUARD_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_FOUNTAIN_GUARD_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.GONDORIAN_PLATE_LEGGINGS) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GONDORIAN_PLATE_LEGGINGS), - conditionsFromItem(EquipmentItemsME.GONDORIAN_PLATE_LEGGINGS)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GONDORIAN_PLATE_LEGGINGS), + has(EquipmentItemsME.GONDORIAN_PLATE_LEGGINGS)) + .save(output); //HOODS - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CITADEL_GUARD_HOOD.getDefaultStack(), "helmet_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CITADEL_GUARD_HOOD.getDefaultInstance(), "helmet_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(Items.BLACK_DYE) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); //CAPES - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CAPTAIN_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CAPTAIN_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(Items.IRON_NUGGET) .input(ResourceItemsME.FABRIC) @@ -458,11 +450,11 @@ public void generate() { .input(Items.WHITE_DYE) .input(ResourceItemsME.FABRIC) .input(Items.WHITE_DYE) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_HERO_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_HERO_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(Items.IRON_NUGGET) .input(ResourceItemsME.FABRIC) @@ -472,11 +464,11 @@ public void generate() { .input(Items.BLACK_DYE) .input(ResourceItemsME.FABRIC) .input(Items.BLACK_DYE) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_KINGS_GUARD_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_KINGS_GUARD_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(Items.GOLD_NUGGET) .input(ResourceItemsME.FABRIC) @@ -486,11 +478,11 @@ public void generate() { .input(Items.WHITE_DYE) .input(ResourceItemsME.FABRIC) .input(Items.WHITE_DYE) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CITADEL_GUARD_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_CITADEL_GUARD_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(Items.GOLD_NUGGET) .input(ResourceItemsME.FABRIC) @@ -500,11 +492,11 @@ public void generate() { .input(Items.YELLOW_DYE) .input(ResourceItemsME.FABRIC) .input(Items.YELLOW_DYE) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_FOUNTAIN_GUARD_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_FOUNTAIN_GUARD_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(Items.GOLD_NUGGET) .input(ResourceItemsME.FABRIC) @@ -514,14 +506,14 @@ public void generate() { .input(Items.BLACK_DYE) .input(ResourceItemsME.FABRIC) .input(Items.BLACK_DYE) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); //endregion //region ROHAN //T1 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_REINFORCED_COAT.getDefaultStack(), "chestplate", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_REINFORCED_COAT.getDefaultInstance(), "chestplate", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) @@ -530,42 +522,42 @@ public void generate() { .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.ARMING_COAT), - conditionsFromItem(EquipmentItemsME.ARMING_COAT)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.ARMING_COAT), + has(EquipmentItemsME.ARMING_COAT)) + .save(output); //T2 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_LEATHER_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_LEATHER_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_REINFORCED_LEATHER_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_REINFORCED_LEATHER_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.IRON_NUGGET) .input(Items.IRON_NUGGET) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_ORNAMENTED_LEATHER_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_ORNAMENTED_LEATHER_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(ResourceItemsME.BRONZE_NUGGET) .input(ResourceItemsME.BRONZE_NUGGET) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_LEATHER_VEST.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_LEATHER_VEST.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) @@ -574,11 +566,11 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.ARMING_COAT), - conditionsFromItem(EquipmentItemsME.ARMING_COAT)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.ARMING_COAT), + has(EquipmentItemsME.ARMING_COAT)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_LEATHER_SCALE_VEST.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_LEATHER_SCALE_VEST.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) @@ -587,11 +579,11 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.ARMING_COAT), - conditionsFromItem(EquipmentItemsME.ARMING_COAT)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.ARMING_COAT), + has(EquipmentItemsME.ARMING_COAT)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_GAMBESON.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_GAMBESON.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) @@ -600,52 +592,52 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.GAMBESON), - conditionsFromItem(EquipmentItemsME.GAMBESON)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.GAMBESON), + has(EquipmentItemsME.GAMBESON)) + .save(output); //T3 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_MILITIA_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_MILITIA_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T3) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .criterion(hasItem(bronzeArmorPlate.getItem()), - conditionsFromItem(bronzeArmorPlate.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .unlockedBy(getHasName(bronzeArmorPlate.getItem()), + has(bronzeArmorPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_BRACED_MILITIA_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_BRACED_MILITIA_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T3) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) - .criterion(hasItem(ironArmorPlate.getItem()), - conditionsFromItem(ironArmorPlate.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) + .unlockedBy(getHasName(ironArmorPlate.getItem()), + has(ironArmorPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_REINFORCED_MILITIA_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_REINFORCED_MILITIA_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T3) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .criterion(hasItem(bronzeArmorPlate.getItem()), - conditionsFromItem(bronzeArmorPlate.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .unlockedBy(getHasName(bronzeArmorPlate.getItem()), + has(bronzeArmorPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_ORNAMENTED_MILITIA_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_ORNAMENTED_MILITIA_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T3) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) - .criterion(hasItem(bronzeArmorPlate.getItem()), - conditionsFromItem(bronzeArmorPlate.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) + .unlockedBy(getHasName(bronzeArmorPlate.getItem()), + has(bronzeArmorPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_REINFORCED_LEATHER_VEST.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_REINFORCED_LEATHER_VEST.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) .input(Items.LEATHER) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) @@ -654,11 +646,11 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.MAIL_HAUBERK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.MAIL_HAUBERK), + has(EquipmentItemsME.MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_REINFORCED_LEATHER_SCALE_VEST.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_REINFORCED_LEATHER_SCALE_VEST.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) .input(Items.LEATHER) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) @@ -667,11 +659,11 @@ public void generate() { .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.MAIL_HAUBERK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.MAIL_HAUBERK), + has(EquipmentItemsME.MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_BRACED_MAIL_SHIRT.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_BRACED_MAIL_SHIRT.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) .input(Items.LEATHER) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) @@ -680,132 +672,132 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.MAIL_HAUBERK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.MAIL_HAUBERK), + has(EquipmentItemsME.MAIL_HAUBERK)) + .save(output); ///T4 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_SOLDIER_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelHelmetPlate.getItem()), steelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(steelHelmetPlate.getItem()), - conditionsFromItem(steelHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_ORNAMENTED_SOLDIER_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelHelmetPlate.getItem()), steelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) - .criterion(hasItem(steelHelmetPlate.getItem()), - conditionsFromItem(steelHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_ROYAL_GUARD_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelHelmetPlate.getItem()), steelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) - .criterion(hasItem(steelHelmetPlate.getItem()), - conditionsFromItem(steelHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_SCALE_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .input(Items.LEATHER) - .input(ResourceItemsME.FABRIC) - .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.MAIL_HAUBERK)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_ORNAMENTED_SCALE_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_SOLDIER_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelHelmetPlate.getComponents(), steelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(steelHelmetPlate.getItem()), + has(steelHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_ORNAMENTED_SOLDIER_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelHelmetPlate.getComponents(), steelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) + .unlockedBy(getHasName(steelHelmetPlate.getItem()), + has(steelHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_ROYAL_GUARD_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelHelmetPlate.getComponents(), steelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) + .unlockedBy(getHasName(steelHelmetPlate.getItem()), + has(steelHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_SCALE_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .input(Items.LEATHER) + .input(ResourceItemsME.FABRIC) + .input(Items.LEATHER) + .unlockedBy(getHasName(EquipmentItemsME.MAIL_HAUBERK), + has(EquipmentItemsME.MAIL_HAUBERK)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_ORNAMENTED_SCALE_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.ROHIRRIC_SCALE_HAUBERK) .input(ResourceItemsME.FABRIC) .input(Items.GREEN_DYE) .input(ResourceItemsME.FABRIC) .input(Items.GREEN_DYE) - .criterion(hasItem(EquipmentItemsME.MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.MAIL_HAUBERK)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_SCALE_JACKET.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.MAIL_HAUBERK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.MAIL_HAUBERK), + has(EquipmentItemsME.MAIL_HAUBERK)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_SCALE_JACKET.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.MAIL_HAUBERK), + has(EquipmentItemsME.MAIL_HAUBERK)) + .save(output); //T5 EORLING MARSHAL - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EORLING_MARSHAL_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EORLING_MARSHAL_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) .input(EquipmentItemsME.ROHIRRIC_SCALE_HAUBERK) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ROHIRRIC_SCALE_HAUBERK), - conditionsFromItem(EquipmentItemsME.ROHIRRIC_SCALE_HAUBERK)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EORLING_MARSHAL_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ROHIRRIC_SCALE_HAUBERK), + has(EquipmentItemsME.ROHIRRIC_SCALE_HAUBERK)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EORLING_MARSHAL_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) .input(EquipmentItemsME.ROHIRRIC_SCALE_JACKET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ROHIRRIC_SCALE_JACKET), - conditionsFromItem(EquipmentItemsME.ROHIRRIC_SCALE_JACKET)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ROHIRRIC_SCALE_JACKET), + has(EquipmentItemsME.ROHIRRIC_SCALE_JACKET)) + .save(output); //T5 HORSE LORD - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.HORSE_LORD_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.HORSE_LORD_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) .input(EquipmentItemsME.ROHIRRIC_SCALE_HAUBERK) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ROHIRRIC_SCALE_HAUBERK), - conditionsFromItem(EquipmentItemsME.ROHIRRIC_SCALE_HAUBERK)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.HORSE_LORD_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ROHIRRIC_SCALE_HAUBERK), + has(EquipmentItemsME.ROHIRRIC_SCALE_HAUBERK)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.HORSE_LORD_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) .input(EquipmentItemsME.ROHIRRIC_SCALE_JACKET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ROHIRRIC_SCALE_JACKET), - conditionsFromItem(EquipmentItemsME.ROHIRRIC_SCALE_JACKET)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ROHIRRIC_SCALE_JACKET), + has(EquipmentItemsME.ROHIRRIC_SCALE_JACKET)) + .save(output); //CAPES - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.BRONZE_NUGGET) .input(ResourceItemsME.FABRIC) @@ -815,11 +807,11 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_ROYAL_GUARD_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_ROYAL_GUARD_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.BRONZE_NUGGET) .input(ResourceItemsME.FABRIC) @@ -829,11 +821,11 @@ public void generate() { .input(Items.GREEN_DYE) .input(ResourceItemsME.FABRIC) .input(Items.GREEN_DYE) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EORLING_MARSHAL_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EORLING_MARSHAL_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.STEEL_NUGGET) .input(ResourceItemsME.FABRIC) @@ -843,11 +835,11 @@ public void generate() { .input(Items.YELLOW_DYE) .input(ResourceItemsME.FABRIC) .input(Items.WHITE_DYE) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.HORSE_LORD_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.HORSE_LORD_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.BRONZE_NUGGET) .input(ResourceItemsME.FABRIC) @@ -857,15 +849,15 @@ public void generate() { .input(Items.RED_DYE) .input(ResourceItemsME.FABRIC) .input(Items.RED_DYE) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); //endregion //region DALE //T1 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_ARMING_COAT_BLACK_FUR.getDefaultStack(), "chestplate", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_ARMING_COAT_BLACK_FUR.getDefaultInstance(), "chestplate", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) @@ -874,11 +866,11 @@ public void generate() { .input(ResourceItemsME.FUR) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FUR) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_ARMING_COAT_BROWN_FUR.getDefaultStack(), "chestplate", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_ARMING_COAT_BROWN_FUR.getDefaultInstance(), "chestplate", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) @@ -887,11 +879,11 @@ public void generate() { .input(ResourceItemsME.FUR) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FUR) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_ARMING_COAT_TAN_FUR.getDefaultStack(), "chestplate", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_ARMING_COAT_TAN_FUR.getDefaultInstance(), "chestplate", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) @@ -900,11 +892,11 @@ public void generate() { .input(ResourceItemsME.FUR) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FUR) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HEYDAY_ARMING_COAT.getDefaultStack(), "chestplate", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HEYDAY_ARMING_COAT.getDefaultInstance(), "chestplate", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) @@ -913,62 +905,62 @@ public void generate() { .input(Items.ORANGE_DYE) .input(ResourceItemsME.FABRIC) .input(Items.ORANGE_DYE) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); //T2 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_BOOTS.getDefaultStack(), "boots", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_BOOTS.getDefaultInstance(), "boots", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); //T3 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HELMET_BLACK_FUR.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HELMET_BLACK_FUR.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T3) .input(ResourceItemsME.FUR) .input(EquipmentItemsME.DALISH_HELMET) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) - .criterion(hasItem(EquipmentItemsME.DALISH_HELMET), - conditionsFromItem(EquipmentItemsME.DALISH_HELMET)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.DALISH_HELMET), + has(EquipmentItemsME.DALISH_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HELMET_BROWN_FUR.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HELMET_BROWN_FUR.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T3) .input(ResourceItemsME.FUR) .input(EquipmentItemsME.DALISH_HELMET) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) - .criterion(hasItem(EquipmentItemsME.DALISH_HELMET), - conditionsFromItem(EquipmentItemsME.DALISH_HELMET)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.DALISH_HELMET), + has(EquipmentItemsME.DALISH_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HELMET_TAN_FUR.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HELMET_TAN_FUR.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T3) .input(ResourceItemsME.FUR) .input(EquipmentItemsME.DALISH_HELMET) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) - .criterion(hasItem(EquipmentItemsME.DALISH_HELMET), - conditionsFromItem(EquipmentItemsME.DALISH_HELMET)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.DALISH_HELMET), + has(EquipmentItemsME.DALISH_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) .input(Items.LEATHER) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) @@ -977,58 +969,58 @@ public void generate() { .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.MAIL_HAUBERK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.MAIL_HAUBERK), + has(EquipmentItemsME.MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_MAIL_COAT.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_MAIL_COAT.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) .input(EquipmentItemsME.MAIL_SKIRT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.MAIL_HAUBERK)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.MAIL_HAUBERK), + has(EquipmentItemsME.MAIL_HAUBERK)) + .save(output); //T4 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_BURGONET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelHelmetPlate.getItem()), steelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(steelHelmetPlate.getItem()), - conditionsFromItem(steelHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_SCALE_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_BURGONET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelHelmetPlate.getComponents(), steelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(steelHelmetPlate.getItem()), + has(steelHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_SCALE_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); //T4 HEYDAY - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HEYDAY_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HEYDAY_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) .input(EquipmentItemsME.DALISH_HELMET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) - .criterion(hasItem(EquipmentItemsME.DALISH_HELMET), - conditionsFromItem(EquipmentItemsME.DALISH_HELMET)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.DALISH_HELMET), + has(EquipmentItemsME.DALISH_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HEYDAY_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T4) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HEYDAY_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T4) .input(Items.LEATHER) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) @@ -1037,83 +1029,83 @@ public void generate() { .input(Items.ORANGE_DYE) .input(ResourceItemsME.FABRIC) .input(Items.ORANGE_DYE) - .criterion(hasItem(EquipmentItemsME.DALISH_SCALE_HAUBERK), - conditionsFromItem(EquipmentItemsME.DALISH_SCALE_HAUBERK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.DALISH_SCALE_HAUBERK), + has(EquipmentItemsME.DALISH_SCALE_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HEYDAY_MAIL_COAT.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T4) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HEYDAY_MAIL_COAT.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T4) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.DALISH_MAIL_COAT) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.DALISH_MAIL_COAT), - conditionsFromItem(EquipmentItemsME.DALISH_MAIL_COAT)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.DALISH_MAIL_COAT), + has(EquipmentItemsME.DALISH_MAIL_COAT)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HEYDAY_BOOTS.getDefaultStack(), "boots", DispositionType.GOOD, XP_T4) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HEYDAY_BOOTS.getDefaultInstance(), "boots", DispositionType.GOOD, XP_T4) .input(Items.LEATHER) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .criterion(hasItem(steelArmorPlate.getItem()), - conditionsFromItem(steelArmorPlate.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .unlockedBy(getHasName(steelArmorPlate.getItem()), + has(steelArmorPlate.getItem())) + .save(output); //T5 BARDING - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BARDING_SOLDIER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BARDING_SOLDIER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) .input(EquipmentItemsME.DALISH_SCALE_HAUBERK) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.DALISH_SCALE_HAUBERK), - conditionsFromItem(EquipmentItemsME.DALISH_SCALE_HAUBERK)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BARDING_MAIL_SKIRT.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.DALISH_SCALE_HAUBERK), + has(EquipmentItemsME.DALISH_SCALE_HAUBERK)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BARDING_MAIL_SKIRT.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) .input(EquipmentItemsME.DALISH_MAIL_COAT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.DALISH_MAIL_COAT), - conditionsFromItem(EquipmentItemsME.DALISH_MAIL_COAT)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.DALISH_MAIL_COAT), + has(EquipmentItemsME.DALISH_MAIL_COAT)) + .save(output); //T5 BARDING SERGEANT - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BARDING_SERGEANT_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T5) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BARDING_SERGEANT_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T5) .input(Items.FEATHER) .input(EquipmentItemsME.BARDING_SOLDIER_HELMET) .input(Items.FEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.BARDING_SOLDIER_HELMET), - conditionsFromItem(EquipmentItemsME.BARDING_SOLDIER_HELMET)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.BARDING_SOLDIER_HELMET), + has(EquipmentItemsME.BARDING_SOLDIER_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BARDING_SERGEANT_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BARDING_SERGEANT_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.BARDING_SOLDIER_CHESTPLATE) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.BARDING_SERGEANT_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.BARDING_SERGEANT_CHESTPLATE)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.BARDING_SERGEANT_CHESTPLATE), + has(EquipmentItemsME.BARDING_SERGEANT_CHESTPLATE)) + .save(output); //CAPES - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BARDING_SURCOAT.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BARDING_SURCOAT.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(Items.STRING) .input(ResourceItemsME.FABRIC) @@ -1123,11 +1115,11 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(Items.PURPLE_DYE) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BARDING_SERGEANT_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BARDING_SERGEANT_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(Items.STRING) .input(ResourceItemsME.FABRIC) @@ -1137,11 +1129,11 @@ public void generate() { .input(Items.PURPLE_DYE) .input(ResourceItemsME.FABRIC) .input(Items.PURPLE_DYE) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HEYDAY_CLOAK.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HEYDAY_CLOAK.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.BRONZE_NUGGET) .input(Items.STRING) .input(ResourceItemsME.BRONZE_NUGGET) @@ -1151,9 +1143,9 @@ public void generate() { .input(Items.RED_DYE) .input(ResourceItemsME.FABRIC) .input(Items.RED_DYE) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); //endregion //endregion @@ -1162,26 +1154,26 @@ public void generate() { //region LOTHLORIEN //T1 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_DIADEM.getDefaultStack(), "helmet", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_DIADEM.getDefaultInstance(), "helmet", DispositionType.GOOD) .input(ResourceItemsME.BRONZE_NUGGET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) .input(ResourceItemsME.BRONZE_NUGGET) - .criterion(hasItem(bronzeArmorPlate.getItem()), - conditionsFromItem(bronzeArmorPlate.getItem())) - .offerTo(exporter); + .unlockedBy(getHasName(bronzeArmorPlate.getItem()), + has(bronzeArmorPlate.getItem())) + .save(output); //T2 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_LEATHER_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_LEATHER_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_ARMING_COAT.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_ARMING_COAT.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) @@ -1190,11 +1182,11 @@ public void generate() { .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.ELVEN_ARMING_COAT), - conditionsFromItem(EquipmentItemsME.ELVEN_ARMING_COAT)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.ELVEN_ARMING_COAT), + has(EquipmentItemsME.ELVEN_ARMING_COAT)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_ARMING_SKIRT.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_ARMING_SKIRT.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(EquipmentItemsME.ELVEN_ARMING_SKIRT) .input(Items.LEATHER) @@ -1202,45 +1194,45 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.ELVEN_ARMING_SKIRT), - conditionsFromItem(EquipmentItemsME.ELVEN_ARMING_SKIRT)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.ELVEN_ARMING_SKIRT), + has(EquipmentItemsME.ELVEN_ARMING_SKIRT)) + .save(output); //T3 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_MAIL_COIF_DIADEM.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_MAIL_COIF_DIADEM.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T3) .input(EquipmentItemsME.ELVEN_MAIL_COIF) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) .input(EquipmentItemsME.LORIEN_DIADEM) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ELVEN_MAIL_COIF), - conditionsFromItem(EquipmentItemsME.ELVEN_MAIL_COIF)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ELVEN_MAIL_COIF), + has(EquipmentItemsME.ELVEN_MAIL_COIF)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_SHORT_MAIL_COIF_DIADEM.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_SHORT_MAIL_COIF_DIADEM.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T3) .input(EquipmentItemsME.ELVEN_MAIL_COIF) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) .input(EquipmentItemsME.LORIEN_DIADEM) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ELVEN_MAIL_COIF), - conditionsFromItem(EquipmentItemsME.ELVEN_MAIL_COIF)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ELVEN_MAIL_COIF), + has(EquipmentItemsME.ELVEN_MAIL_COIF)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(EquipmentItemsME.ELVEN_MAIL_HAUBERK) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ELVEN_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.ELVEN_MAIL_HAUBERK)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ELVEN_MAIL_HAUBERK), + has(EquipmentItemsME.ELVEN_MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_MARCHWARDEN_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_MARCHWARDEN_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) @@ -1249,159 +1241,159 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.ELVEN_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.ELVEN_MAIL_HAUBERK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.ELVEN_MAIL_HAUBERK), + has(EquipmentItemsME.ELVEN_MAIL_HAUBERK)) + .save(output); //T4 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_SOLDIER_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelHelmetPlate.getItem()), edhelSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(edhelSteelHelmetPlate.getItem()), - conditionsFromItem(edhelSteelHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_SOLDIER_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_SOLDIER_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelHelmetPlate.getComponents(), edhelSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(edhelSteelHelmetPlate.getItem()), + has(edhelSteelHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_SOLDIER_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.LORIEN_MAIL_HAUBERK) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.LORIEN_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.LORIEN_MAIL_HAUBERK)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.LORIEN_MAIL_HAUBERK), + has(EquipmentItemsME.LORIEN_MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_SOLDIER_SCALE_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T4) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_SOLDIER_SCALE_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T4) .input(Items.LEATHER) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .criterion(hasItem(edhelSteelScaleMail.getItem()), - conditionsFromItem(edhelSteelScaleMail.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .unlockedBy(getHasName(edhelSteelScaleMail.getItem()), + has(edhelSteelScaleMail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_SCALE_COAT.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_SCALE_COAT.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .criterion(hasItem(edhelSteelScaleMail.getItem()), - conditionsFromItem(edhelSteelScaleMail.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .unlockedBy(getHasName(edhelSteelScaleMail.getItem()), + has(edhelSteelScaleMail.getItem())) + .save(output); //T5 GALADHRIM - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GALADHRIM_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GALADHRIM_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) .input(EquipmentItemsME.LORIEN_SOLDIER_SCALE_HAUBERK) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.LORIEN_SOLDIER_SCALE_HAUBERK), - conditionsFromItem(EquipmentItemsME.LORIEN_SOLDIER_SCALE_HAUBERK)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GALADHRIM_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.LORIEN_SOLDIER_SCALE_HAUBERK), + has(EquipmentItemsME.LORIEN_SOLDIER_SCALE_HAUBERK)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GALADHRIM_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) .input(EquipmentItemsME.LORIEN_SCALE_COAT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.LORIEN_SCALE_COAT), - conditionsFromItem(EquipmentItemsME.LORIEN_SCALE_COAT)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.LORIEN_SCALE_COAT), + has(EquipmentItemsME.LORIEN_SCALE_COAT)) + .save(output); //T5 EGLADIL & GALADHRIM LORD - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EGLADIL_SENTINEL_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(silverArmorPlate.getItem()), silverArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(silverArmorPlate.getItem()), silverArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EGLADIL_SENTINEL_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, silverArmorPlate.getComponents(), silverArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, silverArmorPlate.getComponents(), silverArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.GALADHRIM_CHESTPLATE) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) .input(ResourceItemsME.SILVER_INGOT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GALADHRIM_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.GALADHRIM_CHESTPLATE)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EGLADIL_SENTINEL_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GALADHRIM_CHESTPLATE), + has(EquipmentItemsME.GALADHRIM_CHESTPLATE)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EGLADIL_SENTINEL_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.GALADHRIM_LEGGINGS) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GALADHRIM_LEGGINGS), - conditionsFromItem(EquipmentItemsME.GALADHRIM_LEGGINGS)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GALADHRIM_LEGGINGS), + has(EquipmentItemsME.GALADHRIM_LEGGINGS)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GALADHRIM_LORD_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GALADHRIM_LORD_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.GALADHRIM_CHESTPLATE) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GALADHRIM_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.GALADHRIM_CHESTPLATE)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GALADHRIM_LORD_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GALADHRIM_CHESTPLATE), + has(EquipmentItemsME.GALADHRIM_CHESTPLATE)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GALADHRIM_LORD_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.GALADHRIM_LEGGINGS) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GALADHRIM_LEGGINGS), - conditionsFromItem(EquipmentItemsME.GALADHRIM_LEGGINGS)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GALADHRIM_LEGGINGS), + has(EquipmentItemsME.GALADHRIM_LEGGINGS)) + .save(output); //HOODS - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_MARCHWARDEN_HOOD.getDefaultStack(), "helmet_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_MARCHWARDEN_HOOD.getDefaultInstance(), "helmet_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(Items.GRAY_DYE) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GALADHRIM_HOOD.getDefaultStack(), "helmet_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GALADHRIM_HOOD.getDefaultInstance(), "helmet_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(Items.BLUE_DYE) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); //CAPES - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_MARCHWARDEN_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_MARCHWARDEN_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.BRONZE_NUGGET) .input(ResourceItemsME.FABRIC) @@ -1411,11 +1403,11 @@ public void generate() { .input(Items.GRAY_DYE) .input(ResourceItemsME.FABRIC) .input(Items.GRAY_DYE) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GALADHRIM_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GALADHRIM_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(Items.STRING) .input(ResourceItemsME.FABRIC) .input(Items.STRING) @@ -1425,10 +1417,10 @@ public void generate() { .input(Items.BLUE_DYE) .input(ResourceItemsME.FABRIC) .input(Items.BLUE_DYE) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EGLADIL_SENTINEL_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EGLADIL_SENTINEL_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(Items.STRING) .input(Items.GOLD_NUGGET) .input(Items.STRING) @@ -1438,11 +1430,11 @@ public void generate() { .input(Items.BLUE_DYE) .input(ResourceItemsME.FABRIC) .input(Items.BLUE_DYE) - .criterion(hasItem(Items.GOLD_NUGGET), - conditionsFromItem(Items.GOLD_NUGGET)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.GOLD_NUGGET), + has(Items.GOLD_NUGGET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GALADHRIM_LORD_SURCOAT.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GALADHRIM_LORD_SURCOAT.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(Items.WHITE_DYE) .input(ResourceItemsME.FABRIC) @@ -1452,11 +1444,11 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GALADHRIM_LORD_CLOAK.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GALADHRIM_LORD_CLOAK.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.SILVER_NUGGET) .input(Items.STRING) .input(ResourceItemsME.SILVER_NUGGET) @@ -1466,13 +1458,13 @@ public void generate() { .input(Items.RED_DYE) .input(ResourceItemsME.FABRIC) .input(Items.RED_DYE) - .criterion(hasItem(ResourceItemsME.SILVER_NUGGET), - conditionsFromItem(ResourceItemsME.SILVER_NUGGET)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.SILVER_NUGGET), + has(ResourceItemsME.SILVER_NUGGET)) + .save(output); //endregion //region WOODLAND REALM - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_ARMING_COAT.getDefaultStack(), "chestplate", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_ARMING_COAT.getDefaultInstance(), "chestplate", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) @@ -1481,10 +1473,10 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_LEATHER_ARMING_COAT.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T2) + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_LEATHER_ARMING_COAT.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) @@ -1493,10 +1485,10 @@ public void generate() { .input(Items.STRING) .input(Items.LEATHER) .input(Items.STRING) - .criterion(hasItem(EquipmentItemsME.WOODLAND_REALM_ARMING_COAT), - conditionsFromItem(EquipmentItemsME.WOODLAND_REALM_ARMING_COAT)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_LEATHER_BRONZED_ARMING_COAT.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T2) + .unlockedBy(getHasName(EquipmentItemsME.WOODLAND_REALM_ARMING_COAT), + has(EquipmentItemsME.WOODLAND_REALM_ARMING_COAT)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_LEATHER_BRONZED_ARMING_COAT.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T2) .input(ResourceItemsME.BRONZE_NUGGET) .input(ResourceItemsME.BRONZE_NUGGET) .input(Items.LEATHER) @@ -1505,10 +1497,10 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.WOODLAND_REALM_ARMING_COAT), - conditionsFromItem(EquipmentItemsME.WOODLAND_REALM_ARMING_COAT)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_LEATHER_SILVER_ARMING_COAT.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T2) + .unlockedBy(getHasName(EquipmentItemsME.WOODLAND_REALM_ARMING_COAT), + has(EquipmentItemsME.WOODLAND_REALM_ARMING_COAT)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_LEATHER_SILVER_ARMING_COAT.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T2) .input(ResourceItemsME.SILVER_NUGGET) .input(ResourceItemsME.SILVER_NUGGET) .input(Items.LEATHER) @@ -1517,193 +1509,193 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.WOODLAND_REALM_ARMING_COAT), - conditionsFromItem(EquipmentItemsME.WOODLAND_REALM_ARMING_COAT)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.WOODLAND_REALM_ARMING_COAT), + has(EquipmentItemsME.WOODLAND_REALM_ARMING_COAT)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_BRONZE_TRIMMED_RANGER_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_BRONZE_TRIMMED_RANGER_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(ResourceItemsME.BRONZE_NUGGET) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.BRONZE_NUGGET), - conditionsFromItem(ResourceItemsME.BRONZE_NUGGET)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_SILVER_TRIMMED_RANGER_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T2) + .unlockedBy(getHasName(ResourceItemsME.BRONZE_NUGGET), + has(ResourceItemsME.BRONZE_NUGGET)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_SILVER_TRIMMED_RANGER_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(ResourceItemsME.SILVER_NUGGET) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.SILVER_NUGGET), - conditionsFromItem(ResourceItemsME.SILVER_NUGGET)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.SILVER_NUGGET), + has(ResourceItemsME.SILVER_NUGGET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_CAVALRY_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelHelmetPlate.getItem()), edhelSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(edhelSteelHelmetPlate.getItem()), - conditionsFromItem(edhelSteelHelmetPlate.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_GILDED_SCALE_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_CAVALRY_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelHelmetPlate.getComponents(), edhelSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(edhelSteelHelmetPlate.getItem()), + has(edhelSteelHelmetPlate.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_GILDED_SCALE_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.BRONZED_ELVEN_MAIL_HAUBERK) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.LORIEN_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.LORIEN_MAIL_HAUBERK)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_GILDED_SCALE_SKIRT.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .input(ResourceItemsME.FABRIC) - .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .criterion(hasItem(edhelSteelScaleMail.getItem()), - conditionsFromItem(edhelSteelScaleMail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_ROYAL_GUARD_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelHelmetPlate.getItem()), edhelSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(edhelSteelHelmetPlate.getItem()), - conditionsFromItem(edhelSteelHelmetPlate.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_SCALE_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .input(ResourceItemsME.FABRIC) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.LORIEN_MAIL_HAUBERK), + has(EquipmentItemsME.LORIEN_MAIL_HAUBERK)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_GILDED_SCALE_SKIRT.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .input(ResourceItemsME.FABRIC) + .input(ResourceItemsME.FABRIC) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .unlockedBy(getHasName(edhelSteelScaleMail.getItem()), + has(edhelSteelScaleMail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_ROYAL_GUARD_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelHelmetPlate.getComponents(), edhelSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(edhelSteelHelmetPlate.getItem()), + has(edhelSteelHelmetPlate.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_SCALE_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.BRONZED_ELVEN_MAIL_HAUBERK) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.LORIEN_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.LORIEN_MAIL_HAUBERK)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_SCALE_SKIRT.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.LORIEN_MAIL_HAUBERK), + has(EquipmentItemsME.LORIEN_MAIL_HAUBERK)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_SCALE_SKIRT.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .criterion(hasItem(edhelSteelScaleMail.getItem()), - conditionsFromItem(edhelSteelScaleMail.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .unlockedBy(getHasName(edhelSteelScaleMail.getItem()), + has(edhelSteelScaleMail.getItem())) + .save(output); //T5 WLR - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_SOLDIER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_SOLDIER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) .input(EquipmentItemsME.WOODLAND_REALM_SCALE_HAUBERK) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.WOODLAND_REALM_SCALE_HAUBERK), - conditionsFromItem(EquipmentItemsME.WOODLAND_REALM_SCALE_HAUBERK)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_SOLDIER_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.WOODLAND_REALM_SCALE_HAUBERK), + has(EquipmentItemsME.WOODLAND_REALM_SCALE_HAUBERK)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_SOLDIER_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) .input(EquipmentItemsME.WOODLAND_REALM_SCALE_SKIRT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.WOODLAND_REALM_SCALE_SKIRT), - conditionsFromItem(EquipmentItemsME.WOODLAND_REALM_SCALE_SKIRT)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARDEN_OF_THE_GLADE_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.WOODLAND_REALM_SCALE_SKIRT), + has(EquipmentItemsME.WOODLAND_REALM_SCALE_SKIRT)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARDEN_OF_THE_GLADE_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) .input(EquipmentItemsME.WOODLAND_REALM_GILDED_SCALE_HAUBERK) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.WOODLAND_REALM_GILDED_SCALE_HAUBERK), - conditionsFromItem(EquipmentItemsME.WOODLAND_REALM_GILDED_SCALE_HAUBERK)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARDEN_OF_THE_GLADE_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.WOODLAND_REALM_GILDED_SCALE_HAUBERK), + has(EquipmentItemsME.WOODLAND_REALM_GILDED_SCALE_HAUBERK)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARDEN_OF_THE_GLADE_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) .input(EquipmentItemsME.WOODLAND_REALM_GILDED_SCALE_SKIRT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.WOODLAND_REALM_GILDED_SCALE_SKIRT), - conditionsFromItem(EquipmentItemsME.WOODLAND_REALM_GILDED_SCALE_SKIRT)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARRIOR_OF_THE_NIGHTSHADE_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.WOODLAND_REALM_GILDED_SCALE_SKIRT), + has(EquipmentItemsME.WOODLAND_REALM_GILDED_SCALE_SKIRT)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARRIOR_OF_THE_NIGHTSHADE_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) .input(EquipmentItemsME.WOODLAND_REALM_SCALE_HAUBERK) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.WOODLAND_REALM_SCALE_HAUBERK), - conditionsFromItem(EquipmentItemsME.WOODLAND_REALM_SCALE_HAUBERK)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARRIOR_OF_THE_NIGHTSHADE_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.WOODLAND_REALM_SCALE_HAUBERK), + has(EquipmentItemsME.WOODLAND_REALM_SCALE_HAUBERK)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARRIOR_OF_THE_NIGHTSHADE_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) .input(EquipmentItemsME.WOODLAND_REALM_SCALE_SKIRT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelScaleMail.getItem()), edhelSteelScaleMail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.WOODLAND_REALM_SCALE_SKIRT), - conditionsFromItem(EquipmentItemsME.WOODLAND_REALM_SCALE_SKIRT)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_COMMANDER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelScaleMail.getComponents(), edhelSteelScaleMail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.WOODLAND_REALM_SCALE_SKIRT), + has(EquipmentItemsME.WOODLAND_REALM_SCALE_SKIRT)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_COMMANDER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.WOODLAND_REALM_SOLDIER_CHESTPLATE) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(silverArmorPlate.getItem()), silverArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.WOODLAND_REALM_SOLDIER_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.WOODLAND_REALM_SOLDIER_CHESTPLATE)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_COMMANDER_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, silverArmorPlate.getComponents(), silverArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.WOODLAND_REALM_SOLDIER_CHESTPLATE), + has(EquipmentItemsME.WOODLAND_REALM_SOLDIER_CHESTPLATE)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_COMMANDER_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.WOODLAND_REALM_SOLDIER_LEGGINGS) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.SILVER_INGOT) .input(ResourceItemsME.SILVER_INGOT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.WOODLAND_REALM_SOLDIER_LEGGINGS), - conditionsFromItem(EquipmentItemsME.WOODLAND_REALM_SOLDIER_LEGGINGS)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.WOODLAND_REALM_SOLDIER_LEGGINGS), + has(EquipmentItemsME.WOODLAND_REALM_SOLDIER_LEGGINGS)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_ROYAL_GUARD_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_ROYAL_GUARD_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(Items.RED_DYE) .input(ResourceItemsME.FABRIC) @@ -1713,10 +1705,10 @@ public void generate() { .input(ResourceItemsME.BRONZE_NUGGET) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.BRONZE_NUGGET) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_SOLDIER_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOODLAND_REALM_SOLDIER_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(Items.RED_DYE) .input(ResourceItemsME.FABRIC) @@ -1726,10 +1718,10 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARDEN_OF_THE_GLADE_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARDEN_OF_THE_GLADE_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(Items.BROWN_DYE) .input(ResourceItemsME.FABRIC) @@ -1739,10 +1731,10 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARRIOR_OF_NIGHTSHADE_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARRIOR_OF_NIGHTSHADE_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(Items.GREEN_DYE) .input(ResourceItemsME.FABRIC) @@ -1752,9 +1744,9 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); //endregion //endregion @@ -1762,17 +1754,17 @@ public void generate() { //region DWARVES //region EREBOR - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LONGBEARD_SEGMENTED_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T2) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LONGBEARD_SEGMENTED_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T2) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(bronzeArmorPlate.getItem()), - conditionsFromItem(bronzeArmorPlate.getItem())) - .offerTo(exporter); + .unlockedBy(getHasName(bronzeArmorPlate.getItem()), + has(bronzeArmorPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LONGBEARD_LEATHER_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LONGBEARD_LEATHER_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) @@ -1781,11 +1773,11 @@ public void generate() { .input(Items.LEATHER) .input(ResourceItemsME.BRONZE_NUGGET) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LONGBEARD_WANDERER_COAT.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LONGBEARD_WANDERER_COAT.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) @@ -1794,11 +1786,11 @@ public void generate() { .input(Items.IRON_NUGGET) .input(Items.LEATHER) .input(Items.IRON_NUGGET) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LONGBEARD_LEATHER_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LONGBEARD_LEATHER_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(ResourceItemsME.BRONZE_NUGGET) .input(Items.LEATHER) @@ -1806,11 +1798,11 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LONGBEARD_PARTISAN_OUTFIT.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LONGBEARD_PARTISAN_OUTFIT.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) @@ -1819,11 +1811,11 @@ public void generate() { .input(Items.LEATHER) .input(Items.IRON_NUGGET) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.DWARVEN_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.DWARVEN_MAIL_HAUBERK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.DWARVEN_MAIL_HAUBERK), + has(EquipmentItemsME.DWARVEN_MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LONGBEARD_REINFORCED_LEATHER_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LONGBEARD_REINFORCED_LEATHER_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) @@ -1832,41 +1824,41 @@ public void generate() { .input(Items.LEATHER) .input(ResourceItemsME.BRONZE_NUGGET) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.DWARVEN_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.DWARVEN_MAIL_HAUBERK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.DWARVEN_MAIL_HAUBERK), + has(EquipmentItemsME.DWARVEN_MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_LEATHER_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_LEATHER_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T2) .input(Items.IRON_INGOT) .input(Items.LEATHER) .input(Items.IRON_INGOT) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_BRACED_LEATHER_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_BRACED_LEATHER_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T2) .input(Items.IRON_INGOT) .input(Items.LEATHER) .input(Items.IRON_INGOT) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_NASAL_LEATHER_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_NASAL_LEATHER_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T2) .input(Items.IRON_INGOT) .input(Items.LEATHER) .input(Items.IRON_INGOT) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_LEATHER_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_LEATHER_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T2) .input(Items.LEATHER) .input(ResourceItemsME.BRONZE_NUGGET) .input(Items.LEATHER) @@ -1874,384 +1866,384 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_MAIL_COIF.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_MAIL_COIF.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_GILDED_MAIL_COIF.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_GILDED_MAIL_COIF.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T3) .input(ResourceItemsME.BRONZE_NUGGET) .input(EquipmentItemsME.EREBOR_MAIL_COIF) .input(ResourceItemsME.BRONZE_NUGGET) .input(ResourceItemsME.BRONZE_NUGGET) .input(ResourceItemsME.BRONZE_NUGGET) - .criterion(hasItem(EquipmentItemsME.EREBOR_MAIL_COIF), - conditionsFromItem(EquipmentItemsME.EREBOR_MAIL_COIF)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) + .unlockedBy(getHasName(EquipmentItemsME.EREBOR_MAIL_COIF), + has(EquipmentItemsME.EREBOR_MAIL_COIF)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) .input(Items.IRON_NUGGET) .input(Items.IRON_NUGGET) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_PADDED_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_PADDED_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) .input(Items.LEATHER) .input(EquipmentItemsME.EREBOR_MAIL_HAUBERK) .input(Items.LEATHER) .input(Items.LEATHER) .input(ResourceItemsME.BRONZE_INGOT) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.EREBOR_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.EREBOR_MAIL_HAUBERK)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_MAIL_COAT.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_MAIL_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_MAIL_CHAUSSES.getDefaultStack(), "boots", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_BOOTS.getDefaultStack(), "boots", DispositionType.GOOD, XP_T5) + .unlockedBy(getHasName(EquipmentItemsME.EREBOR_MAIL_HAUBERK), + has(EquipmentItemsME.EREBOR_MAIL_HAUBERK)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_MAIL_COAT.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_MAIL_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_MAIL_CHAUSSES.getDefaultInstance(), "boots", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_BOOTS.getDefaultInstance(), "boots", DispositionType.GOOD, XP_T5) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.IRON_INGOT) .input(Items.IRON_INGOT) - .criterion(hasItem(Items.IRON_INGOT), - conditionsFromItem(Items.IRON_INGOT)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.IRON_INGOT), + has(Items.IRON_INGOT)) + .save(output); //t4 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelHelmetPlate.getItem()), khazadSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelChainmail.getItem()), khazadSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelChainmail.getItem()), khazadSteelChainmail.getComponentChanges())) - .criterion(hasItem(khazadSteelHelmetPlate.getItem()), - conditionsFromItem(khazadSteelHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_GILDED_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T4) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelHelmetPlate.getComponents(), khazadSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelChainmail.getComponents(), khazadSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelChainmail.getComponents(), khazadSteelChainmail.getItem())) + .unlockedBy(getHasName(khazadSteelHelmetPlate.getItem()), + has(khazadSteelHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_GILDED_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T4) .input(EquipmentItemsME.EREBOR_GILDED_MAIL_COIF) .input(EquipmentItemsME.RAVENHILL_HELMET) - .criterion(hasItem(EquipmentItemsME.RAVENHILL_HELMET), - conditionsFromItem(EquipmentItemsME.RAVENHILL_HELMET)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_SCALE_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .criterion(hasItem(khazadSteelScaleMail.getItem()), - conditionsFromItem(khazadSteelScaleMail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_LONG_COAT.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelChainmail.getItem()), khazadSteelChainmail.getComponentChanges())) + .unlockedBy(getHasName(EquipmentItemsME.RAVENHILL_HELMET), + has(EquipmentItemsME.RAVENHILL_HELMET)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_SCALE_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .unlockedBy(getHasName(khazadSteelScaleMail.getItem()), + has(khazadSteelScaleMail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_LONG_COAT.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelChainmail.getComponents(), khazadSteelChainmail.getItem())) .input(EquipmentItemsME.EREBOR_MAIL_HAUBERK) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelChainmail.getItem()), khazadSteelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, khazadSteelChainmail.getComponents(), khazadSteelChainmail.getItem())) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.EREBOR_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.EREBOR_MAIL_HAUBERK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.EREBOR_MAIL_HAUBERK), + has(EquipmentItemsME.EREBOR_MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_BRAWLER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_BRAWLER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.EREBOR_MAIL_HAUBERK) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) .input(Items.BLUE_DYE) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.EREBOR_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.EREBOR_MAIL_HAUBERK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.EREBOR_MAIL_HAUBERK), + has(EquipmentItemsME.EREBOR_MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_REINFORCED_LEATHER_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_REINFORCED_LEATHER_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) .input(Items.LEATHER) .input(EquipmentItemsME.EREBOR_MAIL_HAUBERK) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.EREBOR_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.EREBOR_MAIL_HAUBERK)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.EREBOR_MAIL_HAUBERK), + has(EquipmentItemsME.EREBOR_MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_REINFORCED_COAT.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_REINFORCED_COAT.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.EREBOR_MAIL_HAUBERK) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) .input(Items.BLUE_DYE) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.EREBOR_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.EREBOR_MAIL_HAUBERK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.EREBOR_MAIL_HAUBERK), + has(EquipmentItemsME.EREBOR_MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_REINFORCED_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelChainmail.getItem()), khazadSteelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_REINFORCED_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelChainmail.getComponents(), khazadSteelChainmail.getItem())) .input(EquipmentItemsME.EREBOR_MAIL_HAUBERK) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelChainmail.getItem()), khazadSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelChainmail.getItem()), khazadSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.EREBOR_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.EREBOR_MAIL_HAUBERK)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_SCALE_COAT.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .criterion(hasItem(khazadSteelScaleMail.getItem()), - conditionsFromItem(khazadSteelScaleMail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_SCALE_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .criterion(hasItem(khazadSteelScaleMail.getItem()), - conditionsFromItem(khazadSteelScaleMail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_BOOTS.getDefaultStack(), "boots", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) - .input(Items.LEATHER) - .input(Items.LEATHER) - .criterion(hasItem(khazadSteelArmorPlate.getItem()), - conditionsFromItem(khazadSteelArmorPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_PLATE_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, khazadSteelChainmail.getComponents(), khazadSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelChainmail.getComponents(), khazadSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.EREBOR_MAIL_HAUBERK), + has(EquipmentItemsME.EREBOR_MAIL_HAUBERK)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_SCALE_COAT.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .unlockedBy(getHasName(khazadSteelScaleMail.getItem()), + has(khazadSteelScaleMail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_SCALE_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .unlockedBy(getHasName(khazadSteelScaleMail.getItem()), + has(khazadSteelScaleMail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_BOOTS.getDefaultInstance(), "boots", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) + .input(Items.LEATHER) + .input(Items.LEATHER) + .unlockedBy(getHasName(khazadSteelArmorPlate.getItem()), + has(khazadSteelArmorPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_PLATE_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) .input(EquipmentItemsME.EREBOR_SCALE_HAUBERK) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.EREBOR_SCALE_HAUBERK), - conditionsFromItem(EquipmentItemsME.EREBOR_SCALE_HAUBERK)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_PLATE_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.EREBOR_SCALE_HAUBERK), + has(EquipmentItemsME.EREBOR_SCALE_HAUBERK)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_PLATE_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) .input(EquipmentItemsME.EREBOR_SCALE_LEGGINGS) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.EREBOR_SCALE_LEGGINGS), - conditionsFromItem(EquipmentItemsME.EREBOR_SCALE_LEGGINGS)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_GUARD_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.EREBOR_SCALE_LEGGINGS), + has(EquipmentItemsME.EREBOR_SCALE_LEGGINGS)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_GUARD_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) .input(EquipmentItemsME.EREBOR_PLATE_HELMET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.EREBOR_PLATE_HELMET), - conditionsFromItem(EquipmentItemsME.EREBOR_PLATE_HELMET)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.EREBOR_PLATE_HELMET), + has(EquipmentItemsME.EREBOR_PLATE_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_GATEWARDEN_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_GATEWARDEN_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) .input(EquipmentItemsME.EREBOR_PLATE_HELMET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) .input(ResourceItemsME.BRONZE_INGOT) .input(ResourceItemsME.BRONZE_INGOT) - .criterion(hasItem(EquipmentItemsME.EREBOR_PLATE_HELMET), - conditionsFromItem(EquipmentItemsME.EREBOR_PLATE_HELMET)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.EREBOR_PLATE_HELMET), + has(EquipmentItemsME.EREBOR_PLATE_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_GATEWARDEN_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_GATEWARDEN_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.EREBOR_PLATE_CHESTPLATE) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.BRONZE_INGOT) .input(Items.BLUE_DYE) .input(ResourceItemsME.BRONZE_INGOT) - .criterion(hasItem(EquipmentItemsME.EREBOR_PLATE_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.EREBOR_PLATE_CHESTPLATE)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.EREBOR_PLATE_CHESTPLATE), + has(EquipmentItemsME.EREBOR_PLATE_CHESTPLATE)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_GATEWARDEN_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_GATEWARDEN_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) .input(EquipmentItemsME.EREBOR_PLATE_LEGGINGS) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.EREBOR_PLATE_LEGGINGS), - conditionsFromItem(EquipmentItemsME.EREBOR_PLATE_LEGGINGS)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.EREBOR_PLATE_LEGGINGS), + has(EquipmentItemsME.EREBOR_PLATE_LEGGINGS)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_WATCHWARDEN_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_WATCHWARDEN_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) .input(EquipmentItemsME.EREBOR_PLATE_HELMET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelChainmail.getItem()), khazadSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelChainmail.getItem()), khazadSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.EREBOR_PLATE_HELMET), - conditionsFromItem(EquipmentItemsME.EREBOR_PLATE_HELMET)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelChainmail.getComponents(), khazadSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelChainmail.getComponents(), khazadSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.EREBOR_PLATE_HELMET), + has(EquipmentItemsME.EREBOR_PLATE_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_WATCHWARDEN_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_WATCHWARDEN_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.EREBOR_PLATE_CHESTPLATE) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.BRONZE_INGOT) .input(Items.GRAY_DYE) .input(ResourceItemsME.BRONZE_INGOT) - .criterion(hasItem(EquipmentItemsME.EREBOR_PLATE_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.EREBOR_PLATE_CHESTPLATE)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.EREBOR_PLATE_CHESTPLATE), + has(EquipmentItemsME.EREBOR_PLATE_CHESTPLATE)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_WATCHWARDEN_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_WATCHWARDEN_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) .input(EquipmentItemsME.EREBOR_PLATE_LEGGINGS) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.EREBOR_PLATE_LEGGINGS), - conditionsFromItem(EquipmentItemsME.EREBOR_PLATE_LEGGINGS)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.EREBOR_PLATE_LEGGINGS), + has(EquipmentItemsME.EREBOR_PLATE_LEGGINGS)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_CAPTAIN_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T5) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_CAPTAIN_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T5) .input(Items.GOAT_HORN) .input(EquipmentItemsME.EREBOR_GUARD_HELMET) .input(Items.GOAT_HORN) - .criterion(hasItem(EquipmentItemsME.EREBOR_GUARD_HELMET), - conditionsFromItem(EquipmentItemsME.EREBOR_GUARD_HELMET)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.EREBOR_GUARD_HELMET), + has(EquipmentItemsME.EREBOR_GUARD_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_SENTINEL_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T5) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_SENTINEL_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T5) .input(Items.FEATHER) .input(EquipmentItemsME.RAVENHILL_WATCHWARDEN_HELMET) .input(Items.FEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.RAVENHILL_WATCHWARDEN_HELMET), - conditionsFromItem(EquipmentItemsME.RAVENHILL_WATCHWARDEN_HELMET)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.RAVENHILL_WATCHWARDEN_HELMET), + has(EquipmentItemsME.RAVENHILL_WATCHWARDEN_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_SENTINEL_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(goldArmorPlate.getItem()), goldArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_SENTINEL_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, goldArmorPlate.getComponents(), goldArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.RAVENHILL_WATCHWARDEN_CHESTPLATE) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeArmorPlate.getItem()), bronzeArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, bronzeArmorPlate.getComponents(), bronzeArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.RAVENHILL_WATCHWARDEN_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.RAVENHILL_WATCHWARDEN_CHESTPLATE)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.RAVENHILL_WATCHWARDEN_CHESTPLATE), + has(EquipmentItemsME.RAVENHILL_WATCHWARDEN_CHESTPLATE)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_SENTINEL_LEGGINGS.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_SENTINEL_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T5) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) .input(EquipmentItemsME.RAVENHILL_WATCHWARDEN_LEGGINGS) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.RAVENHILL_WATCHWARDEN_LEGGINGS), - conditionsFromItem(EquipmentItemsME.RAVENHILL_WATCHWARDEN_LEGGINGS)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.RAVENHILL_WATCHWARDEN_LEGGINGS), + has(EquipmentItemsME.RAVENHILL_WATCHWARDEN_LEGGINGS)) + .save(output); //capes - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.EREBOR_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(Items.STRING) .input(ResourceItemsME.FABRIC) @@ -2261,11 +2253,11 @@ public void generate() { .input(Items.BLUE_DYE) .input(ResourceItemsME.FABRIC) .input(Items.BLUE_DYE) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_SENTINEL_CAPE.getDefaultStack(), "back_attachment", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RAVENHILL_SENTINEL_CAPE.getDefaultInstance(), "back_attachment", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(Items.STRING) .input(ResourceItemsME.FABRIC) @@ -2275,9 +2267,9 @@ public void generate() { .input(Items.YELLOW_DYE) .input(ResourceItemsME.FABRIC) .input(Items.YELLOW_DYE) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); //endregion @@ -2286,81 +2278,81 @@ public void generate() { //region ORCS //region MORDOR - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_KETTLE_HAT.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_KETTLE_HAT.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_NASAL_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_NASAL_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_KETTLE_HAT_WITH_COIF.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_KETTLE_HAT.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_KETTLE_HAT.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_NASAL_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_NASAL_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_KETTLE_HAT_WITH_COIF.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) .input(EquipmentItemsME.ORCISH_MAIL_COIF) .input(EquipmentItemsME.MORDOR_KETTLE_HAT) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_COIF), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_COIF)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_COIF), + has(EquipmentItemsME.ORCISH_MAIL_COIF)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_KETTLE_HAT_WITH_COIF.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_KETTLE_HAT_WITH_COIF.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) .input(EquipmentItemsME.ORCISH_MAIL_COIF) .input(EquipmentItemsME.MORDOR_KETTLE_HAT) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_COIF), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_COIF)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_COIF), + has(EquipmentItemsME.ORCISH_MAIL_COIF)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_LEATHER_CUIRASS.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_LEATHER_CUIRASS.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) @@ -2369,11 +2361,11 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_PAINTED_LEATHER_CUIRASS.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_PAINTED_LEATHER_CUIRASS.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(Items.RED_DYE) @@ -2382,320 +2374,320 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.MORDOR_LEATHER_CUIRASS), - conditionsFromItem(EquipmentItemsME.MORDOR_LEATHER_CUIRASS)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_CREST_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelHelmetPlate.getItem()), burzumSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(burzumSteelHelmetPlate.getItem()), - conditionsFromItem(burzumSteelHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_CREST_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelHelmetPlate.getItem()), burzumSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(burzumSteelHelmetPlate.getItem()), - conditionsFromItem(burzumSteelHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_MANDIBLE_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelHelmetPlate.getItem()), burzumSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(burzumSteelHelmetPlate.getItem()), - conditionsFromItem(burzumSteelHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_MANDIBLE_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelHelmetPlate.getItem()), burzumSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(burzumSteelHelmetPlate.getItem()), - conditionsFromItem(burzumSteelHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_SALLET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelHelmetPlate.getItem()), burzumSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(burzumSteelHelmetPlate.getItem()), - conditionsFromItem(burzumSteelHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_SALLET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelHelmetPlate.getItem()), burzumSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(burzumSteelHelmetPlate.getItem()), - conditionsFromItem(burzumSteelHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_CUIRASS.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .unlockedBy(getHasName(EquipmentItemsME.MORDOR_LEATHER_CUIRASS), + has(EquipmentItemsME.MORDOR_LEATHER_CUIRASS)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_CREST_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelHelmetPlate.getComponents(), burzumSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(burzumSteelHelmetPlate.getItem()), + has(burzumSteelHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_CREST_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelHelmetPlate.getComponents(), burzumSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(burzumSteelHelmetPlate.getItem()), + has(burzumSteelHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_MANDIBLE_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelHelmetPlate.getComponents(), burzumSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(burzumSteelHelmetPlate.getItem()), + has(burzumSteelHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_MANDIBLE_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelHelmetPlate.getComponents(), burzumSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(burzumSteelHelmetPlate.getItem()), + has(burzumSteelHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_SALLET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelHelmetPlate.getComponents(), burzumSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(burzumSteelHelmetPlate.getItem()), + has(burzumSteelHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_SALLET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelHelmetPlate.getComponents(), burzumSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(burzumSteelHelmetPlate.getItem()), + has(burzumSteelHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_CUIRASS.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.MORDOR_LEATHER_CUIRASS) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.MORDOR_LEATHER_CUIRASS), - conditionsFromItem(EquipmentItemsME.MORDOR_LEATHER_CUIRASS)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.MORDOR_LEATHER_CUIRASS), + has(EquipmentItemsME.MORDOR_LEATHER_CUIRASS)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_CUIRASS.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_CUIRASS.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.MORDOR_LEATHER_CUIRASS) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.MORDOR_LEATHER_CUIRASS), - conditionsFromItem(EquipmentItemsME.MORDOR_LEATHER_CUIRASS)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.MORDOR_LEATHER_CUIRASS), + has(EquipmentItemsME.MORDOR_LEATHER_CUIRASS)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_GORGET_HAUBERK.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_GORGET_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(Items.LEATHER) .input(EquipmentItemsME.ORCISH_MAIL_HAUBERK) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_HAUBERK)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_HAUBERK), + has(EquipmentItemsME.ORCISH_MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_GORGET_HAUBERK.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_GORGET_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(Items.LEATHER) .input(EquipmentItemsME.ORCISH_MAIL_HAUBERK) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_HAUBERK)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_HAUBERK), + has(EquipmentItemsME.ORCISH_MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_REINFORCED_COAT.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_REINFORCED_COAT.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.MORDOR_LEATHER_CUIRASS) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.MORDOR_LEATHER_CUIRASS), - conditionsFromItem(EquipmentItemsME.MORDOR_LEATHER_CUIRASS)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.MORDOR_LEATHER_CUIRASS), + has(EquipmentItemsME.MORDOR_LEATHER_CUIRASS)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_REINFORCED_COAT.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_REINFORCED_COAT.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.MORDOR_LEATHER_CUIRASS) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.MORDOR_LEATHER_CUIRASS), - conditionsFromItem(EquipmentItemsME.MORDOR_LEATHER_CUIRASS)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.MORDOR_LEATHER_CUIRASS), + has(EquipmentItemsME.MORDOR_LEATHER_CUIRASS)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(EquipmentItemsME.ORCISH_MAIL_HAUBERK) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_HAUBERK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_HAUBERK), + has(EquipmentItemsME.ORCISH_MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(EquipmentItemsME.ORCISH_MAIL_HAUBERK) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_HAUBERK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_HAUBERK), + has(EquipmentItemsME.ORCISH_MAIL_HAUBERK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_PLATE_BOOTS.getDefaultStack(), "boots", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_PLATE_BOOTS.getDefaultInstance(), "boots", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(burzumSteelArmorPlate.getItem()), - conditionsFromItem(burzumSteelArmorPlate.getItem())) - .offerTo(exporter); + .unlockedBy(getHasName(burzumSteelArmorPlate.getItem()), + has(burzumSteelArmorPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_PLATE_BOOTS.getDefaultStack(), "boots", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_PLATE_BOOTS.getDefaultInstance(), "boots", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(burzumSteelArmorPlate.getItem()), - conditionsFromItem(burzumSteelArmorPlate.getItem())) - .offerTo(exporter); + .unlockedBy(getHasName(burzumSteelArmorPlate.getItem()), + has(burzumSteelArmorPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_GREAT_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T4) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_GREAT_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T4) .input(ResourceItemsME.BURZUM_STEEL_INGOT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelHelmetPlate.getItem()), burzumSteelHelmetPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelHelmetPlate.getComponents(), burzumSteelHelmetPlate.getItem())) .input(ResourceItemsME.BURZUM_STEEL_INGOT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .criterion(hasItem(burzumSteelHelmetPlate.getItem()), - conditionsFromItem(burzumSteelHelmetPlate.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(burzumSteelHelmetPlate.getItem()), + has(burzumSteelHelmetPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_SNOUT_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T4) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_MORDOR_SNOUT_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T4) .input(ResourceItemsME.BURZUM_STEEL_INGOT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelHelmetPlate.getItem()), burzumSteelHelmetPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelHelmetPlate.getComponents(), burzumSteelHelmetPlate.getItem())) .input(ResourceItemsME.BURZUM_STEEL_INGOT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .criterion(hasItem(burzumSteelHelmetPlate.getItem()), - conditionsFromItem(burzumSteelHelmetPlate.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(burzumSteelHelmetPlate.getItem()), + has(burzumSteelHelmetPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_DEGRADED_GONDORIAN_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_DEGRADED_GONDORIAN_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(Items.LEATHER) .input(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(Items.RED_DYE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_PAINTED_CUIRASS.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE), + has(EquipmentItemsME.GONDORIAN_PLATE_CHESTPLATE)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_PAINTED_CUIRASS.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(Items.RED_DYE) .input(EquipmentItemsME.MORDOR_CUIRASS) .input(Items.RED_DYE) .input(ResourceItemsME.FABRIC) .input(Items.RED_DYE) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.MORDOR_CUIRASS), - conditionsFromItem(EquipmentItemsME.MORDOR_CUIRASS)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_SCALE_COAT.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .criterion(hasItem(burzumSteelScaleMail.getItem()), - conditionsFromItem(burzumSteelScaleMail.getItem())) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.MORDOR_CUIRASS), + has(EquipmentItemsME.MORDOR_CUIRASS)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_SCALE_COAT.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .unlockedBy(getHasName(burzumSteelScaleMail.getItem()), + has(burzumSteelScaleMail.getItem())) + .save(output); //T5 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACK_URUK_PLATE_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACK_URUK_PLATE_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(EquipmentItemsME.MORDOR_CHESTPLATE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.MORDOR_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.MORDOR_CHESTPLATE)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACK_URUK_PLATE_LEGGINGS.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.MORDOR_CHESTPLATE), + has(EquipmentItemsME.MORDOR_CHESTPLATE)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACK_URUK_PLATE_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.ORCISH_MAIL_COAT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_COAT), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_COAT)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACK_URUK_COMMANDER_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_COAT), + has(EquipmentItemsME.ORCISH_MAIL_COAT)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACK_URUK_COMMANDER_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T5) .input(Items.SKELETON_SKULL) .input(EquipmentItemsME.BLACK_URUK_PLATE_HELMET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(Items.RED_DYE) .input(Items.RED_DYE) - .criterion(hasItem(EquipmentItemsME.BLACK_URUK_PLATE_HELMET), - conditionsFromItem(EquipmentItemsME.BLACK_URUK_PLATE_HELMET)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACK_URUK_COMMANDER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .unlockedBy(getHasName(EquipmentItemsME.BLACK_URUK_PLATE_HELMET), + has(EquipmentItemsME.BLACK_URUK_PLATE_HELMET)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACK_URUK_COMMANDER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(Items.RED_DYE) .input(EquipmentItemsME.BLACK_URUK_PLATE_CHESTPLATE) .input(Items.RED_DYE) .input(ResourceItemsME.FABRIC) .input(Items.RED_DYE) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.BLACK_URUK_PLATE_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.BLACK_URUK_PLATE_CHESTPLATE)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.BLACK_URUK_PLATE_CHESTPLATE), + has(EquipmentItemsME.BLACK_URUK_PLATE_CHESTPLATE)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_BLACK_NUMENOREAN_PLATE_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_BLACK_NUMENOREAN_PLATE_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) .input(EquipmentItemsME.MAIL_HAUBERK) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.MAIL_HAUBERK)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_BLACK_NUMENOREAN_PLATE_LEGGINGS.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.MAIL_HAUBERK), + has(EquipmentItemsME.MAIL_HAUBERK)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_BLACK_NUMENOREAN_PLATE_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) .input(EquipmentItemsME.MAIL_SKIRT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.MAIL_SKIRT), - conditionsFromItem(EquipmentItemsME.MAIL_SKIRT)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_BLACK_NUMENOREAN_CAPE.getDefaultStack(), "back_attachment", DispositionType.EVIL) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.MAIL_SKIRT), + has(EquipmentItemsME.MAIL_SKIRT)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORDOR_BLACK_NUMENOREAN_CAPE.getDefaultInstance(), "back_attachment", DispositionType.EVIL) .input(ResourceItemsME.STEEL_NUGGET) .input(Items.STRING) .input(ResourceItemsME.STEEL_NUGGET) @@ -2705,253 +2697,253 @@ public void generate() { .input(Items.RED_DYE) .input(ResourceItemsME.FABRIC) .input(Items.RED_DYE) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); //endregion //region DOL GULDUR - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_JAILER_COLLAR.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_JAILER_COLLAR.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T2) .input(ResourceItemsME.CRUDE_INGOT) .input(ResourceItemsME.CRUDE_INGOT) .input(ResourceItemsME.CRUDE_INGOT) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.CRUDE_INGOT)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_JAILER_COLLAR.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T2) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.CRUDE_INGOT)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_JAILER_COLLAR.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T2) .input(ResourceItemsME.CRUDE_INGOT) .input(ResourceItemsME.CRUDE_INGOT) .input(ResourceItemsME.CRUDE_INGOT) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.CRUDE_INGOT)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.CRUDE_INGOT)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_EXECUTIONER_HOOD.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_EXECUTIONER_HOOD.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_EXECUTIONER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_EXECUTIONER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_EXECUTIONER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE), + has(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_EXECUTIONER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE), + has(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_PADDED_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_PADDED_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .input(ResourceItemsME.FABRIC) - .input(ResourceItemsME.FABRIC) - .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_HUNTER_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelHelmetPlate.getItem()), burzumSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(burzumSteelArmorPlate.getItem()), - conditionsFromItem(burzumSteelArmorPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_RAIDER_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelHelmetPlate.getItem()), burzumSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(burzumSteelArmorPlate.getItem()), - conditionsFromItem(burzumSteelArmorPlate.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_RAIDER_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelHelmetPlate.getItem()), burzumSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(burzumSteelArmorPlate.getItem()), - conditionsFromItem(burzumSteelArmorPlate.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_RAIDER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .input(ResourceItemsME.FABRIC) + .input(ResourceItemsME.FABRIC) + .input(ResourceItemsME.FABRIC) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE), + has(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_HUNTER_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelHelmetPlate.getComponents(), burzumSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(burzumSteelArmorPlate.getItem()), + has(burzumSteelArmorPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_RAIDER_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelHelmetPlate.getComponents(), burzumSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(burzumSteelArmorPlate.getItem()), + has(burzumSteelArmorPlate.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_RAIDER_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelHelmetPlate.getComponents(), burzumSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(burzumSteelArmorPlate.getItem()), + has(burzumSteelArmorPlate.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_RAIDER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(Items.LEATHER) .input(EquipmentItemsME.ORCISH_MAIL_HAUBERK) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_HAUBERK)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_RAIDER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_HAUBERK), + has(EquipmentItemsME.ORCISH_MAIL_HAUBERK)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_RAIDER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(Items.LEATHER) .input(EquipmentItemsME.ORCISH_MAIL_HAUBERK) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_HAUBERK)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_RAIDER_COAT.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .criterion(hasItem(burzumSteelScaleMail.getItem()), - conditionsFromItem(burzumSteelScaleMail.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_BOOTS.getDefaultStack(), "boots", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .input(Items.LEATHER) - .input(Items.LEATHER) - .criterion(hasItem(burzumSteelArmorPlate.getItem()), - conditionsFromItem(burzumSteelArmorPlate.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_BOOTS.getDefaultStack(), "boots", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .input(Items.LEATHER) - .input(Items.LEATHER) - .criterion(hasItem(burzumSteelArmorPlate.getItem()), - conditionsFromItem(burzumSteelArmorPlate.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .input(Items.LEATHER) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_HAUBERK), + has(EquipmentItemsME.ORCISH_MAIL_HAUBERK)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_RAIDER_COAT.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .unlockedBy(getHasName(burzumSteelScaleMail.getItem()), + has(burzumSteelScaleMail.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_BOOTS.getDefaultInstance(), "boots", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .input(Items.LEATHER) + .input(Items.LEATHER) + .unlockedBy(getHasName(burzumSteelArmorPlate.getItem()), + has(burzumSteelArmorPlate.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_BOOTS.getDefaultInstance(), "boots", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .input(Items.LEATHER) + .input(Items.LEATHER) + .unlockedBy(getHasName(burzumSteelArmorPlate.getItem()), + has(burzumSteelArmorPlate.getItem())) + .save(output); //T5 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_MARAUDER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_MARAUDER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(EquipmentItemsME.ORCISH_SCALE_VEST) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ORCISH_SCALE_VEST), - conditionsFromItem(EquipmentItemsME.ORCISH_SCALE_VEST)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_MARAUDER_LEGGINGS.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_SCALE_VEST), + has(EquipmentItemsME.ORCISH_SCALE_VEST)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_MARAUDER_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.ORCISH_MAIL_COAT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_COAT), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_COAT)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_COAT), + has(EquipmentItemsME.ORCISH_MAIL_COAT)) + .save(output); // Weathered - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_MARAUDER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_MARAUDER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(EquipmentItemsME.ORCISH_SCALE_VEST) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ORCISH_SCALE_VEST), - conditionsFromItem(EquipmentItemsME.ORCISH_SCALE_VEST)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_MARAUDER_LEGGINGS.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_SCALE_VEST), + has(EquipmentItemsME.ORCISH_SCALE_VEST)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_MARAUDER_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.ORCISH_MAIL_COAT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_COAT), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_COAT)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_STALKER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_COAT), + has(EquipmentItemsME.ORCISH_MAIL_COAT)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_STALKER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(EquipmentItemsME.DOL_GULDUR_RAIDER_CHESTPLATE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.DOL_GULDUR_RAIDER_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.DOL_GULDUR_RAIDER_CHESTPLATE)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_STALKER_LEGGINGS.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.DOL_GULDUR_RAIDER_CHESTPLATE), + has(EquipmentItemsME.DOL_GULDUR_RAIDER_CHESTPLATE)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DOL_GULDUR_STALKER_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.ORCISH_MAIL_COAT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_COAT), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_COAT)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_COAT), + has(EquipmentItemsME.ORCISH_MAIL_COAT)) + .save(output); // Weathered - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_STALKER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_STALKER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(EquipmentItemsME.WEATHERED_DOL_GULDUR_RAIDER_CHESTPLATE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.WEATHERED_DOL_GULDUR_RAIDER_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.WEATHERED_DOL_GULDUR_RAIDER_CHESTPLATE)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_STALKER_LEGGINGS.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.WEATHERED_DOL_GULDUR_RAIDER_CHESTPLATE), + has(EquipmentItemsME.WEATHERED_DOL_GULDUR_RAIDER_CHESTPLATE)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WEATHERED_DOL_GULDUR_STALKER_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.ORCISH_MAIL_COAT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_COAT), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_COAT)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_COAT), + has(EquipmentItemsME.ORCISH_MAIL_COAT)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACK_REAVER_SHOULDER_CAPE.getDefaultStack(), "back_attachment", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACK_REAVER_SHOULDER_CAPE.getDefaultInstance(), "back_attachment", DispositionType.EVIL) .input(ResourceItemsME.FABRIC) .input(Items.STRING) .input(ResourceItemsME.FABRIC) @@ -2960,23 +2952,23 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(Items.RED_DYE) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(steelHelmetPlate.getItem()), - conditionsFromItem(steelHelmetPlate.getItem())) - .offerTo(exporter); + .unlockedBy(getHasName(steelHelmetPlate.getItem()), + has(steelHelmetPlate.getItem())) + .save(output); //endregion //region ISENGARD - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_LEATHER_SCOUT_CAP.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_LEATHER_SCOUT_CAP.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_LEATHER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_LEATHER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) @@ -2985,18 +2977,18 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PAINTED_LEATHER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PAINTED_LEATHER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T2) .input(EquipmentItemsME.URUK_HAI_LEATHER_CHESTPLATE) .input(ResourceItemsME.ISENGARD_BANNER_PATTERN) - .criterion(hasItem(EquipmentItemsME.URUK_HAI_LEATHER_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.URUK_HAI_LEATHER_CHESTPLATE)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.URUK_HAI_LEATHER_CHESTPLATE), + has(EquipmentItemsME.URUK_HAI_LEATHER_CHESTPLATE)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_LEATHER_HAUBERK.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_LEATHER_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) @@ -3005,79 +2997,79 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_BOOTS.getDefaultStack(), "boots", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_BOOTS.getDefaultInstance(), "boots", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_LIGHT_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_LIGHT_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PAINTED_LIGHT_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PAINTED_LIGHT_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) .input(EquipmentItemsME.URUK_HAI_LIGHT_HELMET) .input(ResourceItemsME.ISENGARD_BANNER_PATTERN) - .criterion(hasItem(EquipmentItemsME.URUK_HAI_LIGHT_HELMET), - conditionsFromItem(EquipmentItemsME.URUK_HAI_LIGHT_HELMET)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_REINFORCED_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PAINTED_REINFORCED_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) + .unlockedBy(getHasName(EquipmentItemsME.URUK_HAI_LIGHT_HELMET), + has(EquipmentItemsME.URUK_HAI_LIGHT_HELMET)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_REINFORCED_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PAINTED_REINFORCED_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) .input(EquipmentItemsME.URUK_HAI_REINFORCED_HELMET) .input(ResourceItemsME.ISENGARD_BANNER_PATTERN) - .criterion(hasItem(EquipmentItemsME.URUK_HAI_REINFORCED_HELMET), - conditionsFromItem(EquipmentItemsME.URUK_HAI_REINFORCED_HELMET)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_MAIL_COAT.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_MAIL_SKIRT.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T3) + .unlockedBy(getHasName(EquipmentItemsME.URUK_HAI_REINFORCED_HELMET), + has(EquipmentItemsME.URUK_HAI_REINFORCED_HELMET)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_MAIL_COAT.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_MAIL_SKIRT.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T3) .input(Items.LEATHER) .input(EquipmentItemsME.URUK_HAI_MAIL_COAT) .input(Items.LEATHER) @@ -3085,140 +3077,139 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.URUK_HAI_MAIL_COAT), - conditionsFromItem(EquipmentItemsME.URUK_HAI_MAIL_COAT)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.URUK_HAI_MAIL_COAT), + has(EquipmentItemsME.URUK_HAI_MAIL_COAT)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_SOLDIER_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelHelmetPlate.getItem()), burzumSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(burzumSteelHelmetPlate.getItem()), - conditionsFromItem(burzumSteelHelmetPlate.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_SOLDIER_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelHelmetPlate.getComponents(), burzumSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(burzumSteelHelmetPlate.getItem()), + has(burzumSteelHelmetPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PAINTED_SOLDIER_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T4) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PAINTED_SOLDIER_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T4) .input(EquipmentItemsME.URUK_HAI_SOLDIER_HELMET) .input(ResourceItemsME.ISENGARD_BANNER_PATTERN) - .criterion(hasItem(EquipmentItemsME.URUK_HAI_SOLDIER_HELMET), - conditionsFromItem(EquipmentItemsME.URUK_HAI_SOLDIER_HELMET)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.URUK_HAI_SOLDIER_HELMET), + has(EquipmentItemsME.URUK_HAI_SOLDIER_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_CUIRASS.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_CUIRASS.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.STRING) .input(Items.LEATHER) - .criterion(hasItem(burzumSteelArmorPlate.getItem()), - conditionsFromItem(burzumSteelArmorPlate.getItem())) - .offerTo(exporter); + .unlockedBy(getHasName(burzumSteelArmorPlate.getItem()), + has(burzumSteelArmorPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PLATE_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PLATE_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(EquipmentItemsME.URUK_HAI_CUIRASS) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.URUK_HAI_CUIRASS), - conditionsFromItem(EquipmentItemsME.URUK_HAI_CUIRASS)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PLATE_LEGGINGS.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.URUK_HAI_CUIRASS), + has(EquipmentItemsME.URUK_HAI_CUIRASS)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PLATE_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.URUK_HAI_MAIL_COAT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.URUK_HAI_MAIL_COAT), - conditionsFromItem(EquipmentItemsME.URUK_HAI_MAIL_COAT)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PAINTED_PLATE_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.URUK_HAI_MAIL_COAT), + has(EquipmentItemsME.URUK_HAI_MAIL_COAT)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PAINTED_PLATE_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T5) .input(EquipmentItemsME.URUK_HAI_PLATE_HELMET) .input(ResourceItemsME.ISENGARD_BANNER_PATTERN) - .criterion(hasItem(EquipmentItemsME.URUK_HAI_PLATE_HELMET), - conditionsFromItem(EquipmentItemsME.URUK_HAI_PLATE_HELMET)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.URUK_HAI_PLATE_HELMET), + has(EquipmentItemsME.URUK_HAI_PLATE_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PAINTED_SAPPER_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T5) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PAINTED_SAPPER_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T5) .input(EquipmentItemsME.URUK_HAI_SAPPER_HELMET) .input(ResourceItemsME.ISENGARD_BANNER_PATTERN) - .criterion(hasItem(EquipmentItemsME.URUK_HAI_SAPPER_HELMET), - conditionsFromItem(EquipmentItemsME.URUK_HAI_SAPPER_HELMET)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.URUK_HAI_SAPPER_HELMET), + has(EquipmentItemsME.URUK_HAI_SAPPER_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PAINTED_BERSERKER_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T5) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PAINTED_BERSERKER_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T5) .input(EquipmentItemsME.URUK_HAI_BERSERKER_HELMET) .input(ResourceItemsME.ISENGARD_BANNER_PATTERN) - .criterion(hasItem(EquipmentItemsME.URUK_HAI_BERSERKER_HELMET), - conditionsFromItem(EquipmentItemsME.URUK_HAI_BERSERKER_HELMET)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.URUK_HAI_BERSERKER_HELMET), + has(EquipmentItemsME.URUK_HAI_BERSERKER_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_COMMANDER_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_COMMANDER_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.URUK_HAI_PLATE_HELMET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.URUK_HAI_PLATE_HELMET), - conditionsFromItem(EquipmentItemsME.URUK_HAI_PLATE_HELMET)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PAINTED_COMMANDER_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.URUK_HAI_PLATE_HELMET), + has(EquipmentItemsME.URUK_HAI_PLATE_HELMET)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.URUK_HAI_PAINTED_COMMANDER_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T5) .input(EquipmentItemsME.URUK_HAI_COMMANDER_HELMET) .input(ResourceItemsME.ISENGARD_BANNER_PATTERN) - .criterion(hasItem(EquipmentItemsME.URUK_HAI_COMMANDER_HELMET), - conditionsFromItem(EquipmentItemsME.URUK_HAI_COMMANDER_HELMET)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORTHANC_GUARD_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) + .unlockedBy(getHasName(EquipmentItemsME.URUK_HAI_COMMANDER_HELMET), + has(EquipmentItemsME.URUK_HAI_COMMANDER_HELMET)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORTHANC_GUARD_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) .input(EquipmentItemsME.MAIL_HAUBERK) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.MAIL_HAUBERK)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORTHANC_GUARD_LEGGINGS.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.MAIL_HAUBERK), + has(EquipmentItemsME.MAIL_HAUBERK)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORTHANC_GUARD_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) .input(EquipmentItemsME.MAIL_SKIRT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.MAIL_SKIRT), - conditionsFromItem(EquipmentItemsME.MAIL_SKIRT)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORTHANC_COMMANDER_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.MAIL_SKIRT), + has(EquipmentItemsME.MAIL_SKIRT)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORTHANC_COMMANDER_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T5) .input(Items.FEATHER) .input(EquipmentItemsME.ORTHANC_GUARD_HELMET) .input(Items.FEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .criterion(hasItem(steelHelmetPlate.getItem()), - conditionsFromItem(steelHelmetPlate.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .unlockedBy(getHasName(steelHelmetPlate.getItem()), + has(steelHelmetPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORTHANC_GUARD_CAPE.getDefaultStack(), "back_attachment", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORTHANC_GUARD_CAPE.getDefaultInstance(), "back_attachment", DispositionType.EVIL) .input(ResourceItemsME.FABRIC) .input(Items.STRING) .input(ResourceItemsME.FABRIC) @@ -3228,47 +3219,47 @@ public void generate() { .input(Items.BLACK_DYE) .input(ResourceItemsME.FABRIC) .input(Items.BLACK_DYE) - .criterion(hasItem(steelHelmetPlate.getItem()), - conditionsFromItem(steelHelmetPlate.getItem())) - .offerTo(exporter); + .unlockedBy(getHasName(steelHelmetPlate.getItem()), + has(steelHelmetPlate.getItem())) + .save(output); //endregion //region MISTIES - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_BONE_PAULDRON.getDefaultStack(), "chestplate", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_BONE_PAULDRON.getDefaultInstance(), "chestplate", DispositionType.EVIL) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_SEEKER_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_SEEKER_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_LEATHER_SCALE_COAT.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_LEATHER_SCALE_COAT.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_LEATHER_LEGGINGS.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_LEATHER_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) @@ -3276,180 +3267,180 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_LACED_BOOTS.getDefaultStack(), "boots", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_LACED_BOOTS.getDefaultInstance(), "boots", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_SKULLCAP_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_SKULLCAP_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_MAIL_COIF.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_MAIL_COIF.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_MAIL_COAT.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_MAIL_COAT.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_SOLDIER_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelHelmetPlate.getItem()), burzumSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(burzumSteelHelmetPlate.getItem()), - conditionsFromItem(burzumSteelHelmetPlate.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_SOLDIER_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelHelmetPlate.getComponents(), burzumSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(burzumSteelHelmetPlate.getItem()), + has(burzumSteelHelmetPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_SCREECHER_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelHelmetPlate.getItem()), burzumSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(burzumSteelHelmetPlate.getItem()), - conditionsFromItem(burzumSteelHelmetPlate.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_SCREECHER_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelHelmetPlate.getComponents(), burzumSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(burzumSteelHelmetPlate.getItem()), + has(burzumSteelHelmetPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_REINFORCED_LEATHER_SCALE_COAT.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T4) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_REINFORCED_LEATHER_SCALE_COAT.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T4) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.GUNDABAD_LEATHER_SCALE_COAT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.GUNDABAD_LEATHER_SCALE_COAT), - conditionsFromItem(EquipmentItemsME.GUNDABAD_LEATHER_SCALE_COAT)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.GUNDABAD_LEATHER_SCALE_COAT), + has(EquipmentItemsME.GUNDABAD_LEATHER_SCALE_COAT)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_REINFORCED_LEATHER_VEST.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_REINFORCED_LEATHER_VEST.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(EquipmentItemsME.ORCISH_LEATHER_SCALE_VEST) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.ORCISH_LEATHER_SCALE_VEST), - conditionsFromItem(EquipmentItemsME.ORCISH_LEATHER_SCALE_VEST)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_LEATHER_SCALE_VEST), + has(EquipmentItemsME.ORCISH_LEATHER_SCALE_VEST)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_HOBGOBLIN_PLATE_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_HOBGOBLIN_PLATE_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(EquipmentItemsME.GUNDABAD_REINFORCED_LEATHER_VEST) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.GUNDABAD_REINFORCED_LEATHER_VEST), - conditionsFromItem(EquipmentItemsME.GUNDABAD_REINFORCED_LEATHER_VEST)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_HOBGOBLIN_MAIL_COAT.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.GUNDABAD_REINFORCED_LEATHER_VEST), + has(EquipmentItemsME.GUNDABAD_REINFORCED_LEATHER_VEST)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GUNDABAD_HOBGOBLIN_MAIL_COAT.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.GUNDABAD_MAIL_COAT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_COAT), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_COAT)) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_COAT), + has(EquipmentItemsME.ORCISH_MAIL_COAT)) + .save(output); //endregion //region MORIA - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_SNAGA_NASAL_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_SNAGA_NASAL_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) .input(ResourceItemsME.CRUDE_INGOT) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.CRUDE_INGOT)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_SNAGA_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T2) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.CRUDE_INGOT)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_SNAGA_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) .input(ResourceItemsME.CRUDE_INGOT) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.CRUDE_INGOT)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_SNAGA_CUIRASS.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T2) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.CRUDE_INGOT)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_SNAGA_CUIRASS.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.CRUDE_INGOT)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_SNAGA_BELLY_PLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T2) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.CRUDE_INGOT)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_SNAGA_BELLY_PLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.CRUDE_INGOT)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_CLOTH_COAT.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T2) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.CRUDE_INGOT)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_CLOTH_COAT.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T2) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.CRUDE_NUGGET) .input(ResourceItemsME.FABRIC) @@ -3457,10 +3448,10 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.CRUDE_NUGGET), - conditionsFromItem(ResourceItemsME.CRUDE_NUGGET)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_SNAGA_SKIRT.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T2) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_NUGGET), + has(ResourceItemsME.CRUDE_NUGGET)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_SNAGA_SKIRT.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) .input(ResourceItemsME.CRUDE_NUGGET) .input(Items.LEATHER) @@ -3468,38 +3459,38 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.CRUDE_NUGGET), - conditionsFromItem(ResourceItemsME.CRUDE_NUGGET)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.CRUDE_NUGGET), + has(ResourceItemsME.CRUDE_NUGGET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_CRUDE_BOOTS.getDefaultStack(), "boots", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_CRUDE_BOOTS.getDefaultInstance(), "boots", DispositionType.EVIL, XP_T2) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.CRUDE_INGOT) .input(ResourceItemsME.CRUDE_INGOT) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.CRUDE_INGOT)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_CHARGER_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_RUINED_DWARVEN_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_HAUBERK.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.CRUDE_INGOT)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_CHARGER_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_RUINED_DWARVEN_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) .input(ResourceItemsME.CRUDE_INGOT) .input(ResourceItemsME.CRUDE_INGOT) .input(ResourceItemsME.CRUDE_NUGGET) @@ -3508,10 +3499,10 @@ public void generate() { .input(Items.LEATHER) .input(ResourceItemsME.CRUDE_NUGGET) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_HAUBERK)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_RUINED_DWARVEN_HAUBERK.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_HAUBERK), + has(EquipmentItemsME.ORCISH_MAIL_HAUBERK)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_RUINED_DWARVEN_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) .input(ResourceItemsME.CRUDE_INGOT) .input(ResourceItemsME.CRUDE_INGOT) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) @@ -3520,138 +3511,138 @@ public void generate() { .input(Items.LEATHER) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_HAUBERK)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_BITER_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelHelmetPlate.getItem()), burzumSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(burzumSteelHelmetPlate.getItem()), - conditionsFromItem(burzumSteelHelmetPlate.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_MANDIBLE_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelHelmetPlate.getItem()), burzumSteelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(burzumSteelHelmetPlate.getItem()), - conditionsFromItem(burzumSteelHelmetPlate.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_REINFORCED_COAT.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_HAUBERK), + has(EquipmentItemsME.ORCISH_MAIL_HAUBERK)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_BITER_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelHelmetPlate.getComponents(), burzumSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(burzumSteelHelmetPlate.getItem()), + has(burzumSteelHelmetPlate.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_MANDIBLE_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelHelmetPlate.getComponents(), burzumSteelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(burzumSteelHelmetPlate.getItem()), + has(burzumSteelHelmetPlate.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_REINFORCED_COAT.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE), - conditionsFromItem(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE), + has(EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE)) + .save(output); //T5 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_SCREECHER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_SCREECHER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(EquipmentItemsME.MORIA_GOBLIN_REINFORCED_COAT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.MORIA_GOBLIN_REINFORCED_COAT), - conditionsFromItem(EquipmentItemsME.MORIA_GOBLIN_REINFORCED_COAT)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_SCREECHER_LEGGINGS.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.MORIA_GOBLIN_REINFORCED_COAT), + has(EquipmentItemsME.MORIA_GOBLIN_REINFORCED_COAT)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_SCREECHER_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.ORCISH_MAIL_COAT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_COAT), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_COAT)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_CHIEF_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_COAT), + has(EquipmentItemsME.ORCISH_MAIL_COAT)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_CHIEF_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(EquipmentItemsME.MORIA_GOBLIN_REINFORCED_COAT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.MORIA_GOBLIN_REINFORCED_COAT), - conditionsFromItem(EquipmentItemsME.MORIA_GOBLIN_REINFORCED_COAT)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_CHIEF_LEGGINGS.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.MORIA_GOBLIN_REINFORCED_COAT), + has(EquipmentItemsME.MORIA_GOBLIN_REINFORCED_COAT)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_CHIEF_LEGGINGS.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.ORCISH_MAIL_COAT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(EquipmentItemsME.ORCISH_MAIL_COAT), - conditionsFromItem(EquipmentItemsME.ORCISH_MAIL_COAT)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_CHIEF_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T5) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(EquipmentItemsME.ORCISH_MAIL_COAT), + has(EquipmentItemsME.ORCISH_MAIL_COAT)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MORIA_GOBLIN_CHIEF_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T5) .input(Items.GOAT_HORN) .input(EquipmentItemsME.MORIA_GOBLIN_CAPTAIN_HELMET) .input(Items.GOAT_HORN) - .criterion(hasItem(EquipmentItemsME.MORIA_GOBLIN_CAPTAIN_HELMET), - conditionsFromItem(EquipmentItemsME.MORIA_GOBLIN_CAPTAIN_HELMET)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.MORIA_GOBLIN_CAPTAIN_HELMET), + has(EquipmentItemsME.MORIA_GOBLIN_CAPTAIN_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_KING_CROWN.getDefaultStack(), "helmet", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_KING_CROWN.getDefaultInstance(), "helmet", DispositionType.EVIL) .input(ResourceItemsME.DIRTY_BONE) .input(Items.LEATHER) .input(ResourceItemsME.DIRTY_BONE) .input(ResourceItemsME.DIRTY_BONE) .input(ResourceItemsME.DIRTY_BONE) - .criterion(hasItem(ResourceItemsME.DIRTY_BONE), - conditionsFromItem(ResourceItemsME.DIRTY_BONE)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.DIRTY_BONE), + has(ResourceItemsME.DIRTY_BONE)) + .save(output); //endregion //region GOBLIN TOWN - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_CAP.getDefaultStack(), "helmet", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_CAP.getDefaultInstance(), "helmet", DispositionType.EVIL) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_BONE_MANDIBLE_CAP.getDefaultStack(), "helmet", DispositionType.EVIL) + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_BONE_MANDIBLE_CAP.getDefaultInstance(), "helmet", DispositionType.EVIL) .input(Items.BONE) .input(EquipmentItemsME.GOBLIN_TOWN_CAP) .input(Items.BONE) .input(Items.BONE) .input(Items.BONE) - .criterion(hasItem(EquipmentItemsME.GOBLIN_TOWN_CAP), - conditionsFromItem(EquipmentItemsME.GOBLIN_TOWN_CAP)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_CROSSBONES_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL) + .unlockedBy(getHasName(EquipmentItemsME.GOBLIN_TOWN_CAP), + has(EquipmentItemsME.GOBLIN_TOWN_CAP)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_CROSSBONES_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL) .input(Items.BONE) .input(EquipmentItemsME.GOBLIN_TOWN_CAP) .input(Items.BONE) .input(Items.BONE) .input(Items.BONE) - .criterion(hasItem(EquipmentItemsME.GOBLIN_TOWN_CAP), - conditionsFromItem(EquipmentItemsME.GOBLIN_TOWN_CAP)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.GOBLIN_TOWN_CAP), + has(EquipmentItemsME.GOBLIN_TOWN_CAP)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_RIBCAGE.getDefaultStack(), "chestplate", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_RIBCAGE.getDefaultInstance(), "chestplate", DispositionType.EVIL) .input(Items.BONE) .input(Items.BONE) .input(Items.BONE) @@ -3660,10 +3651,10 @@ public void generate() { .input(Items.BONE) .input(Items.BONE) .input(Items.BONE) - .criterion(hasItem(Items.BONE), - conditionsFromItem(Items.BONE)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_BONE_STRAP.getDefaultStack(), "chestplate", DispositionType.EVIL) + .unlockedBy(getHasName(Items.BONE), + has(Items.BONE)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_BONE_STRAP.getDefaultInstance(), "chestplate", DispositionType.EVIL) .input(ResourceItemsME.FUR) .input(Items.BONE) .input(ResourceItemsME.FUR) @@ -3672,10 +3663,10 @@ public void generate() { .input(Items.BONE) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) - .criterion(hasItem(Items.BONE), - conditionsFromItem(Items.BONE)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_LOINCLOTH.getDefaultStack(), "leggings", DispositionType.EVIL) + .unlockedBy(getHasName(Items.BONE), + has(Items.BONE)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_LOINCLOTH.getDefaultInstance(), "leggings", DispositionType.EVIL) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) @@ -3683,73 +3674,73 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_SANDALS.getDefaultStack(), "boots", DispositionType.EVIL) + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_SANDALS.getDefaultInstance(), "boots", DispositionType.EVIL) .input(Items.STICK) .input(Items.STICK) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_NASAL_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_NASAL_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) - .criterion(hasItem(crudeArmorPlate.getItem()), - conditionsFromItem(crudeArmorPlate.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_MANDIBLE_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) + .unlockedBy(getHasName(crudeArmorPlate.getItem()), + has(crudeArmorPlate.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_MANDIBLE_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) - .criterion(hasItem(crudeArmorPlate.getItem()), - conditionsFromItem(crudeArmorPlate.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_HEAVY_NASAL_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) + .unlockedBy(getHasName(crudeArmorPlate.getItem()), + has(crudeArmorPlate.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_HEAVY_NASAL_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) .input(ResourceItemsME.CRUDE_NUGGET) .input(EquipmentItemsME.GOBLIN_TOWN_NASAL_HELMET) .input(ResourceItemsME.CRUDE_NUGGET) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) - .criterion(hasItem(EquipmentItemsME.GOBLIN_TOWN_NASAL_HELMET), - conditionsFromItem(EquipmentItemsME.GOBLIN_TOWN_NASAL_HELMET)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_SKULKER_GUARD_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) + .unlockedBy(getHasName(EquipmentItemsME.GOBLIN_TOWN_NASAL_HELMET), + has(EquipmentItemsME.GOBLIN_TOWN_NASAL_HELMET)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_SKULKER_GUARD_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) .input(ResourceItemsME.CRUDE_INGOT) .input(EquipmentItemsME.GOBLIN_TOWN_NASAL_HELMET) .input(ResourceItemsME.CRUDE_INGOT) .input(ResourceItemsME.CRUDE_NUGGET) .input(ResourceItemsME.CRUDE_NUGGET) - .criterion(hasItem(EquipmentItemsME.GOBLIN_TOWN_NASAL_HELMET), - conditionsFromItem(EquipmentItemsME.GOBLIN_TOWN_NASAL_HELMET)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.GOBLIN_TOWN_NASAL_HELMET), + has(EquipmentItemsME.GOBLIN_TOWN_NASAL_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_SKULL_CAP.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_SKULL_CAP.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) .input(Items.SKELETON_SKULL) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) .input(Items.BONE) .input(Items.BONE) - .criterion(hasItem(Items.SKELETON_SKULL), - conditionsFromItem(Items.SKELETON_SKULL)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_TUNNELER_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) + .unlockedBy(getHasName(Items.SKELETON_SKULL), + has(Items.SKELETON_SKULL)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_TUNNELER_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) .input(Items.CANDLE) .input(EquipmentItemsME.GOBLIN_TOWN_NASAL_HELMET) .input(Items.CANDLE) - .criterion(hasItem(EquipmentItemsME.GOBLIN_TOWN_NASAL_HELMET), - conditionsFromItem(EquipmentItemsME.GOBLIN_TOWN_NASAL_HELMET)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.GOBLIN_TOWN_NASAL_HELMET), + has(EquipmentItemsME.GOBLIN_TOWN_NASAL_HELMET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_BONE_SCALE_COAT.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_BONE_SCALE_COAT.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T2) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(Items.BONE) @@ -3758,22 +3749,22 @@ public void generate() { .input(Items.LEATHER) .input(ResourceItemsME.CRUDE_NUGGET) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.CRUDE_NUGGET), - conditionsFromItem(ResourceItemsME.CRUDE_NUGGET)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_CRUDE_SCALE_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_NUGGET), + has(ResourceItemsME.CRUDE_NUGGET)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_CRUDE_SCALE_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) .input(Items.BONE) .input(Items.BONE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ResourceItemsME.CRUDE_NUGGET), - conditionsFromItem(ResourceItemsME.CRUDE_NUGGET)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_CARAPACE_HARNESS.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T2) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .input(Items.LEATHER) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_NUGGET), + has(ResourceItemsME.CRUDE_NUGGET)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_CARAPACE_HARNESS.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T2) .input(Items.BONE) .input(Items.BONE) .input(ResourceItemsME.FUR) @@ -3782,11 +3773,11 @@ public void generate() { .input(Items.LEATHER) .input(ResourceItemsME.CRUDE_NUGGET) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.CRUDE_NUGGET), - conditionsFromItem(ResourceItemsME.CRUDE_NUGGET)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.CRUDE_NUGGET), + has(ResourceItemsME.CRUDE_NUGGET)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_LEATHER_SKIRT.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_LEATHER_SKIRT.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) @@ -3794,24 +3785,24 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_BELLY_PLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_BELLY_PLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) .input(Items.BONE) .input(ResourceItemsME.FUR) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeArmorPlate.getItem()), crudeArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, crudeArmorPlate.getComponents(), crudeArmorPlate.getItem())) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(crudeArmorPlate.getItem()), - conditionsFromItem(crudeArmorPlate.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_REINFORCED_CARAPACE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) + .unlockedBy(getHasName(crudeArmorPlate.getItem()), + has(crudeArmorPlate.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GOBLIN_TOWN_REINFORCED_CARAPACE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) .input(Items.LEATHER) .input(Items.BONE) .input(ResourceItemsME.CRUDE_INGOT) @@ -3820,9 +3811,9 @@ public void generate() { .input(Items.LEATHER) .input(Items.BONE) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.GOBLIN_TOWN_CARAPACE_HARNESS), - conditionsFromItem(EquipmentItemsME.GOBLIN_TOWN_CARAPACE_HARNESS)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.GOBLIN_TOWN_CARAPACE_HARNESS), + has(EquipmentItemsME.GOBLIN_TOWN_CARAPACE_HARNESS)) + .save(output); //endregion for(ArmorTags.RecipeItem recipe : ArmorTags.heavyHelmets) { @@ -3854,38 +3845,38 @@ public void generate() { if(recipe.noble()) { if(recipe.disposition().equals(DispositionType.GOOD)) { - lowerIngredient = Items.GOLD_INGOT.getDefaultStack(); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, recipe.output().getDefaultStack(), "helmet", recipe.disposition(), XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(mainIngredient.getItem()), mainIngredient.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(helmetIngredient.getItem()), helmetIngredient.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(mainIngredient.getItem()), mainIngredient.getComponentChanges())) + lowerIngredient = Items.GOLD_INGOT.getDefaultInstance(); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, recipe.output().getDefaultInstance(), "helmet", recipe.disposition(), XP_T5) + .componentInput(DataComponentIngredient.of(false, mainIngredient.getComponents(), mainIngredient.getItem())) + .componentInput(DataComponentIngredient.of(false, helmetIngredient.getComponents(), helmetIngredient.getItem())) + .componentInput(DataComponentIngredient.of(false, mainIngredient.getComponents(), mainIngredient.getItem())) .input(lowerIngredient.getItem()) .input(lowerIngredient.getItem()) - .criterion(hasItem(lowerIngredient.getItem()), - conditionsFromItem(lowerIngredient.getItem())) - .offerTo(exporter); + .unlockedBy(getHasName(lowerIngredient.getItem()), + has(lowerIngredient.getItem())) + .save(output); } else { lowerIngredient = silverArmorPlate; - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, recipe.output().getDefaultStack(), "helmet", recipe.disposition(), XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(mainIngredient.getItem()), mainIngredient.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(helmetIngredient.getItem()), helmetIngredient.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(mainIngredient.getItem()), mainIngredient.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(lowerIngredient.getItem()), lowerIngredient.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(lowerIngredient.getItem()), lowerIngredient.getComponentChanges())) - .criterion(hasItem(lowerIngredient.getItem()), - conditionsFromItem(lowerIngredient.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, recipe.output().getDefaultInstance(), "helmet", recipe.disposition(), XP_T5) + .componentInput(DataComponentIngredient.of(false, mainIngredient.getComponents(), mainIngredient.getItem())) + .componentInput(DataComponentIngredient.of(false, helmetIngredient.getComponents(), helmetIngredient.getItem())) + .componentInput(DataComponentIngredient.of(false, mainIngredient.getComponents(), mainIngredient.getItem())) + .componentInput(DataComponentIngredient.of(false, lowerIngredient.getComponents(), lowerIngredient.getItem())) + .componentInput(DataComponentIngredient.of(false, lowerIngredient.getComponents(), lowerIngredient.getItem())) + .unlockedBy(getHasName(lowerIngredient.getItem()), + has(lowerIngredient.getItem())) + .save(output); } } else { - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, recipe.output().getDefaultStack(), "helmet", recipe.disposition(), XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(mainIngredient.getItem()), mainIngredient.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(helmetIngredient.getItem()), helmetIngredient.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(mainIngredient.getItem()), mainIngredient.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(lowerIngredient.getItem()), lowerIngredient.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(lowerIngredient.getItem()), lowerIngredient.getComponentChanges())) - .criterion(hasItem(lowerIngredient.getItem()), - conditionsFromItem(lowerIngredient.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, recipe.output().getDefaultInstance(), "helmet", recipe.disposition(), XP_T5) + .componentInput(DataComponentIngredient.of(false, mainIngredient.getComponents(), mainIngredient.getItem())) + .componentInput(DataComponentIngredient.of(false, helmetIngredient.getComponents(), helmetIngredient.getItem())) + .componentInput(DataComponentIngredient.of(false, mainIngredient.getComponents(), mainIngredient.getItem())) + .componentInput(DataComponentIngredient.of(false, lowerIngredient.getComponents(), lowerIngredient.getItem())) + .componentInput(DataComponentIngredient.of(false, lowerIngredient.getComponents(), lowerIngredient.getItem())) + .unlockedBy(getHasName(lowerIngredient.getItem()), + has(lowerIngredient.getItem())) + .save(output); } } @@ -3899,40 +3890,38 @@ public void generate() { }; if(recipe.noble()) { if(recipe.disposition().equals(DispositionType.GOOD)) { - upperIngredient = Items.GOLD_INGOT.getDefaultStack(); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, recipe.output().getDefaultStack(), "boots", recipe.disposition(), XP_T5) + upperIngredient = Items.GOLD_INGOT.getDefaultInstance(); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, recipe.output().getDefaultInstance(), "boots", recipe.disposition(), XP_T5) .input(upperIngredient.getItem()) .input(upperIngredient.getItem()) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(mainIngredient.getItem()), mainIngredient.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(mainIngredient.getItem()), mainIngredient.getComponentChanges())) - .criterion(hasItem(upperIngredient.getItem()), - conditionsFromItem(upperIngredient.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, mainIngredient.getComponents(), mainIngredient.getItem())) + .componentInput(DataComponentIngredient.of(false, mainIngredient.getComponents(), mainIngredient.getItem())) + .unlockedBy(getHasName(upperIngredient.getItem()), + has(upperIngredient.getItem())) + .save(output); } else { upperIngredient = silverArmorPlate; - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, recipe.output().getDefaultStack(), "boots", recipe.disposition(), XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(upperIngredient.getItem()), upperIngredient.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(upperIngredient.getItem()), upperIngredient.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(mainIngredient.getItem()), mainIngredient.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(mainIngredient.getItem()), mainIngredient.getComponentChanges())) - .criterion(hasItem(upperIngredient.getItem()), - conditionsFromItem(upperIngredient.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, recipe.output().getDefaultInstance(), "boots", recipe.disposition(), XP_T5) + .componentInput(DataComponentIngredient.of(false, upperIngredient.getComponents(), upperIngredient.getItem())) + .componentInput(DataComponentIngredient.of(false, upperIngredient.getComponents(), upperIngredient.getItem())) + .componentInput(DataComponentIngredient.of(false, mainIngredient.getComponents(), mainIngredient.getItem())) + .componentInput(DataComponentIngredient.of(false, mainIngredient.getComponents(), mainIngredient.getItem())) + .unlockedBy(getHasName(upperIngredient.getItem()), + has(upperIngredient.getItem())) + .save(output); } } else { upperIngredient = mainIngredient; - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, recipe.output().getDefaultStack(), "boots", recipe.disposition(), XP_T5) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(upperIngredient.getItem()), upperIngredient.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(upperIngredient.getItem()), upperIngredient.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(mainIngredient.getItem()), mainIngredient.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(mainIngredient.getItem()), mainIngredient.getComponentChanges())) - .criterion(hasItem(upperIngredient.getItem()), - conditionsFromItem(upperIngredient.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, recipe.output().getDefaultInstance(), "boots", recipe.disposition(), XP_T5) + .componentInput(DataComponentIngredient.of(false, upperIngredient.getComponents(), upperIngredient.getItem())) + .componentInput(DataComponentIngredient.of(false, upperIngredient.getComponents(), upperIngredient.getItem())) + .componentInput(DataComponentIngredient.of(false, mainIngredient.getComponents(), mainIngredient.getItem())) + .componentInput(DataComponentIngredient.of(false, mainIngredient.getComponents(), mainIngredient.getItem())) + .unlockedBy(getHasName(upperIngredient.getItem()), + has(upperIngredient.getItem())) + .save(output); } } //endregion - } - }; } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/ArtisanTableGenericArmorRecipeProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/ArtisanTableGenericArmorRecipeProvider.java index 3c77988466..d23153a336 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/ArtisanTableGenericArmorRecipeProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/ArtisanTableGenericArmorRecipeProvider.java @@ -1,27 +1,29 @@ package net.sevenstars.middleearth.datageneration.providers.recipes; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.impl.recipe.ingredient.builtin.ComponentsIngredient; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.data.recipe.RecipeExporter; -import net.minecraft.data.recipe.RecipeGenerator; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.equipment.trim.ArmorTrim; -import net.minecraft.item.equipment.trim.ArmorTrimMaterial; -import net.minecraft.item.equipment.trim.ArmorTrimPattern; -import net.minecraft.recipe.Ingredient; -import net.minecraft.recipe.book.RecipeCategory; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.util.Identifier; +import net.neoforged.neoforge.common.crafting.DataComponentIngredient; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.PackOutput; +import net.minecraft.data.recipes.RecipeCategory; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.data.recipes.RecipeProvider; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.armortrim.ArmorTrim; +import net.minecraft.world.item.armortrim.TrimMaterial; +import net.minecraft.world.item.armortrim.TrimPattern; import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.middleearth.block.registration.ModNatureBlocks; import net.sevenstars.middleearth.block.registration.WoodBlockSets; import net.sevenstars.middleearth.block.special.forge.MetalTypes; +import net.sevenstars.middleearth.datageneration.content.tags.ArmorTags; import net.sevenstars.middleearth.datageneration.custom.ArtisanTableRecipeJsonBuilder; import net.sevenstars.middleearth.item.EquipmentItemsME; import net.sevenstars.middleearth.item.ResourceItemsME; @@ -34,246 +36,233 @@ public class ArtisanTableGenericArmorRecipeProvider extends RecipeProvider { private static final int XP_T2 = 1; private static final int XP_T3 = 4; private static final int XP_T4 = 9; - private final CompletableFuture registryLookup; + private final CompletableFuture registryLookup; - public ArtisanTableGenericArmorRecipeProvider(FabricDataOutput output, CompletableFuture registriesFuture) { + public ArtisanTableGenericArmorRecipeProvider(PackOutput output, CompletableFuture registriesFuture) { super(output, registriesFuture); this.registryLookup = registriesFuture; } - @Override - public String getName() { - return "ArtisanTableGenericArmorRecipes"; - } - - public RegistryWrapper.Impl getArmorTrimMaterialsRegistry(){ - RegistryWrapper.Impl armorTrimMaterialsRegistry; + public HolderLookup.RegistryLookup getArmorTrimMaterialsRegistry(){ + HolderLookup.RegistryLookup armorTrimMaterialsRegistry; try { - armorTrimMaterialsRegistry = this.registryLookup.get().getOrThrow(RegistryKeys.TRIM_MATERIAL); + armorTrimMaterialsRegistry = this.registryLookup.get().lookupOrThrow(Registries.TRIM_MATERIAL); } catch (Exception ignored) { throw new IllegalStateException("Data generation without registries failed!"); } return armorTrimMaterialsRegistry; } - public RegistryWrapper.Impl getArmorTrimPatternsRegistry(){ - RegistryWrapper.Impl armorTrimPatternsRegistry; + public HolderLookup.RegistryLookup getArmorTrimPatternsRegistry(){ + HolderLookup.RegistryLookup armorTrimPatternsRegistry; try { - armorTrimPatternsRegistry = this.registryLookup.get().getOrThrow(RegistryKeys.TRIM_PATTERN); + armorTrimPatternsRegistry = this.registryLookup.get().lookupOrThrow(Registries.TRIM_PATTERN); } catch (Exception ignored) { throw new IllegalStateException("Data generation without registries failed!"); } return armorTrimPatternsRegistry; } - public RegistryEntry getPattern(){ + public Holder getPattern(){ return getArmorTrimPatternsRegistry().getOrThrow(SmithingTrimPatternsME.SMITHING_PART); } - public Identifier getMetalIdentifier(MetalTypes metal){ + public ResourceLocation getMetalIdentifier(MetalTypes metal){ if (metal.isVanilla()){ - return Identifier.of(metal.getName()); + return ResourceLocation.parse(metal.getName()); } else { - return Identifier.of(MiddleEarth.MOD_ID, metal.getName()); + return ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, metal.getName()); } } @Override - protected RecipeGenerator getRecipeGenerator(RegistryWrapper.WrapperLookup wrapperLookup, RecipeExporter recipeExporter) { + protected void buildRecipes(RecipeOutput output, HolderLookup.Provider registries) { ItemStack goldArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - goldArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.GOLD.getName()))), getPattern())); + goldArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.GOLD.getName()))), getPattern())); ItemStack silverArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - silverArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.SILVER.getName()))), getPattern())); + silverArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.SILVER.getName()))), getPattern())); ItemStack bronzeChainmail = new ItemStack(ResourceItemsME.MAIL); - bronzeChainmail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.BRONZE.getName()))), getPattern())); + bronzeChainmail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.BRONZE.getName()))), getPattern())); ItemStack crudeChainmail = new ItemStack(ResourceItemsME.MAIL); - crudeChainmail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.CRUDE.getName()))), getPattern())); + crudeChainmail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.CRUDE.getName()))), getPattern())); ItemStack steelArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - steelArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); + steelArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); ItemStack steelHelmetPlate = new ItemStack(ResourceItemsME.HELMET_PLATE); - steelHelmetPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); + steelHelmetPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); ItemStack steelChainmail = new ItemStack(ResourceItemsME.MAIL); - steelChainmail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); + steelChainmail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); ItemStack steelScaleMail = new ItemStack(ResourceItemsME.SCALE_MAIL); - steelScaleMail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); + steelScaleMail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); ItemStack edhelSteelArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - edhelSteelArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); + edhelSteelArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); ItemStack edhelSteelHelmetPlate = new ItemStack(ResourceItemsME.HELMET_PLATE); - edhelSteelHelmetPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); + edhelSteelHelmetPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); ItemStack edhelSteelChainmail = new ItemStack(ResourceItemsME.MAIL); - edhelSteelChainmail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); + edhelSteelChainmail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); ItemStack edhelSteelScaleMail = new ItemStack(ResourceItemsME.SCALE_MAIL); - edhelSteelScaleMail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); + edhelSteelScaleMail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); ItemStack khazadSteelArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - khazadSteelArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); + khazadSteelArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); ItemStack khazadSteelHelmetPlate = new ItemStack(ResourceItemsME.HELMET_PLATE); - khazadSteelHelmetPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); + khazadSteelHelmetPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); ItemStack khazadSteelChainmail = new ItemStack(ResourceItemsME.MAIL); - khazadSteelChainmail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); + khazadSteelChainmail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); ItemStack khazadSteelScaleMail = new ItemStack(ResourceItemsME.SCALE_MAIL); - khazadSteelScaleMail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); + khazadSteelScaleMail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); ItemStack burzumSteelArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - burzumSteelArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); + burzumSteelArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); ItemStack burzumSteelHelmetPlate = new ItemStack(ResourceItemsME.HELMET_PLATE); - burzumSteelHelmetPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); + burzumSteelHelmetPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); ItemStack burzumSteelChainmail = new ItemStack(ResourceItemsME.MAIL); - burzumSteelChainmail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); + burzumSteelChainmail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); ItemStack burzumSteelScaleMail = new ItemStack(ResourceItemsME.SCALE_MAIL); - burzumSteelScaleMail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); + burzumSteelScaleMail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); ItemStack ironArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - ironArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.IRON.getName()))), getPattern())); + ironArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.IRON.getName()))), getPattern())); ItemStack ironHelmetPlate = new ItemStack(ResourceItemsME.HELMET_PLATE); - ironHelmetPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.IRON.getName()))), getPattern())); + ironHelmetPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.IRON.getName()))), getPattern())); ItemStack ironChainmail = new ItemStack(ResourceItemsME.MAIL); - ironChainmail.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.IRON.getName()))), getPattern())); + ironChainmail.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.IRON.getName()))), getPattern())); ItemStack bronzeArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - bronzeArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.BRONZE.getName()))), getPattern())); + bronzeArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.BRONZE.getName()))), getPattern())); ItemStack crudeArmorPlate = new ItemStack(ResourceItemsME.ARMOR_PLATE); - crudeArmorPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.CRUDE.getName()))), getPattern())); + crudeArmorPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.CRUDE.getName()))), getPattern())); - return new RecipeGenerator(wrapperLookup, recipeExporter) { - @Override - public void generate() { - RegistryWrapper.Impl itemLookup = registries.getOrThrow(RegistryKeys.ITEM); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.SHIRRIFF_HAT.getDefaultStack(), "hat", DispositionType.GOOD) + HolderLookup.RegistryLookup itemLookup = registries.lookupOrThrow(Registries.ITEM); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.SHIRRIFF_HAT.getDefaultInstance(), "hat", DispositionType.GOOD) .input(Items.STRING) .input(Items.LEATHER) .input(Items.FEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); //region GENERIC //T1 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BAGGY_HAT.getDefaultStack(), "hat", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BAGGY_HAT.getDefaultInstance(), "hat", DispositionType.NEUTRAL) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.CHAPERON.getDefaultStack(), "hat", DispositionType.NEUTRAL) + .unlockedBy(getHasName(Items.LEATHER), has(Items.LEATHER)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.CHAPERON.getDefaultInstance(), "hat", DispositionType.NEUTRAL) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GLASSES.getDefaultStack(), "hat", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GLASSES.getDefaultInstance(), "hat", DispositionType.NEUTRAL) .input(ResourceItemsME.BRONZE_NUGGET) .input(ResourceItemsME.BRONZE_INGOT) .input(ResourceItemsME.BRONZE_NUGGET) .input(Items.GLASS) .input(Items.GLASS) - .criterion(hasItem(ResourceItemsME.BRONZE_INGOT), - conditionsFromItem(ResourceItemsME.BRONZE_INGOT)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_MONOCLE.getDefaultStack(), "hat", DispositionType.GOOD) + .unlockedBy(getHasName(ResourceItemsME.BRONZE_INGOT), has(ResourceItemsME.BRONZE_INGOT)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_MONOCLE.getDefaultInstance(), "hat", DispositionType.GOOD) .input(ResourceItemsME.BRONZE_NUGGET) .input(ResourceItemsME.BRONZE_INGOT) .input(Items.LEATHER) .input(Items.GLASS) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.BRONZE_INGOT), - conditionsFromItem(ResourceItemsME.BRONZE_INGOT)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.BRONZE_INGOT), has(ResourceItemsME.BRONZE_INGOT)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.STRAW_HAT.getDefaultStack(), "hat", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.STRAW_HAT.getDefaultInstance(), "hat", DispositionType.NEUTRAL) .input(Items.STRING) .input(ResourceItemsME.STRAW) .input(Items.STRING) .input(ResourceItemsME.STRAW) .input(ResourceItemsME.STRAW) - .criterion(hasItem(ResourceItemsME.STRAW), - conditionsFromItem(ResourceItemsME.STRAW)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.STRAW), + has(ResourceItemsME.STRAW)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOVEN_HAT.getDefaultStack(), "hat", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WOVEN_HAT.getDefaultInstance(), "hat", DispositionType.NEUTRAL) .input(Items.STRING) .input(Items.WHITE_WOOL) .input(Items.STRING) .input(Items.STRING) .input(Items.STRING) - .criterion(hasItem(Items.WHITE_WOOL), - conditionsFromItem(Items.WHITE_WOOL)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.WHITE_WOOL), + has(Items.WHITE_WOOL)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BYCOCKET.getDefaultStack(), "hat", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BYCOCKET.getDefaultInstance(), "hat", DispositionType.NEUTRAL) .input(Items.LEATHER) .input(Items.WHITE_WOOL) .input(Items.LEATHER) .input(Items.STRING) .input(Items.STRING) - .criterion(hasItem(Items.WHITE_WOOL), - conditionsFromItem(Items.WHITE_WOOL)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.WHITE_WOOL), + has(Items.WHITE_WOOL)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BEEKEEPER_MASK.getDefaultStack(), "hat", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BEEKEEPER_MASK.getDefaultInstance(), "hat", DispositionType.NEUTRAL) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.STRAW) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WANDERER_HAT.getDefaultStack(), "hat", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WANDERER_HAT.getDefaultInstance(), "hat", DispositionType.NEUTRAL) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ARMING_COAT.getDefaultStack(), "chestplate", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ARMING_COAT.getDefaultInstance(), "chestplate", DispositionType.NEUTRAL) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) @@ -282,11 +271,11 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ARMING_SKIRT.getDefaultStack(), "leggings", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ARMING_SKIRT.getDefaultInstance(), "leggings", DispositionType.NEUTRAL) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) @@ -294,70 +283,70 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.SHOES.getDefaultStack(), "boots", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.SHOES.getDefaultInstance(), "boots", DispositionType.NEUTRAL) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WORK_SHOES.getDefaultStack(), "boots", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WORK_SHOES.getDefaultInstance(), "boots", DispositionType.NEUTRAL) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); //T2 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LEATHER_SKULLCAP.getDefaultStack(), "helmet", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LEATHER_SKULLCAP.getDefaultInstance(), "helmet", DispositionType.NEUTRAL) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GAMBESON_CAP.getDefaultStack(), "helmet", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GAMBESON_CAP.getDefaultInstance(), "helmet", DispositionType.NEUTRAL) .input(Items.LEATHER) .input(Items.WHITE_WOOL) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GAMBESON_COWL.getDefaultStack(), "helmet", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GAMBESON_COWL.getDefaultInstance(), "helmet", DispositionType.NEUTRAL) .input(Items.LEATHER) .input(Items.WHITE_WOOL) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.KETTLE_HAT.getDefaultStack(), "helmet", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.KETTLE_HAT.getDefaultInstance(), "helmet", DispositionType.NEUTRAL) .input(Items.IRON_NUGGET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) .input(Items.IRON_NUGGET) .input(Items.IRON_NUGGET) .input(Items.IRON_NUGGET) - .criterion(hasItem(ironArmorPlate.getItem()), - conditionsFromItem(ironArmorPlate.getItem())) - .offerTo(exporter); + .unlockedBy(getHasName(ironArmorPlate.getItem()), + has(ironArmorPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GAMBESON.getDefaultStack(), "chestplate", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GAMBESON.getDefaultInstance(), "chestplate", DispositionType.NEUTRAL) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) @@ -366,11 +355,11 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACKSMITH_APRON.getDefaultStack(), "chestplate", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACKSMITH_APRON.getDefaultInstance(), "chestplate", DispositionType.NEUTRAL) .input(Items.STRING) .input(Items.STRING) .input(ResourceItemsME.TIN_NUGGET) @@ -379,11 +368,10 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LEATHER_VEST.getDefaultStack(), "chestplate", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LEATHER_VEST.getDefaultInstance(), "chestplate", DispositionType.NEUTRAL) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) @@ -392,11 +380,11 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LEATHER_SCALE_VEST.getDefaultStack(), "chestplate", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LEATHER_SCALE_VEST.getDefaultInstance(), "chestplate", DispositionType.NEUTRAL) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) @@ -405,227 +393,227 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.STURDY_BOOTS.getDefaultStack(), "boots", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.STURDY_BOOTS.getDefaultInstance(), "boots", DispositionType.NEUTRAL) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.TRAVELLING_BOOTS.getDefaultStack(), "boots", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.TRAVELLING_BOOTS.getDefaultInstance(), "boots", DispositionType.NEUTRAL) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.HIGH_CUT_BOOTS.getDefaultStack(), "boots", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.HIGH_CUT_BOOTS.getDefaultInstance(), "boots", DispositionType.NEUTRAL) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); //T3 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.COOKING_POT_HELMET.getDefaultStack(), "helmet", DispositionType.NEUTRAL, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.COOKING_POT_HELMET.getDefaultInstance(), "helmet", DispositionType.NEUTRAL, XP_T3) .input(Items.IRON_INGOT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) .input(Items.IRON_INGOT) .input(Items.IRON_NUGGET) .input(Items.IRON_NUGGET) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MAIL_COIF.getDefaultStack(), "helmet", DispositionType.NEUTRAL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.CLOSED_MAIL_COIF.getDefaultStack(), "helmet", DispositionType.NEUTRAL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.KETTLE_HAT_WITH_COIF.getDefaultStack(), "helmet", DispositionType.NEUTRAL, XP_T3) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MAIL_COIF.getDefaultInstance(), "helmet", DispositionType.NEUTRAL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.CLOSED_MAIL_COIF.getDefaultInstance(), "helmet", DispositionType.NEUTRAL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.KETTLE_HAT_WITH_COIF.getDefaultInstance(), "helmet", DispositionType.NEUTRAL, XP_T3) .input(EquipmentItemsME.MAIL_COIF) .input(EquipmentItemsME.KETTLE_HAT) - .criterion(hasItem(EquipmentItemsME.MAIL_COIF), - conditionsFromItem(EquipmentItemsME.MAIL_COIF)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.MAIL_COIF), + has(EquipmentItemsME.MAIL_COIF)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.KETTLE_HAT_WITH_CLOSED_COIF.getDefaultStack(), "helmet", DispositionType.NEUTRAL, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.KETTLE_HAT_WITH_CLOSED_COIF.getDefaultInstance(), "helmet", DispositionType.NEUTRAL, XP_T3) .input(EquipmentItemsME.CLOSED_MAIL_COIF) .input(EquipmentItemsME.KETTLE_HAT) - .criterion(hasItem(EquipmentItemsME.CLOSED_MAIL_COIF), - conditionsFromItem(EquipmentItemsME.CLOSED_MAIL_COIF)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.OPEN_FACE_HELMET.getDefaultStack(), "helmet", DispositionType.NEUTRAL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WINGED_HELMET.getDefaultStack(), "helmet", DispositionType.NEUTRAL, XP_T3) - .input(TagKey.of(RegistryKeys.ITEM, MiddleEarth.of("feathers"))) + .unlockedBy(getHasName(EquipmentItemsME.CLOSED_MAIL_COIF), + has(EquipmentItemsME.CLOSED_MAIL_COIF)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.OPEN_FACE_HELMET.getDefaultInstance(), "helmet", DispositionType.NEUTRAL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WINGED_HELMET.getDefaultInstance(), "helmet", DispositionType.NEUTRAL, XP_T3) + .input(TagKey.create(Registries.ITEM, MiddleEarth.of("feathers"))) .input(EquipmentItemsME.OPEN_FACE_HELMET) - .input(TagKey.of(RegistryKeys.ITEM, MiddleEarth.of("feathers"))) - .criterion(hasItem(EquipmentItemsME.OPEN_FACE_HELMET), - conditionsFromItem(EquipmentItemsME.OPEN_FACE_HELMET)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.NEUTRAL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MAIL_SHIRT.getDefaultStack(), "chestplate", DispositionType.NEUTRAL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MAIL_SKIRT.getDefaultStack(), "leggings", DispositionType.NEUTRAL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + .input(TagKey.create(Registries.ITEM, MiddleEarth.of("feathers"))) + .unlockedBy(getHasName(EquipmentItemsME.OPEN_FACE_HELMET), + has(EquipmentItemsME.OPEN_FACE_HELMET)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.NEUTRAL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MAIL_SHIRT.getDefaultInstance(), "chestplate", DispositionType.NEUTRAL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MAIL_SKIRT.getDefaultInstance(), "leggings", DispositionType.NEUTRAL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); //T4 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.SALLET.getDefaultStack(), "helmet", DispositionType.NEUTRAL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelHelmetPlate.getItem()), steelHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelScaleMail.getItem()), steelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(steelHelmetPlate.getItem()), - conditionsFromItem(steelHelmetPlate.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.SALLET.getDefaultInstance(), "helmet", DispositionType.NEUTRAL, XP_T4) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelHelmetPlate.getComponents(), steelHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelScaleMail.getComponents(), steelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(steelHelmetPlate.getItem()), + has(steelHelmetPlate.getItem())) + .save(output); //HOODS - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.HOOD.getDefaultStack(), "helmet_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.HOOD.getDefaultInstance(), "helmet_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(Items.STRING) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.TALL_HOOD.getDefaultStack(), "helmet_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.TALL_HOOD.getDefaultInstance(), "helmet_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(Items.STRING) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACK_FUR_HOOD.getDefaultStack(), "helmet_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACK_FUR_HOOD.getDefaultInstance(), "helmet_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FUR) .input(EquipmentItemsME.HOOD) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(Items.STRING) .input(ResourceItemsME.FUR) - .criterion(hasItem(EquipmentItemsME.HOOD), - conditionsFromItem(EquipmentItemsME.HOOD)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.HOOD), + has(EquipmentItemsME.HOOD)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BROWN_FUR_HOOD.getDefaultStack(), "helmet_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BROWN_FUR_HOOD.getDefaultInstance(), "helmet_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FUR) .input(EquipmentItemsME.HOOD) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(Items.STRING) .input(ResourceItemsME.FUR) - .criterion(hasItem(EquipmentItemsME.HOOD), - conditionsFromItem(EquipmentItemsME.HOOD)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.HOOD), + has(EquipmentItemsME.HOOD)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GRAY_FUR_HOOD.getDefaultStack(), "helmet_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GRAY_FUR_HOOD.getDefaultInstance(), "helmet_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FUR) .input(EquipmentItemsME.HOOD) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(Items.STRING) .input(ResourceItemsME.FUR) - .criterion(hasItem(EquipmentItemsME.HOOD), - conditionsFromItem(EquipmentItemsME.HOOD)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.HOOD), + has(EquipmentItemsME.HOOD)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.TAN_FUR_HOOD.getDefaultStack(), "helmet_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.TAN_FUR_HOOD.getDefaultInstance(), "helmet_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FUR) .input(EquipmentItemsME.HOOD) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(Items.STRING) .input(ResourceItemsME.FUR) - .criterion(hasItem(EquipmentItemsME.HOOD), - conditionsFromItem(EquipmentItemsME.HOOD)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.HOOD), + has(EquipmentItemsME.HOOD)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WHITE_FUR_HOOD.getDefaultStack(), "helmet_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WHITE_FUR_HOOD.getDefaultInstance(), "helmet_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FUR) .input(EquipmentItemsME.HOOD) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(Items.STRING) .input(ResourceItemsME.FUR) - .criterion(hasItem(EquipmentItemsME.HOOD), - conditionsFromItem(EquipmentItemsME.HOOD)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.HOOD), + has(EquipmentItemsME.HOOD)) + .save(output); //CAPES - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.CAPE.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.CAPE.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FABRIC) .input(Items.STRING) .input(ResourceItemsME.FABRIC) @@ -635,29 +623,29 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.SHOULDER_CAPE_LEFT.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.SHOULDER_CAPE_LEFT.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FABRIC) .input(Items.STRING) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.SHOULDER_CAPE_RIGHT.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.SHOULDER_CAPE_RIGHT.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FABRIC) .input(Items.STRING) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.SURCOAT.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.SURCOAT.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FABRIC) .input(Items.STRING) .input(ResourceItemsME.FABRIC) @@ -667,11 +655,11 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(Items.STRING) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.CLOAK.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.CLOAK.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FABRIC) .input(Items.STRING) .input(ResourceItemsME.FABRIC) @@ -681,11 +669,11 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WANDERER_ROBES.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WANDERER_ROBES.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) @@ -695,37 +683,37 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LEAF_CAPE.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("leaves"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LEAF_CAPE.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("leaves"))) .input(Items.STRING) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("leaves"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("leaves"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("leaves"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("leaves"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("leaves"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("leaves"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("leaves"))) - .criterion(hasItem(Items.STRING), - conditionsFromItem(Items.STRING)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LEAF_LITTER_CAPE.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) - .input(Items.LEAF_LITTER) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("leaves"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("leaves"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("leaves"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("leaves"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("leaves"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("leaves"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("leaves"))) + .unlockedBy(getHasName(Items.STRING), + has(Items.STRING)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LEAF_LITTER_CAPE.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) + .input(ModNatureBlocks.LEAF_LITTER) .input(Items.STRING) - .input(Items.LEAF_LITTER) - .input(Items.LEAF_LITTER) - .input(Items.LEAF_LITTER) - .input(Items.LEAF_LITTER) - .input(Items.LEAF_LITTER) - .input(Items.LEAF_LITTER) - .input(Items.LEAF_LITTER) - .criterion(hasItem(Items.LEAF_LITTER), - conditionsFromItem(Items.LEAF_LITTER)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MIRK_LEAF_CAPE.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + .input(ModNatureBlocks.LEAF_LITTER) + .input(ModNatureBlocks.LEAF_LITTER) + .input(ModNatureBlocks.LEAF_LITTER) + .input(ModNatureBlocks.LEAF_LITTER) + .input(ModNatureBlocks.LEAF_LITTER) + .input(ModNatureBlocks.LEAF_LITTER) + .input(ModNatureBlocks.LEAF_LITTER) + .unlockedBy(getHasName(ModNatureBlocks.LEAF_LITTER), + has(ModNatureBlocks.LEAF_LITTER)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MIRK_LEAF_CAPE.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(WoodBlockSets.MIRKWOOD_SET.leaves) .input(Items.STRING) .input(WoodBlockSets.MIRKWOOD_SET.leaves) @@ -735,10 +723,10 @@ public void generate() { .input(WoodBlockSets.MIRKWOOD_SET.leaves) .input(WoodBlockSets.MIRKWOOD_SET.leaves) .input(WoodBlockSets.MIRKWOOD_SET.leaves) - .criterion(hasItem(WoodBlockSets.MIRKWOOD_SET.leaves), - conditionsFromItem(WoodBlockSets.MIRKWOOD_SET.leaves)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MIRK_BARK_CAPE.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + .unlockedBy(getHasName(WoodBlockSets.MIRKWOOD_SET.leaves), + has(WoodBlockSets.MIRKWOOD_SET.leaves)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.MIRK_BARK_CAPE.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(WoodBlockSets.MIRKWOOD_SET.logBlocks.log()) .input(Items.STRING) .input(WoodBlockSets.MIRKWOOD_SET.logBlocks.log()) @@ -748,138 +736,138 @@ public void generate() { .input(WoodBlockSets.MIRKWOOD_SET.logBlocks.log()) .input(WoodBlockSets.MIRKWOOD_SET.logBlocks.log()) .input(WoodBlockSets.MIRKWOOD_SET.logBlocks.log()) - .criterion(hasItem(WoodBlockSets.MIRKWOOD_SET.logBlocks.log()), - conditionsFromItem(WoodBlockSets.MIRKWOOD_SET.logBlocks.log())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.AUTUMN_LEAF_CAPE.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) - .input(TagKey.of(RegistryKeys.ITEM, MiddleEarth.of("autumn_leaves"))) - .input(Items.STRING) - .input(TagKey.of(RegistryKeys.ITEM, MiddleEarth.of("autumn_leaves"))) - .input(TagKey.of(RegistryKeys.ITEM, MiddleEarth.of("autumn_leaves"))) - .input(TagKey.of(RegistryKeys.ITEM, MiddleEarth.of("autumn_leaves"))) - .input(TagKey.of(RegistryKeys.ITEM, MiddleEarth.of("autumn_leaves"))) - .input(TagKey.of(RegistryKeys.ITEM, MiddleEarth.of("autumn_leaves"))) - .input(TagKey.of(RegistryKeys.ITEM, MiddleEarth.of("autumn_leaves"))) - .input(TagKey.of(RegistryKeys.ITEM, MiddleEarth.of("autumn_leaves"))) - .criterion(hasItem(Items.STRING), - conditionsFromItem(Items.STRING)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACK_FUR_CLOAK.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + .unlockedBy(getHasName(WoodBlockSets.MIRKWOOD_SET.logBlocks.log()), + has(WoodBlockSets.MIRKWOOD_SET.logBlocks.log())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.AUTUMN_LEAF_CAPE.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) + .input(TagKey.create(Registries.ITEM, MiddleEarth.of("autumn_leaves"))) + .input(Items.STRING) + .input(TagKey.create(Registries.ITEM, MiddleEarth.of("autumn_leaves"))) + .input(TagKey.create(Registries.ITEM, MiddleEarth.of("autumn_leaves"))) + .input(TagKey.create(Registries.ITEM, MiddleEarth.of("autumn_leaves"))) + .input(TagKey.create(Registries.ITEM, MiddleEarth.of("autumn_leaves"))) + .input(TagKey.create(Registries.ITEM, MiddleEarth.of("autumn_leaves"))) + .input(TagKey.create(Registries.ITEM, MiddleEarth.of("autumn_leaves"))) + .input(TagKey.create(Registries.ITEM, MiddleEarth.of("autumn_leaves"))) + .unlockedBy(getHasName(Items.STRING), + has(Items.STRING)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACK_FUR_CLOAK.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(Items.STRING) .input(EquipmentItemsME.BLACK_FUR) .input(Items.STRING) .input(Items.STRING) .input(EquipmentItemsME.CLOAK) .input(Items.STRING) - .criterion(hasItem(EquipmentItemsME.CLOAK), - conditionsFromItem(EquipmentItemsME.CLOAK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.CLOAK), + has(EquipmentItemsME.CLOAK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BROWN_FUR_CLOAK.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BROWN_FUR_CLOAK.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(Items.STRING) .input(EquipmentItemsME.BROWN_FUR) .input(Items.STRING) .input(Items.STRING) .input(EquipmentItemsME.CLOAK) .input(Items.STRING) - .criterion(hasItem(EquipmentItemsME.CLOAK), - conditionsFromItem(EquipmentItemsME.CLOAK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.CLOAK), + has(EquipmentItemsME.CLOAK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GRAY_FUR_CLOAK.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GRAY_FUR_CLOAK.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(Items.STRING) .input(EquipmentItemsME.GRAY_FUR) .input(Items.STRING) .input(Items.STRING) .input(EquipmentItemsME.CLOAK) .input(Items.STRING) - .criterion(hasItem(EquipmentItemsME.CLOAK), - conditionsFromItem(EquipmentItemsME.CLOAK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.CLOAK), + has(EquipmentItemsME.CLOAK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.TAN_FUR_CLOAK.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.TAN_FUR_CLOAK.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(Items.STRING) .input(EquipmentItemsME.TAN_FUR) .input(Items.STRING) .input(Items.STRING) .input(EquipmentItemsME.CLOAK) .input(Items.STRING) - .criterion(hasItem(EquipmentItemsME.CLOAK), - conditionsFromItem(EquipmentItemsME.CLOAK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.CLOAK), + has(EquipmentItemsME.CLOAK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WHITE_FUR_CLOAK.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WHITE_FUR_CLOAK.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(Items.STRING) .input(EquipmentItemsME.WHITE_FUR) .input(Items.STRING) .input(Items.STRING) .input(EquipmentItemsME.CLOAK) .input(Items.STRING) - .criterion(hasItem(EquipmentItemsME.CLOAK), - conditionsFromItem(EquipmentItemsME.CLOAK)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.CLOAK), + has(EquipmentItemsME.CLOAK)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACK_FUR.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BLACK_FUR.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(Items.STRING) .input(ResourceItemsME.FUR) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BROWN_FUR.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BROWN_FUR.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(Items.STRING) .input(ResourceItemsME.FUR) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GRAY_FUR.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GRAY_FUR.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(Items.STRING) .input(ResourceItemsME.FUR) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.TAN_FUR.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.TAN_FUR.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(Items.STRING) .input(ResourceItemsME.FUR) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WHITE_FUR.getDefaultStack(), "back_attachment", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WHITE_FUR.getDefaultInstance(), "back_attachment", DispositionType.NEUTRAL) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(Items.STRING) .input(ResourceItemsME.FUR) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); //endregion //region ELVES //T1 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_ARMING_COAT.getDefaultStack(), "chestplate", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_ARMING_COAT.getDefaultInstance(), "chestplate", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) @@ -888,11 +876,11 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_ARMING_SKIRT.getDefaultStack(), "leggings", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_ARMING_SKIRT.getDefaultInstance(), "leggings", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) @@ -900,11 +888,11 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_OPEN_ARMING_SKIRT.getDefaultStack(), "leggings", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_OPEN_ARMING_SKIRT.getDefaultInstance(), "leggings", DispositionType.GOOD) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) @@ -912,154 +900,154 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); //T2 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_BOOTS.getDefaultStack(), "boots", DispositionType.GOOD, XP_T2) - .input(Items.LEATHER) - .input(Items.LEATHER) - .input(Items.LEATHER) - .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BRONZED_ELVEN_MAIL_COIF.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T2) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .criterion(hasItem(bronzeChainmail.getItem()), - conditionsFromItem(bronzeChainmail.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BRONZED_ELVEN_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T2) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .criterion(hasItem(bronzeChainmail.getItem()), - conditionsFromItem(bronzeChainmail.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BRONZED_ELVEN_MAIL_SKIRT.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T2) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeChainmail.getItem()), bronzeChainmail.getComponentChanges())) - .criterion(hasItem(bronzeChainmail.getItem()), - conditionsFromItem(bronzeChainmail.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_BOOTS.getDefaultInstance(), "boots", DispositionType.GOOD, XP_T2) + .input(Items.LEATHER) + .input(Items.LEATHER) + .input(Items.LEATHER) + .input(Items.LEATHER) + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BRONZED_ELVEN_MAIL_COIF.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T2) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .unlockedBy(getHasName(bronzeChainmail.getItem()), + has(bronzeChainmail.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BRONZED_ELVEN_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T2) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .unlockedBy(getHasName(bronzeChainmail.getItem()), + has(bronzeChainmail.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BRONZED_ELVEN_MAIL_SKIRT.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T2) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, bronzeChainmail.getComponents(), bronzeChainmail.getItem())) + .unlockedBy(getHasName(bronzeChainmail.getItem()), + has(bronzeChainmail.getItem())) + .save(output); //T3 - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_MAIL_COIF.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_MAIL_SKIRT.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BRONZED_ELVEN_PADDED_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_MAIL_COIF.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_MAIL_SKIRT.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BRONZED_ELVEN_PADDED_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) .input(ResourceItemsME.BRONZE_INGOT) .input(ResourceItemsME.BRONZE_INGOT) .input(Items.LEATHER) .input(EquipmentItemsME.BRONZED_ELVEN_MAIL_HAUBERK) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BRONZED_ELVEN_GORGET_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BRONZED_ELVEN_GORGET_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) .input(ResourceItemsME.BRONZE_INGOT) .input(ResourceItemsME.BRONZE_INGOT) .input(Items.LEATHER) .input(EquipmentItemsME.BRONZED_ELVEN_MAIL_HAUBERK) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_SILVER_PADDED_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_SILVER_PADDED_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) .input(ResourceItemsME.SILVER_NUGGET) .input(ResourceItemsME.SILVER_NUGGET) .input(Items.LEATHER) .input(EquipmentItemsME.BRONZED_ELVEN_MAIL_HAUBERK) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_SILVER_GORGET_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ELVEN_SILVER_GORGET_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) .input(ResourceItemsME.SILVER_NUGGET) .input(ResourceItemsME.SILVER_NUGGET) .input(Items.LEATHER) .input(EquipmentItemsME.BRONZED_ELVEN_MAIL_HAUBERK) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); //endregion //region DWARVES - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_MINER_HELMET.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_MINER_HELMET.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T2) .input(Items.CANDLE) .input(Items.LEATHER) .input(Items.CANDLE) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_GAMBESON.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_GAMBESON.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T2) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) @@ -1068,135 +1056,135 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_MAIL_COIF.getDefaultStack(), "helmet", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_MINER_GAMBESON.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T3) + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_MAIL_COIF.getDefaultInstance(), "helmet", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_MINER_GAMBESON.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T3) .input(EquipmentItemsME.DWARVEN_MAIL_HAUBERK) .input(EquipmentItemsME.DWARVEN_GAMBESON) - .criterion(hasItem(EquipmentItemsME.DWARVEN_MAIL_HAUBERK), - conditionsFromItem(EquipmentItemsME.DWARVEN_MAIL_HAUBERK)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_MAIL_COAT.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_MAIL_CHAUSSES.getDefaultStack(), "boots", DispositionType.GOOD, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_BOOTS.getDefaultStack(), "boots", DispositionType.GOOD, XP_T3) + .unlockedBy(getHasName(EquipmentItemsME.DWARVEN_MAIL_HAUBERK), + has(EquipmentItemsME.DWARVEN_MAIL_HAUBERK)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_MAIL_COAT.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_MAIL_CHAUSSES.getDefaultInstance(), "boots", DispositionType.GOOD, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_BOOTS.getDefaultInstance(), "boots", DispositionType.GOOD, XP_T3) .input(Items.IRON_INGOT) .input(Items.IRON_INGOT) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.IRON_INGOT), - conditionsFromItem(Items.IRON_INGOT)) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_SCALE_HAUBERK.getDefaultStack(), "chestplate", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .criterion(hasItem(khazadSteelScaleMail.getItem()), - conditionsFromItem(khazadSteelScaleMail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_SCALE_COAT.getDefaultStack(), "leggings", DispositionType.GOOD, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelScaleMail.getItem()), khazadSteelScaleMail.getComponentChanges())) - .criterion(hasItem(khazadSteelScaleMail.getItem()), - conditionsFromItem(khazadSteelScaleMail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_REINFORCED_BOOTS.getDefaultStack(), "boots", DispositionType.GOOD, XP_T4) + .unlockedBy(getHasName(Items.IRON_INGOT), + has(Items.IRON_INGOT)) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_SCALE_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .unlockedBy(getHasName(khazadSteelScaleMail.getItem()), + has(khazadSteelScaleMail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_SCALE_COAT.getDefaultInstance(), "leggings", DispositionType.GOOD, XP_T4) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelScaleMail.getComponents(), khazadSteelScaleMail.getItem())) + .unlockedBy(getHasName(khazadSteelScaleMail.getItem()), + has(khazadSteelScaleMail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DWARVEN_REINFORCED_BOOTS.getDefaultInstance(), "boots", DispositionType.GOOD, XP_T4) .input(ResourceItemsME.KHAZAD_STEEL_INGOT) .input(ResourceItemsME.KHAZAD_STEEL_INGOT) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.IRON_INGOT), - conditionsFromItem(Items.IRON_INGOT)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.IRON_INGOT), + has(Items.IRON_INGOT)) + .save(output); //endregion //region ORCS - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_LEATHER_STRAP.getDefaultStack(), "chestplate", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_LEATHER_STRAP.getDefaultInstance(), "chestplate", DispositionType.EVIL) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_SANDALS.getDefaultStack(), "boots", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_SANDALS.getDefaultInstance(), "boots", DispositionType.EVIL) .input(Items.STICK) .input(Items.STICK) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_ORCISH_MAIL_COIF.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T2) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_ORCISH_MAIL_COIF.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T2) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_LEATHER_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) @@ -1205,11 +1193,11 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_LEATHER_SCALE_VEST.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_LEATHER_SCALE_VEST.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) @@ -1218,38 +1206,38 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_ORCISH_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T2) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_ORCISH_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T2) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_ORCISH_MAIL_SHIRT.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T2) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_ORCISH_MAIL_SHIRT.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T2) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_LEATHER_SKIRT.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_LEATHER_SKIRT.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T2) .input(ResourceItemsME.FUR) .input(Items.LEATHER) .input(ResourceItemsME.FUR) @@ -1257,10 +1245,10 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_STRIP_LEATHER_SKIRT.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T2) + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_STRIP_LEATHER_SKIRT.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) @@ -1268,11 +1256,11 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_LEG_BRACER.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_LEG_BRACER.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T2) .input(Items.LEATHER) .input(ResourceItemsME.CRUDE_NUGGET) .input(Items.LEATHER) @@ -1280,258 +1268,257 @@ public void generate() { .input(ResourceItemsME.CRUDE_NUGGET) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_ORCISH_MAIL_COAT.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T2) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .criterion(hasItem(crudeChainmail.getItem()), - conditionsFromItem(crudeChainmail.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_ORCISH_MAIL_COAT.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T2) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .unlockedBy(getHasName(crudeChainmail.getItem()), + has(crudeChainmail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_ORCISH_REINFORCED_LEATHER_SKIRT.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T2) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_ORCISH_REINFORCED_LEATHER_SKIRT.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T2) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(crudeChainmail.getItem()), - conditionsFromItem(crudeChainmail.getItem())) - .offerTo(exporter); + .unlockedBy(getHasName(crudeChainmail.getItem()), + has(crudeChainmail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_ORCISH_REINFORCED_STRIP_LEATHER_SKIRT.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T2) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeChainmail.getItem()), crudeChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.RUSTED_ORCISH_REINFORCED_STRIP_LEATHER_SKIRT.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T2) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, crudeChainmail.getComponents(), crudeChainmail.getItem())) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(crudeChainmail.getItem()), - conditionsFromItem(crudeChainmail.getItem())) - .offerTo(exporter); + .unlockedBy(getHasName(crudeChainmail.getItem()), + has(crudeChainmail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_BLACK_FUR_BOOTS.getDefaultStack(), "boots", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_BLACK_FUR_BOOTS.getDefaultInstance(), "boots", DispositionType.EVIL, XP_T2) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.FUR), - conditionsFromItem(ResourceItemsME.FUR)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FUR), + has(ResourceItemsME.FUR)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_BROWN_FUR_BOOTS.getDefaultStack(), "boots", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_BROWN_FUR_BOOTS.getDefaultInstance(), "boots", DispositionType.EVIL, XP_T2) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.FUR), - conditionsFromItem(ResourceItemsME.FUR)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FUR), + has(ResourceItemsME.FUR)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_GRAY_FUR_BOOTS.getDefaultStack(), "boots", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_GRAY_FUR_BOOTS.getDefaultInstance(), "boots", DispositionType.EVIL, XP_T2) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.FUR), - conditionsFromItem(ResourceItemsME.FUR)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FUR), + has(ResourceItemsME.FUR)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_TAN_FUR_BOOTS.getDefaultStack(), "boots", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_TAN_FUR_BOOTS.getDefaultInstance(), "boots", DispositionType.EVIL, XP_T2) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.FUR), - conditionsFromItem(ResourceItemsME.FUR)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FUR), + has(ResourceItemsME.FUR)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_WHITE_FUR_BOOTS.getDefaultStack(), "boots", DispositionType.EVIL, XP_T2) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_WHITE_FUR_BOOTS.getDefaultInstance(), "boots", DispositionType.EVIL, XP_T2) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.FUR), - conditionsFromItem(ResourceItemsME.FUR)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FUR), + has(ResourceItemsME.FUR)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_BRACED_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_BRACED_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_HELMET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironHelmetPlate.getItem()), ironHelmetPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironArmorPlate.getItem()), ironArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironHelmetPlate.getItem()), - conditionsFromItem(ironHelmetPlate.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_HELMET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironHelmetPlate.getComponents(), ironHelmetPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironArmorPlate.getComponents(), ironArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironHelmetPlate.getItem()), + has(ironHelmetPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_MAIL_COIF.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_MAIL_COIF.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_MAIL_HAUBERK.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_MAIL_HAUBERK.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_MAIL_SHIRT.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_MAIL_SHIRT.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_MAIL_COAT.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_REINFORCED_LEATHER_SKIRT.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .input(Items.LEATHER) - .input(Items.LEATHER) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_REINFORCED_STRIP_LEATHER_SKIRT.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T3) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .input(Items.LEATHER) - .input(Items.LEATHER) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_SALLET.getDefaultStack(), "helmet", DispositionType.EVIL, XP_T4) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_MAIL_COAT.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_REINFORCED_LEATHER_SKIRT.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .input(Items.LEATHER) + .input(Items.LEATHER) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_REINFORCED_STRIP_LEATHER_SKIRT.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T3) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .input(Items.LEATHER) + .input(Items.LEATHER) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_SALLET.getDefaultInstance(), "helmet", DispositionType.EVIL, XP_T4) .input(ResourceItemsME.BURZUM_STEEL_INGOT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelHelmetPlate.getItem()), burzumSteelHelmetPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelHelmetPlate.getComponents(), burzumSteelHelmetPlate.getItem())) .input(ResourceItemsME.BURZUM_STEEL_INGOT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(burzumSteelHelmetPlate.getItem()), - conditionsFromItem(burzumSteelHelmetPlate.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(burzumSteelHelmetPlate.getItem()), + has(burzumSteelHelmetPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_BELLY_PLATE_CHESTPLATE.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T4) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_BELLY_PLATE_CHESTPLATE.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T4) .input(Items.LEATHER) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .criterion(hasItem(burzumSteelScaleMail.getItem()), - conditionsFromItem(burzumSteelScaleMail.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .unlockedBy(getHasName(burzumSteelScaleMail.getItem()), + has(burzumSteelScaleMail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_SCALE_VEST.getDefaultStack(), "chestplate", DispositionType.EVIL, XP_T4) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_SCALE_VEST.getDefaultInstance(), "chestplate", DispositionType.EVIL, XP_T4) .input(Items.LEATHER) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelScaleMail.getItem()), burzumSteelScaleMail.getComponentChanges())) - .criterion(hasItem(burzumSteelScaleMail.getItem()), - conditionsFromItem(burzumSteelScaleMail.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelScaleMail.getComponents(), burzumSteelScaleMail.getItem())) + .unlockedBy(getHasName(burzumSteelScaleMail.getItem()), + has(burzumSteelScaleMail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_REINFORCED_LEG_BRACER.getDefaultStack(), "leggings", DispositionType.EVIL, XP_T4) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_REINFORCED_LEG_BRACER.getDefaultInstance(), "leggings", DispositionType.EVIL, XP_T4) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(burzumSteelArmorPlate.getItem()), - conditionsFromItem(burzumSteelArmorPlate.getItem())) - .offerTo(exporter); + .unlockedBy(getHasName(burzumSteelArmorPlate.getItem()), + has(burzumSteelArmorPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_BRACED_SANDALS.getDefaultStack(), "boots", DispositionType.EVIL, XP_T4) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())).input(Items.LEATHER) - .input(Items.LEATHER) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_BRACED_SANDALS.getDefaultInstance(), "boots", DispositionType.EVIL, XP_T4) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())).input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(burzumSteelArmorPlate.getItem()), - conditionsFromItem(burzumSteelArmorPlate.getItem())) - .offerTo(exporter); + .unlockedBy(getHasName(burzumSteelArmorPlate.getItem()), + has(burzumSteelArmorPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_CAPE.getDefaultStack(), "back_attachment", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_CAPE.getDefaultInstance(), "back_attachment", DispositionType.EVIL) .input(ResourceItemsME.FABRIC) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_LONG_CAPE.getDefaultStack(), "back_attachment", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_LONG_CAPE.getDefaultInstance(), "back_attachment", DispositionType.EVIL) .input(ResourceItemsME.FABRIC) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) @@ -1539,143 +1526,143 @@ public void generate() { .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_SHOULDERS.getDefaultStack(), "back_attachment", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_SHOULDERS.getDefaultInstance(), "back_attachment", DispositionType.EVIL) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) .input(Items.RED_DYE) .input(ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_BLACK_FUR_SURCOAT_WITH_BONE.getDefaultStack(), "back_attachment", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_BLACK_FUR_SURCOAT_WITH_BONE.getDefaultInstance(), "back_attachment", DispositionType.EVIL) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) .input(ResourceItemsME.FUR) .input(Items.STRING) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) .input(Items.STRING) - .criterion(hasItem(ResourceItemsME.FUR), - conditionsFromItem(ResourceItemsME.FUR)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FUR), + has(ResourceItemsME.FUR)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_BROWN_FUR_SURCOAT_WITH_BONE.getDefaultStack(), "back_attachment", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_BROWN_FUR_SURCOAT_WITH_BONE.getDefaultInstance(), "back_attachment", DispositionType.EVIL) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) .input(ResourceItemsME.FUR) .input(Items.STRING) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) .input(Items.STRING) - .criterion(hasItem(ResourceItemsME.FUR), - conditionsFromItem(ResourceItemsME.FUR)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FUR), + has(ResourceItemsME.FUR)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_GRAY_FUR_SURCOAT_WITH_BONE.getDefaultStack(), "back_attachment", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_GRAY_FUR_SURCOAT_WITH_BONE.getDefaultInstance(), "back_attachment", DispositionType.EVIL) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) .input(ResourceItemsME.FUR) .input(Items.STRING) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) .input(Items.STRING) - .criterion(hasItem(ResourceItemsME.FUR), - conditionsFromItem(ResourceItemsME.FUR)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FUR), + has(ResourceItemsME.FUR)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_TAN_FUR_SURCOAT_WITH_BONE.getDefaultStack(), "back_attachment", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_TAN_FUR_SURCOAT_WITH_BONE.getDefaultInstance(), "back_attachment", DispositionType.EVIL) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) .input(ResourceItemsME.FUR) .input(Items.STRING) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) .input(Items.STRING) - .criterion(hasItem(ResourceItemsME.FUR), - conditionsFromItem(ResourceItemsME.FUR)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FUR), + has(ResourceItemsME.FUR)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_WHITE_FUR_SURCOAT_WITH_BONE.getDefaultStack(), "back_attachment", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ORCISH_WHITE_FUR_SURCOAT_WITH_BONE.getDefaultInstance(), "back_attachment", DispositionType.EVIL) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) .input(ResourceItemsME.FUR) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) .input(ResourceItemsME.FUR) .input(Items.STRING) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) .input(Items.STRING) - .criterion(hasItem(ResourceItemsME.FUR), - conditionsFromItem(ResourceItemsME.FUR)) - .offerTo(exporter); + .unlockedBy(getHasName(ResourceItemsME.FUR), + has(ResourceItemsME.FUR)) + .save(output); //endregion //region MOUNT ARMORS - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_HORSE_ARMOR.getDefaultStack(), "mount_armor", DispositionType.GOOD) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GONDORIAN_HORSE_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.GOOD) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(steelArmorPlate.getItem()), - conditionsFromItem(steelArmorPlate.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(steelArmorPlate.getItem()), + has(steelArmorPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_HORSE_ARMOR.getDefaultStack(), "mount_armor", DispositionType.GOOD) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.ROHIRRIC_HORSE_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.GOOD) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(steelArmorPlate.getItem()), - conditionsFromItem(steelArmorPlate.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(steelArmorPlate.getItem()), + has(steelArmorPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HORSE_ARMOR.getDefaultStack(), "mount_armor", DispositionType.GOOD) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.DALISH_HORSE_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.GOOD) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelArmorPlate.getItem()), steelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelChainmail.getItem()), steelChainmail.getComponentChanges())) - .criterion(hasItem(steelArmorPlate.getItem()), - conditionsFromItem(steelArmorPlate.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, steelArmorPlate.getComponents(), steelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, steelChainmail.getComponents(), steelChainmail.getItem())) + .unlockedBy(getHasName(steelArmorPlate.getItem()), + has(steelArmorPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_HORSE_ARMOR.getDefaultStack(), "mount_armor", DispositionType.GOOD) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.LORIEN_HORSE_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.GOOD) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(edhelSteelArmorPlate.getItem()), - conditionsFromItem(edhelSteelArmorPlate.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(edhelSteelArmorPlate.getItem()), + has(edhelSteelArmorPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GREAT_HORN_LIGHT_ARMOR.getDefaultStack(), "mount_armor", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GREAT_HORN_LIGHT_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.GOOD) .input(ResourceItemsME.BRONZE_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) @@ -1683,10 +1670,10 @@ public void generate() { .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GREAT_HORN_LIGHT_GRAY_ARMOR.getDefaultStack(), "mount_armor", DispositionType.GOOD) + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GREAT_HORN_LIGHT_GRAY_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.GOOD) .input(ResourceItemsME.BRONZE_NUGGET) .input(Items.CYAN_DYE) .input(ResourceItemsME.FABRIC) @@ -1694,10 +1681,10 @@ public void generate() { .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GREAT_HORN_LIGHT_GREEN_ARMOR.getDefaultStack(), "mount_armor", DispositionType.GOOD) + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GREAT_HORN_LIGHT_GREEN_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.GOOD) .input(ResourceItemsME.BRONZE_NUGGET) .input(Items.GREEN_DYE) .input(ResourceItemsME.FABRIC) @@ -1705,22 +1692,22 @@ public void generate() { .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GREAT_HORN_PLATE_ARMOR.getDefaultStack(), "mount_armor", DispositionType.GOOD) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GREAT_HORN_PLATE_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.GOOD) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelArmorPlate.getItem()), edhelSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelChainmail.getItem()), edhelSteelChainmail.getComponentChanges())) - .criterion(hasItem(edhelSteelArmorPlate.getItem()), - conditionsFromItem(edhelSteelArmorPlate.getItem())) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GREAT_HORN_ORNAMENTED_PLATE_ARMOR.getDefaultStack(), "mount_armor", DispositionType.GOOD) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelArmorPlate.getComponents(), edhelSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, edhelSteelChainmail.getComponents(), edhelSteelChainmail.getItem())) + .unlockedBy(getHasName(edhelSteelArmorPlate.getItem()), + has(edhelSteelArmorPlate.getItem())) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GREAT_HORN_ORNAMENTED_PLATE_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.GOOD) .input(Items.GOLD_NUGGET) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.GREAT_HORN_PLATE_ARMOR) @@ -1728,10 +1715,10 @@ public void generate() { .input(Items.GOLD_NUGGET) .input(Items.LEATHER) .input(Items.GOLD_NUGGET) - .criterion(hasItem(EquipmentItemsME.GREAT_HORN_PLATE_ARMOR), - conditionsFromItem(EquipmentItemsME.GREAT_HORN_PLATE_ARMOR)) - .offerTo(exporter); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GREAT_HORN_GREEN_PLATE_ARMOR.getDefaultStack(), "mount_armor", DispositionType.GOOD) + .unlockedBy(getHasName(EquipmentItemsME.GREAT_HORN_PLATE_ARMOR), + has(EquipmentItemsME.GREAT_HORN_PLATE_ARMOR)) + .save(output); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.GREAT_HORN_GREEN_PLATE_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.GOOD) .input(Items.GOLD_NUGGET) .input(ResourceItemsME.FABRIC) .input(EquipmentItemsME.GREAT_HORN_PLATE_ARMOR) @@ -1739,11 +1726,11 @@ public void generate() { .input(Items.GOLD_NUGGET) .input(Items.GREEN_DYE) .input(Items.GOLD_NUGGET) - .criterion(hasItem(EquipmentItemsME.GREAT_HORN_PLATE_ARMOR), - conditionsFromItem(EquipmentItemsME.GREAT_HORN_PLATE_ARMOR)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.GREAT_HORN_PLATE_ARMOR), + has(EquipmentItemsME.GREAT_HORN_PLATE_ARMOR)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BROADHOOF_GOAT_PADDED_ARMOR.getDefaultStack(), "mount_armor", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BROADHOOF_GOAT_PADDED_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.GOOD) .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) .input(ResourceItemsME.FABRIC) @@ -1751,11 +1738,11 @@ public void generate() { .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BROADHOOF_GOAT_ORNAMENTED_PADDED_ARMOR.getDefaultStack(), "mount_armor", DispositionType.GOOD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BROADHOOF_GOAT_ORNAMENTED_PADDED_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.GOOD) .input(Items.LEATHER) .input(Items.GOLD_INGOT) .input(EquipmentItemsME.BROADHOOF_GOAT_PADDED_ARMOR) @@ -1763,23 +1750,23 @@ public void generate() { .input(Items.LEATHER) .input(ResourceItemsME.FABRIC) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.BROADHOOF_GOAT_PADDED_ARMOR), - conditionsFromItem(EquipmentItemsME.BROADHOOF_GOAT_PADDED_ARMOR)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.BROADHOOF_GOAT_PADDED_ARMOR), + has(EquipmentItemsME.BROADHOOF_GOAT_PADDED_ARMOR)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BROADHOOF_GOAT_PLATE_ARMOR.getDefaultStack(), "mount_armor", DispositionType.GOOD) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.BROADHOOF_GOAT_PLATE_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.GOOD) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) .input(ResourceItemsME.FABRIC) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelChainmail.getItem()), khazadSteelChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelArmorPlate.getItem()), khazadSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelChainmail.getItem()), khazadSteelChainmail.getComponentChanges())) - .criterion(hasItem(khazadSteelArmorPlate.getItem()), - conditionsFromItem(khazadSteelArmorPlate.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, khazadSteelChainmail.getComponents(), khazadSteelChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelArmorPlate.getComponents(), khazadSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, khazadSteelChainmail.getComponents(), khazadSteelChainmail.getItem())) + .unlockedBy(getHasName(khazadSteelArmorPlate.getItem()), + has(khazadSteelArmorPlate.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARG_LEATHER_ARMOR.getDefaultStack(), "mount_armor", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARG_LEATHER_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.EVIL) .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) @@ -1787,71 +1774,69 @@ public void generate() { .input(Items.LEATHER) .input(Items.LEATHER) .input(Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARG_REINFORCED_LEATHER_ARMOR.getDefaultStack(), "mount_armor", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARG_REINFORCED_LEATHER_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.EVIL) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) .input(EquipmentItemsME.WARG_LEATHER_ARMOR) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))) .input(Items.LEATHER) - .criterion(hasItem(EquipmentItemsME.WARG_LEATHER_ARMOR), - conditionsFromItem(EquipmentItemsME.WARG_LEATHER_ARMOR)) - .offerTo(exporter); + .unlockedBy(getHasName(EquipmentItemsME.WARG_LEATHER_ARMOR), + has(EquipmentItemsME.WARG_LEATHER_ARMOR)) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARG_MORDOR_MAIL_ARMOR.getDefaultStack(), "mount_armor", DispositionType.EVIL) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARG_MORDOR_MAIL_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.EVIL) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironChainmail.getItem()), ironChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .componentInput(DataComponentIngredient.of(false, ironChainmail.getComponents(), ironChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARG_MORDOR_PLATE_ARMOR.getDefaultStack(), "mount_armor", DispositionType.EVIL) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARG_MORDOR_PLATE_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.EVIL) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(EquipmentItemsME.WARG_MORDOR_MAIL_ARMOR) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARG_ISENGARD_PLATE_ARMOR.getDefaultStack(), "mount_armor", DispositionType.EVIL) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARG_ISENGARD_PLATE_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.EVIL) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARG_GUNDABAD_PLATE_ARMOR.getDefaultStack(), "mount_armor", DispositionType.EVIL) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, EquipmentItemsME.WARG_GUNDABAD_PLATE_ARMOR.getDefaultInstance(), "mount_armor", DispositionType.EVIL) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelArmorPlate.getItem()), burzumSteelArmorPlate.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelArmorPlate.getComponents(), burzumSteelArmorPlate.getItem())) + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelChainmail.getItem()), burzumSteelChainmail.getComponentChanges())) - .criterion(hasItem(ironChainmail.getItem()), - conditionsFromItem(ironChainmail.getItem())) - .offerTo(exporter); + .componentInput(DataComponentIngredient.of(false, burzumSteelChainmail.getComponents(), burzumSteelChainmail.getItem())) + .unlockedBy(getHasName(ironChainmail.getItem()), + has(ironChainmail.getItem())) + .save(output); //endregion - } - }; } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/ArtisanTableHandheldRecipeProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/ArtisanTableHandheldRecipeProvider.java index eeed8a416f..5637a1dd40 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/ArtisanTableHandheldRecipeProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/ArtisanTableHandheldRecipeProvider.java @@ -1,27 +1,31 @@ package net.sevenstars.middleearth.datageneration.providers.recipes; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.impl.recipe.ingredient.builtin.ComponentsIngredient; -import net.minecraft.advancement.AdvancementCriterion; -import net.minecraft.advancement.criterion.InventoryChangedCriterion; -import net.minecraft.block.Blocks; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.data.recipe.RecipeExporter; -import net.minecraft.data.recipe.RecipeGenerator; -import net.minecraft.item.Item; -import net.minecraft.item.ItemConvertible; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.equipment.trim.ArmorTrim; -import net.minecraft.item.equipment.trim.ArmorTrimMaterial; -import net.minecraft.item.equipment.trim.ArmorTrimPattern; -import net.minecraft.predicate.item.ItemPredicate; -import net.minecraft.recipe.Ingredient; -import net.minecraft.recipe.book.RecipeCategory; -import net.minecraft.registry.*; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.util.Identifier; +import net.neoforged.neoforge.common.crafting.DataComponentIngredient; +import net.minecraft.advancements.Criterion; +import net.minecraft.advancements.critereon.InventoryChangeTrigger; +import net.minecraft.advancements.critereon.ItemPredicate; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderGetter; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.PackOutput; +import net.minecraft.data.recipes.RecipeCategory; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.data.recipes.RecipeProvider; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.armortrim.ArmorTrim; +import net.minecraft.world.item.armortrim.TrimMaterial; +import net.minecraft.world.item.armortrim.TrimPattern; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.block.Blocks; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import net.sevenstars.middleearth.block.special.forge.MetalTypes; @@ -35,1682 +39,1667 @@ import java.util.Optional; import java.util.concurrent.CompletableFuture; -import static net.minecraft.data.recipe.RecipeGenerator.conditionsFromPredicates; -import static net.minecraft.data.recipe.RecipeGenerator.hasItem; public class ArtisanTableHandheldRecipeProvider extends RecipeProvider { private final int XP_MEDIUM_SHIELD = 2; private final int XP_HEAVY_SHIELD = 4; - private final CompletableFuture registryLookup; + private final CompletableFuture registryLookup; - public ArtisanTableHandheldRecipeProvider(FabricDataOutput output, CompletableFuture registriesFuture) { + public ArtisanTableHandheldRecipeProvider(PackOutput output, CompletableFuture registriesFuture) { super(output, registriesFuture); this.registryLookup = registriesFuture; } - @Override - public String getName() { - return "ArtisanTableHandheldRecipes"; - } - - public RegistryWrapper.Impl getArmorTrimMaterialsRegistry(){ - RegistryWrapper.Impl armorTrimMaterialsRegistry; + public HolderLookup.RegistryLookup getArmorTrimMaterialsRegistry(){ + HolderLookup.RegistryLookup armorTrimMaterialsRegistry; try { - armorTrimMaterialsRegistry = registryLookup.get().getOrThrow(RegistryKeys.TRIM_MATERIAL); + armorTrimMaterialsRegistry = registryLookup.get().lookupOrThrow(Registries.TRIM_MATERIAL); } catch (Exception ignored) { throw new IllegalStateException("Data generation without registries failed!"); } return armorTrimMaterialsRegistry; } - public RegistryWrapper.Impl getArmorTrimPatternsRegistry(){ - RegistryWrapper.Impl armorTrimPatternsRegistry; + public HolderLookup.RegistryLookup getArmorTrimPatternsRegistry(){ + HolderLookup.RegistryLookup armorTrimPatternsRegistry; try { - armorTrimPatternsRegistry = registryLookup.get().getOrThrow(RegistryKeys.TRIM_PATTERN); + armorTrimPatternsRegistry = registryLookup.get().lookupOrThrow(Registries.TRIM_PATTERN); } catch (Exception ignored) { throw new IllegalStateException("Data generation without registries failed!"); } return armorTrimPatternsRegistry; } - public RegistryEntry getPattern(){ + public Holder getPattern(){ return getArmorTrimPatternsRegistry().getOrThrow(SmithingTrimPatternsME.SMITHING_PART); } - public Identifier getMetalIdentifier(MetalTypes metal){ + public ResourceLocation getMetalIdentifier(MetalTypes metal){ if (metal.isVanilla()){ - return Identifier.of(metal.getName()); + return ResourceLocation.parse(metal.getName()); } else { - return Identifier.of(MiddleEarth.MOD_ID, metal.getName()); + return ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, metal.getName()); } } @Override - protected RecipeGenerator getRecipeGenerator(RegistryWrapper.WrapperLookup wrapperLookup, RecipeExporter recipeExporter) { - return new RecipeGenerator(wrapperLookup, recipeExporter) { - @Override - public void generate() { - RegistryWrapper.Impl itemLookup = registries.getOrThrow(RegistryKeys.ITEM); + protected void buildRecipes(RecipeOutput output, HolderLookup.Provider registries) { + HolderLookup.RegistryLookup itemLookup = registries.lookupOrThrow(Registries.ITEM); //region WEAPONS - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.IRON, Items.IRON_SWORD.getDefaultStack(), false, DispositionType.NEUTRAL); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.IRON, WeaponItemsME.IRON_DAGGER.getDefaultStack(), false, DispositionType.NEUTRAL); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.IRON, WeaponItemsME.IRON_SPEAR.getDefaultStack(), false, DispositionType.NEUTRAL); - - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.GOLD, Items.GOLDEN_SWORD.getDefaultStack(), false, DispositionType.NEUTRAL); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.GOLD, WeaponItemsME.GOLDEN_DAGGER.getDefaultStack(), false, DispositionType.NEUTRAL); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.GOLD, WeaponItemsME.GOLDEN_SPEAR.getDefaultStack(), false, DispositionType.NEUTRAL); - - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.NETHERITE, Items.NETHERITE_SWORD.getDefaultStack(), false, DispositionType.NEUTRAL); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.NETHERITE, WeaponItemsME.NETHERITE_DAGGER.getDefaultStack(), false, DispositionType.NEUTRAL); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.NETHERITE, WeaponItemsME.NETHERITE_SPEAR.getDefaultStack(), false, DispositionType.NEUTRAL); - - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.BRONZE, WeaponItemsME.BRONZE_SWORD.getDefaultStack(), false, DispositionType.NEUTRAL); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.BRONZE, WeaponItemsME.BRONZE_DAGGER.getDefaultStack(), false, DispositionType.NEUTRAL); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.BRONZE, WeaponItemsME.BRONZE_SPEAR.getDefaultStack(), false, DispositionType.NEUTRAL); - - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.CRUDE, WeaponItemsME.CRUDE_FALCHION.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.CRUDE, WeaponItemsME.CRUDE_DAGGER.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.CRUDE, WeaponItemsME.CRUDE_SPEAR.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.CRUDE, WeaponItemsME.CRUDE_LONGBLADE.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.CRUDE, Items.BONE, WeaponItemsME.GOBLIN_TOWN_FALCHION.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.CRUDE, Items.BONE, WeaponItemsME.GOBLIN_TOWN_SHANK.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.CRUDE, Items.BONE, WeaponItemsME.GOBLIN_TOWN_SCIMITAR.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.CRUDE, Items.BONE, WeaponItemsME.GOBLIN_TOWN_SPEAR.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.CRUDE, Items.BONE, WeaponItemsME.GOBLIN_TOWN_AXE.getDefaultStack(), false, Optional.empty(), DispositionType.EVIL); - - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_SWORD.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_NOBLE_SWORD.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_SWORD.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_NOBLE_SWORD.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.DALISH_SWORD.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.DALISH_NOBLE_SWORD.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.DALISH_HEYDAY_SWORD.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.STEEL_SWORD.getDefaultStack(), false, DispositionType.NEUTRAL); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.BLACK_NUMENOREAN_SWORD.getDefaultStack(), true, DispositionType.EVIL); - - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_DAGGER.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_NOBLE_DAGGER.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_DAGGER.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_NOBLE_DAGGER.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.DALISH_DAGGER.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.DALISH_HEYDAY_DAGGER.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.DALISH_NOBLE_DAGGER.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.BLACK_NUMENOREAN_DAGGER.getDefaultStack(), true, DispositionType.EVIL); - - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_LONGSWORD.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_NOBLE_LONGSWORD.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_LONGSWORD.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_NOBLE_LONGSWORD.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.DALISH_LONGSWORD.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.DALISH_HEYDAY_LONGSWORD.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.DALISH_HEYDAY_SCIMITAR.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.DALISH_NOBLE_LONGSWORD.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.BLACK_NUMENOREAN_LONGSWORD.getDefaultStack(), true, DispositionType.EVIL); - - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_AXE.getDefaultStack(), false, Optional.empty(), DispositionType.GOOD); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_NOBLE_AXE.getDefaultStack(), true, Optional.empty(), DispositionType.GOOD); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_AXE.getDefaultStack(), false, Optional.empty(), DispositionType.GOOD); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_NOBLE_AXE.getDefaultStack(), true, Optional.empty(), DispositionType.GOOD); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.DALISH_AXE.getDefaultStack(), false, Optional.empty(), DispositionType.GOOD); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.DALISH_NOBLE_AXE.getDefaultStack(), true, Optional.empty(), DispositionType.GOOD); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.DALISH_HEYDAY_AXE.getDefaultStack(), true, Optional.empty(), DispositionType.GOOD); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.BLACK_NUMENOREAN_AXE.getDefaultStack(), true, Optional.empty(), DispositionType.EVIL); - - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_SPEAR.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_NOBLE_SPEAR.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_FOUNTAIN_GUARD_SPEAR.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_SPEAR.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_NOBLE_SPEAR.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.DALISH_SPEAR.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.DALISH_HEYDAY_SPEAR.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.DALISH_NOBLE_SPEAR.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.STEEL_SPEAR.getDefaultStack(), false, DispositionType.NEUTRAL); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.STEEL, WeaponItemsME.BLACK_NUMENOREAN_SPEAR.getDefaultStack(), true, DispositionType.EVIL); - - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_SWORD.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_NOBLE_SWORD.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.KHAZAD_STEEL, WeaponItemsME.KHAZAD_STEEL_SWORD.getDefaultStack(), false, DispositionType.GOOD); - - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_DAGGER.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_NOBLE_DAGGER.getDefaultStack(), true, DispositionType.GOOD); - - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_LONGSWORD.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_NOBLE_LONGSWORD.getDefaultStack(), true, DispositionType.GOOD); - - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_AXE.getDefaultStack(), false, Optional.empty(), DispositionType.GOOD); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_NOBLE_AXE.getDefaultStack(), true, Optional.empty(), DispositionType.GOOD); - - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.KHAZAD_STEEL, WeaponItemsME.KHAZAD_STEEL_SPEAR.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_SPEAR.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_NOBLE_SPEAR.getDefaultStack(), true, DispositionType.GOOD); - - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_SWORD.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_NOBLE_SWORD.getDefaultStack(), true, DispositionType.GOOD); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.EDHEL_STEEL_SWORD.getDefaultStack(), false, DispositionType.GOOD); - - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_DAGGER.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_NOBLE_DAGGER.getDefaultStack(), true, DispositionType.GOOD); - - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_GLAIVE.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_NOBLE_GLAIVE.getDefaultStack(), true, DispositionType.GOOD); - - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_AXE.getDefaultStack(), false, Optional.empty(), DispositionType.GOOD); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_NOBLE_AXE.getDefaultStack(), true, Optional.empty(), DispositionType.GOOD); - - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.EDHEL_STEEL_SPEAR.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_SPEAR.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_NOBLE_SPEAR.getDefaultStack(), true, DispositionType.GOOD); - - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_SWORD.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_NOBLE_SWORD.getDefaultStack(), true, DispositionType.GOOD); - - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_DAGGER.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_NOBLE_DAGGER.getDefaultStack(), true, DispositionType.GOOD); - - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_LONGSWORD.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_NOBLE_LONGSWORD.getDefaultStack(), true, DispositionType.GOOD); - - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_AXE.getDefaultStack(), false, Optional.empty(), DispositionType.GOOD); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_NOBLE_AXE.getDefaultStack(), true, Optional.empty(), DispositionType.GOOD); - - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_SPEAR.getDefaultStack(), false, DispositionType.GOOD); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_NOBLE_SPEAR.getDefaultStack(), true, DispositionType.GOOD); - - - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.BURZUM_STEEL_SWORD.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.ORC_SWORD.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_FALCHION.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_ELITE_CLEAVER.getDefaultStack(), true, DispositionType.EVIL); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.DOL_GULDUR_MACHETE.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.ISENGARD_ORC_CLEAVER.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.URUK_HAI_FALCHION.getDefaultStack(), true, DispositionType.EVIL); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_FALCHION.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_ELITE_CLEAVER.getDefaultStack(), true, DispositionType.EVIL); - createArtisanTableSwordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORIA_GOBLIN_FALCHION.getDefaultStack(), true, DispositionType.EVIL); - - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.ORC_KNIFE.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_DAGGER.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_ELITE_DAGGER.getDefaultStack(), true, DispositionType.EVIL); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.ISENGARD_ORC_DAGGER.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.URUK_HAI_KNIFE.getDefaultStack(), true, DispositionType.EVIL); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_SHANK.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_ELITE_DAGGER.getDefaultStack(), true, DispositionType.EVIL); - createArtisanTableDaggerRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORIA_GOBLIN_SHANK.getDefaultStack(), true, DispositionType.EVIL); - - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.ORC_BROADBLADE.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_SCIMITAR.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_ELITE_WARBLADE.getDefaultStack(), true, DispositionType.EVIL); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.ISENGARD_ORC_WARBLADE.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.URUK_HAI_WARBLADE.getDefaultStack(), true, DispositionType.EVIL); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_WARBLADE.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_ELITE_SCIMITAR.getDefaultStack(), true, DispositionType.EVIL); - createArtisanTableLongswordRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORIA_GOBLIN_HOOKBLADE.getDefaultStack(), true, DispositionType.EVIL); - - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.ORC_AXE.getDefaultStack(), false, Optional.empty(), DispositionType.EVIL); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_AXE.getDefaultStack(), false, Optional.empty(), DispositionType.EVIL); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_ELITE_AXE.getDefaultStack(), true, Optional.empty(), DispositionType.EVIL); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.DOL_GULDUR_AXE.getDefaultStack(), false, Optional.empty(), DispositionType.EVIL); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.ISENGARD_ORC_AXE.getDefaultStack(), false, Optional.empty(), DispositionType.EVIL); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.URUK_HAI_AXE.getDefaultStack(), true, Optional.empty(), DispositionType.EVIL); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_AXE.getDefaultStack(), false, Optional.empty(), DispositionType.EVIL); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_ELITE_BATTLEAXE.getDefaultStack(), true, Optional.empty(), DispositionType.EVIL); - createArtisanTableAxeRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORIA_GOBLIN_HOOKAXE.getDefaultStack(), true, Optional.empty(), DispositionType.EVIL); - - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.BURZUM_STEEL_SPEAR.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.ORC_SPEAR.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_SPEAR.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_ELITE_SPEAR.getDefaultStack(), true, DispositionType.EVIL); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.ISENGARD_ORC_SPEAR.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.URUK_HAI_SPEAR.getDefaultStack(), true, DispositionType.EVIL); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_SPEAR.getDefaultStack(), false, DispositionType.EVIL); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_ELITE_SPEAR.getDefaultStack(), true, DispositionType.EVIL); - createArtisanTableSpearRecipe(itemLookup, recipeExporter, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORIA_GOBLIN_SPEAR.getDefaultStack(), true, DispositionType.EVIL); - - createArtisanTableBowRecipe(itemLookup, recipeExporter, WeaponItemsME.GONDORIAN_BOW.getDefaultStack(), DispositionType.GOOD); - createArtisanTableLongbowRecipe(itemLookup, recipeExporter, WeaponItemsME.GONDORIAN_LONGBOW.getDefaultStack(), DispositionType.GOOD); - createArtisanTableNobleLongbowRecipe(itemLookup, recipeExporter, WeaponItemsME.GONDORIAN_NOBLE_LONGBOW.getDefaultStack(), DispositionType.GOOD); - - createArtisanTableBowRecipe(itemLookup, recipeExporter, WeaponItemsME.ROHIRRIC_BOW.getDefaultStack(), DispositionType.GOOD); - createArtisanTableNobleBowRecipe(itemLookup, recipeExporter, WeaponItemsME.ROHIRRIC_NOBLE_BOW.getDefaultStack(), DispositionType.GOOD); - createArtisanTableLongbowRecipe(itemLookup, recipeExporter, WeaponItemsME.ROHIRRIC_LONGBOW.getDefaultStack(), DispositionType.GOOD); - - createArtisanTableLongbowRecipe(itemLookup, recipeExporter, WeaponItemsME.DALISH_LONGBOW.getDefaultStack(), DispositionType.GOOD); - createArtisanTableNobleLongbowRecipe(itemLookup, recipeExporter, WeaponItemsME.DALISH_HEYDAY_LONGBOW.getDefaultStack(), DispositionType.GOOD); - createArtisanTableNobleLongbowRecipe(itemLookup, recipeExporter, WeaponItemsME.DALISH_NOBLE_LONGBOW.getDefaultStack(), DispositionType.GOOD); - - createArtisanTableBowRecipe(itemLookup, recipeExporter, WeaponItemsME.LORIEN_BOW.getDefaultStack(), DispositionType.GOOD); - createArtisanTableLongbowRecipe(itemLookup, recipeExporter, WeaponItemsME.LORIEN_LONGBOW.getDefaultStack(), DispositionType.GOOD); - createArtisanTableNobleLongbowRecipe(itemLookup, recipeExporter, WeaponItemsME.LORIEN_NOBLE_LONGBOW.getDefaultStack(), DispositionType.GOOD); - - createArtisanTableBowRecipe(itemLookup, recipeExporter, WeaponItemsME.WOODLAND_REALM_BOW.getDefaultStack(), DispositionType.GOOD); - createArtisanTableLongbowRecipe(itemLookup, recipeExporter, WeaponItemsME.WOODLAND_REALM_LONGBOW.getDefaultStack(), DispositionType.GOOD); - createArtisanTableNobleBowRecipe(itemLookup, recipeExporter, WeaponItemsME.WOODLAND_REALM_NOBLE_BOW.getDefaultStack(), DispositionType.GOOD); - createArtisanTableNobleLongbowRecipe(itemLookup, recipeExporter, WeaponItemsME.WOODLAND_REALM_NOBLE_LONGBOW.getDefaultStack(), DispositionType.GOOD); - - createArtisanTableBowRecipe(itemLookup, recipeExporter, WeaponItemsME.EREBOR_BOW.getDefaultStack(), DispositionType.GOOD); - createArtisanTableNobleBowRecipe(itemLookup, recipeExporter, WeaponItemsME.EREBOR_NOBLE_BOW.getDefaultStack(), DispositionType.GOOD); - createArtisanTableCrossbowRecipe(itemLookup, recipeExporter, WeaponItemsME.EREBOR_CROSSBOW.getDefaultStack(), DispositionType.GOOD); - createArtisanTableNobleCrossbowRecipe(itemLookup, recipeExporter, WeaponItemsME.EREBOR_NOBLE_CROSSBOW.getDefaultStack(), DispositionType.GOOD); - - createArtisanTableBowRecipe(itemLookup, recipeExporter, WeaponItemsME.ORCISH_BOW.getDefaultStack(), DispositionType.EVIL); - - createArtisanTableBowRecipe(itemLookup, recipeExporter, WeaponItemsME.MORDOR_BOW.getDefaultStack(), DispositionType.EVIL); - createArtisanTableNobleLongbowRecipe(itemLookup, recipeExporter, WeaponItemsME.MORDOR_ELITE_LONGBOW.getDefaultStack(), DispositionType.EVIL); - - createArtisanTableNobleBowRecipe(itemLookup, recipeExporter, WeaponItemsME.URUK_HAI_BOW.getDefaultStack(), DispositionType.EVIL); - createArtisanTableNobleCrossbowRecipe(itemLookup, recipeExporter, WeaponItemsME.URUK_HAI_CROSSBOW.getDefaultStack(), DispositionType.EVIL); - - createArtisanTableBowRecipe(itemLookup, recipeExporter, WeaponItemsME.GUNDABAD_BOW.getDefaultStack(), DispositionType.EVIL); - createArtisanTableLongbowRecipe(itemLookup, recipeExporter, WeaponItemsME.GUNDABAD_LONGBOW.getDefaultStack(), DispositionType.EVIL); - createArtisanTableCrossbowRecipe(itemLookup, recipeExporter, WeaponItemsME.GOBLIN_CROSSBOW.getDefaultStack(), DispositionType.EVIL); - createArtisanTableBowRecipe(itemLookup, recipeExporter, WeaponItemsME.GOBLIN_TOWN_BOW.getDefaultStack(), DispositionType.EVIL); - createArtisanTableBowRecipe(itemLookup, recipeExporter, WeaponItemsME.MORIA_GOBLIN_BOW.getDefaultStack(), DispositionType.EVIL); - - createArtisanTableBowRecipe(itemLookup, recipeExporter, Items.BOW.getDefaultStack(), DispositionType.NEUTRAL); - createArtisanTableCrossbowRecipe(itemLookup, recipeExporter, Items.CROSSBOW.getDefaultStack(), DispositionType.NEUTRAL); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.IRON, Items.IRON_SWORD.getDefaultInstance(), false, DispositionType.NEUTRAL); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.IRON, WeaponItemsME.IRON_DAGGER.getDefaultInstance(), false, DispositionType.NEUTRAL); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.IRON, WeaponItemsME.IRON_SPEAR.getDefaultInstance(), false, DispositionType.NEUTRAL); + + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.GOLD, Items.GOLDEN_SWORD.getDefaultInstance(), false, DispositionType.NEUTRAL); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.GOLD, WeaponItemsME.GOLDEN_DAGGER.getDefaultInstance(), false, DispositionType.NEUTRAL); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.GOLD, WeaponItemsME.GOLDEN_SPEAR.getDefaultInstance(), false, DispositionType.NEUTRAL); + + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.NETHERITE, Items.NETHERITE_SWORD.getDefaultInstance(), false, DispositionType.NEUTRAL); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.NETHERITE, WeaponItemsME.NETHERITE_DAGGER.getDefaultInstance(), false, DispositionType.NEUTRAL); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.NETHERITE, WeaponItemsME.NETHERITE_SPEAR.getDefaultInstance(), false, DispositionType.NEUTRAL); + + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.BRONZE, WeaponItemsME.BRONZE_SWORD.getDefaultInstance(), false, DispositionType.NEUTRAL); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.BRONZE, WeaponItemsME.BRONZE_DAGGER.getDefaultInstance(), false, DispositionType.NEUTRAL); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.BRONZE, WeaponItemsME.BRONZE_SPEAR.getDefaultInstance(), false, DispositionType.NEUTRAL); + + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.CRUDE, WeaponItemsME.CRUDE_FALCHION.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.CRUDE, WeaponItemsME.CRUDE_DAGGER.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.CRUDE, WeaponItemsME.CRUDE_SPEAR.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.CRUDE, WeaponItemsME.CRUDE_LONGBLADE.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.CRUDE, Items.BONE, WeaponItemsME.GOBLIN_TOWN_FALCHION.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.CRUDE, Items.BONE, WeaponItemsME.GOBLIN_TOWN_SHANK.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.CRUDE, Items.BONE, WeaponItemsME.GOBLIN_TOWN_SCIMITAR.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.CRUDE, Items.BONE, WeaponItemsME.GOBLIN_TOWN_SPEAR.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.CRUDE, Items.BONE, WeaponItemsME.GOBLIN_TOWN_AXE.getDefaultInstance(), false, Optional.empty(), DispositionType.EVIL); + + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_SWORD.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_NOBLE_SWORD.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_SWORD.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_NOBLE_SWORD.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.DALISH_SWORD.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.DALISH_NOBLE_SWORD.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.DALISH_HEYDAY_SWORD.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.STEEL_SWORD.getDefaultInstance(), false, DispositionType.NEUTRAL); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.BLACK_NUMENOREAN_SWORD.getDefaultInstance(), true, DispositionType.EVIL); + + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_DAGGER.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_NOBLE_DAGGER.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_DAGGER.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_NOBLE_DAGGER.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.DALISH_DAGGER.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.DALISH_HEYDAY_DAGGER.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.DALISH_NOBLE_DAGGER.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.BLACK_NUMENOREAN_DAGGER.getDefaultInstance(), true, DispositionType.EVIL); + + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_LONGSWORD.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_NOBLE_LONGSWORD.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_LONGSWORD.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_NOBLE_LONGSWORD.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.DALISH_LONGSWORD.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.DALISH_HEYDAY_LONGSWORD.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.DALISH_HEYDAY_SCIMITAR.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.DALISH_NOBLE_LONGSWORD.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.BLACK_NUMENOREAN_LONGSWORD.getDefaultInstance(), true, DispositionType.EVIL); + + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_AXE.getDefaultInstance(), false, Optional.empty(), DispositionType.GOOD); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_NOBLE_AXE.getDefaultInstance(), true, Optional.empty(), DispositionType.GOOD); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_AXE.getDefaultInstance(), false, Optional.empty(), DispositionType.GOOD); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_NOBLE_AXE.getDefaultInstance(), true, Optional.empty(), DispositionType.GOOD); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.DALISH_AXE.getDefaultInstance(), false, Optional.empty(), DispositionType.GOOD); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.DALISH_NOBLE_AXE.getDefaultInstance(), true, Optional.empty(), DispositionType.GOOD); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.DALISH_HEYDAY_AXE.getDefaultInstance(), true, Optional.empty(), DispositionType.GOOD); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.BLACK_NUMENOREAN_AXE.getDefaultInstance(), true, Optional.empty(), DispositionType.EVIL); + + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_SPEAR.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_NOBLE_SPEAR.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.GONDORIAN_FOUNTAIN_GUARD_SPEAR.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_SPEAR.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.ROHIRRIC_NOBLE_SPEAR.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.DALISH_SPEAR.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.DALISH_HEYDAY_SPEAR.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.DALISH_NOBLE_SPEAR.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.STEEL_SPEAR.getDefaultInstance(), false, DispositionType.NEUTRAL); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.STEEL, WeaponItemsME.BLACK_NUMENOREAN_SPEAR.getDefaultInstance(), true, DispositionType.EVIL); + + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_SWORD.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_NOBLE_SWORD.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.KHAZAD_STEEL, WeaponItemsME.KHAZAD_STEEL_SWORD.getDefaultInstance(), false, DispositionType.GOOD); + + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_DAGGER.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_NOBLE_DAGGER.getDefaultInstance(), true, DispositionType.GOOD); + + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_LONGSWORD.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_NOBLE_LONGSWORD.getDefaultInstance(), true, DispositionType.GOOD); + + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_AXE.getDefaultInstance(), false, Optional.empty(), DispositionType.GOOD); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_NOBLE_AXE.getDefaultInstance(), true, Optional.empty(), DispositionType.GOOD); + + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.KHAZAD_STEEL, WeaponItemsME.KHAZAD_STEEL_SPEAR.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_SPEAR.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.KHAZAD_STEEL, WeaponItemsME.EREBOR_NOBLE_SPEAR.getDefaultInstance(), true, DispositionType.GOOD); + + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_SWORD.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_NOBLE_SWORD.getDefaultInstance(), true, DispositionType.GOOD); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.EDHEL_STEEL_SWORD.getDefaultInstance(), false, DispositionType.GOOD); + + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_DAGGER.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_NOBLE_DAGGER.getDefaultInstance(), true, DispositionType.GOOD); + + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_GLAIVE.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_NOBLE_GLAIVE.getDefaultInstance(), true, DispositionType.GOOD); + + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_AXE.getDefaultInstance(), false, Optional.empty(), DispositionType.GOOD); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_NOBLE_AXE.getDefaultInstance(), true, Optional.empty(), DispositionType.GOOD); + + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.EDHEL_STEEL_SPEAR.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_SPEAR.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.LORIEN_NOBLE_SPEAR.getDefaultInstance(), true, DispositionType.GOOD); + + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_SWORD.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_NOBLE_SWORD.getDefaultInstance(), true, DispositionType.GOOD); + + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_DAGGER.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_NOBLE_DAGGER.getDefaultInstance(), true, DispositionType.GOOD); + + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_LONGSWORD.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_NOBLE_LONGSWORD.getDefaultInstance(), true, DispositionType.GOOD); + + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_AXE.getDefaultInstance(), false, Optional.empty(), DispositionType.GOOD); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_NOBLE_AXE.getDefaultInstance(), true, Optional.empty(), DispositionType.GOOD); + + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_SPEAR.getDefaultInstance(), false, DispositionType.GOOD); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, WeaponItemsME.WOODLAND_REALM_NOBLE_SPEAR.getDefaultInstance(), true, DispositionType.GOOD); + + + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.BURZUM_STEEL_SWORD.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.ORC_SWORD.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_FALCHION.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_ELITE_CLEAVER.getDefaultInstance(), true, DispositionType.EVIL); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.DOL_GULDUR_MACHETE.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.ISENGARD_ORC_CLEAVER.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.URUK_HAI_FALCHION.getDefaultInstance(), true, DispositionType.EVIL); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_FALCHION.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_ELITE_CLEAVER.getDefaultInstance(), true, DispositionType.EVIL); + createArtisanTableSwordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORIA_GOBLIN_FALCHION.getDefaultInstance(), true, DispositionType.EVIL); + + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.ORC_KNIFE.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_DAGGER.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_ELITE_DAGGER.getDefaultInstance(), true, DispositionType.EVIL); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.ISENGARD_ORC_DAGGER.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.URUK_HAI_KNIFE.getDefaultInstance(), true, DispositionType.EVIL); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_SHANK.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_ELITE_DAGGER.getDefaultInstance(), true, DispositionType.EVIL); + createArtisanTableDaggerRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORIA_GOBLIN_SHANK.getDefaultInstance(), true, DispositionType.EVIL); + + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.ORC_BROADBLADE.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_SCIMITAR.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_ELITE_WARBLADE.getDefaultInstance(), true, DispositionType.EVIL); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.ISENGARD_ORC_WARBLADE.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.URUK_HAI_WARBLADE.getDefaultInstance(), true, DispositionType.EVIL); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_WARBLADE.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_ELITE_SCIMITAR.getDefaultInstance(), true, DispositionType.EVIL); + createArtisanTableLongswordRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORIA_GOBLIN_HOOKBLADE.getDefaultInstance(), true, DispositionType.EVIL); + + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.ORC_AXE.getDefaultInstance(), false, Optional.empty(), DispositionType.EVIL); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_AXE.getDefaultInstance(), false, Optional.empty(), DispositionType.EVIL); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_ELITE_AXE.getDefaultInstance(), true, Optional.empty(), DispositionType.EVIL); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.DOL_GULDUR_AXE.getDefaultInstance(), false, Optional.empty(), DispositionType.EVIL); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.ISENGARD_ORC_AXE.getDefaultInstance(), false, Optional.empty(), DispositionType.EVIL); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.URUK_HAI_AXE.getDefaultInstance(), true, Optional.empty(), DispositionType.EVIL); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_AXE.getDefaultInstance(), false, Optional.empty(), DispositionType.EVIL); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_ELITE_BATTLEAXE.getDefaultInstance(), true, Optional.empty(), DispositionType.EVIL); + createArtisanTableAxeRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORIA_GOBLIN_HOOKAXE.getDefaultInstance(), true, Optional.empty(), DispositionType.EVIL); + + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.BURZUM_STEEL_SPEAR.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.ORC_SPEAR.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_SPEAR.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORDOR_ELITE_SPEAR.getDefaultInstance(), true, DispositionType.EVIL); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.ISENGARD_ORC_SPEAR.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.URUK_HAI_SPEAR.getDefaultInstance(), true, DispositionType.EVIL); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_SPEAR.getDefaultInstance(), false, DispositionType.EVIL); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.GUNDABAD_ELITE_SPEAR.getDefaultInstance(), true, DispositionType.EVIL); + createArtisanTableSpearRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, WeaponItemsME.MORIA_GOBLIN_SPEAR.getDefaultInstance(), true, DispositionType.EVIL); + + createArtisanTableBowRecipe(itemLookup, output, WeaponItemsME.GONDORIAN_BOW.getDefaultInstance(), DispositionType.GOOD); + createArtisanTableLongbowRecipe(itemLookup, output, WeaponItemsME.GONDORIAN_LONGBOW.getDefaultInstance(), DispositionType.GOOD); + createArtisanTableNobleLongbowRecipe(itemLookup, output, WeaponItemsME.GONDORIAN_NOBLE_LONGBOW.getDefaultInstance(), DispositionType.GOOD); + + createArtisanTableBowRecipe(itemLookup, output, WeaponItemsME.ROHIRRIC_BOW.getDefaultInstance(), DispositionType.GOOD); + createArtisanTableNobleBowRecipe(itemLookup, output, WeaponItemsME.ROHIRRIC_NOBLE_BOW.getDefaultInstance(), DispositionType.GOOD); + createArtisanTableLongbowRecipe(itemLookup, output, WeaponItemsME.ROHIRRIC_LONGBOW.getDefaultInstance(), DispositionType.GOOD); + + createArtisanTableLongbowRecipe(itemLookup, output, WeaponItemsME.DALISH_LONGBOW.getDefaultInstance(), DispositionType.GOOD); + createArtisanTableNobleLongbowRecipe(itemLookup, output, WeaponItemsME.DALISH_HEYDAY_LONGBOW.getDefaultInstance(), DispositionType.GOOD); + createArtisanTableNobleLongbowRecipe(itemLookup, output, WeaponItemsME.DALISH_NOBLE_LONGBOW.getDefaultInstance(), DispositionType.GOOD); + + createArtisanTableBowRecipe(itemLookup, output, WeaponItemsME.LORIEN_BOW.getDefaultInstance(), DispositionType.GOOD); + createArtisanTableLongbowRecipe(itemLookup, output, WeaponItemsME.LORIEN_LONGBOW.getDefaultInstance(), DispositionType.GOOD); + createArtisanTableNobleLongbowRecipe(itemLookup, output, WeaponItemsME.LORIEN_NOBLE_LONGBOW.getDefaultInstance(), DispositionType.GOOD); + + createArtisanTableBowRecipe(itemLookup, output, WeaponItemsME.WOODLAND_REALM_BOW.getDefaultInstance(), DispositionType.GOOD); + createArtisanTableLongbowRecipe(itemLookup, output, WeaponItemsME.WOODLAND_REALM_LONGBOW.getDefaultInstance(), DispositionType.GOOD); + createArtisanTableNobleBowRecipe(itemLookup, output, WeaponItemsME.WOODLAND_REALM_NOBLE_BOW.getDefaultInstance(), DispositionType.GOOD); + createArtisanTableNobleLongbowRecipe(itemLookup, output, WeaponItemsME.WOODLAND_REALM_NOBLE_LONGBOW.getDefaultInstance(), DispositionType.GOOD); + + createArtisanTableBowRecipe(itemLookup, output, WeaponItemsME.EREBOR_BOW.getDefaultInstance(), DispositionType.GOOD); + createArtisanTableNobleBowRecipe(itemLookup, output, WeaponItemsME.EREBOR_NOBLE_BOW.getDefaultInstance(), DispositionType.GOOD); + createArtisanTableCrossbowRecipe(itemLookup, output, WeaponItemsME.EREBOR_CROSSBOW.getDefaultInstance(), DispositionType.GOOD); + createArtisanTableNobleCrossbowRecipe(itemLookup, output, WeaponItemsME.EREBOR_NOBLE_CROSSBOW.getDefaultInstance(), DispositionType.GOOD); + + createArtisanTableBowRecipe(itemLookup, output, WeaponItemsME.ORCISH_BOW.getDefaultInstance(), DispositionType.EVIL); + + createArtisanTableBowRecipe(itemLookup, output, WeaponItemsME.MORDOR_BOW.getDefaultInstance(), DispositionType.EVIL); + createArtisanTableNobleLongbowRecipe(itemLookup, output, WeaponItemsME.MORDOR_ELITE_LONGBOW.getDefaultInstance(), DispositionType.EVIL); + + createArtisanTableNobleBowRecipe(itemLookup, output, WeaponItemsME.URUK_HAI_BOW.getDefaultInstance(), DispositionType.EVIL); + createArtisanTableNobleCrossbowRecipe(itemLookup, output, WeaponItemsME.URUK_HAI_CROSSBOW.getDefaultInstance(), DispositionType.EVIL); + + createArtisanTableBowRecipe(itemLookup, output, WeaponItemsME.GUNDABAD_BOW.getDefaultInstance(), DispositionType.EVIL); + createArtisanTableLongbowRecipe(itemLookup, output, WeaponItemsME.GUNDABAD_LONGBOW.getDefaultInstance(), DispositionType.EVIL); + createArtisanTableCrossbowRecipe(itemLookup, output, WeaponItemsME.GOBLIN_CROSSBOW.getDefaultInstance(), DispositionType.EVIL); + createArtisanTableBowRecipe(itemLookup, output, WeaponItemsME.GOBLIN_TOWN_BOW.getDefaultInstance(), DispositionType.EVIL); + createArtisanTableBowRecipe(itemLookup, output, WeaponItemsME.MORIA_GOBLIN_BOW.getDefaultInstance(), DispositionType.EVIL); + + createArtisanTableBowRecipe(itemLookup, output, Items.BOW.getDefaultInstance(), DispositionType.NEUTRAL); + createArtisanTableCrossbowRecipe(itemLookup, output, Items.CROSSBOW.getDefaultInstance(), DispositionType.NEUTRAL); //endregion //region TOOLS - createToolSet(itemLookup, exporter, MetalTypes.BRONZE, ToolItemsME.BRONZE_PICKAXE.getDefaultStack(), - ToolItemsME.BRONZE_AXE.getDefaultStack(), - ToolItemsME.BRONZE_SHOVEL.getDefaultStack(), - ToolItemsME.BRONZE_HOE.getDefaultStack(), + createToolSet(itemLookup, output, MetalTypes.BRONZE, ToolItemsME.BRONZE_PICKAXE.getDefaultInstance(), + ToolItemsME.BRONZE_AXE.getDefaultInstance(), + ToolItemsME.BRONZE_SHOVEL.getDefaultInstance(), + ToolItemsME.BRONZE_HOE.getDefaultInstance(), Optional.empty(), DispositionType.NEUTRAL); - createToolSet(itemLookup, exporter, MetalTypes.CRUDE, ToolItemsME.CRUDE_PICKAXE.getDefaultStack(), - ToolItemsME.CRUDE_AXE.getDefaultStack(), - ToolItemsME.CRUDE_SHOVEL.getDefaultStack(), - ToolItemsME.CRUDE_HOE.getDefaultStack(), + createToolSet(itemLookup, output, MetalTypes.CRUDE, ToolItemsME.CRUDE_PICKAXE.getDefaultInstance(), + ToolItemsME.CRUDE_AXE.getDefaultInstance(), + ToolItemsME.CRUDE_SHOVEL.getDefaultInstance(), + ToolItemsME.CRUDE_HOE.getDefaultInstance(), Optional.empty(), DispositionType.EVIL); - createToolSet(itemLookup, exporter, MetalTypes.IRON, Items.IRON_PICKAXE.getDefaultStack(), - Items.IRON_AXE.getDefaultStack(), - Items.IRON_SHOVEL.getDefaultStack(), - Items.IRON_HOE.getDefaultStack(), + createToolSet(itemLookup, output, MetalTypes.IRON, Items.IRON_PICKAXE.getDefaultInstance(), + Items.IRON_AXE.getDefaultInstance(), + Items.IRON_SHOVEL.getDefaultInstance(), + Items.IRON_HOE.getDefaultInstance(), Optional.empty(), DispositionType.NEUTRAL); - createToolSet(itemLookup, exporter, MetalTypes.GOLD, Items.GOLDEN_PICKAXE.getDefaultStack(), - Items.GOLDEN_AXE.getDefaultStack(), - Items.GOLDEN_SHOVEL.getDefaultStack(), - Items.GOLDEN_HOE.getDefaultStack(), + createToolSet(itemLookup, output, MetalTypes.GOLD, Items.GOLDEN_PICKAXE.getDefaultInstance(), + Items.GOLDEN_AXE.getDefaultInstance(), + Items.GOLDEN_SHOVEL.getDefaultInstance(), + Items.GOLDEN_HOE.getDefaultInstance(), Optional.empty(), DispositionType.NEUTRAL); - createToolSet(itemLookup, exporter, MetalTypes.STEEL, ToolItemsME.STEEL_PICKAXE.getDefaultStack(), - ToolItemsME.STEEL_AXE.getDefaultStack(), - ToolItemsME.STEEL_SHOVEL.getDefaultStack(), - ToolItemsME.STEEL_HOE.getDefaultStack(), + createToolSet(itemLookup, output, MetalTypes.STEEL, ToolItemsME.STEEL_PICKAXE.getDefaultInstance(), + ToolItemsME.STEEL_AXE.getDefaultInstance(), + ToolItemsME.STEEL_SHOVEL.getDefaultInstance(), + ToolItemsME.STEEL_HOE.getDefaultInstance(), Optional.empty(), DispositionType.NEUTRAL); - createToolSet(itemLookup, exporter, MetalTypes.KHAZAD_STEEL, ToolItemsME.KHAZAD_STEEL_PICKAXE.getDefaultStack(), - ToolItemsME.KHAZAD_STEEL_AXE.getDefaultStack(), - ToolItemsME.KHAZAD_STEEL_SHOVEL.getDefaultStack(), - ToolItemsME.KHAZAD_STEEL_HOE.getDefaultStack(), + createToolSet(itemLookup, output, MetalTypes.KHAZAD_STEEL, ToolItemsME.KHAZAD_STEEL_PICKAXE.getDefaultInstance(), + ToolItemsME.KHAZAD_STEEL_AXE.getDefaultInstance(), + ToolItemsME.KHAZAD_STEEL_SHOVEL.getDefaultInstance(), + ToolItemsME.KHAZAD_STEEL_HOE.getDefaultInstance(), Optional.empty(), DispositionType.GOOD); - createToolSet(itemLookup, exporter, MetalTypes.EDHEL_STEEL, ToolItemsME.EDHEL_STEEL_PICKAXE.getDefaultStack(), - ToolItemsME.EDHEL_STEEL_AXE.getDefaultStack(), - ToolItemsME.EDHEL_STEEL_SHOVEL.getDefaultStack(), - ToolItemsME.EDHEL_STEEL_HOE.getDefaultStack(), + createToolSet(itemLookup, output, MetalTypes.EDHEL_STEEL, ToolItemsME.EDHEL_STEEL_PICKAXE.getDefaultInstance(), + ToolItemsME.EDHEL_STEEL_AXE.getDefaultInstance(), + ToolItemsME.EDHEL_STEEL_SHOVEL.getDefaultInstance(), + ToolItemsME.EDHEL_STEEL_HOE.getDefaultInstance(), Optional.empty(), DispositionType.GOOD); - createToolSet(itemLookup, exporter, MetalTypes.BURZUM_STEEL, ToolItemsME.BURZUM_STEEL_PICKAXE.getDefaultStack(), - ToolItemsME.BURZUM_STEEL_AXE.getDefaultStack(), - ToolItemsME.BURZUM_STEEL_SHOVEL.getDefaultStack(), - ToolItemsME.BURZUM_STEEL_HOE.getDefaultStack(), + createToolSet(itemLookup, output, MetalTypes.BURZUM_STEEL, ToolItemsME.BURZUM_STEEL_PICKAXE.getDefaultInstance(), + ToolItemsME.BURZUM_STEEL_AXE.getDefaultInstance(), + ToolItemsME.BURZUM_STEEL_SHOVEL.getDefaultInstance(), + ToolItemsME.BURZUM_STEEL_HOE.getDefaultInstance(), Optional.empty(), DispositionType.EVIL); - createToolSet(itemLookup, exporter, MetalTypes.MITHRIL, ToolItemsME.MITHRIL_PICKAXE.getDefaultStack(), - ToolItemsME.MITHRIL_AXE.getDefaultStack(), - ToolItemsME.MITHRIL_SHOVEL.getDefaultStack(), - ToolItemsME.MITHRIL_HOE.getDefaultStack(), + createToolSet(itemLookup, output, MetalTypes.MITHRIL, ToolItemsME.MITHRIL_PICKAXE.getDefaultInstance(), + ToolItemsME.MITHRIL_AXE.getDefaultInstance(), + ToolItemsME.MITHRIL_SHOVEL.getDefaultInstance(), + ToolItemsME.MITHRIL_HOE.getDefaultInstance(), Optional.of(MetalTypes.STEEL), DispositionType.NEUTRAL); - createToolSet(itemLookup, exporter, MetalTypes.MITHRIL, ToolItemsME.MITHRIL_PICKAXE.getDefaultStack(), - ToolItemsME.MITHRIL_AXE.getDefaultStack(), - ToolItemsME.MITHRIL_SHOVEL.getDefaultStack(), - ToolItemsME.MITHRIL_HOE.getDefaultStack(), + createToolSet(itemLookup, output, MetalTypes.MITHRIL, ToolItemsME.MITHRIL_PICKAXE.getDefaultInstance(), + ToolItemsME.MITHRIL_AXE.getDefaultInstance(), + ToolItemsME.MITHRIL_SHOVEL.getDefaultInstance(), + ToolItemsME.MITHRIL_HOE.getDefaultInstance(), Optional.of(MetalTypes.KHAZAD_STEEL), DispositionType.NEUTRAL); - createToolSet(itemLookup, exporter, MetalTypes.MITHRIL, ToolItemsME.MITHRIL_PICKAXE.getDefaultStack(), - ToolItemsME.MITHRIL_AXE.getDefaultStack(), - ToolItemsME.MITHRIL_SHOVEL.getDefaultStack(), - ToolItemsME.MITHRIL_HOE.getDefaultStack(), + createToolSet(itemLookup, output, MetalTypes.MITHRIL, ToolItemsME.MITHRIL_PICKAXE.getDefaultInstance(), + ToolItemsME.MITHRIL_AXE.getDefaultInstance(), + ToolItemsME.MITHRIL_SHOVEL.getDefaultInstance(), + ToolItemsME.MITHRIL_HOE.getDefaultInstance(), Optional.of(MetalTypes.EDHEL_STEEL), DispositionType.NEUTRAL); - createToolSet(itemLookup, exporter, MetalTypes.MITHRIL, ToolItemsME.MITHRIL_PICKAXE.getDefaultStack(), - ToolItemsME.MITHRIL_AXE.getDefaultStack(), - ToolItemsME.MITHRIL_SHOVEL.getDefaultStack(), - ToolItemsME.MITHRIL_HOE.getDefaultStack(), + createToolSet(itemLookup, output, MetalTypes.MITHRIL, ToolItemsME.MITHRIL_PICKAXE.getDefaultInstance(), + ToolItemsME.MITHRIL_AXE.getDefaultInstance(), + ToolItemsME.MITHRIL_SHOVEL.getDefaultInstance(), + ToolItemsME.MITHRIL_HOE.getDefaultInstance(), Optional.of(MetalTypes.BURZUM_STEEL), DispositionType.NEUTRAL); - createToolSet(itemLookup, exporter, MetalTypes.NETHERITE, Items.NETHERITE_PICKAXE.getDefaultStack(), - Items.NETHERITE_AXE.getDefaultStack(), - Items.NETHERITE_SHOVEL.getDefaultStack(), - Items.NETHERITE_HOE.getDefaultStack(), + createToolSet(itemLookup, output, MetalTypes.NETHERITE, Items.NETHERITE_PICKAXE.getDefaultInstance(), + Items.NETHERITE_AXE.getDefaultInstance(), + Items.NETHERITE_SHOVEL.getDefaultInstance(), + Items.NETHERITE_HOE.getDefaultInstance(), Optional.empty(), DispositionType.NEUTRAL); - createArtisanTableChiselRecipe(itemLookup, exporter, MetalTypes.IRON, Items.IRON_NUGGET, ToolItemsME.IRON_CHISEL.getDefaultStack()); - createArtisanTableChiselRecipe(itemLookup, exporter, MetalTypes.STEEL, Items.GOLD_NUGGET, ToolItemsME.STEEL_CHISEL.getDefaultStack()); - createArtisanTableChiselRecipe(itemLookup, exporter, MetalTypes.KHAZAD_STEEL, Items.GOLD_NUGGET, ToolItemsME.STEEL_CHISEL.getDefaultStack()); - createArtisanTableChiselRecipe(itemLookup, exporter, MetalTypes.EDHEL_STEEL, Items.GOLD_NUGGET, ToolItemsME.STEEL_CHISEL.getDefaultStack()); - createArtisanTableChiselRecipe(itemLookup, exporter, MetalTypes.BURZUM_STEEL, Items.GOLD_NUGGET, ToolItemsME.STEEL_CHISEL.getDefaultStack()); - createArtisanTableChiselRecipe(itemLookup, exporter, MetalTypes.MITHRIL, ResourceItemsME.MITHRIL_NUGGET, ToolItemsME.MITHRIL_CHISEL.getDefaultStack()); + createArtisanTableChiselRecipe(itemLookup, output, MetalTypes.IRON, Items.IRON_NUGGET, ToolItemsME.IRON_CHISEL.getDefaultInstance()); + createArtisanTableChiselRecipe(itemLookup, output, MetalTypes.STEEL, Items.GOLD_NUGGET, ToolItemsME.STEEL_CHISEL.getDefaultInstance()); + createArtisanTableChiselRecipe(itemLookup, output, MetalTypes.KHAZAD_STEEL, Items.GOLD_NUGGET, ToolItemsME.STEEL_CHISEL.getDefaultInstance()); + createArtisanTableChiselRecipe(itemLookup, output, MetalTypes.EDHEL_STEEL, Items.GOLD_NUGGET, ToolItemsME.STEEL_CHISEL.getDefaultInstance()); + createArtisanTableChiselRecipe(itemLookup, output, MetalTypes.BURZUM_STEEL, Items.GOLD_NUGGET, ToolItemsME.STEEL_CHISEL.getDefaultInstance()); + createArtisanTableChiselRecipe(itemLookup, output, MetalTypes.MITHRIL, ResourceItemsME.MITHRIL_NUGGET, ToolItemsME.MITHRIL_CHISEL.getDefaultInstance()); //endregion //region SHIELDS ItemStack ironShieldBorder = new ItemStack(ResourceItemsME.SHIELD_BORDER); - ironShieldBorder.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.IRON.getName()))), getPattern())); + ironShieldBorder.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.IRON.getName()))), getPattern())); ItemStack bronzeShieldBorder = new ItemStack(ResourceItemsME.SHIELD_BORDER); - bronzeShieldBorder.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.BRONZE.getName()))), getPattern())); + bronzeShieldBorder.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.BRONZE.getName()))), getPattern())); ItemStack crudeShieldBorder = new ItemStack(ResourceItemsME.SHIELD_BORDER); - crudeShieldBorder.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.CRUDE.getName()))), getPattern())); + crudeShieldBorder.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.CRUDE.getName()))), getPattern())); ItemStack steelShieldPlate = new ItemStack(ResourceItemsME.SHIELD_PLATE); - steelShieldPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); + steelShieldPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.STEEL.getName()))), getPattern())); ItemStack edhelSteelShieldPlate = new ItemStack(ResourceItemsME.SHIELD_PLATE); - edhelSteelShieldPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); + edhelSteelShieldPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.EDHEL_STEEL.getName()))), getPattern())); ItemStack khazadSteelShieldPlate = new ItemStack(ResourceItemsME.SHIELD_PLATE); - khazadSteelShieldPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); + khazadSteelShieldPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.KHAZAD_STEEL.getName()))), getPattern())); ItemStack burzumSteelShieldPlate = new ItemStack(ResourceItemsME.SHIELD_PLATE); - burzumSteelShieldPlate.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, Items.SHIELD.getDefaultStack(), "medium_shield", DispositionType.NEUTRAL, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(Items.SHIELD).getPath() + "_artisan"); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROUND_SHIELD.getDefaultStack(), "medium_shield", DispositionType.NEUTRAL, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.ROUND_SHIELD).getPath() + "_artisan"); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.HEATER_SHIELD.getDefaultStack(), "medium_shield", DispositionType.NEUTRAL, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.HEATER_SHIELD).getPath() + "_artisan"); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.KITE_SHIELD.getDefaultStack(), "medium_shield", DispositionType.NEUTRAL, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.KITE_SHIELD).getPath() + "_artisan"); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GONDORIAN_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + burzumSteelShieldPlate.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, MetalTypes.BURZUM_STEEL.getName()))), getPattern())); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, Items.SHIELD.getDefaultInstance(), "medium_shield", DispositionType.NEUTRAL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(Items.SHIELD).getPath() + "_artisan"); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROUND_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.NEUTRAL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.ROUND_SHIELD).getPath() + "_artisan"); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.HEATER_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.NEUTRAL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.HEATER_SHIELD).getPath() + "_artisan"); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.KITE_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.NEUTRAL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.KITE_SHIELD).getPath() + "_artisan"); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GONDORIAN_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.GONDOR_BANNER_PATTERN) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.BLACK_DYE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.BLACK_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GONDORIAN_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GONDORIAN_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GONDORIAN_TOWER_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GONDORIAN_TOWER_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.GONDOR_BANNER_PATTERN) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.BLACK_DYE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.BLACK_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GONDORIAN_TOWER_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GONDORIAN_TOWER_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GONDORIAN_KINGS_GUARD_TOWER_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GONDORIAN_KINGS_GUARD_TOWER_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.GONDOR_BANNER_PATTERN) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.BLACK_DYE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.BLACK_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GONDORIAN_KINGS_GUARD_TOWER_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GONDORIAN_KINGS_GUARD_TOWER_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.LAST_ALLIANCE_HEIRLOOM_TOWER_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.LAST_ALLIANCE_HEIRLOOM_TOWER_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.GONDOR_BANNER_PATTERN) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.BLACK_DYE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.BLACK_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.LAST_ALLIANCE_HEIRLOOM_TOWER_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.LAST_ALLIANCE_HEIRLOOM_TOWER_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GONDORIAN_HERO_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GONDORIAN_HERO_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GONDORIAN_HERO_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GONDORIAN_HERO_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GONDORIAN_KNIGHT_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GONDORIAN_KNIGHT_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.STEEL_NUGGET) .input(ResourceItemsME.GONDOR_BANNER_PATTERN) .input(ResourceItemsME.STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelShieldPlate.getItem()), steelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, steelShieldPlate.getComponents(), steelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GONDORIAN_KNIGHT_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GONDORIAN_KNIGHT_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GONDORIAN_ORNAMENTED_KNIGHT_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GONDORIAN_ORNAMENTED_KNIGHT_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.STEEL_NUGGET) .input(ResourceItemsME.GONDOR_BANNER_PATTERN) .input(ResourceItemsME.STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelShieldPlate.getItem()), steelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, steelShieldPlate.getComponents(), steelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.GOLD_NUGGET) .input(Items.GREEN_DYE) .input(Items.GOLD_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GONDORIAN_ORNAMENTED_KNIGHT_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GONDORIAN_ORNAMENTED_KNIGHT_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.WHITE_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.GREEN_DYE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.GREEN_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.ROHIRRIC_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.ROHIRRIC_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_BUCKING_HORSE_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_BUCKING_HORSE_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.ROHAN_BANNER_PATTERN) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.GREEN_DYE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.GREEN_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.ROHIRRIC_BUCKING_HORSE_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.ROHIRRIC_BUCKING_HORSE_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_GALLOPING_HORSE_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_GALLOPING_HORSE_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.ROHAN_BANNER_PATTERN) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.GREEN_DYE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.GREEN_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.ROHIRRIC_GALLOPING_HORSE_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.ROHIRRIC_GALLOPING_HORSE_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_HORSE_HEAD_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_HORSE_HEAD_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.ROHAN_BANNER_PATTERN) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.GREEN_DYE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.GREEN_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.ROHIRRIC_HORSE_HEAD_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.ROHIRRIC_HORSE_HEAD_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_PLAINSMAN_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_PLAINSMAN_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.YELLOW_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.GREEN_DYE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.GREEN_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.ROHIRRIC_PLAINSMAN_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.ROHIRRIC_PLAINSMAN_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_TWIN_HORSES_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_TWIN_HORSES_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.ROHAN_BANNER_PATTERN) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.GREEN_DYE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.GREEN_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.ROHIRRIC_TWIN_HORSES_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.ROHIRRIC_TWIN_HORSES_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_EORLING_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_EORLING_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.STEEL_NUGGET) .input(Items.YELLOW_DYE) .input(ResourceItemsME.STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelShieldPlate.getItem()), steelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, steelShieldPlate.getComponents(), steelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.ROHIRRIC_EORLING_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.ROHIRRIC_EORLING_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_ORNAMENTED_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_ORNAMENTED_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.STEEL_NUGGET) .input(ResourceItemsME.ROHAN_BANNER_PATTERN) .input(ResourceItemsME.STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelShieldPlate.getItem()), steelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, steelShieldPlate.getComponents(), steelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.GOLD_NUGGET) .input(Items.LEATHER) .input(Items.GOLD_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.ROHIRRIC_ORNAMENTED_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.ROHIRRIC_ORNAMENTED_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_ROYAL_GUARD_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.ROHIRRIC_ROYAL_GUARD_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.STEEL_NUGGET) .input(Items.YELLOW_DYE) .input(ResourceItemsME.STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelShieldPlate.getItem()), steelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, steelShieldPlate.getComponents(), steelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.ROHIRRIC_ROYAL_GUARD_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.ROHIRRIC_ROYAL_GUARD_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_BLUE_OVAL_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_BLUE_OVAL_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.BLUE_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.BLUE_DYE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.BLUE_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.DALISH_BLUE_OVAL_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.DALISH_BLUE_OVAL_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_BARDING_OVAL_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_BARDING_OVAL_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.BLUE_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.GOLD_NUGGET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.GOLD_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.DALISH_BARDING_OVAL_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.DALISH_BARDING_OVAL_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_BLUE_BRACED_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_BLUE_BRACED_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.IRON_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.BLUE_DYE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.BLUE_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.DALISH_BLUE_BRACED_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.DALISH_BLUE_BRACED_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_BARDING_BRACED_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_BARDING_BRACED_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.IRON_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.GOLD_NUGGET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.GOLD_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.DALISH_BARDING_BRACED_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.DALISH_BARDING_BRACED_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_HEAVY_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_HEAVY_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.STEEL_NUGGET) .input(Items.WHITE_DYE) .input(ResourceItemsME.STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelShieldPlate.getItem()), steelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, steelShieldPlate.getComponents(), steelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.DALISH_HEAVY_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.DALISH_HEAVY_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_BARDING_HEAVY_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_BARDING_HEAVY_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.STEEL_NUGGET) .input(Items.BLUE_DYE) .input(ResourceItemsME.STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelShieldPlate.getItem()), steelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, steelShieldPlate.getComponents(), steelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.DALISH_BARDING_HEAVY_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.DALISH_BARDING_HEAVY_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_ROYAL_HEAVY_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_ROYAL_HEAVY_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(Items.GOLD_NUGGET) .input(Items.LIGHT_BLUE_DYE) .input(Items.GOLD_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelShieldPlate.getItem()), steelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, steelShieldPlate.getComponents(), steelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.DALISH_ROYAL_HEAVY_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.DALISH_ROYAL_HEAVY_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_ROYAL_ROUND_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_ROYAL_ROUND_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(Items.GOLD_NUGGET) .input(Items.LIGHT_BLUE_DYE) .input(Items.GOLD_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelShieldPlate.getItem()), steelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, steelShieldPlate.getComponents(), steelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.GOLD_NUGGET) .input(Items.LEATHER) .input(Items.GOLD_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.DALISH_ROYAL_ROUND_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.DALISH_ROYAL_ROUND_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_HEYDAY_ROUND_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DALISH_HEYDAY_ROUND_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.STEEL_NUGGET) .input(Items.ORANGE_DYE) .input(ResourceItemsME.STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(steelShieldPlate.getItem()), steelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, steelShieldPlate.getComponents(), steelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.DALISH_HEYDAY_ROUND_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.DALISH_HEYDAY_ROUND_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.LORIEN_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.LORIEN_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.LORIEN_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.LORIEN_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.LORIEN_LAURELS_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.LORIEN_LAURELS_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.YELLOW_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.LORIEN_LAURELS_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.LORIEN_LAURELS_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.LORIEN_MALLORN_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.LORIEN_MALLORN_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.YELLOW_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.LORIEN_MALLORN_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.LORIEN_MALLORN_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GALADHRIM_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GALADHRIM_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.YELLOW_DYE) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelShieldPlate.getItem()), edhelSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, edhelSteelShieldPlate.getComponents(), edhelSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GALADHRIM_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GALADHRIM_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GALADHRIM_LORD_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GALADHRIM_LORD_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.YELLOW_DYE) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelShieldPlate.getItem()), edhelSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, edhelSteelShieldPlate.getComponents(), edhelSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.GOLD_NUGGET) .input(Items.LEATHER) .input(Items.GOLD_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GALADHRIM_LORD_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GALADHRIM_LORD_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_BUCKLER_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_BUCKLER_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.COPPER_INGOT) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeShieldBorder.getItem()), bronzeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, bronzeShieldBorder.getComponents(), bronzeShieldBorder.getItem())) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.WOODLAND_REALM_BUCKLER_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.WOODLAND_REALM_BUCKLER_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_SCOUT_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_SCOUT_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.SILVER_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.WOODLAND_REALM_SCOUT_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_SCOUT_BRONZE_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.WOODLAND_REALM_SCOUT_SHIELD).getPath() + "_artisan"); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_SCOUT_BRONZE_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BRONZE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.WOODLAND_REALM_SCOUT_BRONZE_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.WOODLAND_REALM_SCOUT_BRONZE_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GALADHRIM_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GALADHRIM_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.BROWN_DYE) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelShieldPlate.getItem()), edhelSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, edhelSteelShieldPlate.getComponents(), edhelSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.WOODLAND_REALM_HEAVY_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_HEAVY_GREEN_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.WOODLAND_REALM_HEAVY_SHIELD).getPath() + "_artisan"); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_HEAVY_GREEN_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.GREEN_DYE) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelShieldPlate.getItem()), edhelSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, edhelSteelShieldPlate.getComponents(), edhelSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.WOODLAND_REALM_HEAVY_GREEN_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_HEAVY_BLUE_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.WOODLAND_REALM_HEAVY_GREEN_SHIELD).getPath() + "_artisan"); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_HEAVY_BLUE_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.BLUE_DYE) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelShieldPlate.getItem()), edhelSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, edhelSteelShieldPlate.getComponents(), edhelSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.WOODLAND_REALM_HEAVY_BLUE_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.WOODLAND_REALM_HEAVY_BLUE_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_HEAVY_ORNAMENTED_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_HEAVY_ORNAMENTED_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.BROWN_DYE) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelShieldPlate.getItem()), edhelSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, edhelSteelShieldPlate.getComponents(), edhelSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.GOLD_INGOT) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.WOODLAND_REALM_HEAVY_ORNAMENTED_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_HEAVY_ORNAMENTED_GREEN_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.WOODLAND_REALM_HEAVY_ORNAMENTED_SHIELD).getPath() + "_artisan"); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_HEAVY_ORNAMENTED_GREEN_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.GREEN_DYE) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelShieldPlate.getItem()), edhelSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, edhelSteelShieldPlate.getComponents(), edhelSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.GOLD_INGOT) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.WOODLAND_REALM_HEAVY_ORNAMENTED_GREEN_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.WOODLAND_REALM_HEAVY_ORNAMENTED_GREEN_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_GLADE_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_GLADE_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.GREEN_DYE) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelShieldPlate.getItem()), edhelSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, edhelSteelShieldPlate.getComponents(), edhelSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.GOLD_INGOT) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.WOODLAND_REALM_GLADE_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.WOODLAND_REALM_GLADE_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_NIGHTSHADE_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_NIGHTSHADE_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.BLACK_DYE) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelShieldPlate.getItem()), edhelSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, edhelSteelShieldPlate.getComponents(), edhelSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.WOODLAND_REALM_NIGHTSHADE_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_NIGHTSHADE_ORNAMENTED_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.WOODLAND_REALM_NIGHTSHADE_SHIELD).getPath() + "_artisan"); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WOODLAND_REALM_NIGHTSHADE_ORNAMENTED_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.BLACK_DYE) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(edhelSteelShieldPlate.getItem()), edhelSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, edhelSteelShieldPlate.getComponents(), edhelSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) .input(Items.GOLD_INGOT) .input(ResourceItemsME.EDHEL_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.WOODLAND_REALM_NIGHTSHADE_ORNAMENTED_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.WOODLAND_REALM_NIGHTSHADE_ORNAMENTED_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BRONZE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeShieldBorder.getItem()), bronzeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, bronzeShieldBorder.getComponents(), bronzeShieldBorder.getItem())) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.EREBOR_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.EREBOR_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_CROSS_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_CROSS_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BRONZE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeShieldBorder.getItem()), bronzeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, bronzeShieldBorder.getComponents(), bronzeShieldBorder.getItem())) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.EREBOR_CROSS_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.EREBOR_CROSS_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_PLATED_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_PLATED_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BRONZE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BRONZE_NUGGET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeShieldBorder.getItem()), bronzeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, bronzeShieldBorder.getComponents(), bronzeShieldBorder.getItem())) .input(ResourceItemsME.BRONZE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.EREBOR_PLATED_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.EREBOR_PLATED_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_ORNAMENTED_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_ORNAMENTED_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.GOLD_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BRONZE_NUGGET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeShieldBorder.getItem()), bronzeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, bronzeShieldBorder.getComponents(), bronzeShieldBorder.getItem())) .input(ResourceItemsME.BRONZE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.EREBOR_ORNAMENTED_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.EREBOR_ORNAMENTED_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_REINFORCED_SHIELD.getDefaultStack(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_REINFORCED_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.GOOD, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.IRON_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BRONZE_NUGGET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(bronzeShieldBorder.getItem()), bronzeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, bronzeShieldBorder.getComponents(), bronzeShieldBorder.getItem())) .input(ResourceItemsME.BRONZE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.EREBOR_REINFORCED_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.EREBOR_REINFORCED_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_BUCKLER_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_BUCKLER_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) .input(ResourceItemsME.BRONZE_INGOT) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelShieldPlate.getItem()), khazadSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, khazadSteelShieldPlate.getComponents(), khazadSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.EREBOR_BUCKLER_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.EREBOR_BUCKLER_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_TOWER_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_TOWER_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) .input(ResourceItemsME.KHAZAD_STEEL_INGOT) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelShieldPlate.getItem()), khazadSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, khazadSteelShieldPlate.getComponents(), khazadSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.EREBOR_TOWER_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.EREBOR_TOWER_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_REINFORCED_TOWER_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_REINFORCED_TOWER_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) .input(ResourceItemsME.KHAZAD_STEEL_INGOT) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelShieldPlate.getItem()), khazadSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, khazadSteelShieldPlate.getComponents(), khazadSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) .input(ResourceItemsME.KHAZAD_STEEL_INGOT) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.EREBOR_REINFORCED_TOWER_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.EREBOR_REINFORCED_TOWER_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_ORNAMENTED_TOWER_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.EREBOR_ORNAMENTED_TOWER_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) .input(Items.GOLD_NUGGET) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelShieldPlate.getItem()), khazadSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, khazadSteelShieldPlate.getComponents(), khazadSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) .input(Items.GOLD_NUGGET) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.EREBOR_ORNAMENTED_TOWER_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.EREBOR_ORNAMENTED_TOWER_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RAVENHILL_TOWER_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RAVENHILL_TOWER_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) .input(ResourceItemsME.KHAZAD_STEEL_INGOT) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelShieldPlate.getItem()), khazadSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, khazadSteelShieldPlate.getComponents(), khazadSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.RAVENHILL_TOWER_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.RAVENHILL_TOWER_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RAVENHILL_REINFORCED_TOWER_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RAVENHILL_REINFORCED_TOWER_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) .input(ResourceItemsME.KHAZAD_STEEL_INGOT) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelShieldPlate.getItem()), khazadSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, khazadSteelShieldPlate.getComponents(), khazadSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) .input(ResourceItemsME.KHAZAD_STEEL_INGOT) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.RAVENHILL_REINFORCED_TOWER_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.RAVENHILL_REINFORCED_TOWER_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RAVENHILL_ORNAMENTED_TOWER_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RAVENHILL_ORNAMENTED_TOWER_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.GOOD, XP_HEAVY_SHIELD) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) .input(Items.GOLD_NUGGET) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(khazadSteelShieldPlate.getItem()), khazadSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, khazadSteelShieldPlate.getComponents(), khazadSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) .input(Items.GOLD_NUGGET) .input(ResourceItemsME.KHAZAD_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.RAVENHILL_ORNAMENTED_TOWER_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.RAVENHILL_ORNAMENTED_TOWER_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_WOODEN_SHIELD.getDefaultStack(), "light_shield", DispositionType.EVIL) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_WOODEN_SHIELD.getDefaultInstance(), "light_shield", DispositionType.EVIL) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_INGOT) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.CRUDE_INGOT)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.MORDOR_WOODEN_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.CRUDE_INGOT)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.MORDOR_WOODEN_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_PAINTED_WOODEN_SHIELD.getDefaultStack(), "light_shield", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_PAINTED_WOODEN_SHIELD.getDefaultInstance(), "light_shield", DispositionType.EVIL) .input(WeaponItemsME.MORDOR_WOODEN_SHIELD) .input(ResourceItemsME.MORDOR_BANNER_PATTERN) - .criterion(hasItem(WeaponItemsME.MORDOR_WOODEN_SHIELD), - conditionsFromItem(WeaponItemsME.MORDOR_WOODEN_SHIELD)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.MORDOR_PAINTED_WOODEN_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(WeaponItemsME.MORDOR_WOODEN_SHIELD), + has(WeaponItemsME.MORDOR_WOODEN_SHIELD)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.MORDOR_PAINTED_WOODEN_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_ROUND_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_ROUND_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_NUGGET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeShieldBorder.getItem()), crudeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, crudeShieldBorder.getComponents(), crudeShieldBorder.getItem())) .input(ResourceItemsME.CRUDE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.MORDOR_ROUND_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.MORDOR_ROUND_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_PAINTED_ROUND_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_PAINTED_ROUND_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.MORDOR_BANNER_PATTERN) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_NUGGET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeShieldBorder.getItem()), crudeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, crudeShieldBorder.getComponents(), crudeShieldBorder.getItem())) .input(ResourceItemsME.CRUDE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.MORDOR_BANNER_PATTERN), - conditionsFromItem(ResourceItemsME.MORDOR_BANNER_PATTERN)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.MORDOR_PAINTED_ROUND_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.MORDOR_BANNER_PATTERN), + has(ResourceItemsME.MORDOR_BANNER_PATTERN)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.MORDOR_PAINTED_ROUND_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_BLACK_ROUND_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_BLACK_ROUND_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) .input(WeaponItemsME.MORDOR_PAINTED_ROUND_SHIELD) .input(Items.BLACK_DYE) - .criterion(hasItem(WeaponItemsME.MORDOR_PAINTED_ROUND_SHIELD), - conditionsFromItem(WeaponItemsME.MORDOR_PAINTED_ROUND_SHIELD)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.MORDOR_BLACK_ROUND_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(WeaponItemsME.MORDOR_PAINTED_ROUND_SHIELD), + has(WeaponItemsME.MORDOR_PAINTED_ROUND_SHIELD)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.MORDOR_BLACK_ROUND_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_BRACED_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_BRACED_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.IRON_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_NUGGET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeShieldBorder.getItem()), crudeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, crudeShieldBorder.getComponents(), crudeShieldBorder.getItem())) .input(ResourceItemsME.CRUDE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.MORDOR_BRACED_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.MORDOR_BRACED_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_PAINTED_BRACED_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_PAINTED_BRACED_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) .input(WeaponItemsME.MORDOR_BRACED_SHIELD) .input(ResourceItemsME.MORDOR_BANNER_PATTERN) - .criterion(hasItem(WeaponItemsME.MORDOR_BRACED_SHIELD), - conditionsFromItem(WeaponItemsME.MORDOR_BRACED_SHIELD)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.MORDOR_PAINTED_BRACED_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(WeaponItemsME.MORDOR_BRACED_SHIELD), + has(WeaponItemsME.MORDOR_BRACED_SHIELD)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.MORDOR_PAINTED_BRACED_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_BLACK_BRACED_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_BLACK_BRACED_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) .input(WeaponItemsME.MORDOR_PAINTED_BRACED_SHIELD) .input(Items.BLACK_DYE) - .criterion(hasItem(WeaponItemsME.MORDOR_PAINTED_BRACED_SHIELD), - conditionsFromItem(WeaponItemsME.MORDOR_PAINTED_BRACED_SHIELD)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.MORDOR_BLACK_BRACED_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(WeaponItemsME.MORDOR_PAINTED_BRACED_SHIELD), + has(WeaponItemsME.MORDOR_PAINTED_BRACED_SHIELD)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.MORDOR_BLACK_BRACED_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_LARGE_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_LARGE_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.IRON_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_INGOT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeShieldBorder.getItem()), crudeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, crudeShieldBorder.getComponents(), crudeShieldBorder.getItem())) .input(ResourceItemsME.CRUDE_INGOT) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.MORDOR_LARGE_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.MORDOR_LARGE_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_PAINTED_LARGE_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_PAINTED_LARGE_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) .input(WeaponItemsME.MORDOR_LARGE_SHIELD) .input(ResourceItemsME.MORDOR_BANNER_PATTERN) - .criterion(hasItem(WeaponItemsME.MORDOR_LARGE_SHIELD), - conditionsFromItem(WeaponItemsME.MORDOR_LARGE_SHIELD)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.MORDOR_PAINTED_LARGE_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(WeaponItemsME.MORDOR_LARGE_SHIELD), + has(WeaponItemsME.MORDOR_LARGE_SHIELD)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.MORDOR_PAINTED_LARGE_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_BLACK_LARGE_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_BLACK_LARGE_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) .input(WeaponItemsME.MORDOR_PAINTED_LARGE_SHIELD) .input(Items.BLACK_DYE) - .criterion(hasItem(WeaponItemsME.MORDOR_PAINTED_LARGE_SHIELD), - conditionsFromItem(WeaponItemsME.MORDOR_PAINTED_LARGE_SHIELD)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.MORDOR_BLACK_LARGE_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(WeaponItemsME.MORDOR_PAINTED_LARGE_SHIELD), + has(WeaponItemsME.MORDOR_PAINTED_LARGE_SHIELD)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.MORDOR_BLACK_LARGE_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DOL_GULDUR_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DOL_GULDUR_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.IRON_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_NUGGET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeShieldBorder.getItem()), crudeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, crudeShieldBorder.getComponents(), crudeShieldBorder.getItem())) .input(ResourceItemsME.CRUDE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.DOL_GULDUR_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.DOL_GULDUR_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DOL_GULDUR_PAVISE.getDefaultStack(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DOL_GULDUR_PAVISE.getDefaultInstance(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelShieldPlate.getItem()), burzumSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, burzumSteelShieldPlate.getComponents(), burzumSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.DOL_GULDUR_PAVISE).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DOL_GULDUR_ARMRUST_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.DOL_GULDUR_PAVISE).getPath() + "_artisan"); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DOL_GULDUR_ARMRUST_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelShieldPlate.getItem()), burzumSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, burzumSteelShieldPlate.getComponents(), burzumSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.DOL_GULDUR_ARMRUST_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DOL_GULDUR_HEAVY_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.DOL_GULDUR_ARMRUST_SHIELD).getPath() + "_artisan"); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DOL_GULDUR_HEAVY_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelShieldPlate.getItem()), burzumSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, burzumSteelShieldPlate.getComponents(), burzumSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.DOL_GULDUR_HEAVY_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DOL_GULDUR_HEAVY_SKULL_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.DOL_GULDUR_HEAVY_SHIELD).getPath() + "_artisan"); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.DOL_GULDUR_HEAVY_SKULL_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .input(ModDecorativeBlocks.OLD_SKULL.asItem()) + .input(ModDecorativeBlocks.OLD_SKULL) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelShieldPlate.getItem()), burzumSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, burzumSteelShieldPlate.getComponents(), burzumSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.DOL_GULDUR_HEAVY_SKULL_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.DOL_GULDUR_HEAVY_SKULL_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GONDORIAN_CONVERTED_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GONDORIAN_CONVERTED_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) .input(WeaponItemsME.GONDORIAN_SHIELD) .input(ResourceItemsME.MORDOR_BANNER_PATTERN) - .criterion(hasItem(WeaponItemsME.GONDORIAN_SHIELD), - conditionsFromItem(WeaponItemsME.GONDORIAN_SHIELD)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GONDORIAN_CONVERTED_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(WeaponItemsME.GONDORIAN_SHIELD), + has(WeaponItemsME.GONDORIAN_SHIELD)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GONDORIAN_CONVERTED_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_HEAVY_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_HEAVY_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelShieldPlate.getItem()), burzumSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, burzumSteelShieldPlate.getComponents(), burzumSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.MORDOR_HEAVY_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.MORDOR_HEAVY_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_PAINTED_HEAVY_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORDOR_PAINTED_HEAVY_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) .input(WeaponItemsME.MORDOR_HEAVY_SHIELD) .input(ResourceItemsME.MORDOR_BANNER_PATTERN) - .criterion(hasItem(WeaponItemsME.MORDOR_HEAVY_SHIELD), - conditionsFromItem(WeaponItemsME.MORDOR_HEAVY_SHIELD)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.MORDOR_PAINTED_HEAVY_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(WeaponItemsME.MORDOR_HEAVY_SHIELD), + has(WeaponItemsME.MORDOR_HEAVY_SHIELD)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.MORDOR_PAINTED_HEAVY_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.BLACK_NUMENOREAN_TOWER_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.BLACK_NUMENOREAN_TOWER_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.RED_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.BLACK_DYE) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(ironShieldBorder.getItem()), ironShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, ironShieldBorder.getComponents(), ironShieldBorder.getItem())) .input(Items.BLACK_DYE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.BLACK_NUMENOREAN_TOWER_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.BLACK_NUMENOREAN_TOWER_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.URUK_HAI_HEATER_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.URUK_HAI_HEATER_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) .input(ResourceItemsME.CRUDE_NUGGET) .input(ResourceItemsME.CRUDE_INGOT) .input(ResourceItemsME.CRUDE_NUGGET) .input(ResourceItemsME.CRUDE_INGOT) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeShieldBorder.getItem()), crudeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, crudeShieldBorder.getComponents(), crudeShieldBorder.getItem())) .input(ResourceItemsME.CRUDE_INGOT) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.URUK_HAI_HEATER_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.URUK_HAI_HEATER_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.URUK_HAI_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.URUK_HAI_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelShieldPlate.getItem()), burzumSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, burzumSteelShieldPlate.getComponents(), burzumSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.URUK_HAI_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.URUK_HAI_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.URUK_HAI_WHITE_HAND_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.URUK_HAI_WHITE_HAND_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) .input(WeaponItemsME.URUK_HAI_SHIELD) .input(ResourceItemsME.ISENGARD_BANNER_PATTERN) - .criterion(hasItem(WeaponItemsME.URUK_HAI_SHIELD), - conditionsFromItem(WeaponItemsME.URUK_HAI_SHIELD)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.URUK_HAI_WHITE_HAND_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(WeaponItemsME.URUK_HAI_SHIELD), + has(WeaponItemsME.URUK_HAI_SHIELD)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.URUK_HAI_WHITE_HAND_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.URUK_HAI_WHITE_PALMPRINT_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.URUK_HAI_WHITE_PALMPRINT_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) .input(WeaponItemsME.URUK_HAI_SHIELD) .input(ResourceItemsME.ISENGARD_BANNER_PATTERN) - .criterion(hasItem(WeaponItemsME.URUK_HAI_SHIELD), - conditionsFromItem(WeaponItemsME.URUK_HAI_SHIELD)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.URUK_HAI_WHITE_PALMPRINT_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(WeaponItemsME.URUK_HAI_SHIELD), + has(WeaponItemsME.URUK_HAI_SHIELD)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.URUK_HAI_WHITE_PALMPRINT_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.URUK_HAI_S_RUNE_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.URUK_HAI_S_RUNE_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) .input(WeaponItemsME.URUK_HAI_SHIELD) .input(ResourceItemsME.ISENGARD_BANNER_PATTERN) - .criterion(hasItem(WeaponItemsME.URUK_HAI_SHIELD), - conditionsFromItem(WeaponItemsME.URUK_HAI_SHIELD)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.URUK_HAI_S_RUNE_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(WeaponItemsME.URUK_HAI_SHIELD), + has(WeaponItemsME.URUK_HAI_SHIELD)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.URUK_HAI_S_RUNE_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.URUK_HAI_SIEGE_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.URUK_HAI_SIEGE_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelShieldPlate.getItem()), burzumSteelShieldPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelShieldPlate.getComponents(), burzumSteelShieldPlate.getItem())) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelShieldPlate.getItem()), burzumSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, burzumSteelShieldPlate.getComponents(), burzumSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelShieldPlate.getItem()), burzumSteelShieldPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelShieldPlate.getComponents(), burzumSteelShieldPlate.getItem())) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.URUK_HAI_SIEGE_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.URUK_HAI_SIEGE_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GUNDABAD_WOODEN_SHIELD.getDefaultStack(), "light_shield", DispositionType.EVIL) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GUNDABAD_WOODEN_SHIELD.getDefaultInstance(), "light_shield", DispositionType.EVIL) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_INGOT) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.CRUDE_INGOT)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GUNDABAD_WOODEN_SHIELD).getPath() + "_artisan"); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GUNDABAD_PAINTED_WOODEN_SHIELD.getDefaultStack(), "light_shield", DispositionType.EVIL) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.CRUDE_INGOT)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GUNDABAD_WOODEN_SHIELD).getPath() + "_artisan"); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GUNDABAD_PAINTED_WOODEN_SHIELD.getDefaultInstance(), "light_shield", DispositionType.EVIL) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.MISTY_MOUNTAINS_ORCS_BANNER_PATTERN) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.CRUDE_INGOT)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GUNDABAD_PAINTED_WOODEN_SHIELD).getPath() + "_artisan"); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GUNDABAD_GREAT_EYE_PAINTED_WOODEN_SHIELD.getDefaultStack(), "light_shield", DispositionType.EVIL) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.CRUDE_INGOT)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GUNDABAD_PAINTED_WOODEN_SHIELD).getPath() + "_artisan"); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GUNDABAD_GREAT_EYE_PAINTED_WOODEN_SHIELD.getDefaultInstance(), "light_shield", DispositionType.EVIL) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.MISTY_MOUNTAINS_ORCS_BANNER_PATTERN) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.CRUDE_INGOT)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GUNDABAD_GREAT_EYE_PAINTED_WOODEN_SHIELD).getPath() + "_artisan"); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GUNDABAD_PEAKS_PAINTED_WOODEN_SHIELD.getDefaultStack(), "light_shield", DispositionType.EVIL) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.CRUDE_INGOT)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GUNDABAD_GREAT_EYE_PAINTED_WOODEN_SHIELD).getPath() + "_artisan"); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GUNDABAD_PEAKS_PAINTED_WOODEN_SHIELD.getDefaultInstance(), "light_shield", DispositionType.EVIL) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.MISTY_MOUNTAINS_ORCS_BANNER_PATTERN) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.CRUDE_INGOT)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GUNDABAD_PEAKS_PAINTED_WOODEN_SHIELD).getPath() + "_artisan"); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GUNDABAD_REINFORCED_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.CRUDE_INGOT)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GUNDABAD_PEAKS_PAINTED_WOODEN_SHIELD).getPath() + "_artisan"); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GUNDABAD_REINFORCED_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_NUGGET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeShieldBorder.getItem()), crudeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, crudeShieldBorder.getComponents(), crudeShieldBorder.getItem())) .input(ResourceItemsME.CRUDE_INGOT) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GUNDABAD_REINFORCED_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GUNDABAD_REINFORCED_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GUNDABAD_HEAVY_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GUNDABAD_HEAVY_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelShieldPlate.getItem()), burzumSteelShieldPlate.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, burzumSteelShieldPlate.getComponents(), burzumSteelShieldPlate.getItem())) .input(Items.LEATHER) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GUNDABAD_HEAVY_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GUNDABAD_HEAVY_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORIA_GOBLINS_BUCKLER_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORIA_GOBLINS_BUCKLER_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_NUGGET) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeShieldBorder.getItem()), crudeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, crudeShieldBorder.getComponents(), crudeShieldBorder.getItem())) .input(ResourceItemsME.CRUDE_INGOT) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.MORIA_GOBLINS_BUCKLER_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORIA_GOBLINS_HEAVY_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.MORIA_GOBLINS_BUCKLER_SHIELD).getPath() + "_artisan"); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.MORIA_GOBLINS_HEAVY_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelShieldPlate.getItem()), burzumSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, burzumSteelShieldPlate.getComponents(), burzumSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.MORIA_GOBLINS_HEAVY_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.MORIA_GOBLINS_HEAVY_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RUINED_DWARVEN_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RUINED_DWARVEN_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeShieldBorder.getItem()), crudeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, crudeShieldBorder.getComponents(), crudeShieldBorder.getItem())) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.RUINED_DWARVEN_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RUINED_DWARVEN_CROSS_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.RUINED_DWARVEN_SHIELD).getPath() + "_artisan"); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RUINED_DWARVEN_CROSS_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeShieldBorder.getItem()), crudeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, crudeShieldBorder.getComponents(), crudeShieldBorder.getItem())) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.RUINED_DWARVEN_CROSS_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RUINED_DWARVEN_ORNAMENTED_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.RUINED_DWARVEN_CROSS_SHIELD).getPath() + "_artisan"); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RUINED_DWARVEN_ORNAMENTED_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeShieldBorder.getItem()), crudeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, crudeShieldBorder.getComponents(), crudeShieldBorder.getItem())) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.RUINED_DWARVEN_ORNAMENTED_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RUINED_DWARVEN_REINFORCED_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.RUINED_DWARVEN_ORNAMENTED_SHIELD).getPath() + "_artisan"); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RUINED_DWARVEN_REINFORCED_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(crudeShieldBorder.getItem()), crudeShieldBorder.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, crudeShieldBorder.getComponents(), crudeShieldBorder.getItem())) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.RUINED_DWARVEN_REINFORCED_SHIELD).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.RUINED_DWARVEN_REINFORCED_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RUINED_DWARVEN_ORNAMENTED_TOWER_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RUINED_DWARVEN_ORNAMENTED_TOWER_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) .input(Items.LEATHER) .input(ResourceItemsME.CRUDE_NUGGET) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(WeaponItemsME.RUINED_DWARVEN_ORNAMENTED_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.RUINED_DWARVEN_ORNAMENTED_TOWER_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RUINED_DWARVEN_REINFORCED_TOWER_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.RUINED_DWARVEN_ORNAMENTED_TOWER_SHIELD).getPath() + "_artisan"); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.RUINED_DWARVEN_REINFORCED_TOWER_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) .input(Items.LEATHER) .input(ResourceItemsME.CRUDE_NUGGET) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(WeaponItemsME.RUINED_DWARVEN_REINFORCED_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.RUINED_DWARVEN_REINFORCED_TOWER_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.RUINED_DWARVEN_REINFORCED_TOWER_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GOBLIN_TOWN_BONE_SHIELD.getDefaultStack(), "light_shield", DispositionType.EVIL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GOBLIN_TOWN_BONE_SHIELD.getDefaultInstance(), "light_shield", DispositionType.EVIL) .input(Items.BONE) .input(Items.BONE) .input(ResourceItemsME.CRUDE_INGOT) .input(Items.BONE) .input(Items.BONE) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.CRUDE_INGOT)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GOBLIN_TOWN_BONE_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.CRUDE_INGOT)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GOBLIN_TOWN_BONE_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GOBLIN_TOWN_WOODEN_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GOBLIN_TOWN_WOODEN_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.CRUDE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GOBLIN_TOWN_WOODEN_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GOBLIN_TOWN_BONE_WOODEN_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GOBLIN_TOWN_WOODEN_SHIELD).getPath() + "_artisan"); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GOBLIN_TOWN_BONE_WOODEN_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) .input(Items.BONE) .input(ResourceItemsME.CRUDE_NUGGET) .input(Items.BONE) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(WeaponItemsME.GOBLIN_TOWN_WOODEN_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.BONE) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GOBLIN_TOWN_BONE_WOODEN_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GOBLIN_TOWN_LEATHER_WOODEN_SHIELD.getDefaultStack(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GOBLIN_TOWN_BONE_WOODEN_SHIELD).getPath() + "_artisan"); + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GOBLIN_TOWN_LEATHER_WOODEN_SHIELD.getDefaultInstance(), "medium_shield", DispositionType.EVIL, XP_MEDIUM_SHIELD) .input(Items.LEATHER) .input(ResourceItemsME.CRUDE_NUGGET) .input(Items.LEATHER) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(WeaponItemsME.GOBLIN_TOWN_WOODEN_SHIELD) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(Items.LEATHER) - .criterion(hasItem(ResourceItemsME.SHIELD_BORDER), - conditionsFromItem(ResourceItemsME.SHIELD_BORDER)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GOBLIN_TOWN_LEATHER_WOODEN_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_BORDER), + has(ResourceItemsME.SHIELD_BORDER)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GOBLIN_TOWN_LEATHER_WOODEN_SHIELD).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GOBLIN_TOWN_HEAVY_SHIELD.getDefaultStack(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.GOBLIN_TOWN_HEAVY_SHIELD.getDefaultInstance(), "heavy_shield", DispositionType.EVIL, XP_HEAVY_SHIELD) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(burzumSteelShieldPlate.getItem()), burzumSteelShieldPlate.getComponentChanges())) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .componentInput(DataComponentIngredient.of(false, burzumSteelShieldPlate.getComponents(), burzumSteelShieldPlate.getItem())) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) .input(Items.LEATHER) .input(ResourceItemsME.BURZUM_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.SHIELD_PLATE), - conditionsFromItem(ResourceItemsME.SHIELD_PLATE)) - .offerTo(exporter, Registries.ITEM.getId(WeaponItemsME.GOBLIN_TOWN_HEAVY_SHIELD).getPath() + "_artisan"); + .unlockedBy(getHasName(ResourceItemsME.SHIELD_PLATE), + has(ResourceItemsME.SHIELD_PLATE)) + .save(output, BuiltInRegistries.ITEM.getKey(WeaponItemsME.GOBLIN_TOWN_HEAVY_SHIELD).getPath() + "_artisan"); //endregion - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, ToolItemsME.PIPE.getDefaultStack(), "pipe", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, ToolItemsME.PIPE.getDefaultInstance(), "pipe", DispositionType.NEUTRAL) .input(Items.STICK) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_slabs"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_slabs"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(Items.STICK), - conditionsFromItem(Items.STICK)) - .offerTo(exporter, Registries.ITEM.getId(ToolItemsME.PIPE).getPath() + "_artisan"); - - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, ToolItemsME.CLAY_PIPE.getDefaultStack(), "pipe", DispositionType.NEUTRAL) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_slabs"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_slabs"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(Items.STICK), + has(Items.STICK)) + .save(output, BuiltInRegistries.ITEM.getKey(ToolItemsME.PIPE).getPath() + "_artisan"); + + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, ToolItemsME.CLAY_PIPE.getDefaultInstance(), "pipe", DispositionType.NEUTRAL) .input(Items.STICK) .input(Items.TERRACOTTA) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_slabs"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_slabs"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_slabs"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_slabs"))) .input(Items.TERRACOTTA) .input(Items.TERRACOTTA) - .criterion(hasItem(Items.STICK), - conditionsFromItem(Items.STICK)) - .offerTo(exporter, Registries.ITEM.getId(ToolItemsME.CLAY_PIPE).getPath() + "_artisan"); + .unlockedBy(getHasName(Items.STICK), + has(Items.STICK)) + .save(output, BuiltInRegistries.ITEM.getKey(ToolItemsME.CLAY_PIPE).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, ToolItemsME.RIVERBEND_PIPE.getDefaultStack(), "pipe", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, ToolItemsME.RIVERBEND_PIPE.getDefaultInstance(), "pipe", DispositionType.NEUTRAL) .input(Items.STICK) .input(ResourceItemsME.BRONZE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_slabs"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_slabs"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_slabs"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_slabs"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BRONZE_NUGGET) - .criterion(hasItem(Items.STICK), - conditionsFromItem(Items.STICK)) - .offerTo(exporter, Registries.ITEM.getId(ToolItemsME.RIVERBEND_PIPE).getPath() + "_artisan"); + .unlockedBy(getHasName(Items.STICK), + has(Items.STICK)) + .save(output, BuiltInRegistries.ITEM.getKey(ToolItemsME.RIVERBEND_PIPE).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, ToolItemsME.BRIMMINGBEND_PIPE.getDefaultStack(), "pipe", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, ToolItemsME.BRIMMINGBEND_PIPE.getDefaultInstance(), "pipe", DispositionType.NEUTRAL) .input(Items.STICK) .input(ResourceItemsME.BRONZE_NUGGET) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_slabs"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_slabs"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_slabs"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_slabs"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) .input(ResourceItemsME.BRONZE_NUGGET) - .criterion(hasItem(Items.STICK), - conditionsFromItem(Items.STICK)) - .offerTo(exporter, Registries.ITEM.getId(ToolItemsME.BRIMMINGBEND_PIPE).getPath() + "_artisan"); + .unlockedBy(getHasName(Items.STICK), + has(Items.STICK)) + .save(output, BuiltInRegistries.ITEM.getKey(ToolItemsME.BRIMMINGBEND_PIPE).getPath() + "_artisan"); - ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, ToolItemsME.LONGBOTTOM_PIPE.getDefaultStack(), "pipe", DispositionType.NEUTRAL) + ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, ToolItemsME.LONGBOTTOM_PIPE.getDefaultInstance(), "pipe", DispositionType.NEUTRAL) .input(Items.STICK) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_slabs"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_slabs"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(Items.STICK), - conditionsFromItem(Items.STICK)) - .offerTo(exporter, Registries.ITEM.getId(ToolItemsME.LONGBOTTOM_PIPE).getPath() + "_artisan"); + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_slabs"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_slabs"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(Items.STICK), + has(Items.STICK)) + .save(output, BuiltInRegistries.ITEM.getKey(ToolItemsME.LONGBOTTOM_PIPE).getPath() + "_artisan"); - } - }; } private int getXpFor(MetalTypes metalTypes) { @@ -1726,137 +1715,137 @@ private int getXpFor(MetalTypes metalTypes) { }; } - private void createToolSet(RegistryEntryLookup itemLookup, RecipeExporter exporter, MetalTypes metal, ItemStack outputPickaxe, ItemStack outputAxe, ItemStack outputShovel, ItemStack outputHoe, Optional rodMetal, DispositionType dispositionType) { + private void createToolSet(HolderGetter itemLookup, RecipeOutput exporter, MetalTypes metal, ItemStack outputPickaxe, ItemStack outputAxe, ItemStack outputShovel, ItemStack outputHoe, Optional rodMetal, DispositionType dispositionType) { createArtisanTablePickaxeRecipe(itemLookup, exporter, metal, outputPickaxe, rodMetal, dispositionType); createArtisanTableAxeRecipe(itemLookup, exporter, metal, outputAxe, false, rodMetal, dispositionType); createArtisanTableShovelRecipe(itemLookup, exporter, metal, outputShovel, rodMetal, dispositionType); createArtisanTableHoeRecipe(itemLookup, exporter, metal, outputHoe, rodMetal, dispositionType); } - private void createArtisanTableSwordRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, MetalTypes metal, ItemStack output, boolean noble, DispositionType dispositionType) { + private void createArtisanTableSwordRecipe(HolderGetter itemLookup, RecipeOutput exporter, MetalTypes metal, ItemStack output, boolean noble, DispositionType dispositionType) { createArtisanTableSwordRecipe(itemLookup, exporter, metal, Items.STICK, output, noble, dispositionType); } - private void createArtisanTableSwordRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, MetalTypes metal, Item stick, ItemStack output, boolean noble, DispositionType dispositionType) { + private void createArtisanTableSwordRecipe(HolderGetter itemLookup, RecipeOutput exporter, MetalTypes metal, Item stick, ItemStack output, boolean noble, DispositionType dispositionType) { ItemStack blade = new ItemStack(ResourceItemsME.BLADE); - blade.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, + blade.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, getMetalIdentifier(metal))), getPattern())); ItemStack swordHilt = new ItemStack(ResourceItemsME.SWORD_HILT); int xp = getXpFor(metal); if (!noble) { - swordHilt.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, + swordHilt.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, getMetalIdentifier(metal))), getPattern())); } else { - swordHilt.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.GOLD.getName()))), getPattern())); + swordHilt.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.GOLD.getName()))), getPattern())); xp++; } ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "sword", dispositionType, xp) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(blade.getItem()), blade.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(swordHilt.getItem()), swordHilt.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, blade.getComponents(), blade.getItem())) + .componentInput(DataComponentIngredient.of(false, swordHilt.getComponents(), swordHilt.getItem())) .input(stick) - .criterion(hasItem(blade.getItem()), + .unlockedBy(getHasName(blade.getItem()), conditionsFromItem(blade.getItem(), itemLookup)) - .offerTo(exporter); + .save(exporter); } - private void createArtisanTableLongswordRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, MetalTypes metal, ItemStack output, boolean noble, DispositionType dispositionType) { + private void createArtisanTableLongswordRecipe(HolderGetter itemLookup, RecipeOutput exporter, MetalTypes metal, ItemStack output, boolean noble, DispositionType dispositionType) { createArtisanTableLongswordRecipe(itemLookup, exporter, metal, Items.STICK, output, noble, dispositionType); } - private void createArtisanTableLongswordRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, MetalTypes metal, Item stick, ItemStack output, boolean noble, DispositionType dispositionType) { + private void createArtisanTableLongswordRecipe(HolderGetter itemLookup, RecipeOutput exporter, MetalTypes metal, Item stick, ItemStack output, boolean noble, DispositionType dispositionType) { ItemStack longBlade = new ItemStack(ResourceItemsME.LONG_BLADE); - longBlade.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, + longBlade.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, getMetalIdentifier(metal))), getPattern())); ItemStack swordHilt = new ItemStack(ResourceItemsME.SWORD_HILT); int xp = (int) (getXpFor(metal) * 1.5f); if (!noble) { - swordHilt.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, + swordHilt.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, getMetalIdentifier(metal))), getPattern())); } else { - swordHilt.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.GOLD.getName()))), getPattern())); + swordHilt.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.GOLD.getName()))), getPattern())); xp++; } ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "sword", dispositionType, xp) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(longBlade.getItem()), longBlade.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(swordHilt.getItem()), swordHilt.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, longBlade.getComponents(), longBlade.getItem())) + .componentInput(DataComponentIngredient.of(false, swordHilt.getComponents(), swordHilt.getItem())) .input(stick) - .criterion(hasItem(longBlade.getItem()), + .unlockedBy(getHasName(longBlade.getItem()), conditionsFromItem(longBlade.getItem(), itemLookup)) - .offerTo(exporter); + .save(exporter); } - private void createArtisanTableDaggerRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, MetalTypes metal, ItemStack output, boolean noble, DispositionType dispositionType) { + private void createArtisanTableDaggerRecipe(HolderGetter itemLookup, RecipeOutput exporter, MetalTypes metal, ItemStack output, boolean noble, DispositionType dispositionType) { createArtisanTableDaggerRecipe(itemLookup, exporter, metal, Items.STICK, output, noble, dispositionType); } - private void createArtisanTableDaggerRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, MetalTypes metal, Item stick, ItemStack output, boolean noble, DispositionType dispositionType) { + private void createArtisanTableDaggerRecipe(HolderGetter itemLookup, RecipeOutput exporter, MetalTypes metal, Item stick, ItemStack output, boolean noble, DispositionType dispositionType) { ItemStack shortBlade = new ItemStack(ResourceItemsME.SHORT_BLADE); - shortBlade.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, + shortBlade.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, getMetalIdentifier(metal))), getPattern())); ItemStack swordHilt = new ItemStack(ResourceItemsME.SWORD_HILT); int xp = (int) (getXpFor(metal) * 0.5f); if (!noble) { - swordHilt.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, + swordHilt.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, getMetalIdentifier(metal))), getPattern())); } else { - swordHilt.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.GOLD.getName()))), getPattern())); + swordHilt.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.GOLD.getName()))), getPattern())); xp++; } ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "sword", dispositionType, xp) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(shortBlade.getItem()), shortBlade.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(swordHilt.getItem()), swordHilt.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, shortBlade.getComponents(), shortBlade.getItem())) + .componentInput(DataComponentIngredient.of(false, swordHilt.getComponents(), swordHilt.getItem())) .input(stick) - .criterion(hasItem(shortBlade.getItem()), + .unlockedBy(getHasName(shortBlade.getItem()), conditionsFromItem(shortBlade.getItem(), itemLookup)) - .offerTo(exporter); + .save(exporter); } - private void createArtisanTableSpearRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, MetalTypes metal, ItemStack output, boolean noble, DispositionType dispositionType) { + private void createArtisanTableSpearRecipe(HolderGetter itemLookup, RecipeOutput exporter, MetalTypes metal, ItemStack output, boolean noble, DispositionType dispositionType) { createArtisanTableSpearRecipe(itemLookup, exporter, metal, Items.STICK, output, noble, dispositionType); } - private void createArtisanTableSpearRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, MetalTypes metal, Item stick, ItemStack output, boolean noble, DispositionType dispositionType) { + private void createArtisanTableSpearRecipe(HolderGetter itemLookup, RecipeOutput exporter, MetalTypes metal, Item stick, ItemStack output, boolean noble, DispositionType dispositionType) { ItemStack blade = new ItemStack(ResourceItemsME.SHORT_BLADE); - blade.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, + blade.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, getMetalIdentifier(metal))), getPattern())); int xp = (int) (getXpFor(metal) * 0.5f); if (!noble) { ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "spear", dispositionType, xp) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(blade.getItem()), blade.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, blade.getComponents(), blade.getItem())) .input(stick) .input(stick) - .criterion(hasItem(blade.getItem()), + .unlockedBy(getHasName(blade.getItem()), conditionsFromItem(blade.getItem(), itemLookup)) - .offerTo(exporter); + .save(exporter); } else { ItemStack rod = new ItemStack(ResourceItemsME.ROD); xp++; - rod.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.GOLD.getName()))), getPattern())); + rod.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.GOLD.getName()))), getPattern())); ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "spear", dispositionType, xp) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(blade.getItem()), blade.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(rod.getItem()), rod.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, blade.getComponents(), blade.getItem())) + .componentInput(DataComponentIngredient.of(false, rod.getComponents(), rod.getItem())) .input(stick) - .criterion(hasItem(blade.getItem()), + .unlockedBy(getHasName(blade.getItem()), conditionsFromItem(blade.getItem(), itemLookup)) - .offerTo(exporter); + .save(exporter); } } - private void createArtisanTableBowRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, ItemStack output, DispositionType dispositionType) { + private void createArtisanTableBowRecipe(HolderGetter itemLookup, RecipeOutput exporter, ItemStack output, DispositionType dispositionType) { ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "bow", dispositionType) .input(Items.STICK) .input(Items.STRING) @@ -1864,238 +1853,238 @@ private void createArtisanTableBowRecipe(RegistryEntryLookup itemLookup, R .input(Items.STRING) .input(Items.STICK) .input(Items.STRING) - .criterion(hasItem(Items.STRING), + .unlockedBy(getHasName(Items.STRING), conditionsFromItem(Items.STRING, itemLookup)) - .offerTo(exporter); + .save(exporter); } - private void createArtisanTableNobleBowRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, ItemStack output, DispositionType dispositionType) { + private void createArtisanTableNobleBowRecipe(HolderGetter itemLookup, RecipeOutput exporter, ItemStack output, DispositionType dispositionType) { ItemStack rod = new ItemStack(ResourceItemsME.ROD); - rod.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.GOLD.getName()))), getPattern())); + rod.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.GOLD.getName()))), getPattern())); ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "bow", dispositionType, XP_MEDIUM_SHIELD) .input(Items.STICK) .input(Items.STRING) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(rod.getItem()), rod.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, rod.getComponents(), rod.getItem())) .input(Items.STRING) .input(Items.STICK) .input(Items.STRING) - .criterion(hasItem(Items.STRING), + .unlockedBy(getHasName(Items.STRING), conditionsFromItem(Items.STRING, itemLookup)) - .offerTo(exporter); + .save(exporter); } - private void createArtisanTableLongbowRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, ItemStack output, DispositionType dispositionType) { + private void createArtisanTableLongbowRecipe(HolderGetter itemLookup, RecipeOutput exporter, ItemStack output, DispositionType dispositionType) { ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "bow", dispositionType) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_fences"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_fences"))) .input(Items.STRING) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_fences"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_fences"))) .input(Items.STRING) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_fences"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_fences"))) .input(Items.STRING) - .criterion(hasItem(Items.STRING), + .unlockedBy(getHasName(Items.STRING), conditionsFromItem(Items.STRING, itemLookup)) - .offerTo(exporter); + .save(exporter); } - private void createArtisanTableNobleLongbowRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, ItemStack output, DispositionType dispositionType) { + private void createArtisanTableNobleLongbowRecipe(HolderGetter itemLookup, RecipeOutput exporter, ItemStack output, DispositionType dispositionType) { ItemStack rod = new ItemStack(ResourceItemsME.ROD); - rod.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.GOLD.getName()))), getPattern())); + rod.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.GOLD.getName()))), getPattern())); ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "bow", dispositionType, 2) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_fences"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_fences"))) .input(Items.STRING) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(rod.getItem()), rod.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, rod.getComponents(), rod.getItem())) .input(Items.STRING) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_fences"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_fences"))) .input(Items.STRING) - .criterion(hasItem(Items.STRING), + .unlockedBy(getHasName(Items.STRING), conditionsFromItem(Items.STRING, itemLookup)) - .offerTo(exporter); + .save(exporter); } - private void createArtisanTableCrossbowRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, ItemStack output, DispositionType dispositionType) { + private void createArtisanTableCrossbowRecipe(HolderGetter itemLookup, RecipeOutput exporter, ItemStack output, DispositionType dispositionType) { ItemStack rod = new ItemStack(ResourceItemsME.ROD); - rod.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.IRON.getName()))), getPattern())); + rod.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.IRON.getName()))), getPattern())); ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "crossbow", dispositionType, 2) .input(Items.STICK) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(rod.getItem()), rod.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, rod.getComponents(), rod.getItem())) .input(Items.STICK) .input(Items.STRING) .input(Blocks.TRIPWIRE_HOOK) .input(Items.STRING) .input(Items.STICK) - .criterion(hasItem(Items.STRING), + .unlockedBy(getHasName(Items.STRING), conditionsFromItem(Items.STRING, itemLookup)) - .offerTo(exporter); + .save(exporter); } - private void createArtisanTableNobleCrossbowRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, ItemStack output, DispositionType dispositionType) { + private void createArtisanTableNobleCrossbowRecipe(HolderGetter itemLookup, RecipeOutput exporter, ItemStack output, DispositionType dispositionType) { ItemStack rod = new ItemStack(ResourceItemsME.ROD); - rod.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.GOLD.getName()))), getPattern())); + rod.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.GOLD.getName()))), getPattern())); ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "crossbow", dispositionType, 2) .input(Items.STICK) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(rod.getItem()), rod.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, rod.getComponents(), rod.getItem())) .input(Items.STICK) .input(Items.STRING) .input(Blocks.TRIPWIRE_HOOK) .input(Items.STRING) .input(Items.STICK) - .criterion(hasItem(Items.STRING), + .unlockedBy(getHasName(Items.STRING), conditionsFromItem(Items.STRING, itemLookup)) - .offerTo(exporter); + .save(exporter); } - private void createArtisanTablePickaxeRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, MetalTypes metal, ItemStack output, Optional rodMetal, DispositionType dispositionType) { + private void createArtisanTablePickaxeRecipe(HolderGetter itemLookup, RecipeOutput exporter, MetalTypes metal, ItemStack output, Optional rodMetal, DispositionType dispositionType) { ItemStack pickaxeHead = new ItemStack(ResourceItemsME.PICKAXE_HEAD); - pickaxeHead.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, + pickaxeHead.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, getMetalIdentifier(metal))), getPattern())); int xp = (int) (getXpFor(metal) * 1.5f); if (rodMetal.isPresent()){ ItemStack rod = new ItemStack(ResourceItemsME.ROD); - rod.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, + rod.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, getMetalIdentifier(rodMetal.get()))), getPattern())); ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "pickaxe", dispositionType, xp) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(pickaxeHead.getItem()), pickaxeHead.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(rod.getItem()), rod.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(rod.getItem()), rod.getComponentChanges())) - .criterion(hasItem(pickaxeHead.getItem()), + .componentInput(DataComponentIngredient.of(false, pickaxeHead.getComponents(), pickaxeHead.getItem())) + .componentInput(DataComponentIngredient.of(false, rod.getComponents(), rod.getItem())) + .componentInput(DataComponentIngredient.of(false, rod.getComponents(), rod.getItem())) + .unlockedBy(getHasName(pickaxeHead.getItem()), conditionsFromItem(pickaxeHead.getItem(), itemLookup)) - .offerTo(exporter, Registries.ITEM.getId(output.getItem()).getPath() + "_" + rodMetal.get().getName() + "_artisan"); + .save(exporter, BuiltInRegistries.ITEM.getKey(output.getItem()).getPath() + "_" + rodMetal.get().getName() + "_artisan"); } else { ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "pickaxe", dispositionType, xp) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(pickaxeHead.getItem()), pickaxeHead.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, pickaxeHead.getComponents(), pickaxeHead.getItem())) .input(Items.STICK) .input(Items.STICK) - .criterion(hasItem(pickaxeHead.getItem()), + .unlockedBy(getHasName(pickaxeHead.getItem()), conditionsFromItem(pickaxeHead.getItem(), itemLookup)) - .offerTo(exporter, Registries.ITEM.getId(output.getItem()).getPath() + "_artisan"); + .save(exporter, BuiltInRegistries.ITEM.getKey(output.getItem()).getPath() + "_artisan"); } } - private void createArtisanTableAxeRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, MetalTypes metal, ItemStack output, boolean noble, Optional rodMetal, DispositionType dispositionType) { + private void createArtisanTableAxeRecipe(HolderGetter itemLookup, RecipeOutput exporter, MetalTypes metal, ItemStack output, boolean noble, Optional rodMetal, DispositionType dispositionType) { createArtisanTableAxeRecipe(itemLookup, exporter, metal, Items.STICK, output, noble, rodMetal, dispositionType); } - private void createArtisanTableAxeRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, MetalTypes metal, Item stick, ItemStack output, boolean noble, Optional rodMetal, DispositionType dispositionType) { + private void createArtisanTableAxeRecipe(HolderGetter itemLookup, RecipeOutput exporter, MetalTypes metal, Item stick, ItemStack output, boolean noble, Optional rodMetal, DispositionType dispositionType) { ItemStack axeHead = new ItemStack(ResourceItemsME.AXE_HEAD); - axeHead.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, + axeHead.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, getMetalIdentifier(metal))), getPattern())); int xp = (int) (getXpFor(metal) * 1.5f); if (!noble){ if (rodMetal.isPresent()){ ItemStack rod = new ItemStack(ResourceItemsME.ROD); - rod.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, + rod.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, getMetalIdentifier(rodMetal.get()))), getPattern())); ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "axe", dispositionType, xp) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(axeHead.getItem()), axeHead.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(rod.getItem()), rod.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(rod.getItem()), rod.getComponentChanges())) - .criterion(hasItem(axeHead.getItem()), + .componentInput(DataComponentIngredient.of(false, axeHead.getComponents(), axeHead.getItem())) + .componentInput(DataComponentIngredient.of(false, rod.getComponents(), rod.getItem())) + .componentInput(DataComponentIngredient.of(false, rod.getComponents(), rod.getItem())) + .unlockedBy(getHasName(axeHead.getItem()), conditionsFromItem(axeHead.getItem(), itemLookup)) - .offerTo(exporter, Registries.ITEM.getId(output.getItem()).getPath() + "_" + rodMetal.get().getName() + "_artisan"); + .save(exporter, BuiltInRegistries.ITEM.getKey(output.getItem()).getPath() + "_" + rodMetal.get().getName() + "_artisan"); } else { ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "axe", dispositionType, xp) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(axeHead.getItem()), axeHead.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, axeHead.getComponents(), axeHead.getItem())) .input(stick) .input(stick) - .criterion(hasItem(axeHead.getItem()), + .unlockedBy(getHasName(axeHead.getItem()), conditionsFromItem(axeHead.getItem(), itemLookup)) - .offerTo(exporter); + .save(exporter); } } else { ItemStack rod = new ItemStack(ResourceItemsME.ROD); - rod.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, - Identifier.of(MetalTypes.GOLD.getName()))), getPattern())); + rod.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, + ResourceLocation.parse(MetalTypes.GOLD.getName()))), getPattern())); ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "axe", dispositionType, xp + 1) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(axeHead.getItem()), axeHead.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(rod.getItem()), rod.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, axeHead.getComponents(), axeHead.getItem())) + .componentInput(DataComponentIngredient.of(false, rod.getComponents(), rod.getItem())) .input(stick) - .criterion(hasItem(axeHead.getItem()), + .unlockedBy(getHasName(axeHead.getItem()), conditionsFromItem(axeHead.getItem(), itemLookup)) - .offerTo(exporter); + .save(exporter); } } - private void createArtisanTableShovelRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, MetalTypes metal, ItemStack output, Optional rodMetal, DispositionType dispositionType) { + private void createArtisanTableShovelRecipe(HolderGetter itemLookup, RecipeOutput exporter, MetalTypes metal, ItemStack output, Optional rodMetal, DispositionType dispositionType) { ItemStack shovelHead = new ItemStack(ResourceItemsME.SHOVEL_HEAD); - shovelHead.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, + shovelHead.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, getMetalIdentifier(metal))), getPattern())); int xp = (int) (getXpFor(metal) * 0.5f); if (rodMetal.isPresent()){ ItemStack rod = new ItemStack(ResourceItemsME.ROD); - rod.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, + rod.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, getMetalIdentifier(rodMetal.get()))), getPattern())); ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "shovel", dispositionType, xp) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(shovelHead.getItem()), shovelHead.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(rod.getItem()), rod.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(rod.getItem()), rod.getComponentChanges())) - .criterion(hasItem(shovelHead.getItem()), + .componentInput(DataComponentIngredient.of(false, shovelHead.getComponents(), shovelHead.getItem())) + .componentInput(DataComponentIngredient.of(false, rod.getComponents(), rod.getItem())) + .componentInput(DataComponentIngredient.of(false, rod.getComponents(), rod.getItem())) + .unlockedBy(getHasName(shovelHead.getItem()), conditionsFromItem(shovelHead.getItem(), itemLookup)) - .offerTo(exporter, Registries.ITEM.getId(output.getItem()).getPath() + "_" + rodMetal.get().getName() + "_artisan"); + .save(exporter, BuiltInRegistries.ITEM.getKey(output.getItem()).getPath() + "_" + rodMetal.get().getName() + "_artisan"); } else { ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "shovel", dispositionType, xp) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(shovelHead.getItem()), shovelHead.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, shovelHead.getComponents(), shovelHead.getItem())) .input(Items.STICK) .input(Items.STICK) - .criterion(hasItem(shovelHead.getItem()), + .unlockedBy(getHasName(shovelHead.getItem()), conditionsFromItem(shovelHead.getItem(), itemLookup)) - .offerTo(exporter); + .save(exporter); } } - private void createArtisanTableHoeRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, MetalTypes metal, ItemStack output, Optional rodMetal, DispositionType dispositionType) { + private void createArtisanTableHoeRecipe(HolderGetter itemLookup, RecipeOutput exporter, MetalTypes metal, ItemStack output, Optional rodMetal, DispositionType dispositionType) { ItemStack hoeHead = new ItemStack(ResourceItemsME.HOE_HEAD); - hoeHead.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, + hoeHead.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, getMetalIdentifier(metal))), getPattern())); int xp = getXpFor(metal); if (rodMetal.isPresent()){ ItemStack rod = new ItemStack(ResourceItemsME.ROD); - rod.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, + rod.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, getMetalIdentifier(rodMetal.get()))), getPattern())); ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "hoe", dispositionType, xp) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(hoeHead.getItem()), hoeHead.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(rod.getItem()), rod.getComponentChanges())) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(rod.getItem()), rod.getComponentChanges())) - .criterion(hasItem(hoeHead.getItem()), + .componentInput(DataComponentIngredient.of(false, hoeHead.getComponents(), hoeHead.getItem())) + .componentInput(DataComponentIngredient.of(false, rod.getComponents(), rod.getItem())) + .componentInput(DataComponentIngredient.of(false, rod.getComponents(), rod.getItem())) + .unlockedBy(getHasName(hoeHead.getItem()), conditionsFromItem(hoeHead.getItem(), itemLookup)) - .offerTo(exporter, Registries.ITEM.getId(output.getItem()).getPath() + "_" + rodMetal.get().getName() + "_artisan"); + .save(exporter, BuiltInRegistries.ITEM.getKey(output.getItem()).getPath() + "_" + rodMetal.get().getName() + "_artisan"); } else { ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "hoe", dispositionType, xp) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(hoeHead.getItem()), hoeHead.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, hoeHead.getComponents(), hoeHead.getItem())) .input(Items.STICK) .input(Items.STICK) - .criterion(hasItem(hoeHead.getItem()), + .unlockedBy(getHasName(hoeHead.getItem()), conditionsFromItem(hoeHead.getItem(), itemLookup)) - .offerTo(exporter); + .save(exporter); } } - private void createArtisanTableChiselRecipe(RegistryEntryLookup itemLookup, RecipeExporter exporter, MetalTypes metal, Item nugget, ItemStack output) { + private void createArtisanTableChiselRecipe(HolderGetter itemLookup, RecipeOutput exporter, MetalTypes metal, Item nugget, ItemStack output) { ItemStack shortBlade = new ItemStack(ResourceItemsME.SHORT_BLADE); - shortBlade.set(DataComponentTypes.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(RegistryKey.of(RegistryKeys.TRIM_MATERIAL, + shortBlade.set(DataComponents.TRIM, new ArmorTrim(getArmorTrimMaterialsRegistry().getOrThrow(ResourceKey.create(Registries.TRIM_MATERIAL, getMetalIdentifier(metal))), getPattern())); int xp = (int) (getXpFor(metal) * 0.5f); ArtisanTableRecipeJsonBuilder.createArtisanRecipe(itemLookup, RecipeCategory.COMBAT, output, "chisel", DispositionType.NEUTRAL, xp) - .componentInput(new ComponentsIngredient(Ingredient.ofItems(shortBlade.getItem()), shortBlade.getComponentChanges())) + .componentInput(DataComponentIngredient.of(false, shortBlade.getComponents(), shortBlade.getItem())) .input(nugget) .input(Items.STICK) - .criterion(hasItem(shortBlade.getItem()), + .unlockedBy(getHasName(shortBlade.getItem()), conditionsFromItem(shortBlade.getItem(), itemLookup)) - .offerTo(exporter, Registries.ITEM.getId(output.getItem()).getPath() + "_" + metal.getName() + "_artisan"); + .save(exporter, BuiltInRegistries.ITEM.getKey(output.getItem()).getPath() + "_" + metal.getName() + "_artisan"); } - public AdvancementCriterion conditionsFromItem(ItemConvertible item, RegistryEntryLookup itemLookup) { - return conditionsFromPredicates(ItemPredicate.Builder.create().items(itemLookup, new ItemConvertible[]{item})); + public Criterion conditionsFromItem(ItemLike item, HolderGetter itemLookup) { + return inventoryTrigger(ItemPredicate.Builder.item().of(item)); } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/InscriptionRecipeProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/InscriptionRecipeProvider.java index 25aedf8b6e..80b8d07a63 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/InscriptionRecipeProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/InscriptionRecipeProvider.java @@ -1,18 +1,18 @@ package net.sevenstars.middleearth.datageneration.providers.recipes; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.minecraft.data.recipe.RecipeExporter; -import net.minecraft.data.recipe.RecipeGenerator; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.Enchantments; -import net.minecraft.item.Item; -import net.minecraft.item.Items; -import net.minecraft.recipe.book.RecipeCategory; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.util.Identifier; +import net.minecraft.core.Holder; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.PackOutput; +import net.minecraft.data.recipes.RecipeCategory; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.data.recipes.RecipeProvider; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.Enchantments; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.datageneration.custom.InscriptionRecipeJsonBuilder; import net.sevenstars.middleearth.enchantments.EnchantmentsME; @@ -22,40 +22,32 @@ import java.util.concurrent.CompletableFuture; public class InscriptionRecipeProvider extends RecipeProvider { - private final CompletableFuture registryLookup; + private final CompletableFuture registryLookup; - public InscriptionRecipeProvider(FabricDataOutput output, CompletableFuture registriesFuture) { + public InscriptionRecipeProvider(PackOutput output, CompletableFuture registriesFuture) { super(output, registriesFuture); this.registryLookup = registriesFuture; } - public RegistryWrapper.Impl getEnchantmentRegistry() { - RegistryWrapper.Impl enchantmentImpl; + public HolderLookup.RegistryLookup getEnchantmentRegistry() { + HolderLookup.RegistryLookup enchantmentImpl; try { - enchantmentImpl = this.registryLookup.get().getOrThrow(RegistryKeys.ENCHANTMENT); + enchantmentImpl = this.registryLookup.get().lookupOrThrow(Registries.ENCHANTMENT); } catch (Exception ignored) { throw new IllegalStateException("Data generation without registries failed!"); } return enchantmentImpl; } - public RegistryEntry getEnchantment(RegistryKey enchantmentRegistryKey) { + public Holder getEnchantment(ResourceKey enchantmentRegistryKey) { return getEnchantmentRegistry().getOrThrow(enchantmentRegistryKey); } @Override - public String getName() { - return "InscriptionRecipes"; - } - - @Override - protected RecipeGenerator getRecipeGenerator(RegistryWrapper.WrapperLookup wrapperLookup, RecipeExporter recipeExporter) { - return new RecipeGenerator(wrapperLookup, recipeExporter) { - @Override - public void generate() { - RegistryWrapper.Impl itemLookup = registries.getOrThrow(RegistryKeys.ITEM); + protected void buildRecipes(RecipeOutput output, HolderLookup.Provider registries) { + HolderLookup.RegistryLookup itemLookup = registries.lookupOrThrow(Registries.ITEM); //region UNBREAKING InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, @@ -63,27 +55,27 @@ public void generate() { .chisel(ItemTagsME.EARLY_CHISELS) .addWord("resilient") .addWord("blessing") - .criterion(hasItem(Items.LAPIS_LAZULI), - conditionsFromItem(Items.LAPIS_LAZULI)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_unbreaking_1"))); + .unlockedBy(getHasName(Items.LAPIS_LAZULI), + has(Items.LAPIS_LAZULI)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_unbreaking_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.UNBREAKING), 2, 3) .chisel(ItemTagsME.MID_CHISELS) .addWord("resilient") .addWord("blessing") - .criterion(hasItem(Items.LAPIS_LAZULI), - conditionsFromItem(Items.LAPIS_LAZULI)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_unbreaking_2"))); + .unlockedBy(getHasName(Items.LAPIS_LAZULI), + has(Items.LAPIS_LAZULI)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_unbreaking_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.UNBREAKING), 3, 5) - .chisel(ItemTagsME.EARLY_CHISELS) + .chisel(ItemTagsME.MID_CHISELS) .addWord("resilient") .addWord("blessing") - .criterion(hasItem(Items.LAPIS_LAZULI), - conditionsFromItem(Items.LAPIS_LAZULI)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_unbreaking_3"))); + .unlockedBy(getHasName(Items.LAPIS_LAZULI), + has(Items.LAPIS_LAZULI)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_unbreaking_3"))); //endregion //region THORNS @@ -92,27 +84,27 @@ public void generate() { .chisel(ItemTagsME.EARLY_CHISELS) .addWord("fierce") .addWord("warded") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_thorns_1"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_thorns_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.THORNS), 2, 6) .chisel(ItemTagsME.MID_CHISELS) .addWord("fierce") .addWord("warded") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_thorns_2"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_thorns_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.THORNS), 3, 8) .chisel(ItemTagsME.MID_CHISELS) .addWord("fierce") .addWord("warded") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_thorns_3"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_thorns_3"))); //endregion //region PROJECTILE PROTECTION @@ -121,36 +113,36 @@ public void generate() { .chisel(ItemTagsME.EARLY_CHISELS) .addWord("pierce") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_projectile_protection_1"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_projectile_protection_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.PROJECTILE_PROTECTION), 2, 6) .chisel(ItemTagsME.MID_CHISELS) .addWord("pierce") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_projectile_protection_2"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_projectile_protection_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.PROJECTILE_PROTECTION), 3, 8) .chisel(ItemTagsME.MID_CHISELS) .addWord("pierce") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_projectile_protection_3"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_projectile_protection_3"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.PROJECTILE_PROTECTION), 4, 10) .chisel(ItemTagsME.MID_CHISELS) .addWord("pierce") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_projectile_protection_4"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_projectile_protection_4"))); //endregion //region FIRE PROTECTION @@ -159,36 +151,36 @@ public void generate() { .chisel(ItemTagsME.EARLY_CHISELS) .addWord("flame") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_fire_protection_1"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_fire_protection_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.FIRE_PROTECTION), 2, 6) .chisel(ItemTagsME.MID_CHISELS) .addWord("flame") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_fire_protection_2"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_fire_protection_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.FIRE_PROTECTION), 3, 8) .chisel(ItemTagsME.MID_CHISELS) .addWord("flame") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_fire_protection_3"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_fire_protection_3"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.FIRE_PROTECTION), 4, 10) .chisel(ItemTagsME.MID_CHISELS) .addWord("flame") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_fire_protection_4"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_fire_protection_4"))); //endregion //region BLAST PROTECTION @@ -198,9 +190,9 @@ public void generate() { .addWord("flame") .addWord("sturdy") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_blast_protection_1"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_blast_protection_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.BLAST_PROTECTION), 2, 6) @@ -208,9 +200,9 @@ public void generate() { .addWord("flame") .addWord("sturdy") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_blast_protection_2"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_blast_protection_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.BLAST_PROTECTION), 3, 8) @@ -218,9 +210,9 @@ public void generate() { .addWord("flame") .addWord("sturdy") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_blast_protection_3"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_blast_protection_3"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.BLAST_PROTECTION), 4, 10) @@ -228,9 +220,9 @@ public void generate() { .addWord("flame") .addWord("sturdy") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_blast_protection_4"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_blast_protection_4"))); //endregion //region RESPIRATION @@ -240,9 +232,9 @@ public void generate() { .addWord("gifted") .addWord("tidal") .addWord("blessing") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_respiration_1"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_respiration_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.RESPIRATION), 2, 8) @@ -250,9 +242,9 @@ public void generate() { .addWord("gifted") .addWord("tidal") .addWord("blessing") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_respiration_2"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_respiration_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.RESPIRATION), 3, 11) @@ -260,9 +252,9 @@ public void generate() { .addWord("gifted") .addWord("tidal") .addWord("blessing") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_respiration_3"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_respiration_3"))); //endregion //region FEATHER FALLING @@ -272,9 +264,9 @@ public void generate() { .addWord("sturdy") .addWord("resilient") .addWord("traveller") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_feather_falling_1"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_feather_falling_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.FEATHER_FALLING), 2, 5) @@ -282,9 +274,9 @@ public void generate() { .addWord("sturdy") .addWord("resilient") .addWord("traveller") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_feather_falling_2"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_feather_falling_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.FEATHER_FALLING), 3, 7) @@ -292,9 +284,9 @@ public void generate() { .addWord("sturdy") .addWord("resilient") .addWord("traveller") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_feather_falling_3"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_feather_falling_3"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.FEATHER_FALLING), 4, 9) @@ -302,9 +294,9 @@ public void generate() { .addWord("sturdy") .addWord("resilient") .addWord("traveller") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_feather_falling_4"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_feather_falling_4"))); //endregion //region AQUA AFINITY @@ -314,9 +306,9 @@ public void generate() { .addWord("careful") .addWord("tidal") .addWord("collector") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_aqua_affinity"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_aqua_affinity"))); // endregion //region DEPTH STRIDER @@ -326,9 +318,9 @@ public void generate() { .addWord("swift") .addWord("tidal") .addWord("traveller") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_depth_strider_1"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_depth_strider_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.DEPTH_STRIDER), 2, 8) @@ -336,9 +328,9 @@ public void generate() { .addWord("swift") .addWord("tidal") .addWord("traveller") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_depth_strider_2"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_depth_strider_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.DEPTH_STRIDER), 3, 11) @@ -346,9 +338,9 @@ public void generate() { .addWord("swift") .addWord("tidal") .addWord("traveller") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_depth_strider_3"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_depth_strider_3"))); //endregion //region LURE @@ -358,9 +350,9 @@ public void generate() { .addWord("swift") .addWord("tidal") .addWord("collector") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_lure_1"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_lure_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.LURE), 2, 4) @@ -368,9 +360,9 @@ public void generate() { .addWord("swift") .addWord("tidal") .addWord("collector") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_lure_2"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_lure_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.LURE), 3, 6) @@ -378,9 +370,9 @@ public void generate() { .addWord("swift") .addWord("tidal") .addWord("collector") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_lure_3"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_lure_3"))); //endregion //region SHARPNESS @@ -389,27 +381,27 @@ public void generate() { .chisel(ItemTagsME.EARLY_CHISELS) .addWord("forceful") .addWord("cutter") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_sharpness_1"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_sharpness_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.SHARPNESS), 2, 5) .chisel(ItemTagsME.MID_CHISELS) .addWord("forceful") .addWord("cutter") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_sharpness_2"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_sharpness_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.SHARPNESS), 3, 7) .chisel(ItemTagsME.LATE_CHISELS) .addWord("forceful") .addWord("cutter") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_sharpness_3"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_sharpness_3"))); /*InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.SHARPNESS), 4, 9) @@ -436,18 +428,18 @@ public void generate() { .chisel(ItemTagsME.EARLY_CHISELS) .addWord("forceful") .addWord("edge") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_knockback_1"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_knockback_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.KNOCKBACK), 2, 6) .chisel(ItemTagsME.MID_CHISELS) .addWord("forceful") .addWord("edge") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_knockback_2"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_knockback_2"))); //endregion //region LOOTING @@ -457,9 +449,9 @@ public void generate() { .addWord("gifted") .addWord("blessing") .addWord("edge") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_looting_1"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_looting_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.LOOTING), 2, 5) @@ -467,9 +459,9 @@ public void generate() { .addWord("gifted") .addWord("blessing") .addWord("edge") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_looting_2"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_looting_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.LOOTING), 3, 7) @@ -477,9 +469,9 @@ public void generate() { .addWord("gifted") .addWord("blessing") .addWord("edge") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_looting_3"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_looting_3"))); //endregion //region SMITE @@ -489,9 +481,9 @@ public void generate() { .addWord("spirit") .addWord("bane") .addWord("cutter") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_smite_1"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_smite_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.SMITE), 2, 5) @@ -499,9 +491,9 @@ public void generate() { .addWord("spirit") .addWord("bane") .addWord("cutter") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_smite_2"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_smite_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.SMITE), 3, 7) @@ -509,9 +501,9 @@ public void generate() { .addWord("spirit") .addWord("bane") .addWord("cutter") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_smite_3"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_smite_3"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.SMITE), 4, 9) @@ -519,9 +511,9 @@ public void generate() { .addWord("spirit") .addWord("bane") .addWord("cutter") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_smite_4"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_smite_4"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.SMITE), 5, 11) @@ -529,9 +521,9 @@ public void generate() { .addWord("spirit") .addWord("bane") .addWord("cutter") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_smite_5"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_smite_5"))); //endregion //region SWEEPING EDGE @@ -541,9 +533,9 @@ public void generate() { .addWord("broad") .addWord("edge") .addWord("cutter") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_sweeping_edge_1"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_sweeping_edge_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.SWEEPING_EDGE), 2, 5) @@ -551,9 +543,9 @@ public void generate() { .addWord("broad") .addWord("edge") .addWord("cutter") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_sweeping_edge_2"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_sweeping_edge_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.SWEEPING_EDGE), 3, 7) @@ -561,9 +553,9 @@ public void generate() { .addWord("broad") .addWord("edge") .addWord("cutter") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_sweeping_edge_3"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_sweeping_edge_3"))); //endregion //region POWER @@ -572,27 +564,27 @@ public void generate() { .chisel(ItemTagsME.EARLY_CHISELS) .addWord("fierce") .addWord("point") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_power_1"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_power_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.POWER), 2, 5) .chisel(ItemTagsME.MID_CHISELS) .addWord("fierce") .addWord("point") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_power_2"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_power_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.POWER), 3, 7) .chisel(ItemTagsME.LATE_CHISELS) .addWord("fierce") .addWord("point") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_power_3"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_power_3"))); /*InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.POWER), 4, 9) @@ -619,18 +611,18 @@ public void generate() { .chisel(ItemTagsME.EARLY_CHISELS) .addWord("forceful") .addWord("draw") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_punch_1"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_punch_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.PUNCH), 2, 8) .chisel(ItemTagsME.MID_CHISELS) .addWord("forceful") .addWord("draw") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_punch_2"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_punch_2"))); //endregion //region PIERCING @@ -639,36 +631,36 @@ public void generate() { .chisel(ItemTagsME.EARLY_CHISELS) .addWord("long") .addWord("point") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_piercing_1"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_piercing_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.PIERCING), 2, 5) .chisel(ItemTagsME.MID_CHISELS) .addWord("long") .addWord("point") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_piercing_2"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_piercing_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.PIERCING), 3, 7) .chisel(ItemTagsME.MID_CHISELS) .addWord("long") .addWord("point") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_piercing_3"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_piercing_3"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.PIERCING), 4, 9) .chisel(ItemTagsME.LATE_CHISELS) .addWord("long") .addWord("point") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_piercing_4"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_piercing_4"))); //endregion @@ -678,27 +670,27 @@ public void generate() { .chisel(ItemTagsME.EARLY_CHISELS) .addWord("swift") .addWord("draw") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_quick_charge_1"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_quick_charge_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.QUICK_CHARGE), 2, 6) .chisel(ItemTagsME.MID_CHISELS) .addWord("swift") .addWord("draw") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_quick_charge_2"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_quick_charge_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.QUICK_CHARGE), 3, 8) .chisel(ItemTagsME.MID_CHISELS) .addWord("swift") .addWord("draw") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_quick_charge_3"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_quick_charge_3"))); //endregion //region EFFICIENCY @@ -707,45 +699,45 @@ public void generate() { .chisel(ItemTagsME.EARLY_CHISELS) .addWord("swift") .addWord("collector") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_efficiency_1"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_efficiency_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.EFFICIENCY), 2, 4) .chisel(ItemTagsME.EARLY_CHISELS) .addWord("swift") .addWord("collector") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_efficiency_2"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_efficiency_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.EFFICIENCY), 3, 6) .chisel(ItemTagsME.MID_CHISELS) .addWord("swift") .addWord("collector") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_efficiency_3"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_efficiency_3"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.EFFICIENCY), 4, 8) .chisel(ItemTagsME.MID_CHISELS) .addWord("swift") .addWord("collector") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_efficiency_4"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_efficiency_4"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.EFFICIENCY), 5, 10) .chisel(ItemTagsME.LATE_CHISELS) .addWord("swift") .addWord("collector") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_efficiency_5"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_efficiency_5"))); //endregion //region FORTUNE @@ -755,9 +747,9 @@ public void generate() { .addWord("gifted") .addWord("blessing") .addWord("collector") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_fortune_1"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_fortune_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.FORTUNE), 2, 9) @@ -765,9 +757,9 @@ public void generate() { .addWord("gifted") .addWord("blessing") .addWord("collector") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_fortune_2"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_fortune_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(Enchantments.FORTUNE), 3, 11) @@ -775,9 +767,9 @@ public void generate() { .addWord("gifted") .addWord("blessing") .addWord("collector") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_fortune_3"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_fortune_3"))); //endregion //region SILK TOUCH @@ -786,9 +778,9 @@ public void generate() { .chisel(ItemTagsME.MID_CHISELS) .addWord("careful") .addWord("collector") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_silk_touch"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_silk_touch"))); //endregion @@ -800,9 +792,9 @@ public void generate() { .addWord("sturdy") .addWord("resilient") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_ailment_protection_1"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_ailment_protection_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.AILMENT_PROTECTION), 2, 6) @@ -810,9 +802,9 @@ public void generate() { .addWord("sturdy") .addWord("resilient") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_ailment_protection_2"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_ailment_protection_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.AILMENT_PROTECTION), 3, 8) @@ -820,9 +812,9 @@ public void generate() { .addWord("sturdy") .addWord("resilient") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_ailment_protection_3"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_ailment_protection_3"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.AILMENT_PROTECTION), 4, 10) @@ -830,9 +822,9 @@ public void generate() { .addWord("sturdy") .addWord("resilient") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_ailment_protection_4"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_ailment_protection_4"))); //endregion //region AULE BLESSING @@ -841,27 +833,24 @@ public void generate() { .chisel(ItemTagsME.EARLY_CHISELS) .addWord("gifted") .addWord("core") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_aule_blessing_1"))); + .unlockedBy(getHasName(Items.EMERALD), has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_aule_blessing_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, - getEnchantment(EnchantmentsME.AILMENT_PROTECTION), 2, 6) + getEnchantment(EnchantmentsME.AULE_BLESSING), 2, 6) .chisel(ItemTagsME.MID_CHISELS) .addWord("gifted") .addWord("core") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_aule_blessing_2"))); + .unlockedBy(getHasName(Items.EMERALD), has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_aule_blessing_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, - getEnchantment(EnchantmentsME.AILMENT_PROTECTION), 3, 8) - .chisel(ItemTagsME.MID_CHISELS) + getEnchantment(EnchantmentsME.AULE_BLESSING), 3, 8) + .chisel(ItemTagsME.LATE_CHISELS) .addWord("gifted") .addWord("core") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_aule_blessing_3"))); + .unlockedBy(getHasName(Items.EMERALD), has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_aule_blessing_3"))); //endregion //region BANE OF GIANTS @@ -871,9 +860,9 @@ public void generate() { .addWord("giant") .addWord("bane") .addWord("cutter") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_bane_of_giants_1"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_bane_of_giants_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.BANE_OF_GIANTS), 2, 5) @@ -881,9 +870,9 @@ public void generate() { .addWord("giant") .addWord("bane") .addWord("cutter") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_bane_of_giants_2"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_bane_of_giants_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.BANE_OF_GIANTS), 3, 7) @@ -891,9 +880,9 @@ public void generate() { .addWord("giant") .addWord("bane") .addWord("cutter") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_bane_of_giants_3"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_bane_of_giants_3"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.BANE_OF_GIANTS), 4, 9) @@ -901,9 +890,9 @@ public void generate() { .addWord("giant") .addWord("bane") .addWord("cutter") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_bane_of_giants_4"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_bane_of_giants_4"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.BANE_OF_GIANTS), 5, 11) @@ -911,9 +900,9 @@ public void generate() { .addWord("giant") .addWord("bane") .addWord("cutter") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_bane_of_giants_5"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_bane_of_giants_5"))); //endregion //region CELERITY @@ -922,9 +911,9 @@ public void generate() { .chisel(ItemTagsME.MID_CHISELS) .addWord("swift") .addWord("edge") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_celerity"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_celerity"))); //endregion //region GROUNDED @@ -934,9 +923,9 @@ public void generate() { .addWord("sturdy") .addWord("edge") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_grounded_1"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_grounded_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.GROUNDED), 2, 7) @@ -944,9 +933,9 @@ public void generate() { .addWord("sturdy") .addWord("edge") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_grounded_2"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_grounded_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.GROUNDED), 3, 9) @@ -954,9 +943,9 @@ public void generate() { .addWord("sturdy") .addWord("edge") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_grounded_3"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_grounded_3"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.GROUNDED), 4, 11) @@ -964,9 +953,9 @@ public void generate() { .addWord("sturdy") .addWord("edge") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_grounded_4"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_grounded_4"))); //endregion //region HEWING @@ -975,56 +964,57 @@ public void generate() { .chisel(ItemTagsME.EARLY_CHISELS) .addWord("broad") .addWord("collector") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_hewing_1"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_hewing_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.HEWING), 2, 7) .chisel(ItemTagsME.MID_CHISELS) .addWord("broad") .addWord("collector") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_hewing_2"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_hewing_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.HEWING), 3, 9) .chisel(ItemTagsME.LATE_CHISELS) .addWord("broad") .addWord("collector") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_hewing_3"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_hewing_3"))); //endregion + //region TREE_FELLER InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.TREE_FELLER), 1, 5) .chisel(ItemTagsME.EARLY_CHISELS) .addWord("broad") .addWord("cutter") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_tree_feller_1"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_tree_feller_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.TREE_FELLER), 2, 7) .chisel(ItemTagsME.MID_CHISELS) .addWord("broad") .addWord("cutter") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_tree_feller_2"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_tree_feller_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.TREE_FELLER), 3, 9) .chisel(ItemTagsME.LATE_CHISELS) .addWord("broad") .addWord("cutter") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_tree_feller_3"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_tree_feller_3"))); //endregion //region HIGH STEP @@ -1033,9 +1023,9 @@ public void generate() { .chisel(ItemTagsME.MID_CHISELS) .addWord("long") .addWord("traveller") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_high_step"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_high_step"))); //endregion //region MINER_REACH @@ -1044,9 +1034,9 @@ public void generate() { .chisel(ItemTagsME.MID_CHISELS) .addWord("long") .addWord("collector") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_miner_reach"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_miner_reach"))); //endregion //region STEALTHY_TRAIL @@ -1055,27 +1045,27 @@ public void generate() { .chisel(ItemTagsME.EARLY_CHISELS) .addWord("noiseless") .addWord("traveller") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_stealthy_trail_1"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_stealthy_trail_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.STEALTHY_TRAIL), 2, 5) .chisel(ItemTagsME.MID_CHISELS) .addWord("noiseless") .addWord("traveller") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_stealthy_trail_2"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_stealthy_trail_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.STEALTHY_TRAIL), 3, 7) .chisel(ItemTagsME.MID_CHISELS) .addWord("noiseless") .addWord("traveller") - .criterion(hasItem(ResourceItemsME.RUBY), - conditionsFromItem(ResourceItemsME.RUBY)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_stealthy_trail_3"))); + .unlockedBy(getHasName(ResourceItemsME.RUBY), + has(ResourceItemsME.RUBY)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_stealthy_trail_3"))); //endregion //region STALWART @@ -1085,9 +1075,9 @@ public void generate() { .addWord("sturdy") .addWord("point") .addWord("warded") - .criterion(hasItem(ResourceItemsME.SAPPHIRE), - conditionsFromItem(ResourceItemsME.SAPPHIRE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_stalwart"))); + .unlockedBy(getHasName(ResourceItemsME.SAPPHIRE), + has(ResourceItemsME.SAPPHIRE)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_stalwart"))); //endregion //region STRIDE @@ -1096,27 +1086,27 @@ public void generate() { .chisel(ItemTagsME.EARLY_CHISELS) .addWord("swift") .addWord("traveller") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_stride_1"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_stride_1"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.STRIDE), 2, 5) .chisel(ItemTagsME.MID_CHISELS) .addWord("swift") .addWord("traveller") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_stride_2"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_stride_2"))); InscriptionRecipeJsonBuilder.createInscriptionRecipe(itemLookup, RecipeCategory.MISC, getEnchantment(EnchantmentsME.STRIDE), 3, 7) .chisel(ItemTagsME.MID_CHISELS) .addWord("swift") .addWord("traveller") - .criterion(hasItem(ResourceItemsME.ADAMANT), - conditionsFromItem(ResourceItemsME.ADAMANT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_stride_3"))); + .unlockedBy(getHasName(ResourceItemsME.ADAMANT), + has(ResourceItemsME.ADAMANT)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_stride_3"))); //endregion //region VANTAGE @@ -1125,12 +1115,10 @@ public void generate() { .chisel(ItemTagsME.MID_CHISELS) .addWord("long") .addWord("edge") - .criterion(hasItem(Items.EMERALD), - conditionsFromItem(Items.EMERALD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "inscription_vantage"))); + .unlockedBy(getHasName(Items.EMERALD), + has(Items.EMERALD)) + .save(output, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "inscription_vantage"))); //endregion - } - }; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/RecipeProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/RecipeProvider.java index e7e07833b1..87fb7ab952 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/RecipeProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/recipes/RecipeProvider.java @@ -1,20 +1,28 @@ package net.sevenstars.middleearth.datageneration.providers.recipes; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; -import net.minecraft.data.recipe.*; -import net.minecraft.item.Item; -import net.minecraft.item.Items; -import net.minecraft.recipe.*; -import net.minecraft.recipe.book.RecipeCategory; -import net.minecraft.registry.Registries; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.util.Identifier; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.PackOutput; +import net.minecraft.data.recipes.RecipeCategory; +import net.minecraft.data.recipes.RecipeOutput; +import net.minecraft.data.recipes.ShapedRecipeBuilder; +import net.minecraft.data.recipes.ShapelessRecipeBuilder; +import net.minecraft.data.recipes.SimpleCookingRecipeBuilder; +import net.minecraft.data.recipes.SpecialRecipeBuilder; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.ItemTags; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.CampfireCookingRecipe; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeSerializer; +import net.minecraft.world.item.crafting.SmeltingRecipe; +import net.minecraft.world.item.crafting.SmokingRecipe; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.*; import net.sevenstars.middleearth.block.utils.BlockRecordTypes; @@ -32,22 +40,21 @@ import java.util.List; import java.util.concurrent.CompletableFuture; -public class RecipeProvider extends FabricRecipeProvider { +public class RecipeProvider extends net.minecraft.data.recipes.RecipeProvider { private static final int INGOT_LIQUID_VALUE = 144; + private HolderLookup.RegistryLookup itemLookup; + private RecipeOutput recipeOutput; - public RecipeProvider(FabricDataOutput output, CompletableFuture registriesFuture) { - super(output, registriesFuture); + public RecipeProvider(PackOutput recipeOutput, CompletableFuture registriesFuture) { + super(recipeOutput, registriesFuture); } @Override - protected RecipeGenerator getRecipeGenerator(RegistryWrapper.WrapperLookup wrapperLookup, RecipeExporter recipeExporter) { - return new RecipeGenerator(wrapperLookup, recipeExporter) { - - final RegistryWrapper.Impl itemLookup = registries.getOrThrow(RegistryKeys.ITEM); - - @Override - public void generate() { + protected void buildRecipes(RecipeOutput recipeOutput, HolderLookup.Provider registries) { + this.recipeOutput = recipeOutput; + this.itemLookup = registries.lookupOrThrow(Registries.ITEM); + HolderLookup.RegistryLookup itemLookup = this.itemLookup; //region STONE RECIPES for (StoneBlockSetBuilder record : StoneBlockSets.stoneSetsList) { if(record.hasMossy) { @@ -57,146 +64,183 @@ public void generate() { createStoneSetRecipes(record.mossyPillarBlocks); createStoneSetRecipes(record.mossyTileBlocks); createStoneSetRecipes(record.mossySmoothBlocks); - if(record.mossyCobblestoneBlocks != null && record.cobblestoneBlocks != null) { - createMossyRecipe(exporter, record.cobblestoneBlocks.base(), record.mossyCobblestoneBlocks.base()); + if(record.mossyCobblestoneBlocks != null && record.cobblestoneBlocks != null + && !isVanillaBlock(record.mossyCobblestoneBlocks.base())) { + createMossyRecipe(recipeOutput, record.cobblestoneBlocks.base(), record.mossyCobblestoneBlocks.base()); } - if(record.mossyBrickBlocks != null && record.brickBlocks != null) { - createMossyRecipe(exporter, record.brickBlocks.base(), record.mossyBrickBlocks.base()); + if(record.mossyBrickBlocks != null && record.brickBlocks != null + && !isVanillaBlock(record.mossyBrickBlocks.base())) { + createMossyRecipe(recipeOutput, record.brickBlocks.base(), record.mossyBrickBlocks.base()); } - if(record.mossyPillarBlocks != null && record.pillarBlocks != null) { - createMossyRecipe(exporter, record.pillarBlocks.base(), record.mossyPillarBlocks.base()); + if(record.mossyPillarBlocks != null && record.pillarBlocks != null + && !isVanillaBlock(record.mossyPillarBlocks.base())) { + createMossyRecipe(recipeOutput, record.pillarBlocks.base(), record.mossyPillarBlocks.base()); } - if(record.mossyPolishedBlocks != null && record.polishedBlocks != null) { - createMossyRecipe(exporter, record.polishedBlocks.base(), record.mossyPolishedBlocks.base()); + if(record.mossyPolishedBlocks != null && record.polishedBlocks != null + && !isVanillaBlock(record.mossyPolishedBlocks.base())) { + createMossyRecipe(recipeOutput, record.polishedBlocks.base(), record.mossyPolishedBlocks.base()); } - if(record.mossyTileBlocks != null && record.tileBlocks != null) { - createMossyRecipe(exporter, record.tileBlocks.base(), record.mossyTileBlocks.base()); + if(record.mossyTileBlocks != null && record.tileBlocks != null + && !isVanillaBlock(record.mossyTileBlocks.base())) { + createMossyRecipe(recipeOutput, record.tileBlocks.base(), record.mossyTileBlocks.base()); } - if(record.mossySmoothBlocks != null && record.smoothBlocks != null) { - createMossyRecipe(exporter, record.smoothBlocks.base(), record.mossySmoothBlocks.base()); + if(record.mossySmoothBlocks != null && record.smoothBlocks != null + && !isVanillaBlock(record.mossySmoothBlocks.base())) { + createMossyRecipe(recipeOutput, record.smoothBlocks.base(), record.mossySmoothBlocks.base()); } } if(record.hasCracked) { if(record.crackedBrickBlocks != null && record.brickBlocks != null) { createStoneSetRecipes(record.crackedBrickBlocks); - offerSmelting(List.of(record.brickBlocks.base()), RecipeCategory.BUILDING_BLOCKS, - record.crackedBrickBlocks.base(), 0.1f, 200, "cracked_bricks"); + if(!isVanillaBlock(record.crackedBrickBlocks.base())) { + oreSmelting(List.of(record.brickBlocks.base()), RecipeCategory.BUILDING_BLOCKS, + record.crackedBrickBlocks.base(), 0.1f, 200, "cracked_bricks"); + } } if(record.crackedPillarBlocks != null && record.pillarBlocks != null) { createStoneSetRecipes(record.crackedPillarBlocks); - offerSmelting(List.of(record.pillarBlocks.base()), RecipeCategory.BUILDING_BLOCKS, - record.crackedPillarBlocks.base(), 0.1f, 200, "cracked_bricks"); + if(!isVanillaBlock(record.crackedPillarBlocks.base())) { + oreSmelting(List.of(record.pillarBlocks.base()), RecipeCategory.BUILDING_BLOCKS, + record.crackedPillarBlocks.base(), 0.1f, 200, "cracked_bricks"); + } } if(record.crackedPolishedBlocks != null && record.polishedBlocks != null) { createStoneSetRecipes(record.crackedPolishedBlocks); - offerSmelting(List.of(record.polishedBlocks.base()), RecipeCategory.BUILDING_BLOCKS, - record.crackedPolishedBlocks.base(), 0.1f, 200, "cracked_bricks"); + if(!isVanillaBlock(record.crackedPolishedBlocks.base())) { + oreSmelting(List.of(record.polishedBlocks.base()), RecipeCategory.BUILDING_BLOCKS, + record.crackedPolishedBlocks.base(), 0.1f, 200, "cracked_bricks"); + } } if(record.crackedTileBlocks != null && record.tileBlocks != null) { createStoneSetRecipes(record.crackedTileBlocks); - offerSmelting(List.of(record.tileBlocks.base()), RecipeCategory.BUILDING_BLOCKS, - record.crackedTileBlocks.base(), 0.1f, 200, "cracked_bricks"); + if(!isVanillaBlock(record.crackedTileBlocks.base())) { + oreSmelting(List.of(record.tileBlocks.base()), RecipeCategory.BUILDING_BLOCKS, + record.crackedTileBlocks.base(), 0.1f, 200, "cracked_bricks"); + } } if(record.crackedSmoothBlocks != null && record.smoothBlocks != null) { createStoneSetRecipes(record.crackedSmoothBlocks); - offerSmelting(List.of(record.smoothBlocks.base()), RecipeCategory.BUILDING_BLOCKS, - record.crackedSmoothBlocks.base(), 0.1f, 200, "cracked_bricks"); + if(!isVanillaBlock(record.crackedSmoothBlocks.base())) { + oreSmelting(List.of(record.smoothBlocks.base()), RecipeCategory.BUILDING_BLOCKS, + record.crackedSmoothBlocks.base(), 0.1f, 200, "cracked_bricks"); + } } } if(record.cobblestoneBlocks != null && record.baseBlocks != null) { - if(!record.hasVanillaCobble) { - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, record.cobblestoneBlocks.base(), record.baseBlocks.base(), 1); - offerSmelting(List.of(record.cobblestoneBlocks.base()), RecipeCategory.BUILDING_BLOCKS, + if(!isVanillaBlock(record.cobblestoneBlocks.base())) { + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, record.cobblestoneBlocks.base(), record.baseBlocks.base(), 1); + } + if(!isVanillaBlock(record.baseBlocks.base())) { + oreSmelting(List.of(record.cobblestoneBlocks.base()), RecipeCategory.BUILDING_BLOCKS, record.baseBlocks.base(), 0.1f, 200, "blocks"); + } else if(!isVanillaBlock(record.cobblestoneBlocks.base())) { + createCobbledBaseSmeltingRecipe(recipeOutput, + record.cobblestoneBlocks.base(), record.baseBlocks.base()); } + if(record.brickworkBlocks != null) { - createBrickworkBlockRecipe(exporter, record.cobblestoneBlocks.base(), GenericBlockSets.STUCCO.blockSet.base(), record.brickworkBlocks.base()); + createBrickworkBlockRecipe(recipeOutput, record.cobblestoneBlocks.base(), GenericBlockSets.STUCCO.blockSet.base(), record.brickworkBlocks.base()); } } - if(record.smoothBlocks != null && record.tileBlocks != null) { - createBrickRecipe(exporter, record.smoothBlocks.base().asItem(), record.tileBlocks.base(), 4); + if (record.smoothBlocks != null && record.tileBlocks != null + && !isVanillaBlock(record.tileBlocks.base())) { + createBrickRecipe(recipeOutput, record.smoothBlocks.base().asItem(), + record.tileBlocks.base(), 4); } if (record.baseBlocks != null) { - if(record.brickBlocks != null) { - createBrickRecipe(exporter, record.baseBlocks.base().asItem(), record.brickBlocks.base(), 4); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, record.brickBlocks.base(), record.baseBlocks.base(), 1); + if(record.brickBlocks != null && !isVanillaBlock(record.brickBlocks.base())) { + createBrickRecipe(recipeOutput, record.baseBlocks.base().asItem(), record.brickBlocks.base(), 4); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, record.brickBlocks.base(), record.baseBlocks.base(), 1); } - if(record.pillarBlocks != null) { - createPillarRecipe(exporter, record.baseBlocks.base(), record.pillarBlocks.base(), 3); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, record.pillarBlocks.base(), record.baseBlocks.base(), 1); + if(record.pillarBlocks != null && !isVanillaBlock(record.pillarBlocks.base())) { + createPillarRecipe(recipeOutput, record.baseBlocks.base(), record.pillarBlocks.base(), 3); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, record.pillarBlocks.base(), record.baseBlocks.base(), 1); } - if(record.polishedBlocks != null && !record.hasVanillaPolished) { - createBrickRecipe(exporter, record.baseBlocks.base().asItem(), record.polishedBlocks.base(), 4); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, record.polishedBlocks.base(), record.baseBlocks.base(), 1); + if(record.polishedBlocks != null && !isVanillaBlock(record.polishedBlocks.base())) { + createBrickRecipe(recipeOutput, record.baseBlocks.base().asItem(), record.polishedBlocks.base(), 4); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, record.polishedBlocks.base(), record.baseBlocks.base(), 1); } - if(record.smoothBlocks != null) { - createSmeltingRecipe(exporter, record.baseBlocks.base().asItem(), record.smoothBlocks.base().asItem()); + if(record.smoothBlocks != null && !isVanillaBlock(record.smoothBlocks.base())) { + createSmeltingRecipe(recipeOutput, record.baseBlocks.base().asItem(), record.smoothBlocks.base().asItem()); } - if(record.chiseledBlocks != null) { - createChiseledRecipe(exporter, record.baseBlocks.base(), record.chiseledBlocks.base(), 2); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, record.chiseledBlocks.base(), record.baseBlocks.base(), 1); + if(record.chiseledBlocks != null && !isVanillaBlock(record.chiseledBlocks.base())) { + createChiseledRecipe(recipeOutput, record.baseBlocks.base(), record.chiseledBlocks.base(), 2); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, record.chiseledBlocks.base(), record.baseBlocks.base(), 1); } - if(record.chiseledBricksBlocks != null && record.brickBlocks != null) { - createChiseledRecipe(exporter, record.brickBlocks.base(), record.chiseledBricksBlocks.base(), 2); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, record.chiseledBricksBlocks.base(), record.brickBlocks.base(), 1); + if(record.chiseledBricksBlocks != null && record.brickBlocks != null + && !isVanillaBlock(record.chiseledBricksBlocks.base())) { + createChiseledRecipe(recipeOutput, record.brickBlocks.base(), record.chiseledBricksBlocks.base(), 2); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, record.chiseledBricksBlocks.base(), record.brickBlocks.base(), 1); } - if(record.chiseledPolishedBlocks != null && record.polishedBlocks != null) { - createChiseledRecipe(exporter, record.polishedBlocks.base(), record.chiseledPolishedBlocks.base(), 2); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, record.chiseledPolishedBlocks.base(), record.polishedBlocks.base(), 1); + if(record.chiseledPolishedBlocks != null && record.polishedBlocks != null + && !isVanillaBlock(record.chiseledPolishedBlocks.base())) { + createChiseledRecipe(recipeOutput, record.polishedBlocks.base(), record.chiseledPolishedBlocks.base(), 2); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, record.chiseledPolishedBlocks.base(), record.polishedBlocks.base(), 1); } - if(record.chiseledSmoothBlocks != null && record.smoothBlocks != null) { - createChiseledRecipe(exporter, record.smoothBlocks.base(), record.chiseledSmoothBlocks.base(), 2); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, record.chiseledSmoothBlocks.base(), record.smoothBlocks.base(), 1); + if(record.chiseledSmoothBlocks != null && record.smoothBlocks != null + && !isVanillaBlock(record.chiseledSmoothBlocks.base())) { + createChiseledRecipe(recipeOutput, record.smoothBlocks.base(), record.chiseledSmoothBlocks.base(), 2); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, record.chiseledSmoothBlocks.base(), record.smoothBlocks.base(), 1); } - if(record.chiseledTilesBlocks != null && record.tileBlocks != null) { - createChiseledRecipe(exporter, record.tileBlocks.base(), record.chiseledTilesBlocks.base(), 2); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, record.chiseledTilesBlocks.base(), record.tileBlocks.base(), 1); + if(record.chiseledTilesBlocks != null && record.tileBlocks != null + && !isVanillaBlock(record.chiseledTilesBlocks.base())) { + createChiseledRecipe(recipeOutput, record.tileBlocks.base(), record.chiseledTilesBlocks.base(), 2); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, record.chiseledTilesBlocks.base(), record.tileBlocks.base(), 1); } - if(record.oldBlocks != null) { - createCenterSurroundRecipe(exporter, record.baseBlocks.base().asItem(), ResourceItemsME.ASH, record.oldBlocks.base().asItem(), 8); + if(record.oldBlocks != null && !isVanillaBlock(record.oldBlocks.base())) { + createCenterSurroundRecipe(recipeOutput, record.baseBlocks.base().asItem(), ResourceItemsME.ASH, record.oldBlocks.base().asItem(), 8); } - createFilledRecipe(exporter, record.baseBlocks.base().asItem(), record.baseBlocks.trapdoor(), 3); - createPressurePlateRecipe(exporter, record.baseBlocks.base(), record.baseBlocks.pressurePlate()); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, record.baseBlocks.trapdoor(), record.baseBlocks.base()); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, record.baseBlocks.rocks(), record.baseBlocks.base(), 4); - createButtonRecipe(exporter, record.baseBlocks.base(), record.baseBlocks.button()); + if(!isVanillaBlock(record.baseBlocks.trapdoor())) { + createFilledRecipe(recipeOutput, record.baseBlocks.base().asItem(), record.baseBlocks.trapdoor(), 3); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, record.baseBlocks.trapdoor(), record.baseBlocks.base()); + } + if(!isVanillaBlock(record.baseBlocks.pressurePlate())) { + createPressurePlateRecipe(recipeOutput, record.baseBlocks.base(), record.baseBlocks.pressurePlate()); + } + if(!isVanillaBlock(record.baseBlocks.rocks())) { + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, record.baseBlocks.rocks(), record.baseBlocks.base(), 4); + } + if(!isVanillaBlock(record.baseBlocks.button())) { + createButtonRecipe(recipeOutput, record.baseBlocks.base(), record.baseBlocks.button()); + } - createStoneStoolRecipe(exporter, record.baseBlocks.base().asItem(), record.baseBlocks.stool()); - createStoneTableRecipe(exporter, record.baseBlocks.base().asItem(), record.baseBlocks.table()); - createStoneChairRecipe(exporter, record.baseBlocks.base().asItem(), record.baseBlocks.chair()); + createStoneStoolRecipe(recipeOutput, record.baseBlocks.base().asItem(), record.baseBlocks.stool()); + createStoneTableRecipe(recipeOutput, record.baseBlocks.base().asItem(), record.baseBlocks.table()); + createStoneChairRecipe(recipeOutput, record.baseBlocks.base().asItem(), record.baseBlocks.chair()); } - if(!record.isVanilla) createStoneSetRecipes(record.baseBlocks); - if(!record.hasVanillaCobble) createStoneSetRecipes(record.cobblestoneBlocks); + createStoneSetRecipes(record.baseBlocks); + createStoneSetRecipes(record.cobblestoneBlocks); createStoneSetRecipes(record.brickBlocks); createStoneSetRecipes(record.tileBlocks); createStoneSetRecipes(record.smoothBlocks); - if(!record.hasVanillaPolished) createStoneSetRecipes(record.polishedBlocks); + createStoneSetRecipes(record.polishedBlocks); + createStoneSetRecipes(record.brickworkBlocks); + createStoneSetRecipes(record.pillarBlocks); + createStoneSetRecipes(record.oldBlocks); createStoneSetRecipes(record.chiseledBlocks); createStoneSetRecipes(record.chiseledBricksBlocks); createStoneSetRecipes(record.chiseledTilesBlocks); createStoneSetRecipes(record.chiseledPolishedBlocks); createStoneSetRecipes(record.chiseledSmoothBlocks); - createStoneSetRecipes(record.brickworkBlocks); - createStoneSetRecipes(record.pillarBlocks); - createStoneSetRecipes(record.oldBlocks); if(record.carvedWindows != null && record.baseBlocks != null) { - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, record.carvedWindows.block(), 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, record.carvedWindows.block(), 4) .pattern("EEE") .pattern("EGE") .pattern("EEE") - .input('E', record.baseBlocks.base()) - .input('G', Items.GLASS) - .criterion(hasItem(record.baseBlocks.base()), - conditionsFromItem(record.baseBlocks.base())) - .offerTo(exporter); - createPaneRecipe(exporter, record.carvedWindows.block().asItem(), record.carvedWindows.verticalSlab(), 12); + .define('E', record.baseBlocks.base()) + .define('G', Items.GLASS) + .unlockedBy(getHasName(record.baseBlocks.base()), + has(record.baseBlocks.base())) + .save(recipeOutput); + createPaneRecipe(recipeOutput, record.carvedWindows.block().asItem(), + record.carvedWindows.verticalSlab(), 12); } } //endregion @@ -204,113 +248,153 @@ public void generate() { //region WOOD RECIPES for (WoodBlockSetBuilder record : WoodBlockSets.woodSetsList) { if(record.logBlocks != null) { - offerWallRecipe(RecipeCategory.BUILDING_BLOCKS, record.logBlocks.wall(), record.logBlocks.wood()); - createFenceRecipe(exporter, record.logBlocks.wood().asItem(), record.logBlocks.fence()); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, record.logBlocks.slab(), record.logBlocks.wood()); - createStairsRecipe(exporter, record.logBlocks.wood(), record.logBlocks.stairs()); - - createSlabsFromVerticalRecipe(exporter, record.logBlocks.verticalSlab(), record.logBlocks.slab()); - createVerticalSlabsRecipe(exporter, record.logBlocks.slab(), record.logBlocks.verticalSlab()); - createSlabsFromVerticalRecipe(exporter, record.planksBlocks.verticalSlab(), record.planksBlocks.slab()); - createVerticalSlabsRecipe(exporter, record.planksBlocks.slab(), record.planksBlocks.verticalSlab()); - - if(!record.vanilla) { - createBrickRecipe(exporter, record.logBlocks.log().asItem(), record.logBlocks.wood(), 3); - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, record.planksBlocks.base(), 4) - .input(record.logBlocks.log()) - .criterion(hasItem(record.logBlocks.log()), - conditionsFromItem(record.planksBlocks.base())) - .offerTo(exporter); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, record.planksBlocks.base(), 4) - .input(record.logBlocks.wood()) - .criterion(hasItem(record.logBlocks.wood()), - conditionsFromItem(record.planksBlocks.base())) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, Registries.BLOCK.getId(record.planksBlocks.base()).getPath() + "_from_wood"))); + if(!isVanillaBlock(record.logBlocks.wood())) { + createBrickRecipe(recipeOutput, record.logBlocks.log().asItem(), record.logBlocks.wood(), 3); + } + if(!isVanillaBlock(record.logBlocks.wall())) { + wall(RecipeCategory.BUILDING_BLOCKS, record.logBlocks.wall(), record.logBlocks.wood()); + } + if(!isVanillaBlock(record.logBlocks.fence())) { + createFenceRecipe(recipeOutput, record.logBlocks.wood().asItem(), record.logBlocks.fence()); + } + if(!isVanillaBlock(record.logBlocks.slab())) { + slab(RecipeCategory.BUILDING_BLOCKS, record.logBlocks.slab(), record.logBlocks.wood()); + } + if(!isVanillaBlock(record.logBlocks.stairs())) { + createStairsRecipe(recipeOutput, record.logBlocks.wood(), record.logBlocks.stairs()); } - } else if(record.mushroomStemBlocks != null) { - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, record.planksBlocks.base(), 4) - .input(record.mushroomStemBlocks.stem()) - .criterion(hasItem(record.mushroomStemBlocks.stem()), - conditionsFromItem(record.planksBlocks.base())) - .offerTo(exporter); + if(!isVanillaBlock(record.planksBlocks.base())) { + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, record.planksBlocks.base(), 4) + .requires(record.logBlocks.log()) + .unlockedBy(getHasName(record.logBlocks.log()), + has(record.planksBlocks.base())) + .save(recipeOutput); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, record.planksBlocks.base(), 4) + .requires(record.logBlocks.wood()) + .unlockedBy(getHasName(record.logBlocks.wood()), + has(record.planksBlocks.base())) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, BuiltInRegistries.BLOCK.getKey(record.planksBlocks.base()).getPath() + "_from_wood"))); + } - offerWallRecipe(RecipeCategory.BUILDING_BLOCKS, record.mushroomStemBlocks.wall(), record.mushroomStemBlocks.stem()); - createFenceRecipe(exporter, record.mushroomStemBlocks.stem().asItem(), record.mushroomStemBlocks.fence()); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, record.mushroomStemBlocks.slab(), record.mushroomStemBlocks.stem()); - createVerticalSlabsRecipe(exporter, record.mushroomStemBlocks.slab(), record.mushroomStemBlocks.verticalSlab()); - createSlabsFromVerticalRecipe(exporter, record.mushroomStemBlocks.verticalSlab(), record.mushroomStemBlocks.slab()); - createStairsRecipe(exporter, record.mushroomStemBlocks.stem(), record.mushroomStemBlocks.stairs()); + if(!isVanillaBlock(record.logBlocks.verticalSlab())) { + createVerticalSlabsRecipe(recipeOutput, record.logBlocks.slab(), record.logBlocks.verticalSlab()); + } + if(!isVanillaBlock(record.logBlocks.slab())) { + createSlabsFromVerticalRecipe(recipeOutput, record.logBlocks.verticalSlab(), record.logBlocks.slab()); + } + } else if(record.mushroomStemBlocks != null) { + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, record.planksBlocks.base(), 4) + .requires(record.mushroomStemBlocks.stem()) + .unlockedBy(getHasName(record.mushroomStemBlocks.stem()), + has(record.planksBlocks.base())) + .save(recipeOutput); + + wall(RecipeCategory.BUILDING_BLOCKS, record.mushroomStemBlocks.wall(), record.mushroomStemBlocks.stem()); + createFenceRecipe(recipeOutput, record.mushroomStemBlocks.stem().asItem(), record.mushroomStemBlocks.fence()); + slab(RecipeCategory.BUILDING_BLOCKS, record.mushroomStemBlocks.slab(), record.mushroomStemBlocks.stem()); + createVerticalSlabsRecipe(recipeOutput, record.mushroomStemBlocks.slab(), record.mushroomStemBlocks.verticalSlab()); + createSlabsFromVerticalRecipe(recipeOutput, record.mushroomStemBlocks.verticalSlab(), record.mushroomStemBlocks.slab()); + createStairsRecipe(recipeOutput, record.mushroomStemBlocks.stem(), record.mushroomStemBlocks.stairs()); } if(record.strippedLogBlocks != null) { - createBrickRecipe(exporter, record.strippedLogBlocks.log().asItem(), record.strippedLogBlocks.wood(), 3); - offerWallRecipe(RecipeCategory.BUILDING_BLOCKS, record.strippedLogBlocks.wall(), record.strippedLogBlocks.wood()); - createFenceRecipe(exporter, record.strippedLogBlocks.wood().asItem(), record.strippedLogBlocks.fence()); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, record.strippedLogBlocks.slab(), record.strippedLogBlocks.wood()); - createStairsRecipe(exporter, record.strippedLogBlocks.wood(), record.strippedLogBlocks.stairs()); - - createSlabsFromVerticalRecipe(exporter, record.strippedLogBlocks.verticalSlab(), record.strippedLogBlocks.slab()); - createVerticalSlabsRecipe(exporter, record.strippedLogBlocks.slab(), record.strippedLogBlocks.verticalSlab()); - // if(!record.vanilla) - //createSlabsFromVerticalRecipe(exporter, record.strippedLogBlocks.verticalSlab(), record.strippedLogBlocks.slab()); - //createVerticalSlabsRecipe(exporter, record.strippedLogBlocks.slab(), record.strippedLogBlocks.verticalSlab()); - //createSlabsFromVerticalRecipe(exporter, record.strippedLogBlocks.verticalSlab(), record.strippedLogBlocks.slab()); - //createStairsRecipe(exporter, record.strippedLogBlocks.wood(), record.strippedLogBlocks.stairs()); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, record.planksBlocks.base(), 4) - .input(record.strippedLogBlocks.log()) - .criterion(hasItem(record.strippedLogBlocks.log()), - conditionsFromItem(record.planksBlocks.base())) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, Registries.BLOCK.getId(record.planksBlocks.base()).getPath() + "_from_stripped_log"))); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, record.planksBlocks.base(), 4) - .input(record.strippedLogBlocks.wood()) - .criterion(hasItem(record.strippedLogBlocks.wood()), - conditionsFromItem(record.planksBlocks.base())) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, Registries.BLOCK.getId(record.planksBlocks.base()).getPath() + "_from_stripped_wood"))); + if(!isVanillaBlock(record.strippedLogBlocks.wood())) { + createBrickRecipe(recipeOutput, record.strippedLogBlocks.log().asItem(), record.strippedLogBlocks.wood(), 3); + } + if(!isVanillaBlock(record.strippedLogBlocks.wall())) { + wall(RecipeCategory.BUILDING_BLOCKS, record.strippedLogBlocks.wall(), record.strippedLogBlocks.wood()); + } + if(!isVanillaBlock(record.strippedLogBlocks.fence())) { + createFenceRecipe(recipeOutput, record.strippedLogBlocks.wood().asItem(), record.strippedLogBlocks.fence()); + } + if(!isVanillaBlock(record.strippedLogBlocks.slab())) { + slab(RecipeCategory.BUILDING_BLOCKS, record.strippedLogBlocks.slab(), record.strippedLogBlocks.wood()); + } + if(!isVanillaBlock(record.strippedLogBlocks.verticalSlab())) { + createVerticalSlabsRecipe(recipeOutput, record.strippedLogBlocks.slab(), record.strippedLogBlocks.verticalSlab()); + } + if(!isVanillaBlock(record.strippedLogBlocks.slab())) { + createSlabsFromVerticalRecipe(recipeOutput, record.strippedLogBlocks.verticalSlab(), record.strippedLogBlocks.slab()); + } + if(!isVanillaBlock(record.strippedLogBlocks.stairs())) { + createStairsRecipe(recipeOutput, record.strippedLogBlocks.wood(), record.strippedLogBlocks.stairs()); + } + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, record.planksBlocks.base(), 4) + .requires(record.strippedLogBlocks.log()) + .unlockedBy(getHasName(record.strippedLogBlocks.log()), + has(record.planksBlocks.base())) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, BuiltInRegistries.BLOCK.getKey(record.planksBlocks.base()).getPath() + "_from_stripped_log"))); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, record.planksBlocks.base(), 4) + .requires(record.strippedLogBlocks.wood()) + .unlockedBy(getHasName(record.strippedLogBlocks.wood()), + has(record.planksBlocks.base())) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, BuiltInRegistries.BLOCK.getKey(record.planksBlocks.base()).getPath() + "_from_stripped_wood"))); } - createFenceRecipe(exporter, record.planksBlocks.base().asItem(), record.planksBlocks.fence()); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, record.planksBlocks.slab(), record.planksBlocks.base()); + if(!isVanillaBlock(record.planksBlocks.fence())) { + createFenceRecipe(recipeOutput, record.planksBlocks.base().asItem(), record.planksBlocks.fence()); + } + if(!isVanillaBlock(record.planksBlocks.slab())) { + slab(RecipeCategory.BUILDING_BLOCKS, record.planksBlocks.slab(), record.planksBlocks.base()); + } if(record.shinglesBlocks != null) { - createShinglesRecipe(exporter, record.planksBlocks.base(), record.shinglesBlocks.base()); + createShinglesRecipe(recipeOutput, record.planksBlocks.base(), record.shinglesBlocks.base()); createRegularSetRecipes(record.shinglesBlocks); } if(record.roofingBlocks != null) { - createRoofingRecipe(exporter, record.planksBlocks.slab(), record.roofingBlocks.base()); + createRoofingRecipe(recipeOutput, record.planksBlocks.slab(), record.roofingBlocks.base()); createRegularSetRecipes(record.roofingBlocks); } - createStairsRecipe(exporter, record.planksBlocks.base(), record.planksBlocks.stairs()); + if(!isVanillaBlock(record.planksBlocks.verticalSlab())) { + createVerticalSlabsRecipe(recipeOutput, record.planksBlocks.slab(), record.planksBlocks.verticalSlab()); + } + createSlabsFromVerticalRecipe(recipeOutput, record.planksBlocks.verticalSlab(), record.planksBlocks.slab()); + + if(!isVanillaBlock(record.planksBlocks.stairs())) { + createStairsRecipe(recipeOutput, record.planksBlocks.base(), record.planksBlocks.stairs()); + } if(record.redstoneBlocks != null) { - createDoorRecipe(exporter, record.planksBlocks.base(), record.redstoneBlocks.door()); - createTrapdoorRecipe(exporter, record.planksBlocks.base(), record.redstoneBlocks.trapdoor()); - createButtonRecipe(exporter, record.planksBlocks.base(), record.redstoneBlocks.button()); - createPressurePlateRecipe(exporter, record.planksBlocks.base(), record.redstoneBlocks.pressurePlate()); + if(!isVanillaBlock(record.redstoneBlocks.door())) { + createDoorRecipe(recipeOutput, record.planksBlocks.base(), record.redstoneBlocks.door()); + } + if(!isVanillaBlock(record.redstoneBlocks.trapdoor())) { + createTrapdoorRecipe(recipeOutput, record.planksBlocks.base(), record.redstoneBlocks.trapdoor()); + } + if(!isVanillaBlock(record.redstoneBlocks.button())) { + createButtonRecipe(recipeOutput, record.planksBlocks.base(), record.redstoneBlocks.button()); + } + if(!isVanillaBlock(record.redstoneBlocks.pressurePlate())) { + createPressurePlateRecipe(recipeOutput, record.planksBlocks.base(), record.redstoneBlocks.pressurePlate()); + } } if(record.furnitureBlocks != null) { - createWoodStoolRecipe(exporter, record.planksBlocks.base().asItem(), record.furnitureBlocks.stool()); - createWoodBenchRecipe(exporter, record.planksBlocks.base().asItem(), record.furnitureBlocks.bench()); - createWoodTableRecipe(exporter, record.planksBlocks.base().asItem(), record.furnitureBlocks.table()); - createWoodChairRecipe(exporter, record.planksBlocks.base().asItem(), record.furnitureBlocks.chair()); - createWoodLadderRecipe(exporter, record.planksBlocks.base().asItem(), record.furnitureBlocks.ladder()); + createWoodStoolRecipe(recipeOutput, record.planksBlocks.base().asItem(), record.furnitureBlocks.stool()); + createWoodBenchRecipe(recipeOutput, record.planksBlocks.base().asItem(), record.furnitureBlocks.bench()); + createWoodTableRecipe(recipeOutput, record.planksBlocks.base().asItem(), record.furnitureBlocks.table()); + createWoodChairRecipe(recipeOutput, record.planksBlocks.base().asItem(), record.furnitureBlocks.chair()); + createWoodLadderRecipe(recipeOutput, record.planksBlocks.base().asItem(), record.furnitureBlocks.ladder()); } - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, record.planksBlocks.gate(), 1) - .pattern("sls") - .pattern("sls") - .input('l', record.planksBlocks.base()) - .input('s', Items.STICK) - .criterion(hasItem(record.planksBlocks.base()), - conditionsFromItem(record.planksBlocks.base())) - .criterion(hasItem(Items.STICK), - conditionsFromItem(Items.STICK)) - .offerTo(exporter); + if(!isVanillaBlock(record.planksBlocks.gate())) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, record.planksBlocks.gate(), 1) + .pattern("sls") + .pattern("sls") + .define('l', record.planksBlocks.base()) + .define('s', Items.STICK) + .unlockedBy(getHasName(record.planksBlocks.base()), + has(record.planksBlocks.base())) + .unlockedBy(getHasName(Items.STICK), + has(Items.STICK)) + .save(recipeOutput); + } } //endregion @@ -322,447 +406,468 @@ public void generate() { createRegularSetRecipes(set.blockSet); } } - for(SimpleBlockSetBuilder set : GenericBlockSets.simpleSetsList) { + for (SimpleBlockSetBuilder set : GenericBlockSets.simpleSetsList) { createGenericRecipes(set); } + //region ROOF RECIPES + /*for (GenericBlockSets.RoofBlockSet record : GenericBlockSets.sets) { + + if (record.origin() != null) { + ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, record.block(), 7) + .pattern(" l ") + .pattern("lll") + .pattern("lll") + .input('l', record.origin()) + .criterion(hasItem(record.origin()), + conditionsFromItem(record.origin())) + .offerTo(exporter); + } + offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, record.slab(), record.block()); + createVerticalSlabsRecipe(exporter, record.slab(), record.verticalSlab()); + createSlabsFromVerticalRecipe(exporter, record.verticalSlab(), record.slab()); + createStairsRecipe(exporter, record.block(), record.stairs()); + offerWallRecipe(RecipeCategory.BUILDING_BLOCKS, record.wall(), record.block()); + } + + for (GenericBlockSets.MiscBlockSet record : GenericBlockSets.specialWoodSets) { + if (record.origin() != null) { + ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, record.block(), 7) + .pattern(" l ") + .pattern("lll") + .pattern("lll") + .input('l', record.origin()) + .criterion(hasItem(record.origin()), + conditionsFromItem(record.origin())) + .offerTo(exporter); + } + offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, record.slab(), record.block()); + createVerticalSlabsRecipe(exporter, record.slab(), record.verticalSlab()); + createSlabsFromVerticalRecipe(exporter, record.verticalSlab(), record.slab()); + createStairsRecipe(exporter, record.block(), record.stairs()); + offerWallRecipe(RecipeCategory.BUILDING_BLOCKS, record.wall(), record.block()); + }*/ + //endregion + //region BLOCK LIST SPECIFIC RECIPES for (SimpleVerticalSlabModel.VerticalSlab verticalSlab : SimpleVerticalSlabModel.vanillaVerticalSlabs) { - createVerticalSlabsRecipe(exporter, verticalSlab.slab(), verticalSlab.verticalSlab()); - createSlabsFromVerticalRecipe(exporter, verticalSlab.verticalSlab(), verticalSlab.slab()); + createVerticalSlabsRecipe(recipeOutput, verticalSlab.slab(), verticalSlab.verticalSlab()); + createSlabsFromVerticalRecipe(recipeOutput, verticalSlab.verticalSlab(), verticalSlab.slab()); } for (SimpleVerticalSlabModel.VerticalSlab verticalSlab : SimpleVerticalSlabModel.vanillaWoodVerticalSlabs) { - createVerticalSlabsRecipe(exporter, verticalSlab.slab(), verticalSlab.verticalSlab()); - createSlabsFromVerticalRecipe(exporter, verticalSlab.verticalSlab(), verticalSlab.slab()); + createVerticalSlabsRecipe(recipeOutput, verticalSlab.slab(), verticalSlab.verticalSlab()); + createSlabsFromVerticalRecipe(recipeOutput, verticalSlab.verticalSlab(), verticalSlab.slab()); } for (SimpleVerticalSlabModel.VerticalSlab verticalSlab : SimpleVerticalSlabModel.vanillaStrippedVerticalSlabs) { - createVerticalSlabsRecipe(exporter, verticalSlab.slab(), verticalSlab.verticalSlab()); - createSlabsFromVerticalRecipe(exporter, verticalSlab.verticalSlab(), verticalSlab.slab()); + createVerticalSlabsRecipe(recipeOutput, verticalSlab.slab(), verticalSlab.verticalSlab()); + createSlabsFromVerticalRecipe(recipeOutput, verticalSlab.verticalSlab(), verticalSlab.slab()); } for (SimplePillarModel.StonePillar pillar : SimplePillarModel.stonePillars) { if (pillar.toString().contains("mossy_")) { - createMossyRecipe(exporter, pillar.origin(), pillar.base()); + createMossyRecipe(recipeOutput, pillar.origin(), pillar.base()); } else if (pillar.toString().contains("cracked_")) { - createSmeltingRecipe(exporter, pillar.origin().asItem(), pillar.base().asItem()); + createSmeltingRecipe(recipeOutput, pillar.origin().asItem(), pillar.base().asItem()); } else { - createPillarRecipe(exporter, pillar.origin(), pillar.base(), 3); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, pillar.base().asItem(), pillar.origin()); + createPillarRecipe(recipeOutput, pillar.origin(), pillar.base(), 3); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, pillar.base().asItem(), pillar.origin()); } } for (SimpleBlockModel.ChiseledPolishedBlock block : SimpleBlockModel.chiseledPolishedBlocksTopBottom) { - createChiseledRecipe(exporter, block.origin(), block.base(), 1); + createChiseledRecipe(recipeOutput, block.origin(), block.base(), 1); } for (SimpleBlockModel.ChiseledBlock block : SimpleBlockModel.chiseledMainBlockTopBottom) { - createChiseledRecipe(exporter, block.origin(), block.base(), 1); + createChiseledRecipe(recipeOutput, block.origin(), block.base(), 1); } for (SimpleBlockModel.ChiseledBlock block : SimpleBlockModel.chiseledBlocksTopBottom) { - createChiseledRecipe(exporter, block.origin(), block.base(), 1); + createChiseledRecipe(recipeOutput, block.origin(), block.base(), 1); } for (SimpleBlockModel.ChiseledPolishedBlock block : SimpleBlockModel.chiseledPolishedBlocks) { - createCutPolishedRecipe(exporter, block.origin(), block.base(), 1); + createCutPolishedRecipe(recipeOutput, block.origin(), block.base(), 1); } for (SimpleBlockModel.ChiseledPolishedBlock block : SimpleBlockModel.chiseledTilesBlocksTopBottom) { - createCutPolishedRecipe(exporter, block.origin(), block.base(), 1); + createCutPolishedRecipe(recipeOutput, block.origin(), block.base(), 1); } for (SimpleBlockModel.ChiseledPolishedBlock block : SimpleBlockModel.chiseledSmoothBlocksTopBottom) { - createCutPolishedRecipe(exporter, block.origin(), block.base(), 1); + createCutPolishedRecipe(recipeOutput, block.origin(), block.base(), 1); } for (SimpleSlabModel.Slab slab : SimpleSlabModel.vanillaSlabs) { - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, slab.slab(), slab.origin()); + slab(RecipeCategory.BUILDING_BLOCKS, slab.slab(), slab.origin()); } for (SimpleSlabModel.Slab slab : SimpleSlabModel.vanillaWoodSlabs) { - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, slab.slab(), slab.origin()); + slab(RecipeCategory.BUILDING_BLOCKS, slab.slab(), slab.origin()); } for (SimpleSlabModel.Slab slab : SimpleSlabModel.vanillaStrippedSlab) { - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, slab.slab(), slab.origin()); + slab(RecipeCategory.BUILDING_BLOCKS, slab.slab(), slab.origin()); } for (SimpleStairModel.Stair stair : SimpleStairModel.vanillaStairs) { - createStairsRecipe(exporter, stair.origin(), stair.stairs()); + createStairsRecipe(recipeOutput, stair.origin(), stair.stairs()); } for (SimpleStairModel.Stair stair : SimpleStairModel.vanillaWoodStairs) { - createStairsRecipe(exporter, stair.origin(), stair.stairs()); + createStairsRecipe(recipeOutput, stair.origin(), stair.stairs()); } for (SimpleStairModel.Stair stair : SimpleStairModel.vanillaStrippedStairs) { - createStairsRecipe(exporter, stair.origin(), stair.stairs()); + createStairsRecipe(recipeOutput, stair.origin(), stair.stairs()); } for (SimpleWallModel.Wall wall : SimpleWallModel.vanillaWalls) { - offerWallRecipe(RecipeCategory.BUILDING_BLOCKS, wall.wall(), wall.block()); + wall(RecipeCategory.BUILDING_BLOCKS, wall.wall(), wall.block()); } for (SimpleWallModel.Wall wall : SimpleWallModel.vanillaStrippedWalls) { - offerWallRecipe(RecipeCategory.BUILDING_BLOCKS, wall.wall(), wall.block()); + wall(RecipeCategory.BUILDING_BLOCKS, wall.wall(), wall.block()); } for (SimpleWallModel.Wall wall : SimpleWallModel.vanillaWoodWalls) { - offerWallRecipe(RecipeCategory.BUILDING_BLOCKS, wall.wall(), wall.block()); + wall(RecipeCategory.BUILDING_BLOCKS, wall.wall(), wall.block()); } for (SimpleFenceModel.Fence fence : SimpleFenceModel.vanillaStrippedFences) { - createFenceRecipe(exporter, fence.block().asItem(), fence.fence()); + createFenceRecipe(recipeOutput, fence.block().asItem(), fence.fence()); } for (SimpleFenceModel.Fence fence : SimpleFenceModel.vanillaWoodFences) { - createFenceRecipe(exporter, fence.block().asItem(), fence.fence()); + createFenceRecipe(recipeOutput, fence.block().asItem(), fence.fence()); } for (SimplePaneModel.Pane pane : SimplePaneModel.panes) { - createPaneRecipe(exporter, pane.glass().asItem(), pane.pane(), 16); + createPaneRecipe(recipeOutput, pane.glass().asItem(), pane.pane(), 16); } for (SimpleWoodStoolModel.VanillaStool stool : SimpleWoodStoolModel.vanillaStools) { - createWoodStoolRecipe(exporter, stool.planks().asItem(), stool.base()); + createWoodStoolRecipe(recipeOutput, stool.planks().asItem(), stool.base()); } for (SimpleWoodBenchModel.VanillaBench bench : SimpleWoodBenchModel.vanillaBenchs) { - createWoodBenchRecipe(exporter, bench.planks().asItem(), bench.base()); + createWoodBenchRecipe(recipeOutput, bench.planks().asItem(), bench.base()); } for (SimpleWoodTableModel.VanillaTable table : SimpleWoodTableModel.vanillaTables) { - createWoodTableRecipe(exporter, table.planks().asItem(), table.base()); + createWoodTableRecipe(recipeOutput, table.planks().asItem(), table.base()); } for (SimpleWoodChairModel.VanillaChair chair : SimpleWoodChairModel.vanillaChairs) { - createWoodChairRecipe(exporter, chair.planks().asItem(), chair.base()); + createWoodChairRecipe(recipeOutput, chair.planks().asItem(), chair.base()); } for (SimpleLadderModel.Ladder ladder : SimpleLadderModel.vanillaLadders) { - createWoodLadderRecipe(exporter, ladder.block().asItem(), ladder.ladder()); + createWoodLadderRecipe(recipeOutput, ladder.block().asItem(), ladder.ladder()); } for (SimpleRocksModel.Rocks rock : SimpleRocksModel.vanillaRocks) { - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, rock.rocks(), rock.block(), 4); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, rock.rocks(), rock.block(), 4); } //endregion //region MANUAL BLOCK RECIPES - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.BLACK_DYE, ModDecorativeBlocks.BLACK_STAINED_LEAD_GLASS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.BLUE_DYE, ModDecorativeBlocks.BLUE_STAINED_LEAD_GLASS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.BROWN_DYE, ModDecorativeBlocks.BROWN_STAINED_LEAD_GLASS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.CYAN_DYE, ModDecorativeBlocks.CYAN_STAINED_LEAD_GLASS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.GRAY_DYE, ModDecorativeBlocks.GRAY_STAINED_LEAD_GLASS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.GREEN_DYE, ModDecorativeBlocks.GREEN_STAINED_LEAD_GLASS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.LIGHT_BLUE_DYE, ModDecorativeBlocks.LIGHT_BLUE_STAINED_LEAD_GLASS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.LIGHT_GRAY_DYE, ModDecorativeBlocks.LIGHT_GRAY_STAINED_LEAD_GLASS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.LIME_DYE, ModDecorativeBlocks.LIME_STAINED_LEAD_GLASS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.MAGENTA_DYE, ModDecorativeBlocks.MAGENTA_STAINED_LEAD_GLASS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.ORANGE_DYE, ModDecorativeBlocks.ORANGE_STAINED_LEAD_GLASS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.PINK_DYE, ModDecorativeBlocks.PINK_STAINED_LEAD_GLASS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.PURPLE_DYE, ModDecorativeBlocks.PURPLE_STAINED_LEAD_GLASS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.RED_DYE, ModDecorativeBlocks.RED_STAINED_LEAD_GLASS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.WHITE_DYE, ModDecorativeBlocks.WHITE_STAINED_LEAD_GLASS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.YELLOW_DYE, ModDecorativeBlocks.YELLOW_STAINED_LEAD_GLASS.asItem(), 8); - - createLayerRecipe(exporter, Blocks.GRAVEL.asItem(), ModBlocks.GRAVEL_LAYER); - createLayerRecipe(exporter, Blocks.SAND.asItem(), ModBlocks.SAND_LAYER); - createLayerRecipe(exporter, ModBlocks.BLACK_SAND.asItem(), ModBlocks.BLACK_SAND_LAYER); - createLayerRecipe(exporter, ModBlocks.WHITE_SAND.asItem(), ModBlocks.WHITE_SAND_LAYER); - createLayerRecipe(exporter, ModBlocks.ASHEN_SAND.asItem(), ModBlocks.ASHEN_SAND_LAYER); - createLayerRecipe(exporter, ModBlocks.ASHEN_GRAVEL.asItem(), ModBlocks.ASHEN_GRAVEL_LAYER); - createLayerRecipe(exporter, ModBlocks.SKELETAL_PILE.asItem(), ModBlocks.SKELETAL_PILE_LAYER); - createLayerRecipe(exporter, ModBlocks.WASTE_PILE.asItem(), ModBlocks.WASTE_PILE_LAYER); - - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.TRAVERTINE_SET.baseBlocks.base(), 4) + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.BLACK_DYE, ModDecorativeBlocks.BLACK_STAINED_LEAD_GLASS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.BLUE_DYE, ModDecorativeBlocks.BLUE_STAINED_LEAD_GLASS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.BROWN_DYE, ModDecorativeBlocks.BROWN_STAINED_LEAD_GLASS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.CYAN_DYE, ModDecorativeBlocks.CYAN_STAINED_LEAD_GLASS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.GRAY_DYE, ModDecorativeBlocks.GRAY_STAINED_LEAD_GLASS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.GREEN_DYE, ModDecorativeBlocks.GREEN_STAINED_LEAD_GLASS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.LIGHT_BLUE_DYE, ModDecorativeBlocks.LIGHT_BLUE_STAINED_LEAD_GLASS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.LIGHT_GRAY_DYE, ModDecorativeBlocks.LIGHT_GRAY_STAINED_LEAD_GLASS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.LIME_DYE, ModDecorativeBlocks.LIME_STAINED_LEAD_GLASS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.MAGENTA_DYE, ModDecorativeBlocks.MAGENTA_STAINED_LEAD_GLASS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.ORANGE_DYE, ModDecorativeBlocks.ORANGE_STAINED_LEAD_GLASS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.PINK_DYE, ModDecorativeBlocks.PINK_STAINED_LEAD_GLASS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.PURPLE_DYE, ModDecorativeBlocks.PURPLE_STAINED_LEAD_GLASS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.RED_DYE, ModDecorativeBlocks.RED_STAINED_LEAD_GLASS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.WHITE_DYE, ModDecorativeBlocks.WHITE_STAINED_LEAD_GLASS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.LEAD_GLASS.asItem(), Items.YELLOW_DYE, ModDecorativeBlocks.YELLOW_STAINED_LEAD_GLASS.asItem(), 8); + + createLayerRecipe(recipeOutput, Blocks.GRAVEL.asItem(), ModBlocks.GRAVEL_LAYER); + createLayerRecipe(recipeOutput, Blocks.SAND.asItem(), ModBlocks.SAND_LAYER); + createLayerRecipe(recipeOutput, ModBlocks.BLACK_SAND.asItem(), ModBlocks.BLACK_SAND_LAYER); + createLayerRecipe(recipeOutput, ModBlocks.WHITE_SAND.asItem(), ModBlocks.WHITE_SAND_LAYER); + createLayerRecipe(recipeOutput, ModBlocks.ASHEN_SAND.asItem(), ModBlocks.ASHEN_SAND_LAYER); + createLayerRecipe(recipeOutput, ModBlocks.ASHEN_GRAVEL.asItem(), ModBlocks.ASHEN_GRAVEL_LAYER); + createLayerRecipe(recipeOutput, ModBlocks.SKELETAL_PILE.asItem(), ModBlocks.SKELETAL_PILE_LAYER); + createLayerRecipe(recipeOutput, ModBlocks.WASTE_PILE.asItem(), ModBlocks.WASTE_PILE_LAYER); + + // Minecraft 1.21.8 provides this recipe in vanilla; 1.21.1 still needs the mod recipe. + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, Items.SADDLE) + .pattern("LLL") + .pattern("I I") + .define('L', Items.LEATHER) + .define('I', Items.IRON_INGOT) + .unlockedBy(getHasName(Items.LEATHER), has(Items.LEATHER)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath( + MiddleEarth.MOD_ID, "saddle"))); + + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.TRAVERTINE_SET.baseBlocks.base(), 4) .pattern("CS") .pattern("SC") - .input('C', Blocks.CALCITE) - .input('S', Blocks.SANDSTONE) - .criterion(hasItem(Blocks.CALCITE), - conditionsFromItem(Blocks.CALCITE)) - .offerTo(exporter); + .define('C', Blocks.CALCITE) + .define('S', Blocks.SANDSTONE) + .unlockedBy(getHasName(Blocks.CALCITE), + has(Blocks.CALCITE)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.REED_THATCH.blockSet.base(), 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.REED_THATCH.blockSet.base(), 1) .pattern("RR") .pattern("RR") - .input('R', ResourceItemsME.REEDS) - .criterion(hasItem(ResourceItemsME.REEDS), - conditionsFromItem(ResourceItemsME.REEDS)) - .offerTo(exporter); + .define('R', ResourceItemsME.REEDS) + .unlockedBy(getHasName(ResourceItemsME.REEDS), + has(ResourceItemsME.REEDS)) + .save(recipeOutput); - createStairsRecipe(exporter, ModBlocks.GRASSY_DIRT, ModBlocks.GRASSY_DIRT_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_DIRT_SLAB, ModBlocks.GRASSY_DIRT); + createStairsRecipe(recipeOutput, ModBlocks.GRASSY_DIRT, ModBlocks.GRASSY_DIRT_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_DIRT_SLAB, ModBlocks.GRASSY_DIRT); - createStairsRecipe(exporter, ModBlocks.PEBBLED_GRASS, ModBlocks.PEBBLED_GRASS_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.PEBBLED_GRASS_SLAB, ModBlocks.PEBBLED_GRASS); + createStairsRecipe(recipeOutput, ModBlocks.PEBBLED_GRASS, ModBlocks.PEBBLED_GRASS_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.PEBBLED_GRASS_SLAB, ModBlocks.PEBBLED_GRASS); - createStairsRecipe(exporter, ModBlocks.TURF, ModBlocks.TURF_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.TURF_SLAB, ModBlocks.TURF); - createVerticalSlabsRecipe(exporter, ModBlocks.TURF, ModBlocks.TURF_VERTICAL_SLAB); - createSlabsFromVerticalRecipe(exporter, ModBlocks.TURF_VERTICAL_SLAB, ModBlocks.TURF_SLAB); + createStairsRecipe(recipeOutput, ModBlocks.TURF, ModBlocks.TURF_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.TURF_SLAB, ModBlocks.TURF); + createVerticalSlabsRecipe(recipeOutput, ModBlocks.TURF, ModBlocks.TURF_VERTICAL_SLAB); + createSlabsFromVerticalRecipe(recipeOutput, ModBlocks.TURF_VERTICAL_SLAB, ModBlocks.TURF_SLAB); - createStairsRecipe(exporter, ModBlocks.MIRE, ModBlocks.MIRE_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.MIRE_SLAB, ModBlocks.MIRE); + createStairsRecipe(recipeOutput, ModBlocks.MIRE, ModBlocks.MIRE_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.MIRE_SLAB, ModBlocks.MIRE); - createStairsRecipe(exporter, ModBlocks.CHALKSOIL, ModBlocks.CHALKSOIL_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.CHALKSOIL_SLAB, ModBlocks.CHALKSOIL); - createStairsRecipe(exporter, ModBlocks.GRASSY_CHALKSOIL, ModBlocks.GRASSY_CHALKSOIL_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_CHALKSOIL_SLAB, ModBlocks.GRASSY_CHALKSOIL); - createStairsRecipe(exporter, ModBlocks.COARSE_CHALKSOIL, ModBlocks.COARSE_CHALKSOIL_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.COARSE_CHALKSOIL_SLAB, ModBlocks.COARSE_CHALKSOIL); + createStairsRecipe(recipeOutput, ModBlocks.CHALKSOIL, ModBlocks.CHALKSOIL_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.CHALKSOIL_SLAB, ModBlocks.CHALKSOIL); + createStairsRecipe(recipeOutput, ModBlocks.GRASSY_CHALKSOIL, ModBlocks.GRASSY_CHALKSOIL_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_CHALKSOIL_SLAB, ModBlocks.GRASSY_CHALKSOIL); + createStairsRecipe(recipeOutput, ModBlocks.COARSE_CHALKSOIL, ModBlocks.COARSE_CHALKSOIL_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.COARSE_CHALKSOIL_SLAB, ModBlocks.COARSE_CHALKSOIL); - createStairsRecipe(exporter, ModBlocks.LOAM, ModBlocks.LOAM_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.LOAM_SLAB, ModBlocks.LOAM); - createStairsRecipe(exporter, ModBlocks.GRASSY_LOAM, ModBlocks.GRASSY_LOAM_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_LOAM_SLAB, ModBlocks.GRASSY_LOAM); - createStairsRecipe(exporter, ModBlocks.COARSE_LOAM, ModBlocks.COARSE_LOAM_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.COARSE_LOAM_SLAB, ModBlocks.COARSE_LOAM); + createStairsRecipe(recipeOutput, ModBlocks.LOAM, ModBlocks.LOAM_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.LOAM_SLAB, ModBlocks.LOAM); + createStairsRecipe(recipeOutput, ModBlocks.GRASSY_LOAM, ModBlocks.GRASSY_LOAM_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_LOAM_SLAB, ModBlocks.GRASSY_LOAM); + createStairsRecipe(recipeOutput, ModBlocks.COARSE_LOAM, ModBlocks.COARSE_LOAM_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.COARSE_LOAM_SLAB, ModBlocks.COARSE_LOAM); - createStairsRecipe(exporter, ModBlocks.PEAT, ModBlocks.PEAT_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.PEAT_SLAB, ModBlocks.PEAT); - createStairsRecipe(exporter, ModBlocks.GRASSY_PEAT, ModBlocks.GRASSY_PEAT_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_PEAT_SLAB, ModBlocks.GRASSY_PEAT); - createStairsRecipe(exporter, ModBlocks.COARSE_PEAT, ModBlocks.COARSE_PEAT_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.COARSE_PEAT_SLAB, ModBlocks.COARSE_PEAT); + createStairsRecipe(recipeOutput, ModBlocks.PEAT, ModBlocks.PEAT_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.PEAT_SLAB, ModBlocks.PEAT); + createStairsRecipe(recipeOutput, ModBlocks.GRASSY_PEAT, ModBlocks.GRASSY_PEAT_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_PEAT_SLAB, ModBlocks.GRASSY_PEAT); + createStairsRecipe(recipeOutput, ModBlocks.COARSE_PEAT, ModBlocks.COARSE_PEAT_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.COARSE_PEAT_SLAB, ModBlocks.COARSE_PEAT); - createStairsRecipe(exporter, ModBlocks.SILT, ModBlocks.SILT_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.SILT_SLAB, ModBlocks.SILT); - createStairsRecipe(exporter, ModBlocks.GRASSY_SILT, ModBlocks.GRASSY_SILT_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_SILT_SLAB, ModBlocks.GRASSY_SILT); - createStairsRecipe(exporter, ModBlocks.COARSE_SILT, ModBlocks.COARSE_SILT_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.COARSE_SILT_SLAB, ModBlocks.COARSE_SILT); + createStairsRecipe(recipeOutput, ModBlocks.SILT, ModBlocks.SILT_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.SILT_SLAB, ModBlocks.SILT); + createStairsRecipe(recipeOutput, ModBlocks.GRASSY_SILT, ModBlocks.GRASSY_SILT_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_SILT_SLAB, ModBlocks.GRASSY_SILT); + createStairsRecipe(recipeOutput, ModBlocks.COARSE_SILT, ModBlocks.COARSE_SILT_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.COARSE_SILT_SLAB, ModBlocks.COARSE_SILT); - createStairsRecipe(exporter, ModBlocks.DRY_DIRT, ModBlocks.DRY_DIRT_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.DRY_DIRT_SLAB, ModBlocks.DRY_DIRT); + createStairsRecipe(recipeOutput, ModBlocks.DRY_DIRT, ModBlocks.DRY_DIRT_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.DRY_DIRT_SLAB, ModBlocks.DRY_DIRT); - createStairsRecipe(exporter, ModBlocks.FOUL_DIRT, ModBlocks.FOUL_DIRT_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.FOUL_DIRT_SLAB, ModBlocks.FOUL_DIRT); + createStairsRecipe(recipeOutput, ModBlocks.FOUL_DIRT, ModBlocks.FOUL_DIRT_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.FOUL_DIRT_SLAB, ModBlocks.FOUL_DIRT); - createStairsRecipe(exporter, ModBlocks.DIRTY_ROOTS, ModBlocks.DIRTY_ROOTS_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.DIRTY_ROOTS_SLAB, ModBlocks.DIRTY_ROOTS); + createStairsRecipe(recipeOutput, ModBlocks.DIRTY_ROOTS, ModBlocks.DIRTY_ROOTS_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.DIRTY_ROOTS_SLAB, ModBlocks.DIRTY_ROOTS); - createStairsRecipe(exporter, ModBlocks.ASHEN_DIRT, ModBlocks.ASHEN_DIRT_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.ASHEN_DIRT_SLAB, ModBlocks.ASHEN_DIRT); + createStairsRecipe(recipeOutput, ModBlocks.ASHEN_DIRT, ModBlocks.ASHEN_DIRT_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.ASHEN_DIRT_SLAB, ModBlocks.ASHEN_DIRT); - createStairsRecipe(exporter, ModBlocks.COBBLY_ASHEN_DIRT, ModBlocks.COBBLY_ASHEN_DIRT_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.COBBLY_ASHEN_DIRT_SLAB, ModBlocks.COBBLY_ASHEN_DIRT); + createStairsRecipe(recipeOutput, ModBlocks.COBBLY_ASHEN_DIRT, ModBlocks.COBBLY_ASHEN_DIRT_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.COBBLY_ASHEN_DIRT_SLAB, ModBlocks.COBBLY_ASHEN_DIRT); - createStairsRecipe(exporter, ModBlocks.COBBLY_DIRT, ModBlocks.COBBLY_DIRT_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.COBBLY_DIRT_SLAB, ModBlocks.COBBLY_DIRT); + createStairsRecipe(recipeOutput, ModBlocks.COBBLY_DIRT, ModBlocks.COBBLY_DIRT_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.COBBLY_DIRT_SLAB, ModBlocks.COBBLY_DIRT); - createStairsRecipe(exporter, ModBlocks.SNOWY_DIRT, ModBlocks.SNOWY_DIRT_STAIRS); - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, ModBlocks.SNOWY_DIRT_SLAB, ModBlocks.SNOWY_DIRT); + createStairsRecipe(recipeOutput, ModBlocks.SNOWY_DIRT, ModBlocks.SNOWY_DIRT_STAIRS); + slab(RecipeCategory.BUILDING_BLOCKS, ModBlocks.SNOWY_DIRT_SLAB, ModBlocks.SNOWY_DIRT); - createPaneRecipe(exporter, Blocks.WHITE_WOOL.asItem(), ModBlocks.NET, 16); + createPaneRecipe(recipeOutput, Blocks.WHITE_WOOL.asItem(), ModBlocks.NET, 16); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.COPPER_BARS, 16) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.COPPER_BARS, 16) .pattern("IBI") .pattern("IBI") - .input('I', Items.COPPER_INGOT) - .input('B', Items.CUT_COPPER) - .criterion(hasItem(Items.CUT_COPPER), - conditionsFromItem(Items.CUT_COPPER)) - .offerTo(exporter); + .define('I', Items.COPPER_INGOT) + .define('B', Items.CUT_COPPER) + .unlockedBy(getHasName(Items.CUT_COPPER), + has(Items.CUT_COPPER)) + .save(recipeOutput); - createBrickRecipe(exporter, ResourceItemsME.CITRINE_SHARD, ModBlocks.CITRINE_BLOCK, 1); - createFilledRecipe(exporter, Items.GLOWSTONE, ModBlocks.GLOWSTONE_BLOCK, 1); - createBrickRecipe(exporter, ResourceItemsME.QUARTZ_SHARD, ModBlocks.QUARTZ_BLOCK, 1); - createBrickRecipe(exporter, ResourceItemsME.RED_AGATE_SHARD, ModBlocks.RED_AGATE_BLOCK, 1); + createBrickRecipe(recipeOutput, ResourceItemsME.CITRINE_SHARD, ModBlocks.CITRINE_BLOCK, 1); + createFilledRecipe(recipeOutput, Items.GLOWSTONE, ModBlocks.GLOWSTONE_BLOCK, 1); + createBrickRecipe(recipeOutput, ResourceItemsME.QUARTZ_SHARD, ModBlocks.QUARTZ_BLOCK, 1); + createBrickRecipe(recipeOutput, ResourceItemsME.RED_AGATE_SHARD, ModBlocks.RED_AGATE_BLOCK, 1); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, Blocks.BRICKS, GenericBlockSets.OLD_BRICKS.blockSet.base()); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, Blocks.BRICKS, GenericBlockSets.OLD_BRICKS.blockSet.base()); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.WHITE_DAUB_HOBBIT_WINDOW, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.WHITE_DAUB_HOBBIT_WINDOW, 4) .pattern("WBW") .pattern("BGB") .pattern("WBW") - .input('W', GenericBlockSets.WHITE_DAUB.blockSet.base()) - .input('G', Items.GLASS) - .input('B', Items.BRICK) - .criterion(hasItem(GenericBlockSets.WHITE_DAUB.blockSet.base()), - conditionsFromItem(GenericBlockSets.WHITE_DAUB.blockSet.base())) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.YELLOW_DAUB_HOBBIT_WINDOW, 4) + .define('W', GenericBlockSets.WHITE_DAUB.blockSet.base()) + .define('G', Items.GLASS) + .define('B', Items.BRICK) + .unlockedBy(getHasName(GenericBlockSets.WHITE_DAUB.blockSet.base()), + has(GenericBlockSets.WHITE_DAUB.blockSet.base())) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.YELLOW_DAUB_HOBBIT_WINDOW, 4) .pattern("WBW") .pattern("BGB") .pattern("WBW") - .input('W', GenericBlockSets.YELLOW_DAUB.blockSet.base()) - .input('G', Items.GLASS) - .input('B', Items.BRICK) - .criterion(hasItem(GenericBlockSets.YELLOW_DAUB.blockSet.base()), - conditionsFromItem(GenericBlockSets.YELLOW_DAUB.blockSet.base())) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.PLASTER_HOBBIT_WINDOW, 4) + .define('W', GenericBlockSets.YELLOW_DAUB.blockSet.base()) + .define('G', Items.GLASS) + .define('B', Items.BRICK) + .unlockedBy(getHasName(GenericBlockSets.YELLOW_DAUB.blockSet.base()), + has(GenericBlockSets.YELLOW_DAUB.blockSet.base())) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.PLASTER_HOBBIT_WINDOW, 4) .pattern("WBW") .pattern("BGB") .pattern("WBW") - .input('W', GenericBlockSets.PLASTER.blockSet.base()) - .input('G', Items.GLASS) - .input('B', Items.BRICK) - .criterion(hasItem(GenericBlockSets.PLASTER.blockSet.base()), - conditionsFromItem(GenericBlockSets.PLASTER.blockSet.base())) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SIMPLE_OAK_WINDOW, 8) + .define('W', GenericBlockSets.PLASTER.blockSet.base()) + .define('G', Items.GLASS) + .define('B', Items.BRICK) + .unlockedBy(getHasName(GenericBlockSets.PLASTER.blockSet.base()), + has(GenericBlockSets.PLASTER.blockSet.base())) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SIMPLE_OAK_WINDOW, 8) .pattern("EEE") .pattern("EGE") .pattern("EEE") - .input('E', Blocks.OAK_LOG) - .input('G', ResourceItemsME.LEAD_NUGGET) - .criterion(hasItem(Blocks.OAK_LOG), - conditionsFromItem(Blocks.OAK_LOG)) - .offerTo(exporter); + .define('E', Blocks.OAK_LOG) + .define('G', ResourceItemsME.LEAD_NUGGET) + .unlockedBy(getHasName(Blocks.OAK_LOG), + has(Blocks.OAK_LOG)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.DRYSTONE_SET.carvedWindows.block(), 2) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.DRYSTONE_SET.carvedWindows.block(), 2) .pattern("EEE") .pattern("EGE") .pattern("EEE") - .input('E', StoneBlockSets.DRYSTONE_SET.cobblestoneBlocks.base()) - .input('G', Items.GLASS) - .criterion(hasItem(StoneBlockSets.DRYSTONE_SET.cobblestoneBlocks.base()), - conditionsFromItem(StoneBlockSets.DRYSTONE_SET.cobblestoneBlocks.base())) - .offerTo(exporter); - createPaneRecipe(exporter, StoneBlockSets.DRYSTONE_SET.carvedWindows.block().asItem(), StoneBlockSets.DRYSTONE_SET.carvedWindows.verticalSlab(), 12); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.LEAD_GLASS, 4) + .define('E', StoneBlockSets.DRYSTONE_SET.cobblestoneBlocks.base()) + .define('G', Items.GLASS) + .unlockedBy(getHasName(StoneBlockSets.DRYSTONE_SET.cobblestoneBlocks.base()), + has(StoneBlockSets.DRYSTONE_SET.cobblestoneBlocks.base())) + .save(recipeOutput); + createPaneRecipe(recipeOutput, StoneBlockSets.DRYSTONE_SET.carvedWindows.block().asItem(), StoneBlockSets.DRYSTONE_SET.carvedWindows.verticalSlab(), 12); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.LEAD_GLASS, 4) .pattern("LGL") .pattern("GLG") .pattern("LGL") - .input('L', ResourceItemsME.LEAD_NUGGET) - .input('G', Items.GLASS) - .criterion(hasItem(ResourceItemsME.ROD), - conditionsFromItem(ResourceItemsME.ROD)) - .offerTo(exporter); + .define('L', ResourceItemsME.LEAD_NUGGET) + .define('G', Items.GLASS) + .unlockedBy(getHasName(ResourceItemsME.ROD), + has(ResourceItemsME.ROD)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.ROPE, 3) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.ROPE, 3) .pattern("SS") .pattern("SS") .pattern("SS") - .input('S', Items.STRING) - .criterion(hasItem(Items.STRING), - conditionsFromItem(Items.STRING)) - .offerTo(exporter); + .define('S', Items.STRING) + .unlockedBy(getHasName(Items.STRING), + has(Items.STRING)) + .save(recipeOutput); - createBrickRecipe(exporter, ResourceItemsME.ASH, ModBlocks.ASH_BLOCK, 1); - createBrickRecipe(exporter, ModBlocks.ASH_BLOCK.asItem(), Blocks.TUFF, 1); + createBrickRecipe(recipeOutput, ResourceItemsME.ASH, ModBlocks.ASH_BLOCK, 1); + createBrickRecipe(recipeOutput, ModBlocks.ASH_BLOCK.asItem(), Blocks.TUFF, 1); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.ASHENSTONE_SET.baseBlocks.base(), 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.ASHENSTONE_SET.baseBlocks.base(), 4) .pattern("AS") .pattern("SA") - .input('A', ModBlocks.ASH_BLOCK) - .input('S', Blocks.STONE) - .criterion(hasItem(ModBlocks.ASH_BLOCK), - conditionsFromItem(ModBlocks.ASH_BLOCK)) - .offerTo(exporter); + .define('A', ModBlocks.ASH_BLOCK) + .define('S', Blocks.STONE) + .unlockedBy(getHasName(ModBlocks.ASH_BLOCK), + has(ModBlocks.ASH_BLOCK)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.GILDED_GREEN_TUFF_SET.baseBlocks.base(), 5) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.GILDED_GREEN_TUFF_SET.baseBlocks.base(), 5) .pattern("TNT") .pattern("NTN") .pattern("TNT") - .input('T', StoneBlockSets.GREEN_TUFF_SET.baseBlocks.base()) - .input('N', Items.GOLD_NUGGET) - .criterion(hasItem(StoneBlockSets.GREEN_TUFF_SET.baseBlocks.base()), - conditionsFromItem(StoneBlockSets.GREEN_TUFF_SET.baseBlocks.base())) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.GILDED_GREEN_TUFF_SET.chiseledBricksBlocks.base(), 5) + .define('T', StoneBlockSets.GREEN_TUFF_SET.baseBlocks.base()) + .define('N', Items.GOLD_NUGGET) + .unlockedBy(getHasName(StoneBlockSets.GREEN_TUFF_SET.baseBlocks.base()), + has(StoneBlockSets.GREEN_TUFF_SET.baseBlocks.base())) + .save(recipeOutput); + + createGildedStoneRecipe( + StoneBlockSets.GREEN_TUFF_SET.chiseledBricksBlocks.base(), + StoneBlockSets.GILDED_GREEN_TUFF_SET.chiseledBricksBlocks.base()); + createGildedStoneRecipe( + StoneBlockSets.GREEN_TUFF_SET.chiseledTilesBlocks.base(), + StoneBlockSets.GILDED_GREEN_TUFF_SET.chiseledTilesBlocks.base()); + createGildedStoneRecipe( + StoneBlockSets.GREEN_TUFF_SET.chiseledSmoothBlocks.base(), + StoneBlockSets.GILDED_GREEN_TUFF_SET.chiseledSmoothBlocks.base()); + createGildedStoneRecipe( + StoneBlockSets.GREEN_TUFF_SET.chiseledPolishedBlocks.base(), + StoneBlockSets.GILDED_GREEN_TUFF_SET.chiseledPolishedBlocks.base()); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.BURZUM_GABBRO_SET.chiseledBlocks.base(), 5) .pattern("TNT") .pattern("NTN") .pattern("TNT") - .input('T', StoneBlockSets.GREEN_TUFF_SET.chiseledBricksBlocks.base()) - .input('N', Items.GOLD_NUGGET) - .criterion(hasItem(StoneBlockSets.GREEN_TUFF_SET.chiseledBricksBlocks.base()), - conditionsFromItem(StoneBlockSets.GREEN_TUFF_SET.chiseledBricksBlocks.base())) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.GILDED_GREEN_TUFF_SET.chiseledTilesBlocks.base(), 5) - .pattern("TNT") - .pattern("NTN") - .pattern("TNT") - .input('T', StoneBlockSets.GREEN_TUFF_SET.chiseledTilesBlocks.base()) - .input('N', Items.GOLD_NUGGET) - .criterion(hasItem(StoneBlockSets.GREEN_TUFF_SET.chiseledTilesBlocks.base()), - conditionsFromItem(StoneBlockSets.GREEN_TUFF_SET.chiseledTilesBlocks.base())) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.GILDED_GREEN_TUFF_SET.chiseledSmoothBlocks.base(), 5) - .pattern("TNT") - .pattern("NTN") - .pattern("TNT") - .input('T', StoneBlockSets.GREEN_TUFF_SET.chiseledSmoothBlocks.base()) - .input('N', Items.GOLD_NUGGET) - .criterion(hasItem(StoneBlockSets.GREEN_TUFF_SET.chiseledSmoothBlocks.base()), - conditionsFromItem(StoneBlockSets.GREEN_TUFF_SET.chiseledSmoothBlocks.base())) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.GILDED_GREEN_TUFF_SET.chiseledPolishedBlocks.base(), 5) - .pattern("TNT") - .pattern("NTN") - .pattern("TNT") - .input('T', StoneBlockSets.GREEN_TUFF_SET.chiseledPolishedBlocks.base()) - .input('N', Items.GOLD_NUGGET) - .criterion(hasItem(StoneBlockSets.GREEN_TUFF_SET.chiseledPolishedBlocks.base()), - conditionsFromItem(StoneBlockSets.GREEN_TUFF_SET.chiseledPolishedBlocks.base())) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.BURZUM_GABBRO_SET.chiseledBlocks.base(), 5) - .pattern("TNT") - .pattern("NTN") - .pattern("TNT") - .input('T', StoneBlockSets.GABBRO_SET.baseBlocks.base()) - .input('N', ResourceItemsME.BURZUM_STEEL_NUGGET) - .criterion(hasItem(StoneBlockSets.GABBRO_SET.baseBlocks.base()), - conditionsFromItem(StoneBlockSets.GABBRO_SET.baseBlocks.base())) - .offerTo(exporter); - //createStoneSetRecipes(StoneBlockSets.BURZUM_GABBRO_SET.chiseledBlocks); + .define('T', StoneBlockSets.GABBRO_SET.baseBlocks.base()) + .define('N', ResourceItemsME.BURZUM_STEEL_NUGGET) + .unlockedBy(getHasName(StoneBlockSets.GABBRO_SET.baseBlocks.base()), + has(StoneBlockSets.GABBRO_SET.baseBlocks.base())) + .save(recipeOutput); - createBrickRecipe(exporter, StoneBlockSets.BURZUM_GABBRO_SET.chiseledBlocks.base().asItem(), StoneBlockSets.BURZUM_GABBRO_SET.chiseledBricksBlocks.base(), 4); - //createStoneSetRecipes(StoneBlockSets.BURZUM_GABBRO_SET.chiseledBricksBlocks); + createBrickRecipe(recipeOutput, StoneBlockSets.BURZUM_GABBRO_SET.chiseledBlocks.base().asItem(), StoneBlockSets.BURZUM_GABBRO_SET.chiseledBricksBlocks.base(), 4); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.BURZUM_GABBRO_SET.chiseledSmoothBlocks.base(), 5) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.BURZUM_GABBRO_SET.chiseledSmoothBlocks.base(), 5) .pattern("TNT") .pattern("NTN") .pattern("TNT") - .input('T', StoneBlockSets.GABBRO_SET.smoothBlocks.base()) - .input('N', ResourceItemsME.BURZUM_STEEL_NUGGET) - .criterion(hasItem(StoneBlockSets.GABBRO_SET.smoothBlocks.base()), - conditionsFromItem(StoneBlockSets.GABBRO_SET.smoothBlocks.base())) - .offerTo(exporter); - //createStoneSetRecipes(StoneBlockSets.BURZUM_GABBRO_SET.chiseledSmoothBlocks); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.BURZUM_GABBRO_SET.chiseledPolishedBlocks.base(), 5) + .define('T', StoneBlockSets.GABBRO_SET.smoothBlocks.base()) + .define('N', ResourceItemsME.BURZUM_STEEL_NUGGET) + .unlockedBy(getHasName(StoneBlockSets.GABBRO_SET.smoothBlocks.base()), + has(StoneBlockSets.GABBRO_SET.smoothBlocks.base())) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.BURZUM_GABBRO_SET.chiseledPolishedBlocks.base(), 5) .pattern("TNT") .pattern("NTN") .pattern("TNT") - .input('T', StoneBlockSets.GABBRO_SET.polishedBlocks.base()) - .input('N', ResourceItemsME.BURZUM_STEEL_NUGGET) - .criterion(hasItem(StoneBlockSets.GABBRO_SET.polishedBlocks.base()), - conditionsFromItem(StoneBlockSets.GABBRO_SET.polishedBlocks.base())) - .offerTo(exporter); - //createStoneSetRecipes(StoneBlockSets.BURZUM_GABBRO_SET.chiseledPolishedBlocks); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.BURZUM_GABBRO_SET.chiseledTilesBlocks.base(), 5) + .define('T', StoneBlockSets.GABBRO_SET.polishedBlocks.base()) + .define('N', ResourceItemsME.BURZUM_STEEL_NUGGET) + .unlockedBy(getHasName(StoneBlockSets.GABBRO_SET.polishedBlocks.base()), + has(StoneBlockSets.GABBRO_SET.polishedBlocks.base())) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.BURZUM_GABBRO_SET.chiseledTilesBlocks.base(), 5) .pattern("TNT") .pattern("NTN") .pattern("TNT") - .input('T', StoneBlockSets.GABBRO_SET.tileBlocks.base()) - .input('N', ResourceItemsME.BURZUM_STEEL_NUGGET) - .criterion(hasItem(StoneBlockSets.GABBRO_SET.tileBlocks.base()), - conditionsFromItem(StoneBlockSets.GABBRO_SET.tileBlocks.base())) - .offerTo(exporter); - //createStoneSetRecipes(StoneBlockSets.BURZUM_GABBRO_SET.chiseledTilesBlocks); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.WATTLE_TRAPDOOR, 2) + .define('T', StoneBlockSets.GABBRO_SET.tileBlocks.base()) + .define('N', ResourceItemsME.BURZUM_STEEL_NUGGET) + .unlockedBy(getHasName(StoneBlockSets.GABBRO_SET.tileBlocks.base()), + has(StoneBlockSets.GABBRO_SET.tileBlocks.base())) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.WATTLE_TRAPDOOR, 2) .pattern("PLP") .pattern("PLP") - .input('P', TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input('L', ResourceItemsME.LEAD_NUGGET) - .criterion(hasItem(ResourceItemsME.LEAD_NUGGET), - conditionsFromItem(ResourceItemsME.LEAD_NUGGET)) - .offerTo(exporter); + .define('P', TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .define('L', ResourceItemsME.LEAD_NUGGET) + .unlockedBy(getHasName(ResourceItemsME.LEAD_NUGGET), + has(ResourceItemsME.LEAD_NUGGET)) + .save(recipeOutput); - createDyeableItemRecipe(exporter, ModBlocks.WATTLE_TRAPDOOR, Items.RED_DYE, ModBlocks.RED_WATTLE_TRAPDOOR); - createDyeableItemRecipe(exporter, ModBlocks.WATTLE_TRAPDOOR, Items.GREEN_DYE, ModBlocks.GREEN_WATTLE_TRAPDOOR); - createDyeableItemRecipe(exporter, ModBlocks.WATTLE_TRAPDOOR, Items.BROWN_DYE, ModBlocks.DARK_WATTLE_TRAPDOOR); - createDyeableItemRecipe(exporter, ModBlocks.WATTLE_TRAPDOOR, Items.BLACK_DYE, ModBlocks.BLACK_WATTLE_TRAPDOOR); + createDyeableItemRecipe(recipeOutput, ModBlocks.WATTLE_TRAPDOOR, Items.RED_DYE, ModBlocks.RED_WATTLE_TRAPDOOR); + createDyeableItemRecipe(recipeOutput, ModBlocks.WATTLE_TRAPDOOR, Items.GREEN_DYE, ModBlocks.GREEN_WATTLE_TRAPDOOR); + createDyeableItemRecipe(recipeOutput, ModBlocks.WATTLE_TRAPDOOR, Items.BROWN_DYE, ModBlocks.DARK_WATTLE_TRAPDOOR); + createDyeableItemRecipe(recipeOutput, ModBlocks.WATTLE_TRAPDOOR, Items.BLACK_DYE, ModBlocks.BLACK_WATTLE_TRAPDOOR); //createBrickworkBlockRecipe(exporter, StoneBlockSets.STONE_SET.tileBlocks.base(), GenericBlockSets.STUCCO.blockSet.base(), StoneBlockSets.STONE_SET.brickworkBlocks.base()); //createBrickworkBlockRecipe(exporter, StoneBlockSets.CALCITE_SET.tileBlocks.base(), GenericBlockSets.STUCCO.blockSet.base(), StoneBlockSets.CALCITE_SET.brickworkBlocks.base()); @@ -772,30 +877,34 @@ public void generate() { //createBrickworkBlockRecipe(exporter, StoneBlockSets.DIORITE_SET.tileBlocks.base(), GenericBlockSets.STUCCO.blockSet.base(), StoneBlockSets.DIORITE_SET.brickworkBlocks.base()); //createBrickworkBlockRecipe(exporter, StoneBlockSets.GRANITE_SET.tileBlocks.base(), GenericBlockSets.STUCCO.blockSet.base(), StoneBlockSets.GRANITE_SET.brickworkBlocks.base()); - createBrickRecipe(exporter, StoneBlockSets.QUARTZITE_SET.brickBlocks.base().asItem(), StoneBlockSets.QUARTZITE_SET.tileBlocks.base(), 4); - createBrickRecipe(exporter, GenericBlockSets.PACKED_MIRE.blockSet.base().asItem(), GenericBlockSets.MIRE_BRICKS.blockSet.base(), 4); - - createMossyRecipe(exporter, GenericBlockSets.MIXED_STONES.blockSet.base(), GenericBlockSets.MOSSY_MIXED_STONES.blockSet.base()); - offerSmelting(List.of(GenericBlockSets.MIXED_STONES.blockSet.base()), RecipeCategory.BUILDING_BLOCKS, - GenericBlockSets.CRACKED_MIXED_STONES.blockSet.base(), 0.1f, 200, "cracked_bricks"); - - createBrickRecipe(exporter, Blocks.BRICKS.asItem(), GenericBlockSets.CLAY_TILING.blockSet.base(), 4); - createCenterSurroundRecipe(exporter, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.BLACK_CLAY_TILING.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.BLUE_DYE, GenericBlockSets.BLUE_CLAY_TILING.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.BROWN_DYE, GenericBlockSets.BROWN_CLAY_TILING.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.CYAN_DYE, GenericBlockSets.CYAN_CLAY_TILING.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.GRAY_CLAY_TILING.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.GREEN_DYE, GenericBlockSets.GREEN_CLAY_TILING.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.LIGHT_BLUE_DYE, GenericBlockSets.LIGHT_BLUE_CLAY_TILING.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.LIGHT_GRAY_DYE, GenericBlockSets.LIGHT_GRAY_CLAY_TILING.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.LIME_DYE, GenericBlockSets.LIME_CLAY_TILING.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.MAGENTA_DYE, GenericBlockSets.MAGENTA_CLAY_TILING.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.ORANGE_DYE, GenericBlockSets.ORANGE_CLAY_TILING.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.PINK_DYE, GenericBlockSets.PINK_CLAY_TILING.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.PURPLE_DYE, GenericBlockSets.PURPLE_CLAY_TILING.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.RED_DYE, GenericBlockSets.RED_CLAY_TILING.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.WHITE_DYE, GenericBlockSets.WHITE_CLAY_TILING.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.YELLOW_DYE, GenericBlockSets.YELLOW_CLAY_TILING.blockSet.base().asItem(), 8); + createBrickRecipe(recipeOutput, StoneBlockSets.QUARTZITE_SET.brickBlocks.base().asItem(), + StoneBlockSets.QUARTZITE_SET.tileBlocks.base(), 4); + createBrickRecipe(recipeOutput, GenericBlockSets.PACKED_MIRE.blockSet.base().asItem(), + GenericBlockSets.MIRE_BRICKS.blockSet.base(), 4); + createMossyRecipe(recipeOutput, GenericBlockSets.MIXED_STONES.blockSet.base(), + GenericBlockSets.MOSSY_MIXED_STONES.blockSet.base()); + oreSmelting(List.of(GenericBlockSets.MIXED_STONES.blockSet.base()), + RecipeCategory.BUILDING_BLOCKS, + GenericBlockSets.CRACKED_MIXED_STONES.blockSet.base(), + 0.1F, 200, "cracked_bricks"); + + createBrickRecipe(recipeOutput, Blocks.BRICKS.asItem(), GenericBlockSets.CLAY_TILING.blockSet.base(), 4); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.BLACK_CLAY_TILING.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.BLUE_DYE, GenericBlockSets.BLUE_CLAY_TILING.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.BROWN_DYE, GenericBlockSets.BROWN_CLAY_TILING.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.CYAN_DYE, GenericBlockSets.CYAN_CLAY_TILING.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.GRAY_CLAY_TILING.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.GREEN_DYE, GenericBlockSets.GREEN_CLAY_TILING.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.LIGHT_BLUE_DYE, GenericBlockSets.LIGHT_BLUE_CLAY_TILING.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.LIGHT_GRAY_DYE, GenericBlockSets.LIGHT_GRAY_CLAY_TILING.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.LIME_DYE, GenericBlockSets.LIME_CLAY_TILING.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.MAGENTA_DYE, GenericBlockSets.MAGENTA_CLAY_TILING.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.ORANGE_DYE, GenericBlockSets.ORANGE_CLAY_TILING.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.PINK_DYE, GenericBlockSets.PINK_CLAY_TILING.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.PURPLE_DYE, GenericBlockSets.PURPLE_CLAY_TILING.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.RED_DYE, GenericBlockSets.RED_CLAY_TILING.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.WHITE_DYE, GenericBlockSets.WHITE_CLAY_TILING.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CLAY_TILING.blockSet.base().asItem(), Items.YELLOW_DYE, GenericBlockSets.YELLOW_CLAY_TILING.blockSet.base().asItem(), 8); //createBrickworkBlockRecipe(exporter, StoneBlockSets.DOLOMITE_SET.tileBlocks.base(), GenericBlockSets.STUCCO.blockSet.base(), StoneBlockSets.DOLOMITE_SET.brickworkBlocks.base()); //createBrickworkBlockRecipe(exporter, StoneBlockSets.HEMATITE_SET.tileBlocks.base(), GenericBlockSets.STUCCO.blockSet.base(), StoneBlockSets.HEMATITE_SET.brickworkBlocks.base()); @@ -806,484 +915,485 @@ public void generate() { //createBrickworkBlockRecipe(exporter, StoneBlockSets.GABBRO_SET.brickBlocks.base(), GenericBlockSets.STUCCO.blockSet.base(), StoneBlockSets.GABBRO_SET.brickworkBlocks.base()); //createBrickworkBlockRecipe(exporter, StoneBlockSets.TUFF_SET.tileBlocks.base(), GenericBlockSets.STUCCO.blockSet.base(), StoneBlockSets.TUFF_SET.brickworkBlocks.base()); //createBrickworkBlockRecipe(exporter, StoneBlockSets.BLACKSTONE_SET.tileBlocks.base(), GenericBlockSets.STUCCO.blockSet.base(), StoneBlockSets.BLACKSTONE_SET.brickworkBlocks.base()); - createBrickworkBlockRecipe(exporter, StoneBlockSets.TAN_CLAY.brickBlocks.base(), GenericBlockSets.PLASTER.blockSet.base(), StoneBlockSets.TAN_CLAY.brickworkBlocks.base()); - createBrickworkBlockRecipe(exporter, GenericBlockSets.MIXED_STONES.blockSet.base(), GenericBlockSets.STUCCO.blockSet.base(), GenericBlockSets.MIXED_STONES_BRICKWORK.blockSet.base()); + createBrickworkBlockRecipe(recipeOutput, StoneBlockSets.TAN_CLAY.brickBlocks.base(), GenericBlockSets.PLASTER.blockSet.base(), StoneBlockSets.TAN_CLAY.brickworkBlocks.base()); + createBrickworkBlockRecipe(recipeOutput, GenericBlockSets.MIXED_STONES.blockSet.base(), GenericBlockSets.STUCCO.blockSet.base(), GenericBlockSets.MIXED_STONES_BRICKWORK.blockSet.base()); //createBrickworkBlockRecipe(exporter, StoneBlockSets.MEDGON_SET.baseBlocks.base(), GenericBlockSets.STUCCO.blockSet.base(), StoneBlockSets.MEDGON_SET.brickworkBlocks.base()); - createCenterSurroundRecipe(exporter, Items.BRICK, Items.BLUE_DYE, GenericBlockSets.BLUE_ROOF_TILES.blockSet.base().asItem(), 2); - createCenterSurroundRecipe(exporter, GenericBlockSets.BLUE_ROOF_TILES.blockSet.base().asItem(), Items.WHITE_DYE, GenericBlockSets.LIGHT_BLUE_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.BLUE_ROOF_TILES.blockSet.base().asItem(), Items.LIGHT_GRAY_DYE, GenericBlockSets.BRIGHT_BLUE_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.BLUE_ROOF_TILES.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.OFF_BLUE_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.BLUE_ROOF_TILES.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.DARK_BLUE_ROOF_TILES.blockSet.base().asItem(), 8); - - createCenterSurroundRecipe(exporter, Items.BRICK, Items.BROWN_DYE, GenericBlockSets.BROWN_ROOF_TILES.blockSet.base().asItem(), 2); - createCenterSurroundRecipe(exporter, GenericBlockSets.BROWN_ROOF_TILES.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.OFF_BROWN_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.BROWN_ROOF_TILES.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.DARK_BROWN_ROOF_TILES.blockSet.base().asItem(), 8); - - createCenterSurroundRecipe(exporter, Items.BRICK, Items.CYAN_DYE, GenericBlockSets.CYAN_ROOF_TILES.blockSet.base().asItem(), 2); - createCenterSurroundRecipe(exporter, GenericBlockSets.CYAN_ROOF_TILES.blockSet.base().asItem(), Items.WHITE_DYE, GenericBlockSets.LIGHT_CYAN_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CYAN_ROOF_TILES.blockSet.base().asItem(), Items.LIGHT_GRAY_DYE, GenericBlockSets.BRIGHT_CYAN_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CYAN_ROOF_TILES.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.OFF_CYAN_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CYAN_ROOF_TILES.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.DARK_CYAN_ROOF_TILES.blockSet.base().asItem(), 8); - - createCenterSurroundRecipe(exporter, Items.BRICK, Items.GRAY_DYE, GenericBlockSets.GRAY_ROOF_TILES.blockSet.base().asItem(), 2); - createCenterSurroundRecipe(exporter, GenericBlockSets.GRAY_ROOF_TILES.blockSet.base().asItem(), Items.WHITE_DYE, GenericBlockSets.LIGHT_GRAY_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.GRAY_ROOF_TILES.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.OFF_GRAY_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.GRAY_ROOF_TILES.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.DARK_GRAY_ROOF_TILES.blockSet.base().asItem(), 8); - - createCenterSurroundRecipe(exporter, Items.BRICK, Items.GREEN_DYE, GenericBlockSets.GREEN_ROOF_TILES.blockSet.base().asItem(), 2); - createCenterSurroundRecipe(exporter, GenericBlockSets.GREEN_ROOF_TILES.blockSet.base().asItem(), Items.WHITE_DYE, GenericBlockSets.LIGHT_GREEN_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.GREEN_ROOF_TILES.blockSet.base().asItem(), Items.LIGHT_GRAY_DYE, GenericBlockSets.BRIGHT_GREEN_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.GREEN_ROOF_TILES.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.OFF_GREEN_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.GREEN_ROOF_TILES.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.DARK_GREEN_ROOF_TILES.blockSet.base().asItem(), 8); - - createCenterSurroundRecipe(exporter, Items.BRICK, Items.RED_DYE, GenericBlockSets.RED_ROOF_TILES.blockSet.base().asItem(), 2); - createCenterSurroundRecipe(exporter, GenericBlockSets.RED_ROOF_TILES.blockSet.base().asItem(), Items.WHITE_DYE, GenericBlockSets.LIGHT_RED_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.RED_ROOF_TILES.blockSet.base().asItem(), Items.LIGHT_GRAY_DYE, GenericBlockSets.BRIGHT_RED_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.RED_ROOF_TILES.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.OFF_RED_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.RED_ROOF_TILES.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.DARK_RED_ROOF_TILES.blockSet.base().asItem(), 8); - - createCenterSurroundRecipe(exporter, Items.BRICK, Items.YELLOW_DYE, GenericBlockSets.YELLOW_ROOF_TILES.blockSet.base().asItem(), 2); - createCenterSurroundRecipe(exporter, GenericBlockSets.YELLOW_ROOF_TILES.blockSet.base().asItem(), Items.WHITE_DYE, GenericBlockSets.LIGHT_YELLOW_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.YELLOW_ROOF_TILES.blockSet.base().asItem(), Items.LIGHT_GRAY_DYE, GenericBlockSets.BRIGHT_YELLOW_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.YELLOW_ROOF_TILES.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.OFF_YELLOW_ROOF_TILES.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.YELLOW_ROOF_TILES.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.DARK_YELLOW_ROOF_TILES.blockSet.base().asItem(), 8); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.TAN_CLAY.brickBlocks.base(), 5) + createCenterSurroundRecipe(recipeOutput, Items.BRICK, Items.BLUE_DYE, GenericBlockSets.BLUE_ROOF_TILES.blockSet.base().asItem(), 2); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.BLUE_ROOF_TILES.blockSet.base().asItem(), Items.WHITE_DYE, GenericBlockSets.LIGHT_BLUE_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.BLUE_ROOF_TILES.blockSet.base().asItem(), Items.LIGHT_GRAY_DYE, GenericBlockSets.BRIGHT_BLUE_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.BLUE_ROOF_TILES.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.OFF_BLUE_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.BLUE_ROOF_TILES.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.DARK_BLUE_ROOF_TILES.blockSet.base().asItem(), 8); + + createCenterSurroundRecipe(recipeOutput, Items.BRICK, Items.BROWN_DYE, GenericBlockSets.BROWN_ROOF_TILES.blockSet.base().asItem(), 2); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.BROWN_ROOF_TILES.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.OFF_BROWN_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.BROWN_ROOF_TILES.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.DARK_BROWN_ROOF_TILES.blockSet.base().asItem(), 8); + + createCenterSurroundRecipe(recipeOutput, Items.BRICK, Items.CYAN_DYE, GenericBlockSets.CYAN_ROOF_TILES.blockSet.base().asItem(), 2); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CYAN_ROOF_TILES.blockSet.base().asItem(), Items.WHITE_DYE, GenericBlockSets.LIGHT_CYAN_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CYAN_ROOF_TILES.blockSet.base().asItem(), Items.LIGHT_GRAY_DYE, GenericBlockSets.BRIGHT_CYAN_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CYAN_ROOF_TILES.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.OFF_CYAN_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CYAN_ROOF_TILES.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.DARK_CYAN_ROOF_TILES.blockSet.base().asItem(), 8); + + createCenterSurroundRecipe(recipeOutput, Items.BRICK, Items.GRAY_DYE, GenericBlockSets.GRAY_ROOF_TILES.blockSet.base().asItem(), 2); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.GRAY_ROOF_TILES.blockSet.base().asItem(), Items.WHITE_DYE, GenericBlockSets.LIGHT_GRAY_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.GRAY_ROOF_TILES.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.OFF_GRAY_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.GRAY_ROOF_TILES.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.DARK_GRAY_ROOF_TILES.blockSet.base().asItem(), 8); + + createCenterSurroundRecipe(recipeOutput, Items.BRICK, Items.GREEN_DYE, GenericBlockSets.GREEN_ROOF_TILES.blockSet.base().asItem(), 2); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.GREEN_ROOF_TILES.blockSet.base().asItem(), Items.WHITE_DYE, GenericBlockSets.LIGHT_GREEN_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.GREEN_ROOF_TILES.blockSet.base().asItem(), Items.LIGHT_GRAY_DYE, GenericBlockSets.BRIGHT_GREEN_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.GREEN_ROOF_TILES.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.OFF_GREEN_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.GREEN_ROOF_TILES.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.DARK_GREEN_ROOF_TILES.blockSet.base().asItem(), 8); + + createCenterSurroundRecipe(recipeOutput, Items.BRICK, Items.RED_DYE, GenericBlockSets.RED_ROOF_TILES.blockSet.base().asItem(), 2); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.RED_ROOF_TILES.blockSet.base().asItem(), Items.WHITE_DYE, GenericBlockSets.LIGHT_RED_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.RED_ROOF_TILES.blockSet.base().asItem(), Items.LIGHT_GRAY_DYE, GenericBlockSets.BRIGHT_RED_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.RED_ROOF_TILES.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.OFF_RED_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.RED_ROOF_TILES.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.DARK_RED_ROOF_TILES.blockSet.base().asItem(), 8); + + createCenterSurroundRecipe(recipeOutput, Items.BRICK, Items.YELLOW_DYE, GenericBlockSets.YELLOW_ROOF_TILES.blockSet.base().asItem(), 2); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.YELLOW_ROOF_TILES.blockSet.base().asItem(), Items.WHITE_DYE, GenericBlockSets.LIGHT_YELLOW_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.YELLOW_ROOF_TILES.blockSet.base().asItem(), Items.LIGHT_GRAY_DYE, GenericBlockSets.BRIGHT_YELLOW_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.YELLOW_ROOF_TILES.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.OFF_YELLOW_ROOF_TILES.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.YELLOW_ROOF_TILES.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.DARK_YELLOW_ROOF_TILES.blockSet.base().asItem(), 8); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.TAN_CLAY.brickBlocks.base(), 5) .pattern(" B ") .pattern("BPB") .pattern(" B ") - .input('P', GenericBlockSets.PLASTER.blockSet.base()) - .input('B', Items.BRICKS) - .criterion(hasItem(GenericBlockSets.PLASTER.blockSet.base()), - conditionsFromItem(GenericBlockSets.PLASTER.blockSet.base())) - .offerTo(exporter); + .define('P', GenericBlockSets.PLASTER.blockSet.base()) + .define('B', Items.BRICKS) + .unlockedBy(getHasName(GenericBlockSets.PLASTER.blockSet.base()), + has(GenericBlockSets.PLASTER.blockSet.base())) + .save(recipeOutput); //endregion //region SMITHING - createDaggerRecipeTag(exporter, Items.STICK, TagKey.of(RegistryKeys.ITEM, Identifier.of("planks")), WeaponItemsME.WOODEN_DAGGER); - createDaggerRecipeTag(exporter, Items.STICK, TagKey.of(RegistryKeys.ITEM, Identifier.of("stone_tool_materials")), WeaponItemsME.STONE_DAGGER); - createDaggerRecipe(exporter, Items.STICK, Items.DIAMOND, WeaponItemsME.DIAMOND_DAGGER); + createDaggerRecipeTag(recipeOutput, Items.STICK, TagKey.create(Registries.ITEM, ResourceLocation.parse("planks")), WeaponItemsME.WOODEN_DAGGER); + createDaggerRecipeTag(recipeOutput, Items.STICK, TagKey.create(Registries.ITEM, ResourceLocation.parse("stone_tool_materials")), WeaponItemsME.STONE_DAGGER); + createDaggerRecipe(recipeOutput, Items.STICK, Items.DIAMOND, WeaponItemsME.DIAMOND_DAGGER); - createSpearRecipeTag(exporter, Items.STICK, TagKey.of(RegistryKeys.ITEM, Identifier.of("planks")), WeaponItemsME.WOODEN_SPEAR); - createSpearRecipeTag(exporter, Items.STICK, TagKey.of(RegistryKeys.ITEM, Identifier.of("stone_tool_materials")), WeaponItemsME.STONE_SPEAR); - createSpearRecipe(exporter, Items.STICK, Items.DIAMOND, WeaponItemsME.DIAMOND_SPEAR); + createSpearRecipeTag(recipeOutput, Items.STICK, TagKey.create(Registries.ITEM, ResourceLocation.parse("planks")), WeaponItemsME.WOODEN_SPEAR); + createSpearRecipeTag(recipeOutput, Items.STICK, TagKey.create(Registries.ITEM, ResourceLocation.parse("stone_tool_materials")), WeaponItemsME.STONE_SPEAR); + createSpearRecipe(recipeOutput, Items.STICK, Items.DIAMOND, WeaponItemsME.DIAMOND_SPEAR); - createToolSetRecipes(exporter, Items.STICK, ResourceItemsME.BRONZE_INGOT, ToolItemsME.BRONZE_PICKAXE, ToolItemsME.BRONZE_AXE, ToolItemsME.BRONZE_SHOVEL, ToolItemsME.BRONZE_HOE); + createToolSetRecipes(recipeOutput, Items.STICK, ResourceItemsME.BRONZE_INGOT, ToolItemsME.BRONZE_PICKAXE, ToolItemsME.BRONZE_AXE, ToolItemsME.BRONZE_SHOVEL, ToolItemsME.BRONZE_HOE); - createToolSetRecipes(exporter, Items.STICK, ResourceItemsME.CRUDE_INGOT, ToolItemsME.CRUDE_PICKAXE, ToolItemsME.CRUDE_AXE, ToolItemsME.CRUDE_SHOVEL, ToolItemsME.CRUDE_HOE); + createToolSetRecipes(recipeOutput, Items.STICK, ResourceItemsME.CRUDE_INGOT, ToolItemsME.CRUDE_PICKAXE, ToolItemsME.CRUDE_AXE, ToolItemsME.CRUDE_SHOVEL, ToolItemsME.CRUDE_HOE); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.COMBAT, WeaponItemsME.WEAVER_STING, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, WeaponItemsME.WEAVER_STING, 1) .pattern(" S") .pattern(" S ") .pattern("W ") - .input('S', ResourceItemsME.SPIDER_STINGER) - .input('W', Items.STICK) - .criterion(hasItem(ResourceItemsME.SPIDER_STINGER), - conditionsFromItem(ResourceItemsME.SPIDER_STINGER)) - .offerTo(exporter); + .define('S', ResourceItemsME.SPIDER_STINGER) + .define('W', Items.STICK) + .unlockedBy(getHasName(ResourceItemsME.SPIDER_STINGER), + has(ResourceItemsME.SPIDER_STINGER)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.MISC, ResourceItemsME.FABRIC, 2) + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ResourceItemsME.FABRIC, 2) .pattern("sss") .pattern("sss") - .input('s', Items.STRING) - .criterion(hasItem(Items.STRING), - conditionsFromItem(Items.STRING)) - .offerTo(exporter); + .define('s', Items.STRING) + .unlockedBy(getHasName(Items.STRING), + has(Items.STRING)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, DecorativeItemsME.REINFORCED_SCAFFOLDING, 6) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, DecorativeItemsME.REINFORCED_SCAFFOLDING, 6) .pattern("LCL") .pattern("S S") .pattern("T T") - .input('L', TagKey.of(RegistryKeys.ITEM, Identifier.of("c","stripped_logs"))) - .input('C', GenericBlockSets.CANVAS.blockSet.base()) - .input('T', ResourceItemsME.TIN_INGOT) - .input('S', Items.STICK) - .criterion(hasItem(ResourceItemsME.TIN_INGOT), - conditionsFromItem(ResourceItemsME.TIN_INGOT)) - .offerTo(exporter, "reinforced_scaffolding"); + .define('L', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("c","stripped_logs"))) + .define('C', GenericBlockSets.CANVAS.blockSet.base()) + .define('T', ResourceItemsME.TIN_INGOT) + .define('S', Items.STICK) + .unlockedBy(getHasName(ResourceItemsME.TIN_INGOT), + has(ResourceItemsME.TIN_INGOT)) + .save(recipeOutput, "reinforced_scaffolding"); //region CANVAS - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.CANVAS.blockSet.base(), 3) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.CANVAS.blockSet.base(), 3) .pattern("FF") .pattern("FF") - .input('F', ResourceItemsME.FABRIC) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); - - createCenterSurroundRecipe(exporter, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.WHITE_DYE, GenericBlockSets.WHITE_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.BLACK_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.BLUE_DYE, GenericBlockSets.BLUE_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.BROWN_DYE, GenericBlockSets.BROWN_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.CYAN_DYE, GenericBlockSets.CYAN_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.GRAY_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.GREEN_DYE, GenericBlockSets.GREEN_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.LIGHT_BLUE_DYE, GenericBlockSets.LIGHT_BLUE_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.LIGHT_GRAY_DYE, GenericBlockSets.LIGHT_GRAY_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.MAGENTA_DYE, GenericBlockSets.MAGENTA_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.ORANGE_DYE, GenericBlockSets.ORANGE_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.PINK_DYE, GenericBlockSets.PINK_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.PURPLE_DYE, GenericBlockSets.PURPLE_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.RED_DYE, GenericBlockSets.RED_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.YELLOW_DYE, GenericBlockSets.YELLOW_CANVAS.blockSet.base().asItem(), 8); - - createCenterSurroundRecipe(exporter, GenericBlockSets.BLUE_CANVAS.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.DARK_BLUE_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.BROWN_CANVAS.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.DARK_BROWN_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.GRAY_CANVAS.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.DARK_GRAY_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.GREEN_CANVAS.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.DARK_GREEN_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.RED_CANVAS.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.DARK_RED_CANVAS.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.YELLOW_CANVAS.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.DARK_YELLOW_CANVAS.blockSet.base().asItem(), 8); + .define('F', ResourceItemsME.FABRIC) + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(recipeOutput); + + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.WHITE_DYE, GenericBlockSets.WHITE_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.BLACK_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.BLUE_DYE, GenericBlockSets.BLUE_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.BROWN_DYE, GenericBlockSets.BROWN_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.CYAN_DYE, GenericBlockSets.CYAN_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.GRAY_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.GREEN_DYE, GenericBlockSets.GREEN_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.LIGHT_BLUE_DYE, GenericBlockSets.LIGHT_BLUE_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.LIGHT_GRAY_DYE, GenericBlockSets.LIGHT_GRAY_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.MAGENTA_DYE, GenericBlockSets.MAGENTA_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.ORANGE_DYE, GenericBlockSets.ORANGE_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.PINK_DYE, GenericBlockSets.PINK_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.PURPLE_DYE, GenericBlockSets.PURPLE_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.RED_DYE, GenericBlockSets.RED_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.CANVAS.blockSet.base().asItem(), Items.YELLOW_DYE, GenericBlockSets.YELLOW_CANVAS.blockSet.base().asItem(), 8); + + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.BLUE_CANVAS.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.DARK_BLUE_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.BROWN_CANVAS.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.DARK_BROWN_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.GRAY_CANVAS.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.DARK_GRAY_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.GREEN_CANVAS.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.DARK_GREEN_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.RED_CANVAS.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.DARK_RED_CANVAS.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.YELLOW_CANVAS.blockSet.base().asItem(), Items.GRAY_DYE, GenericBlockSets.DARK_YELLOW_CANVAS.blockSet.base().asItem(), 8); //endregion - createBucketRecipe(exporter, Items.IRON_INGOT, Items.BUCKET); - - createMetalsRecipe(exporter, ResourceItemsME.TIN_NUGGET, ResourceItemsME.TIN_INGOT, ModBlocks.TIN_BLOCK); - createMetalsRecipe(exporter, ResourceItemsME.LEAD_NUGGET, ResourceItemsME.LEAD_INGOT, ModBlocks.LEAD_BLOCK); - createMetalsRecipe(exporter, ResourceItemsME.SILVER_NUGGET, ResourceItemsME.SILVER_INGOT, ModBlocks.SILVER_BLOCK); - createMetalsRecipe(exporter, ResourceItemsME.MITHRIL_NUGGET, ResourceItemsME.MITHRIL_INGOT, ModBlocks.MITHRIL_BLOCK); - - createMetalsRecipe(exporter, ResourceItemsME.BRONZE_NUGGET, ResourceItemsME.BRONZE_INGOT, ModBlocks.BRONZE_BLOCK); - createMetalsRecipe(exporter, ResourceItemsME.CRUDE_NUGGET, ResourceItemsME.CRUDE_INGOT, ModBlocks.CRUDE_BLOCK); - createMetalsRecipe(exporter, ResourceItemsME.BURZUM_STEEL_NUGGET, ResourceItemsME.BURZUM_STEEL_INGOT, ModBlocks.BURZUM_STEEL_BLOCK); - createMetalsRecipe(exporter, ResourceItemsME.STEEL_NUGGET, ResourceItemsME.STEEL_INGOT, ModBlocks.STEEL_BLOCK); - createMetalsRecipe(exporter, ResourceItemsME.EDHEL_STEEL_NUGGET, ResourceItemsME.EDHEL_STEEL_INGOT, ModBlocks.EDHEL_STEEL_BLOCK); - createMetalsRecipe(exporter, ResourceItemsME.KHAZAD_STEEL_NUGGET, ResourceItemsME.KHAZAD_STEEL_INGOT, ModBlocks.KHAZAD_STEEL_BLOCK); - - ShapelessRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.MISC, ResourceItemsME.ADAMANT, 9) - .input(ModBlocks.ADAMANT_BLOCK) - .criterion(hasItem(ModBlocks.ADAMANT_BLOCK), - conditionsFromItem(ModBlocks.ADAMANT_BLOCK)) - .offerTo(exporter); - - ShapelessRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.MISC, ResourceItemsME.RUBY, 9) - .input(ModBlocks.RUBY_BLOCK) - .criterion(hasItem(ModBlocks.RUBY_BLOCK), - conditionsFromItem(ModBlocks.RUBY_BLOCK)) - .offerTo(exporter); - - ShapelessRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.MISC, ResourceItemsME.SAPPHIRE, 9) - .input(ModBlocks.SAPPHIRE_BLOCK) - .criterion(hasItem(ModBlocks.SAPPHIRE_BLOCK), - conditionsFromItem(ModBlocks.SAPPHIRE_BLOCK)) - .offerTo(exporter); + createBucketRecipe(recipeOutput, Items.IRON_INGOT, Items.BUCKET); + + createMetalsRecipe(recipeOutput, ResourceItemsME.TIN_NUGGET, ResourceItemsME.TIN_INGOT, ModBlocks.TIN_BLOCK); + createMetalsRecipe(recipeOutput, ResourceItemsME.LEAD_NUGGET, ResourceItemsME.LEAD_INGOT, ModBlocks.LEAD_BLOCK); + createMetalsRecipe(recipeOutput, ResourceItemsME.SILVER_NUGGET, ResourceItemsME.SILVER_INGOT, ModBlocks.SILVER_BLOCK); + createMetalsRecipe(recipeOutput, ResourceItemsME.MITHRIL_NUGGET, ResourceItemsME.MITHRIL_INGOT, ModBlocks.MITHRIL_BLOCK); + + createMetalsRecipe(recipeOutput, ResourceItemsME.BRONZE_NUGGET, ResourceItemsME.BRONZE_INGOT, ModBlocks.BRONZE_BLOCK); + createMetalsRecipe(recipeOutput, ResourceItemsME.CRUDE_NUGGET, ResourceItemsME.CRUDE_INGOT, ModBlocks.CRUDE_BLOCK); + createMetalsRecipe(recipeOutput, ResourceItemsME.BURZUM_STEEL_NUGGET, ResourceItemsME.BURZUM_STEEL_INGOT, ModBlocks.BURZUM_STEEL_BLOCK); + createMetalsRecipe(recipeOutput, ResourceItemsME.STEEL_NUGGET, ResourceItemsME.STEEL_INGOT, ModBlocks.STEEL_BLOCK); + createMetalsRecipe(recipeOutput, ResourceItemsME.EDHEL_STEEL_NUGGET, ResourceItemsME.EDHEL_STEEL_INGOT, ModBlocks.EDHEL_STEEL_BLOCK); + createMetalsRecipe(recipeOutput, ResourceItemsME.KHAZAD_STEEL_NUGGET, ResourceItemsME.KHAZAD_STEEL_INGOT, ModBlocks.KHAZAD_STEEL_BLOCK); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ResourceItemsME.ADAMANT, 9) + .requires(ModBlocks.ADAMANT_BLOCK) + .unlockedBy(getHasName(ModBlocks.ADAMANT_BLOCK), + has(ModBlocks.ADAMANT_BLOCK)) + .save(recipeOutput); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ResourceItemsME.RUBY, 9) + .requires(ModBlocks.RUBY_BLOCK) + .unlockedBy(getHasName(ModBlocks.RUBY_BLOCK), + has(ModBlocks.RUBY_BLOCK)) + .save(recipeOutput); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ResourceItemsME.SAPPHIRE, 9) + .requires(ModBlocks.SAPPHIRE_BLOCK) + .unlockedBy(getHasName(ModBlocks.SAPPHIRE_BLOCK), + has(ModBlocks.SAPPHIRE_BLOCK)) + .save(recipeOutput); //endregion //region SEEDS - createSeedsRecipe(exporter, FoodItemsME.TOMATO, ResourceItemsME.TOMATO_SEEDS); - createSeedsRecipe(exporter, FoodItemsME.BELL_PEPPER, ResourceItemsME.BELL_PEPPER_SEEDS); - createSeedsRecipe(exporter, FoodItemsME.CUCUMBER, ResourceItemsME.CUCUMBER_SEEDS); - createSeedsRecipe(exporter, FoodItemsME.LETTUCE, ResourceItemsME.LETTUCE_SEEDS); - createSeedsRecipe(exporter, ResourceItemsME.PIPEWEED, ResourceItemsME.PIPEWEED_SEEDS); - createSeedsRecipe(exporter, ResourceItemsME.FLAX, ResourceItemsME.FLAX_SEEDS); + createSeedsRecipe(recipeOutput, FoodItemsME.TOMATO, ResourceItemsME.TOMATO_SEEDS); + createSeedsRecipe(recipeOutput, FoodItemsME.BELL_PEPPER, ResourceItemsME.BELL_PEPPER_SEEDS); + createSeedsRecipe(recipeOutput, FoodItemsME.CUCUMBER, ResourceItemsME.CUCUMBER_SEEDS); + createSeedsRecipe(recipeOutput, FoodItemsME.LETTUCE, ResourceItemsME.LETTUCE_SEEDS); + createSeedsRecipe(recipeOutput, ResourceItemsME.PIPEWEED, ResourceItemsME.PIPEWEED_SEEDS); + createSeedsRecipe(recipeOutput, ResourceItemsME.FLAX, ResourceItemsME.FLAX_SEEDS); //endregion //region FOOD - createCookedFoodRecipes(exporter, FoodItemsME.RAW_HORSE, FoodItemsME.COOKED_HORSE); - createCookedFoodRecipes(exporter, FoodItemsME.MEAT_SKEWER, FoodItemsME.COOKED_MEAT_SKEWER); - createCookedFoodRecipes(exporter, FoodItemsME.VEGETABLE_SKEWER, FoodItemsME.COOKED_VEGETABLE_SKEWER); - createCookedFoodRecipes(exporter, Items.EGG, FoodItemsME.BOILED_EGG); + createCookedFoodRecipes(recipeOutput, FoodItemsME.RAW_HORSE, FoodItemsME.COOKED_HORSE); + createCookedFoodRecipes(recipeOutput, FoodItemsME.MEAT_SKEWER, FoodItemsME.COOKED_MEAT_SKEWER); + createCookedFoodRecipes(recipeOutput, FoodItemsME.VEGETABLE_SKEWER, FoodItemsME.COOKED_VEGETABLE_SKEWER); + createCookedFoodRecipes(recipeOutput, Items.EGG, FoodItemsME.BOILED_EGG); //endregion - ComplexRecipeJsonBuilder.create(HelmetAttachmentRecipe::new).offerTo(exporter, "custom_armor_hood"); - ComplexRecipeJsonBuilder.create(HelmetAttachmentRemovalRecipe::new).offerTo(exporter, "custom_armor_hood_removal"); - ComplexRecipeJsonBuilder.create(BackAttachmentRecipe::new).offerTo(exporter, "custom_armor_cape"); - ComplexRecipeJsonBuilder.create(BackAttachmentRemovalRecipe::new).offerTo(exporter, "custom_armor_cape_removal"); - ComplexRecipeJsonBuilder.create(MountArmorAddonRemovalRecipe::new).offerTo(exporter, "custom_mount_armor_addon_removal"); - ComplexRecipeJsonBuilder.create(MountArmorSideSkullAddonRecipe::new).offerTo(exporter, "custom_mount_armor_side_skull_addon"); - ComplexRecipeJsonBuilder.create(MountArmorTopSkullAddonRecipe::new).offerTo(exporter, "custom_mount_armor_top_skull_addon"); + SpecialRecipeBuilder.special(HelmetAttachmentRecipe::new).save(recipeOutput, "custom_armor_hood"); + SpecialRecipeBuilder.special(HelmetAttachmentRemovalRecipe::new).save(recipeOutput, "custom_armor_hood_removal"); + SpecialRecipeBuilder.special(BackAttachmentRecipe::new).save(recipeOutput, "custom_armor_cape"); + SpecialRecipeBuilder.special(BackAttachmentRemovalRecipe::new).save(recipeOutput, "custom_armor_cape_removal"); + SpecialRecipeBuilder.special(MountArmorAddonRemovalRecipe::new).save(recipeOutput, "custom_mount_armor_addon_removal"); + SpecialRecipeBuilder.special(MountArmorSideSkullAddonRecipe::new).save(recipeOutput, "custom_mount_armor_side_skull_addon"); + SpecialRecipeBuilder.special(MountArmorTopSkullAddonRecipe::new).save(recipeOutput, "custom_mount_armor_top_skull_addon"); //region Alloying AlloyRecipeJsonBuilder.createAlloyRecipe(itemLookup, RecipeCategory.MISC, "bronze", INGOT_LIQUID_VALUE * 4, 4) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "copper"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "copper"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "copper"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "tin"))) - .criterion(hasItem(Items.COPPER_INGOT), - conditionsFromItem(Items.COPPER_INGOT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "bronze" + "_from_alloying"))); + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "copper"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "copper"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "copper"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "tin"))) + .unlockedBy(getHasName(Items.COPPER_INGOT), + has(Items.COPPER_INGOT)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bronze" + "_from_alloying"))); AlloyRecipeJsonBuilder.createAlloyRecipe(itemLookup, RecipeCategory.MISC, "crude", INGOT_LIQUID_VALUE * 3, 3) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "copper"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "copper"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "tin"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "copper"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "copper"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "tin"))) .input(ResourceItemsME.ASH) - .criterion(hasItem(Items.COPPER_INGOT), - conditionsFromItem(Items.COPPER_INGOT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "crude" + "_from_alloying"))); + .unlockedBy(getHasName(Items.COPPER_INGOT), + has(Items.COPPER_INGOT)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "crude" + "_from_alloying"))); AlloyRecipeJsonBuilder.createAlloyRecipe(itemLookup, RecipeCategory.MISC, "steel", INGOT_LIQUID_VALUE * 3, 3) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "iron"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "iron"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "iron"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "iron"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "iron"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "iron"))) .input(Items.COAL) - .criterion(hasItem(Items.IRON_INGOT), - conditionsFromItem(Items.IRON_INGOT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "steel" + "_from_alloying_tags"))); + .unlockedBy(getHasName(Items.IRON_INGOT), + has(Items.IRON_INGOT)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel" + "_from_alloying_tags"))); AlloyRecipeJsonBuilder.createAlloyRecipe(itemLookup, RecipeCategory.MISC, "khazad_steel", INGOT_LIQUID_VALUE * 3, 3) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "iron"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "iron"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "lead"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "iron"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "iron"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "lead"))) .input(Items.COAL) - .criterion(hasItem(Items.IRON_INGOT), - conditionsFromItem(Items.IRON_INGOT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "khazad_steel" + "_from_alloying_tags"))); + .unlockedBy(getHasName(Items.IRON_INGOT), + has(Items.IRON_INGOT)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "khazad_steel" + "_from_alloying_tags"))); AlloyRecipeJsonBuilder.createAlloyRecipe(itemLookup, RecipeCategory.MISC, "edhel_steel", INGOT_LIQUID_VALUE * 3, 3) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "iron"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "iron"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "iron"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "iron"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "iron"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "iron"))) .input(ResourceItemsME.SILVER_NUGGET) - .criterion(hasItem(Items.IRON_INGOT), - conditionsFromItem(Items.IRON_INGOT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "edhel_steel" + "_from_alloying_tags"))); + .unlockedBy(getHasName(Items.IRON_INGOT), + has(Items.IRON_INGOT)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "edhel_steel" + "_from_alloying_tags"))); AlloyRecipeJsonBuilder.createAlloyRecipe(itemLookup, RecipeCategory.MISC, "burzum_steel", INGOT_LIQUID_VALUE * 3, 3) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "iron"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "iron"))) - .input(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "lead"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "iron"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "iron"))) + .input(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "lead"))) .input(ResourceItemsME.ASH) - .criterion(hasItem(Items.IRON_INGOT), - conditionsFromItem(Items.IRON_INGOT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "burzum_steel" + "_from_alloying_tags"))); + .unlockedBy(getHasName(Items.IRON_INGOT), + has(Items.IRON_INGOT)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "burzum_steel" + "_from_alloying_tags"))); AlloyRecipeJsonBuilder.createAlloyRecipe(itemLookup, RecipeCategory.MISC, "chicken_nugget", INGOT_LIQUID_VALUE, 1) .input(Items.CHICKEN) .input(Items.WHEAT) .input(Items.EGG) .input(FoodItemsME.GARLIC) - .criterion(hasItem(ResourceItemsME.PTEROSAUR_NUGGET), - conditionsFromItem(ResourceItemsME.PTEROSAUR_NUGGET)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "chicken_nugget" + "_from_alloying"))); + .unlockedBy(getHasName(ResourceItemsME.PTEROSAUR_NUGGET), + has(ResourceItemsME.PTEROSAUR_NUGGET)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "chicken_nugget" + "_from_alloying"))); HotMetalsModel.nuggets.forEach(nugget -> { //createMeltRecipe(exporter, nugget, Registries.ITEM.getId(nugget).getPath().replace("_nugget", ""), INGOT_LIQUID_VALUE / 9); }); HotMetalsModel.shapesTag.forEach(shape -> { - createAnvilShapingRecipeTag(exporter, shape.tagKey(), shape.output(), shape.amount()); + createAnvilShapingRecipeTag(recipeOutput, shape.tagKey(), shape.output(), shape.amount()); }); HotMetalsModel.shapesItem.forEach(shape -> { - createAnvilShapingRecipeItem(exporter, shape.item(), shape.output(), shape.amount()); + createAnvilShapingRecipeItem(recipeOutput, shape.item(), shape.output(), shape.amount()); }); - createMeltBulkRecipeTag(exporter, TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "copper")), "copper"); - createMeltBulkRecipeTag(exporter, TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "tin")), "tin"); + createMeltBulkRecipeTag(recipeOutput, TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "copper")), "copper"); + createMeltBulkRecipeTag(recipeOutput, TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "tin")), "tin"); - createMeltBulkRecipe(exporter, ResourceItemsME.BRONZE_INGOT, "bronze"); - createMeltBulkRecipe(exporter, ResourceItemsME.CRUDE_INGOT, "crude"); + createMeltBulkRecipe(recipeOutput, ResourceItemsME.BRONZE_INGOT, "bronze"); + createMeltBulkRecipe(recipeOutput, ResourceItemsME.CRUDE_INGOT, "crude"); - createMeltBulkRecipeTag(exporter, TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "lead")), "lead"); - createMeltBulkRecipeTag(exporter, TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "silver")), "silver"); - createMeltBulkRecipeTag(exporter, TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "iron")), "iron"); - createMeltBulkRecipeTag(exporter, TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "gold")), "gold"); + createMeltBulkRecipeTag(recipeOutput, TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "lead")), "lead"); + createMeltBulkRecipeTag(recipeOutput, TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "silver")), "silver"); + createMeltBulkRecipeTag(recipeOutput, TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "iron")), "iron"); + createMeltBulkRecipeTag(recipeOutput, TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "gold")), "gold"); - createMeltBulkRecipe(exporter, ResourceItemsME.STEEL_INGOT, "steel"); - createMeltBulkRecipe(exporter, ResourceItemsME.KHAZAD_STEEL_INGOT, "khazad_steel"); - createMeltBulkRecipe(exporter, ResourceItemsME.EDHEL_STEEL_INGOT, "edhel_steel"); - createMeltBulkRecipe(exporter, ResourceItemsME.BURZUM_STEEL_INGOT, "burzum_steel"); + createMeltBulkRecipe(recipeOutput, ResourceItemsME.STEEL_INGOT, "steel"); + createMeltBulkRecipe(recipeOutput, ResourceItemsME.KHAZAD_STEEL_INGOT, "khazad_steel"); + createMeltBulkRecipe(recipeOutput, ResourceItemsME.EDHEL_STEEL_INGOT, "edhel_steel"); + createMeltBulkRecipe(recipeOutput, ResourceItemsME.BURZUM_STEEL_INGOT, "burzum_steel"); - createMeltBulkRecipeTag(exporter, TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "mithril")), "mithril"); + createMeltBulkRecipeTag(recipeOutput, TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "mithril")), "mithril"); - createMeltBulkRecipe(exporter, Items.NETHERITE_INGOT, "netherite"); + createMeltBulkRecipe(recipeOutput, Items.NETHERITE_INGOT, "netherite"); - createAnvilRecipe(exporter, ModBlocks.STEEL_BLOCK.asItem(), ResourceItemsME.STEEL_INGOT, DecorativeItemsME.TREATED_ANVIL); - createAnvilRecipe(exporter, ModBlocks.KHAZAD_STEEL_BLOCK.asItem(), ResourceItemsME.KHAZAD_STEEL_INGOT, DecorativeItemsME.DWARVEN_TREATED_ANVIL); - createAnvilRecipe(exporter, ModBlocks.EDHEL_STEEL_BLOCK.asItem(), ResourceItemsME.EDHEL_STEEL_INGOT, DecorativeItemsME.ELVEN_TREATED_ANVIL); - createAnvilRecipe(exporter, ModBlocks.BURZUM_STEEL_BLOCK.asItem(), ResourceItemsME.BURZUM_STEEL_INGOT, DecorativeItemsME.ORCISH_TREATED_ANVIL); + createAnvilRecipe(recipeOutput, ModBlocks.STEEL_BLOCK.asItem(), ResourceItemsME.STEEL_INGOT, DecorativeItemsME.TREATED_ANVIL); + createAnvilRecipe(recipeOutput, ModBlocks.KHAZAD_STEEL_BLOCK.asItem(), ResourceItemsME.KHAZAD_STEEL_INGOT, DecorativeItemsME.DWARVEN_TREATED_ANVIL); + createAnvilRecipe(recipeOutput, ModBlocks.EDHEL_STEEL_BLOCK.asItem(), ResourceItemsME.EDHEL_STEEL_INGOT, DecorativeItemsME.ELVEN_TREATED_ANVIL); + createAnvilRecipe(recipeOutput, ModBlocks.BURZUM_STEEL_BLOCK.asItem(), ResourceItemsME.BURZUM_STEEL_INGOT, DecorativeItemsME.ORCISH_TREATED_ANVIL); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, DecorativeItemsME.BELLOWS, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, DecorativeItemsME.BELLOWS, 1) .pattern(" PS") .pattern("PFF") .pattern("TPS") - .input('P', TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .input('S', Items.STICK) - .input('F', Items.LEATHER) - .input('T', ResourceItemsME.TIN_INGOT) - .criterion(hasItem(ResourceItemsME.TIN_INGOT), - conditionsFromItem(ResourceItemsME.TIN_INGOT)) - .offerTo(exporter); - - createWattleRecipes(exporter, Items.BRICKS, + .define('P', TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .define('S', Items.STICK) + .define('F', Items.LEATHER) + .define('T', ResourceItemsME.TIN_INGOT) + .unlockedBy(getHasName(ResourceItemsME.TIN_INGOT), + has(ResourceItemsME.TIN_INGOT)) + .save(recipeOutput); + + createWattleRecipes(recipeOutput, Items.BRICKS, ModBlocks.WATTLE_AND_BRICK, ModBlocks.WATTLE_AND_BRICK_CROSS, ModBlocks.WATTLE_AND_BRICK_RIGHT, ModBlocks.WATTLE_AND_BRICK_LEFT, ModBlocks.WATTLE_AND_BRICK_PILLAR, ModBlocks.WATTLE_AND_BRICK_DIAMOND); - createWattleRecipes(exporter, GenericBlockSets.WHITE_DAUB.blockSet.base().asItem(), + createWattleRecipes(recipeOutput, GenericBlockSets.WHITE_DAUB.blockSet.base().asItem(), ModBlocks.WATTLE_AND_WHITE_DAUB, ModBlocks.WATTLE_AND_WHITE_DAUB_CROSS, ModBlocks.WATTLE_AND_WHITE_DAUB_RIGHT, ModBlocks.WATTLE_AND_WHITE_DAUB_LEFT, ModBlocks.WATTLE_AND_WHITE_DAUB_PILLAR, ModBlocks.WATTLE_AND_WHITE_DAUB_DIAMOND); - createWattleRecipes(exporter, GenericBlockSets.DARK_DAUB.blockSet.base().asItem(), + createWattleRecipes(recipeOutput, GenericBlockSets.DARK_DAUB.blockSet.base().asItem(), ModBlocks.DARK_WATTLE_AND_DARK_DAUB, ModBlocks.DARK_WATTLE_AND_DARK_DAUB_CROSS, ModBlocks.DARK_WATTLE_AND_DARK_DAUB_RIGHT, ModBlocks.DARK_WATTLE_AND_DARK_DAUB_LEFT, ModBlocks.DARK_WATTLE_AND_DARK_DAUB_PILLAR, ModBlocks.DARK_WATTLE_AND_DARK_DAUB_DIAMOND); - createWattleRecipes(exporter, GenericBlockSets.YELLOW_DAUB.blockSet.base().asItem(), + createWattleRecipes(recipeOutput, GenericBlockSets.YELLOW_DAUB.blockSet.base().asItem(), ModBlocks.WATTLE_AND_YELLOW_DAUB, ModBlocks.WATTLE_AND_YELLOW_DAUB_CROSS, ModBlocks.WATTLE_AND_YELLOW_DAUB_RIGHT, ModBlocks.WATTLE_AND_YELLOW_DAUB_LEFT, ModBlocks.WATTLE_AND_YELLOW_DAUB_PILLAR, ModBlocks.WATTLE_AND_YELLOW_DAUB_DIAMOND); - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB.asItem(), Items.BLACK_DYE, ModBlocks.BLACK_WATTLE_AND_WHITE_DAUB.asItem(), 8); - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB_CROSS.asItem(), Items.BLACK_DYE, ModBlocks.BLACK_WATTLE_AND_WHITE_DAUB_CROSS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB_RIGHT.asItem(), Items.BLACK_DYE, ModBlocks.BLACK_WATTLE_AND_WHITE_DAUB_RIGHT.asItem(), 8); - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB_LEFT.asItem(), Items.BLACK_DYE, ModBlocks.BLACK_WATTLE_AND_WHITE_DAUB_LEFT.asItem(), 8); - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB_PILLAR.asItem(), Items.BLACK_DYE, ModBlocks.BLACK_WATTLE_AND_WHITE_DAUB_PILLAR.asItem(), 8); - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB_DIAMOND.asItem(), Items.BLACK_DYE, ModBlocks.BLACK_WATTLE_AND_WHITE_DAUB_DIAMOND.asItem(), 8); - - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB.asItem(), Items.GREEN_DYE, ModBlocks.GREEN_WATTLE_AND_WHITE_DAUB.asItem(), 8); - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB_CROSS.asItem(), Items.GREEN_DYE, ModBlocks.GREEN_WATTLE_AND_WHITE_DAUB_CROSS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB_RIGHT.asItem(), Items.GREEN_DYE, ModBlocks.GREEN_WATTLE_AND_WHITE_DAUB_RIGHT.asItem(), 8); - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB_LEFT.asItem(), Items.GREEN_DYE, ModBlocks.GREEN_WATTLE_AND_WHITE_DAUB_LEFT.asItem(), 8); - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB_PILLAR.asItem(), Items.GREEN_DYE, ModBlocks.GREEN_WATTLE_AND_WHITE_DAUB_PILLAR.asItem(), 8); - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB_DIAMOND.asItem(), Items.GREEN_DYE, ModBlocks.GREEN_WATTLE_AND_WHITE_DAUB_DIAMOND.asItem(), 8); - - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB.asItem(), Items.RED_DYE, ModBlocks.RED_WATTLE_AND_WHITE_DAUB.asItem(), 8); - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB_CROSS.asItem(), Items.RED_DYE, ModBlocks.RED_WATTLE_AND_WHITE_DAUB_CROSS.asItem(), 8); - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB_RIGHT.asItem(), Items.RED_DYE, ModBlocks.RED_WATTLE_AND_WHITE_DAUB_RIGHT.asItem(), 8); - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB_LEFT.asItem(), Items.RED_DYE, ModBlocks.RED_WATTLE_AND_WHITE_DAUB_LEFT.asItem(), 8); - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB_PILLAR.asItem(), Items.RED_DYE, ModBlocks.RED_WATTLE_AND_WHITE_DAUB_PILLAR.asItem(), 8); - createCenterSurroundRecipe(exporter, ModBlocks.WATTLE_AND_WHITE_DAUB_DIAMOND.asItem(), Items.RED_DYE, ModBlocks.RED_WATTLE_AND_WHITE_DAUB_DIAMOND.asItem(), 8); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.BRONZE_BARS, 16) + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB.asItem(), Items.BLACK_DYE, ModBlocks.BLACK_WATTLE_AND_WHITE_DAUB.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB_CROSS.asItem(), Items.BLACK_DYE, ModBlocks.BLACK_WATTLE_AND_WHITE_DAUB_CROSS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB_RIGHT.asItem(), Items.BLACK_DYE, ModBlocks.BLACK_WATTLE_AND_WHITE_DAUB_RIGHT.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB_LEFT.asItem(), Items.BLACK_DYE, ModBlocks.BLACK_WATTLE_AND_WHITE_DAUB_LEFT.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB_PILLAR.asItem(), Items.BLACK_DYE, ModBlocks.BLACK_WATTLE_AND_WHITE_DAUB_PILLAR.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB_DIAMOND.asItem(), Items.BLACK_DYE, ModBlocks.BLACK_WATTLE_AND_WHITE_DAUB_DIAMOND.asItem(), 8); + + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB.asItem(), Items.GREEN_DYE, ModBlocks.GREEN_WATTLE_AND_WHITE_DAUB.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB_CROSS.asItem(), Items.GREEN_DYE, ModBlocks.GREEN_WATTLE_AND_WHITE_DAUB_CROSS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB_RIGHT.asItem(), Items.GREEN_DYE, ModBlocks.GREEN_WATTLE_AND_WHITE_DAUB_RIGHT.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB_LEFT.asItem(), Items.GREEN_DYE, ModBlocks.GREEN_WATTLE_AND_WHITE_DAUB_LEFT.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB_PILLAR.asItem(), Items.GREEN_DYE, ModBlocks.GREEN_WATTLE_AND_WHITE_DAUB_PILLAR.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB_DIAMOND.asItem(), Items.GREEN_DYE, ModBlocks.GREEN_WATTLE_AND_WHITE_DAUB_DIAMOND.asItem(), 8); + + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB.asItem(), Items.RED_DYE, ModBlocks.RED_WATTLE_AND_WHITE_DAUB.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB_CROSS.asItem(), Items.RED_DYE, ModBlocks.RED_WATTLE_AND_WHITE_DAUB_CROSS.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB_RIGHT.asItem(), Items.RED_DYE, ModBlocks.RED_WATTLE_AND_WHITE_DAUB_RIGHT.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB_LEFT.asItem(), Items.RED_DYE, ModBlocks.RED_WATTLE_AND_WHITE_DAUB_LEFT.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB_PILLAR.asItem(), Items.RED_DYE, ModBlocks.RED_WATTLE_AND_WHITE_DAUB_PILLAR.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModBlocks.WATTLE_AND_WHITE_DAUB_DIAMOND.asItem(), Items.RED_DYE, ModBlocks.RED_WATTLE_AND_WHITE_DAUB_DIAMOND.asItem(), 8); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.BRONZE_BARS, 16) .pattern("SSS") .pattern("SSS") - .input('S', ResourceItemsME.BRONZE_INGOT) - .criterion(hasItem(ResourceItemsME.BRONZE_INGOT), - conditionsFromItem(ResourceItemsME.BRONZE_INGOT)) - .offerTo(exporter); + .define('S', ResourceItemsME.BRONZE_INGOT) + .unlockedBy(getHasName(ResourceItemsME.BRONZE_INGOT), + has(ResourceItemsME.BRONZE_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.CRUDE_BARS, 16) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.CRUDE_BARS, 16) .pattern("SSS") .pattern("SSS") - .input('S', ResourceItemsME.CRUDE_INGOT) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.CRUDE_INGOT)) - .offerTo(exporter); + .define('S', ResourceItemsME.CRUDE_INGOT) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.CRUDE_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.TREATED_STEEL_BARS, 16) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.TREATED_STEEL_BARS, 16) .pattern("SSS") .pattern("SSS") - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_ingots"))) - .criterion(hasItem(ResourceItemsME.STEEL_INGOT), - conditionsFromItem(ResourceItemsME.STEEL_INGOT)) - .offerTo(exporter); + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_ingots"))) + .unlockedBy(getHasName(ResourceItemsME.STEEL_INGOT), + has(ResourceItemsME.STEEL_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.BURZUM_BARS, 16) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.BURZUM_BARS, 16) .pattern("SSS") .pattern("SSS") - .input('S', ResourceItemsME.BURZUM_STEEL_INGOT) - .criterion(hasItem(ResourceItemsME.BURZUM_STEEL_INGOT), - conditionsFromItem(ResourceItemsME.BURZUM_STEEL_INGOT)) - .offerTo(exporter); + .define('S', ResourceItemsME.BURZUM_STEEL_INGOT) + .unlockedBy(getHasName(ResourceItemsME.BURZUM_STEEL_INGOT), + has(ResourceItemsME.BURZUM_STEEL_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.AGED_WOOD_WINDOW, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.AGED_WOOD_WINDOW, 4) .pattern("AAA") .pattern("AGA") .pattern("AAA") - .input('A', GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base()) - .input('G', Items.GLASS) - .criterion(hasItem(GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base()), - conditionsFromItem(GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base())) - .offerTo(exporter); + .define('A', GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base()) + .define('G', Items.GLASS) + .unlockedBy(getHasName(GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base()), + has(GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base())) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.AGED_WOOD_TRAPDOOR, 2) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.AGED_WOOD_TRAPDOOR, 2) .pattern("WWW") .pattern("WWW") - .input('W', GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base()) - .criterion(hasItem(GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base()), - conditionsFromItem(GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base())) - .offerTo(exporter); + .define('W', GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base()) + .unlockedBy(getHasName(GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base()), + has(GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base())) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.BRONZE_TRAPDOOR, 2) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.BRONZE_TRAPDOOR, 2) .pattern("NSN") .pattern("NSN") - .input('S', ResourceItemsME.BRONZE_INGOT) - .input('N', ResourceItemsME.BRONZE_NUGGET) - .criterion(hasItem(ResourceItemsME.BRONZE_INGOT), - conditionsFromItem(ResourceItemsME.BRONZE_INGOT)) - .offerTo(exporter); + .define('S', ResourceItemsME.BRONZE_INGOT) + .define('N', ResourceItemsME.BRONZE_NUGGET) + .unlockedBy(getHasName(ResourceItemsME.BRONZE_INGOT), + has(ResourceItemsME.BRONZE_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.CRUDE_TRAPDOOR, 2) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.CRUDE_TRAPDOOR, 2) .pattern("NSN") .pattern("NSN") - .input('S', ResourceItemsME.CRUDE_INGOT) - .input('N', ResourceItemsME.CRUDE_NUGGET) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.CRUDE_INGOT)) - .offerTo(exporter); + .define('S', ResourceItemsME.CRUDE_INGOT) + .define('N', ResourceItemsME.CRUDE_NUGGET) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.CRUDE_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.TREATED_STEEL_TRAPDOOR, 2) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.TREATED_STEEL_TRAPDOOR, 2) .pattern("NSN") .pattern("NSN") - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_ingots"))) - .input('N', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_nuggets"))) - .criterion(hasItem(ResourceItemsME.STEEL_INGOT), - conditionsFromItem(ResourceItemsME.STEEL_INGOT)) - .offerTo(exporter); + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_ingots"))) + .define('N', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_nuggets"))) + .unlockedBy(getHasName(ResourceItemsME.STEEL_INGOT), + has(ResourceItemsME.STEEL_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.AGED_WOOD_DOOR, 3) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.AGED_WOOD_DOOR, 3) .pattern("SS") .pattern("SS") .pattern("SS") - .input('S', GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base()) - .criterion(hasItem(GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base()), - conditionsFromItem(GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base())) - .offerTo(exporter); + .define('S', GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base()) + .unlockedBy(getHasName(GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base()), + has(GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base())) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.BRONZE_DOOR, 3) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.BRONZE_DOOR, 3) .pattern("SS") .pattern("SS") .pattern("SS") - .input('S', ResourceItemsME.BRONZE_INGOT) - .criterion(hasItem(ResourceItemsME.BRONZE_INGOT), - conditionsFromItem(ResourceItemsME.BRONZE_INGOT)) - .offerTo(exporter); + .define('S', ResourceItemsME.BRONZE_INGOT) + .unlockedBy(getHasName(ResourceItemsME.BRONZE_INGOT), + has(ResourceItemsME.BRONZE_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.CRUDE_DOOR, 3) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.CRUDE_DOOR, 3) .pattern("SS") .pattern("SS") .pattern("SS") - .input('S', ResourceItemsME.CRUDE_INGOT) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.CRUDE_INGOT)) - .offerTo(exporter); + .define('S', ResourceItemsME.CRUDE_INGOT) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.CRUDE_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.TREATED_STEEL_DOOR, 3) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.TREATED_STEEL_DOOR, 3) .pattern("SS") .pattern("SS") .pattern("SS") - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_ingots"))) - .criterion(hasItem(ResourceItemsME.STEEL_INGOT), - conditionsFromItem(ResourceItemsME.STEEL_INGOT)) - .offerTo(exporter); + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_ingots"))) + .unlockedBy(getHasName(ResourceItemsME.STEEL_INGOT), + has(ResourceItemsME.STEEL_INGOT)) + .save(recipeOutput); - createPaneRecipe(exporter, ResourceItemsME.SILVER_INGOT, ModBlocks.SILVER_BARS, 16); - createPaneRecipe(exporter, Items.GOLD_INGOT, ModBlocks.GILDED_BARS, 16); + createPaneRecipe(recipeOutput, ResourceItemsME.SILVER_INGOT, ModBlocks.SILVER_BARS, 16); + createPaneRecipe(recipeOutput, Items.GOLD_INGOT, ModBlocks.GILDED_BARS, 16); - createCenterSurroundRecipe(exporter, GenericBlockSets.WHITE_DAUB.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.DARK_DAUB.blockSet.base().asItem(), 8); - createCenterSurroundRecipe(exporter, GenericBlockSets.WHITE_DAUB.blockSet.base().asItem(), Items.YELLOW_DYE, GenericBlockSets.YELLOW_DAUB.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.WHITE_DAUB.blockSet.base().asItem(), Items.BLACK_DYE, GenericBlockSets.DARK_DAUB.blockSet.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, GenericBlockSets.WHITE_DAUB.blockSet.base().asItem(), Items.YELLOW_DYE, GenericBlockSets.YELLOW_DAUB.blockSet.base().asItem(), 8); //region TREATED_WOOD - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.TREATED_WOOD.blockSet.base(), 6) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.TREATED_WOOD.blockSet.base(), 6) .pattern("PPP") .pattern("PHP") .pattern("PPP") - .input('P', TagKey.of(RegistryKeys.ITEM, Identifier.of("logs"))) - .input('H', Items.HONEYCOMB) - .criterion(hasItem(Items.HONEYCOMB), - conditionsFromItem(Items.HONEYCOMB)) - .offerTo(exporter); - - createBrickRecipe(exporter, GenericBlockSets.TREATED_WOOD.blockSet.base().asItem(), GenericBlockSets.TREATED_WOOD_BEAM.blockSet.base(), 3); - createBrickRecipe(exporter, GenericBlockSets.TREATED_WOOD_BEAM.blockSet.base().asItem(), GenericBlockSets.TREATED_WOOD_TILING.blockSet.base(), 4); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.TREATED_WOOD_PLANKS.blockSet.base(), 4) - .input(GenericBlockSets.TREATED_WOOD.blockSet.base()) - .criterion(hasItem(GenericBlockSets.TREATED_WOOD.blockSet.base()), - conditionsFromItem(GenericBlockSets.TREATED_WOOD.blockSet.base())) - .offerTo(exporter); - - createBrickRecipe(exporter, GenericBlockSets.TREATED_WOOD_PLANKS.blockSet.base().asItem(), GenericBlockSets.TREATED_WOOD_PANELS.blockSet.base(), 4); + .define('P', TagKey.create(Registries.ITEM, ResourceLocation.parse("logs"))) + .define('H', Items.HONEYCOMB) + .unlockedBy(getHasName(Items.HONEYCOMB), + has(Items.HONEYCOMB)) + .save(recipeOutput); + + createBrickRecipe(recipeOutput, GenericBlockSets.TREATED_WOOD.blockSet.base().asItem(), GenericBlockSets.TREATED_WOOD_BEAM.blockSet.base(), 3); + createBrickRecipe(recipeOutput, GenericBlockSets.TREATED_WOOD_BEAM.blockSet.base().asItem(), + GenericBlockSets.TREATED_WOOD_TILING.blockSet.base(), 4); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.TREATED_WOOD_PLANKS.blockSet.base(), 4) + .requires(GenericBlockSets.TREATED_WOOD.blockSet.base()) + .unlockedBy(getHasName(GenericBlockSets.TREATED_WOOD.blockSet.base()), + has(GenericBlockSets.TREATED_WOOD.blockSet.base())) + .save(recipeOutput); + + createBrickRecipe(recipeOutput, GenericBlockSets.TREATED_WOOD_PLANKS.blockSet.base().asItem(), GenericBlockSets.TREATED_WOOD_PANELS.blockSet.base(), 4); createGenericRecipes(GenericBlockSets.TREATED_WOOD); createGenericRecipes(GenericBlockSets.TREATED_WOOD_PLANKS); createGenericRecipes(GenericBlockSets.TREATED_WOOD_BEAM); @@ -1291,2165 +1401,2207 @@ public void generate() { createGenericRecipes(GenericBlockSets.TREATED_WOOD_TILING); createGenericRecipes(GenericBlockSets.TREATED_WOOD_CARVED_BEAM); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.TREATED_WOOD_CARVED_BEAM.blockSet.base(), 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.TREATED_WOOD_CARVED_BEAM.blockSet.base(), 1) .pattern("S") .pattern("S") - .input('S', GenericBlockSets.TREATED_WOOD_BEAM.blockSet.slab()) - .criterion(hasItem(GenericBlockSets.TREATED_WOOD_BEAM.blockSet.slab()), - conditionsFromItem(GenericBlockSets.TREATED_WOOD_BEAM.blockSet.slab())) - .offerTo(exporter); + .define('S', GenericBlockSets.TREATED_WOOD_BEAM.blockSet.slab()) + .unlockedBy(getHasName(GenericBlockSets.TREATED_WOOD_BEAM.blockSet.slab()), + has(GenericBlockSets.TREATED_WOOD_BEAM.blockSet.slab())) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.TREATED_WOOD_ROPE_FENCE, 3) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.TREATED_WOOD_ROPE_FENCE, 3) .pattern("WRW") .pattern("WRW") - .input('W', GenericBlockSets.TREATED_WOOD.blockSet.base()) - .input('R', ModDecorativeBlocks.ROPE) - .criterion(hasItem(GenericBlockSets.TREATED_WOOD.blockSet.base()), - conditionsFromItem(GenericBlockSets.TREATED_WOOD.blockSet.base())) - .offerTo(exporter); + .define('W', GenericBlockSets.TREATED_WOOD.blockSet.base()) + .define('R', ModDecorativeBlocks.ROPE) + .unlockedBy(getHasName(GenericBlockSets.TREATED_WOOD.blockSet.base()), + has(GenericBlockSets.TREATED_WOOD.blockSet.base())) + .save(recipeOutput); //endregion //region AGED_WOOD - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD.blockSet.base(), 6) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD.blockSet.base(), 6) .pattern("PPP") .pattern("PAP") .pattern("PPP") - .input('P', TagKey.of(RegistryKeys.ITEM, Identifier.of("logs"))) - .input('A', ResourceItemsME.ASH) - .criterion(hasItem(ResourceItemsME.ASH), - conditionsFromItem(ResourceItemsME.ASH)) - .offerTo(exporter); + .define('P', TagKey.create(Registries.ITEM, ResourceLocation.parse("logs"))) + .define('A', ResourceItemsME.ASH) + .unlockedBy(getHasName(ResourceItemsME.ASH), + has(ResourceItemsME.ASH)) + .save(recipeOutput); - createBrickRecipe(exporter, GenericBlockSets.AGED_WOOD.blockSet.base().asItem(), GenericBlockSets.AGED_WOOD_BEAM.blockSet.base(), 3); + createBrickRecipe(recipeOutput, GenericBlockSets.AGED_WOOD.blockSet.base().asItem(), GenericBlockSets.AGED_WOOD_BEAM.blockSet.base(), 3); createGenericRecipes(GenericBlockSets.AGED_WOOD); createGenericRecipes(GenericBlockSets.AGED_WOOD_PLANKS); createGenericRecipes(GenericBlockSets.AGED_WOOD_BEAM); createGenericRecipes(GenericBlockSets.AGED_WOOD_PANELS); createGenericRecipes(GenericBlockSets.AGED_WOOD_BOARDS); + createGenericRecipes(GenericBlockSets.AGED_WOOD_CARVING); createGenericRecipes(GenericBlockSets.AGED_WOOD_FISH_CARVING); createGenericRecipes(GenericBlockSets.AGED_WOOD_CARVED_BEAM); createGenericRecipes(GenericBlockSets.AGED_WOOD_KNOTTED_BEAM); - createShinglesRecipe(exporter, GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base(), GenericBlockSets.AGED_WOOD_SHINGLES.blockSet.base()); + createShinglesRecipe(recipeOutput, GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base(), GenericBlockSets.AGED_WOOD_SHINGLES.blockSet.base()); createGenericRecipes(GenericBlockSets.AGED_WOOD_SHINGLES); - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base(), 4) - .input(GenericBlockSets.AGED_WOOD.blockSet.base()) - .criterion(hasItem(GenericBlockSets.AGED_WOOD.blockSet.base()), - conditionsFromItem(GenericBlockSets.AGED_WOOD.blockSet.base())) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, Registries.BLOCK.getId(GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base()).getPath() + "_from_wood"))); + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base(), 4) + .requires(GenericBlockSets.AGED_WOOD.blockSet.base()) + .unlockedBy(getHasName(GenericBlockSets.AGED_WOOD.blockSet.base()), + has(GenericBlockSets.AGED_WOOD.blockSet.base())) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, BuiltInRegistries.BLOCK.getKey(GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base()).getPath() + "_from_wood"))); - createBrickRecipe(exporter, GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base().asItem(), GenericBlockSets.AGED_WOOD_PANELS.blockSet.base(), 4); + createBrickRecipe(recipeOutput, GenericBlockSets.AGED_WOOD_PLANKS.blockSet.base().asItem(), GenericBlockSets.AGED_WOOD_PANELS.blockSet.base(), 4); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_CARVING.blockSet.base(), 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_CARVING.blockSet.base(), 1) .pattern("S") .pattern("S") - .input('S', GenericBlockSets.AGED_WOOD_BEAM.blockSet.slab()) - .criterion(hasItem(GenericBlockSets.AGED_WOOD_BEAM.blockSet.slab()), - conditionsFromItem(GenericBlockSets.AGED_WOOD_BEAM.blockSet.slab())) - .offerTo(exporter); - createGenericRecipes(GenericBlockSets.AGED_WOOD_CARVING); + .define('S', GenericBlockSets.AGED_WOOD_BEAM.blockSet.slab()) + .unlockedBy(getHasName(GenericBlockSets.AGED_WOOD_BEAM.blockSet.slab()), + has(GenericBlockSets.AGED_WOOD_BEAM.blockSet.slab())) + .save(recipeOutput); - createBrickRecipe(exporter, GenericBlockSets.AGED_WOOD_PANELS.blockSet.base().asItem(), GenericBlockSets.AGED_WOOD_BOARDS.blockSet.base(), 4); + createBrickRecipe(recipeOutput, GenericBlockSets.AGED_WOOD_PANELS.blockSet.base().asItem(), GenericBlockSets.AGED_WOOD_BOARDS.blockSet.base(), 4); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_FISH_CARVING.blockSet.base(), 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_FISH_CARVING.blockSet.base(), 1) .pattern("S") .pattern("S") - .input('S', GenericBlockSets.AGED_WOOD_CARVING.blockSet.slab()) - .criterion(hasItem(GenericBlockSets.AGED_WOOD_CARVING.blockSet.slab()), - conditionsFromItem(GenericBlockSets.AGED_WOOD_CARVING.blockSet.slab())) - .offerTo(exporter); + .define('S', GenericBlockSets.AGED_WOOD_CARVING.blockSet.slab()) + .unlockedBy(getHasName(GenericBlockSets.AGED_WOOD_CARVING.blockSet.slab()), + has(GenericBlockSets.AGED_WOOD_CARVING.blockSet.slab())) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_CARVED_BEAM.blockSet.base(), 3) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_CARVED_BEAM.blockSet.base(), 3) .pattern("P") .pattern("P") .pattern("P") - .input('P', GenericBlockSets.AGED_WOOD_BEAM.blockSet.base()) - .criterion(hasItem(GenericBlockSets.AGED_WOOD_BEAM.blockSet.base()), - conditionsFromItem(GenericBlockSets.AGED_WOOD_BEAM.blockSet.base())) - .offerTo(exporter); + .define('P', GenericBlockSets.AGED_WOOD_BEAM.blockSet.base()) + .unlockedBy(getHasName(GenericBlockSets.AGED_WOOD_BEAM.blockSet.base()), + has(GenericBlockSets.AGED_WOOD_BEAM.blockSet.base())) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_KNOTTED_BEAM.blockSet.base(), 6) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_KNOTTED_BEAM.blockSet.base(), 6) .pattern("PW") .pattern("WP") .pattern("PW") - .input('W', GenericBlockSets.AGED_WOOD.blockSet.base()) - .input('P', GenericBlockSets.AGED_WOOD_BEAM.blockSet.base()) - .criterion(hasItem(GenericBlockSets.AGED_WOOD_BEAM.blockSet.base()), - conditionsFromItem(GenericBlockSets.AGED_WOOD_BEAM.blockSet.base())) - .offerTo(exporter); + .define('W', GenericBlockSets.AGED_WOOD.blockSet.base()) + .define('P', GenericBlockSets.AGED_WOOD_BEAM.blockSet.base()) + .unlockedBy(getHasName(GenericBlockSets.AGED_WOOD_BEAM.blockSet.base()), + has(GenericBlockSets.AGED_WOOD_BEAM.blockSet.base())) + .save(recipeOutput); //endregion //region AGED_WOOD_REDDISH - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_REDDISH_BEAM.blockSet.base(), 8) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_REDDISH_BEAM.blockSet.base(), 8) .pattern("PPP") .pattern("PRP") .pattern("PPP") - .input('P', GenericBlockSets.AGED_WOOD_BEAM.blockSet.base()) - .input('R', Items.RED_DYE) - .criterion(hasItem(GenericBlockSets.AGED_WOOD_BEAM.blockSet.base()), - conditionsFromItem(GenericBlockSets.AGED_WOOD_BEAM.blockSet.base())) - .offerTo(exporter); + .define('P', GenericBlockSets.AGED_WOOD_BEAM.blockSet.base()) + .define('R', Items.RED_DYE) + .unlockedBy(getHasName(GenericBlockSets.AGED_WOOD_BEAM.blockSet.base()), + has(GenericBlockSets.AGED_WOOD_BEAM.blockSet.base())) + .save(recipeOutput); createGenericRecipes(GenericBlockSets.AGED_WOOD_REDDISH_BEAM); //endregion //region AGED_WOOD_GILDED_CARVED_PILLAR - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_GILDED_CARVED_PILLAR.blockSet.base(), 8) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_GILDED_CARVED_PILLAR.blockSet.base(), 8) .pattern("PPP") .pattern("PGP") .pattern("PPP") - .input('P', GenericBlockSets.AGED_WOOD_BEAM.blockSet.base()) - .input('G', Items.GOLD_NUGGET) - .criterion(hasItem(GenericBlockSets.AGED_WOOD_BEAM.blockSet.base()), - conditionsFromItem(GenericBlockSets.AGED_WOOD_BEAM.blockSet.base())) - .offerTo(exporter); + .define('P', GenericBlockSets.AGED_WOOD_BEAM.blockSet.base()) + .define('G', Items.GOLD_NUGGET) + .unlockedBy(getHasName(GenericBlockSets.AGED_WOOD_BEAM.blockSet.base()), + has(GenericBlockSets.AGED_WOOD_BEAM.blockSet.base())) + .save(recipeOutput); createGenericRecipes(GenericBlockSets.AGED_WOOD_GILDED_CARVED_PILLAR); //endregion //region AGED_WOOD_GILDED_CARVED_PILLAR - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_GILDED_CARVING.blockSet.base(), 8) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_GILDED_CARVING.blockSet.base(), 8) .pattern("PPP") .pattern("PGP") .pattern("PPP") - .input('P', GenericBlockSets.AGED_WOOD_CARVING.blockSet.base()) - .input('G', Items.GOLD_NUGGET) - .criterion(hasItem(GenericBlockSets.AGED_WOOD_CARVING.blockSet.base()), - conditionsFromItem(GenericBlockSets.AGED_WOOD_CARVING.blockSet.base())) - .offerTo(exporter); + .define('P', GenericBlockSets.AGED_WOOD_CARVING.blockSet.base()) + .define('G', Items.GOLD_NUGGET) + .unlockedBy(getHasName(GenericBlockSets.AGED_WOOD_CARVING.blockSet.base()), + has(GenericBlockSets.AGED_WOOD_CARVING.blockSet.base())) + .save(recipeOutput); createGenericRecipes(GenericBlockSets.AGED_WOOD_GILDED_CARVING); //endregion //region AGED_WOOD_GILDED_CARVED_PILLAR - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_GILDED_HORSES.blockSet.base(), 8) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_GILDED_HORSES.blockSet.base(), 8) .pattern("PPP") .pattern("PGP") .pattern("PPP") - .input('P', GenericBlockSets.AGED_WOOD_FISH_CARVING.blockSet.base()) - .input('G', Items.GOLD_NUGGET) - .criterion(hasItem(GenericBlockSets.AGED_WOOD_FISH_CARVING.blockSet.base()), - conditionsFromItem(GenericBlockSets.AGED_WOOD_FISH_CARVING.blockSet.base())) - .offerTo(exporter); + .define('P', GenericBlockSets.AGED_WOOD_FISH_CARVING.blockSet.base()) + .define('G', Items.GOLD_NUGGET) + .unlockedBy(getHasName(GenericBlockSets.AGED_WOOD_FISH_CARVING.blockSet.base()), + has(GenericBlockSets.AGED_WOOD_FISH_CARVING.blockSet.base())) + .save(recipeOutput); createGenericRecipes(GenericBlockSets.AGED_WOOD_GILDED_HORSES); //endregion //region AGED_WOOD_GILDED_CARVED_PILLAR - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_GILDED_TRIM.blockSet.base(), 8) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.AGED_WOOD_GILDED_TRIM.blockSet.base(), 8) .pattern("PPP") .pattern("PGP") .pattern("PPP") - .input('P', GenericBlockSets.AGED_WOOD_PANELS.blockSet.base()) - .input('G', Items.GOLD_NUGGET) - .criterion(hasItem(GenericBlockSets.AGED_WOOD_PANELS.blockSet.base()), - conditionsFromItem(GenericBlockSets.AGED_WOOD_PANELS.blockSet.base())) - .offerTo(exporter); + .define('P', GenericBlockSets.AGED_WOOD_PANELS.blockSet.base()) + .define('G', Items.GOLD_NUGGET) + .unlockedBy(getHasName(GenericBlockSets.AGED_WOOD_PANELS.blockSet.base()), + has(GenericBlockSets.AGED_WOOD_PANELS.blockSet.base())) + .save(recipeOutput); createGenericRecipes(GenericBlockSets.AGED_WOOD_GILDED_TRIM); //endregion - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.OLD_SKULL, 1) - .input(Items.SKELETON_SKULL) - .input(ResourceItemsME.ASH) - .criterion(hasItem(Items.SKELETON_SKULL), - conditionsFromItem(Items.SKELETON_SKULL)) - .offerTo(exporter); + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.OLD_SKULL) + .requires(Items.SKELETON_SKULL) + .requires(ResourceItemsME.ASH) + .unlockedBy(getHasName(Items.SKELETON_SKULL), has(Items.SKELETON_SKULL)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SKELETON, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SKELETON) .pattern("BSB") .pattern(" B ") .pattern("B B") - .input('B', TagKey.of(RegistryKeys.ITEM, MiddleEarth.of("bones"))) - .input('S', ModDecorativeBlocks.OLD_SKULL.asItem()) - .criterion(hasItem(ModDecorativeBlocks.OLD_SKULL.asItem()), - conditionsFromItem(ModDecorativeBlocks.OLD_SKULL.asItem())) - .offerTo(exporter); + .define('B', TagKey.create(Registries.ITEM, MiddleEarth.of("bones"))) + .define('S', ModDecorativeBlocks.OLD_SKULL) + .unlockedBy(getHasName(ModDecorativeBlocks.OLD_SKULL), has(ModDecorativeBlocks.OLD_SKULL)) + .save(recipeOutput); - createCombinedItemRecipe(exporter, Blocks.SKELETON_SKULL, ItemTags.CANDLES, ModDecorativeBlocks.SKULL_CANDLE); + createCombinedItemRecipe(recipeOutput, Blocks.SKELETON_SKULL, ItemTags.CANDLES, ModDecorativeBlocks.SKULL_CANDLE); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CANDLESTICK, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CANDLESTICK, 1) .pattern("C") .pattern("S") .pattern("S") - .input('C', TagKey.of(RegistryKeys.ITEM, Identifier.of("candles"))) - .input('S', ResourceItemsME.STEEL_NUGGET) - .criterion(hasItem(Items.CANDLE), - conditionsFromItem(Items.CANDLE)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CANDLE_HOLDER, 1) + .define('C', TagKey.create(Registries.ITEM, ResourceLocation.parse("candles"))) + .define('S', ResourceItemsME.STEEL_NUGGET) + .unlockedBy(getHasName(Items.CANDLE), + has(Items.CANDLE)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CANDLE_HOLDER, 1) .pattern("C ") .pattern("SS") - .input('C', TagKey.of(RegistryKeys.ITEM, Identifier.of("candles"))) - .input('S', ResourceItemsME.STEEL_NUGGET) - .criterion(hasItem(Items.CANDLE), - conditionsFromItem(Items.CANDLE)) - .offerTo(exporter); + .define('C', TagKey.create(Registries.ITEM, ResourceLocation.parse("candles"))) + .define('S', ResourceItemsME.STEEL_NUGGET) + .unlockedBy(getHasName(Items.CANDLE), + has(Items.CANDLE)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CERAMIC_LAMP, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CERAMIC_LAMP, 1) .pattern("T ") .pattern("BB") - .input('T', Items.TORCH) - .input('B', Items.BRICK) - .criterion(hasItem(Items.BRICK), - conditionsFromItem(Items.BRICK)) - .offerTo(exporter); + .define('T', Items.TORCH) + .define('B', Items.BRICK) + .unlockedBy(getHasName(Items.BRICK), + has(Items.BRICK)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CANDLE_HEAP, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CANDLE_HEAP, 1) .pattern("CCC") .pattern("CCC") - .input('C', TagKey.of(RegistryKeys.ITEM, Identifier.of("candles"))) - .criterion(hasItem(Items.CANDLE), - conditionsFromItem(Items.CANDLE)) - .offerTo(exporter); + .define('C', TagKey.create(Registries.ITEM, ResourceLocation.parse("candles"))) + .unlockedBy(getHasName(Items.CANDLE), + has(Items.CANDLE)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SMALL_CHANDELIER, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SMALL_CHANDELIER) .pattern(" N ") .pattern("CNC") .pattern("N N") - .input('C', TagKey.of(RegistryKeys.ITEM, Identifier.of("candles"))) - .input('N', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_nuggets"))) - .criterion(hasItem(Items.CANDLE), - conditionsFromItem(Items.CANDLE)) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CHANDELIER, 1) + .define('C', ItemTags.CANDLES) + .define('N', TagKey.create(Registries.ITEM, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_nuggets"))) + .unlockedBy(getHasName(Items.CANDLE), has(Items.CANDLE)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CHANDELIER) .pattern(" N ") .pattern("CHC") .pattern("N N") - .input('C', TagKey.of(RegistryKeys.ITEM, Identifier.of("candles"))) - .input('H', ModDecorativeBlocks.SMALL_CHANDELIER) - .input('N', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_nuggets"))) - .criterion(hasItem(Items.CANDLE), - conditionsFromItem(Items.CANDLE)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SMALL_BRONZE_CHANDELIER, 1) + .define('C', ItemTags.CANDLES) + .define('H', ModDecorativeBlocks.SMALL_CHANDELIER) + .define('N', TagKey.create(Registries.ITEM, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_nuggets"))) + .unlockedBy(getHasName(Items.CANDLE), has(Items.CANDLE)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SMALL_BRONZE_CHANDELIER) .pattern(" N ") .pattern("CNC") .pattern("N N") - .input('C', TagKey.of(RegistryKeys.ITEM, Identifier.of("candles"))) - .input('N', ResourceItemsME.BRONZE_NUGGET) - .criterion(hasItem(Items.CANDLE), - conditionsFromItem(Items.CANDLE)) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BRONZE_CHANDELIER, 1) + .define('C', ItemTags.CANDLES) + .define('N', ResourceItemsME.BRONZE_NUGGET) + .unlockedBy(getHasName(Items.CANDLE), has(Items.CANDLE)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BRONZE_CHANDELIER) .pattern(" N ") .pattern("CHC") .pattern("N N") - .input('C', TagKey.of(RegistryKeys.ITEM, Identifier.of("candles"))) - .input('H', ModDecorativeBlocks.SMALL_BRONZE_CHANDELIER) - .input('N', ResourceItemsME.BRONZE_NUGGET) - .criterion(hasItem(Items.CANDLE), - conditionsFromItem(Items.CANDLE)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.STONE_LECTERN.asItem(), 1) + .define('C', ItemTags.CANDLES) + .define('H', ModDecorativeBlocks.SMALL_BRONZE_CHANDELIER) + .define('N', ResourceItemsME.BRONZE_NUGGET) + .unlockedBy(getHasName(Items.CANDLE), has(Items.CANDLE)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.STONE_LECTERN.asItem(), 1) .pattern("SSS") .pattern(" B ") .pattern(" S ") - .input('S', Items.STONE) - .input('B', Items.BOOKSHELF) - .criterion(hasItem(Items.BOOKSHELF), - conditionsFromItem(Items.BOOKSHELF)) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CHISELED_DOLOMITE_BOOKSHELF, 1) + .define('S', Items.STONE) + .define('B', Items.BOOKSHELF) + .unlockedBy(getHasName(Items.BOOKSHELF), + has(Items.BOOKSHELF)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CHISELED_DOLOMITE_BOOKSHELF, 1) .pattern("DDD") .pattern("SSS") .pattern("DDD") - .input('D', StoneBlockSets.DOLOMITE_SET.baseBlocks.base()) - .input('S', StoneBlockSets.DOLOMITE_SET.baseBlocks.slab()) - .criterion(hasItem(Items.BOOKSHELF), - conditionsFromItem(Items.BOOKSHELF)) - .offerTo(exporter); - - createStatueRecipe(exporter, Blocks.POLISHED_BASALT, Blocks.BASALT, StoneBlockSets.BASALT_SET.baseBlocks.wall(), ModDecorativeBlocks.BASALT_STATUE); - createStatueRecipe(exporter, StoneBlockSets.CALCITE_SET.polishedBlocks.base(), Blocks.CALCITE, StoneBlockSets.CALCITE_SET.baseBlocks.wall(), ModDecorativeBlocks.CALCITE_STATUE); - createStatueRecipe(exporter, StoneBlockSets.DEEPSLATE_SET.polishedBlocks.base(), Blocks.DEEPSLATE, StoneBlockSets.DEEPSLATE_SET.baseBlocks.wall(), ModDecorativeBlocks.DEEPSLATE_STATUE); - createStatueRecipe(exporter, StoneBlockSets.DIORITE_SET.polishedBlocks.base(), Blocks.DIORITE, Blocks.DIORITE_WALL, ModDecorativeBlocks.DIORITE_STATUE); - createStatueRecipe(exporter, StoneBlockSets.GABBRO_SET.polishedBlocks.base(), StoneBlockSets.GABBRO_SET.baseBlocks.base(), StoneBlockSets.GABBRO_SET.baseBlocks.wall(), ModDecorativeBlocks.GABBRO_STATUE); - createStatueRecipe(exporter, StoneBlockSets.GALONN_SET.polishedBlocks.base(), StoneBlockSets.GALONN_SET.baseBlocks.base(), StoneBlockSets.GALONN_SET.baseBlocks.wall(), ModDecorativeBlocks.GALONN_STATUE); - createStatueRecipe(exporter, StoneBlockSets.KHAGALABAN_SET.polishedBlocks.base(), StoneBlockSets.KHAGALABAN_SET.baseBlocks.base(), StoneBlockSets.KHAGALABAN_SET.baseBlocks.wall(), ModDecorativeBlocks.KHAGALABAN_STATUE); - createStatueRecipe(exporter, StoneBlockSets.PUMICE_SET.baseBlocks.base(), StoneBlockSets.PUMICE_SET.baseBlocks.base(), StoneBlockSets.PUMICE_SET.baseBlocks.wall(), ModDecorativeBlocks.PUMICE_STATUE); - createStatueRecipe(exporter, Blocks.POLISHED_TUFF, Blocks.TUFF, Blocks.TUFF_WALL, ModDecorativeBlocks.TUFF_STATUE); - createStatueRecipe(exporter, StoneBlockSets.ZIGILABAN_SET.baseBlocks.base(), StoneBlockSets.ZIGILABAN_SET.baseBlocks.base(), StoneBlockSets.ZIGILABAN_SET.baseBlocks.wall(), ModDecorativeBlocks.ZIGILABAN_STATUE); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CERAMIC_PLATE, 1) + .define('D', StoneBlockSets.DOLOMITE_SET.baseBlocks.base()) + .define('S', StoneBlockSets.DOLOMITE_SET.baseBlocks.slab()) + .unlockedBy(getHasName(Items.BOOKSHELF), + has(Items.BOOKSHELF)) + .save(recipeOutput); + + createStatueRecipe(recipeOutput, Blocks.POLISHED_BASALT, Blocks.BASALT, StoneBlockSets.BASALT_SET.baseBlocks.wall(), ModDecorativeBlocks.BASALT_STATUE); + createStatueRecipe(recipeOutput, StoneBlockSets.CALCITE_SET.polishedBlocks.base(), Blocks.CALCITE, StoneBlockSets.CALCITE_SET.baseBlocks.wall(), ModDecorativeBlocks.CALCITE_STATUE); + createStatueRecipe(recipeOutput, StoneBlockSets.DEEPSLATE_SET.polishedBlocks.base(), Blocks.DEEPSLATE, StoneBlockSets.DEEPSLATE_SET.baseBlocks.wall(), ModDecorativeBlocks.DEEPSLATE_STATUE); + createStatueRecipe(recipeOutput, StoneBlockSets.DIORITE_SET.polishedBlocks.base(), Blocks.DIORITE, Blocks.DIORITE_WALL, ModDecorativeBlocks.DIORITE_STATUE); + createStatueRecipe(recipeOutput, StoneBlockSets.GABBRO_SET.polishedBlocks.base(), StoneBlockSets.GABBRO_SET.baseBlocks.base(), StoneBlockSets.GABBRO_SET.baseBlocks.wall(), ModDecorativeBlocks.GABBRO_STATUE); + createStatueRecipe(recipeOutput, StoneBlockSets.GALONN_SET.polishedBlocks.base(), StoneBlockSets.GALONN_SET.baseBlocks.base(), StoneBlockSets.GALONN_SET.baseBlocks.wall(), ModDecorativeBlocks.GALONN_STATUE); + createStatueRecipe(recipeOutput, StoneBlockSets.KHAGALABAN_SET.polishedBlocks.base(), StoneBlockSets.KHAGALABAN_SET.baseBlocks.base(), StoneBlockSets.KHAGALABAN_SET.baseBlocks.wall(), ModDecorativeBlocks.KHAGALABAN_STATUE); + createStatueRecipe(recipeOutput, StoneBlockSets.PUMICE_SET.baseBlocks.base(), StoneBlockSets.PUMICE_SET.baseBlocks.base(), StoneBlockSets.PUMICE_SET.baseBlocks.wall(), ModDecorativeBlocks.PUMICE_STATUE); + createStatueRecipe(recipeOutput, Blocks.POLISHED_TUFF, Blocks.TUFF, Blocks.TUFF_WALL, ModDecorativeBlocks.TUFF_STATUE); + createStatueRecipe(recipeOutput, StoneBlockSets.ZIGILABAN_SET.baseBlocks.base(), StoneBlockSets.ZIGILABAN_SET.baseBlocks.base(), StoneBlockSets.ZIGILABAN_SET.baseBlocks.wall(), ModDecorativeBlocks.ZIGILABAN_STATUE); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CERAMIC_PLATE, 1) .pattern("BB") - .input('B', Items.BRICK) - .criterion(hasItem(Items.BRICK), - conditionsFromItem(Items.BRICK)) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.ROTTEN_PLATE, 4) + .define('B', Items.BRICK) + .unlockedBy(getHasName(Items.BRICK), + has(Items.BRICK)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.ROTTEN_PLATE, 4) .pattern("RR") - .input('R', WoodBlockSets.ROTTEN_SET.logBlocks.log()) - .criterion(hasItem(WoodBlockSets.ROTTEN_SET.logBlocks.log()), - conditionsFromItem(WoodBlockSets.ROTTEN_SET.logBlocks.log())) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SILVER_PLATE, 1) + .define('R', WoodBlockSets.ROTTEN_SET.logBlocks.log()) + .unlockedBy(getHasName(WoodBlockSets.ROTTEN_SET.logBlocks.log()), + has(WoodBlockSets.ROTTEN_SET.logBlocks.log())) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SILVER_PLATE, 1) .pattern("SS") - .input('S', ResourceItemsME.SILVER_INGOT) - .criterion(hasItem(ResourceItemsME.SILVER_INGOT), - conditionsFromItem(ResourceItemsME.SILVER_INGOT)) - .offerTo(exporter); + .define('S', ResourceItemsME.SILVER_INGOT) + .unlockedBy(getHasName(ResourceItemsME.SILVER_INGOT), + has(ResourceItemsME.SILVER_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.MEDGON_SPIKE, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.MEDGON_SPIKE, 1) .pattern("M ") .pattern("MM ") .pattern("PMP") - .input('M', StoneBlockSets.MEDGON_SET.baseBlocks.base()) - .input('P', StoneBlockSets.MEDGON_SET.polishedBlocks.base()) - .criterion(hasItem(StoneBlockSets.MEDGON_SET.baseBlocks.base()), - conditionsFromItem(StoneBlockSets.MEDGON_SET.baseBlocks.base())) - .offerTo(exporter); + .define('M', StoneBlockSets.MEDGON_SET.baseBlocks.base()) + .define('P', StoneBlockSets.MEDGON_SET.polishedBlocks.base()) + .unlockedBy(getHasName(StoneBlockSets.MEDGON_SET.baseBlocks.base()), + has(StoneBlockSets.MEDGON_SET.baseBlocks.base())) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.BURZUM_SPIKES, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.BURZUM_SPIKES, 4) .pattern(" N ") .pattern("NBN") .pattern("BBB") - .input('B', ResourceItemsME.BURZUM_STEEL_INGOT) - .input('N', ResourceItemsME.BURZUM_STEEL_NUGGET) - .criterion(hasItem(ResourceItemsME.BURZUM_STEEL_INGOT), - conditionsFromItem(ResourceItemsME.BURZUM_STEEL_INGOT)) - .offerTo(exporter); + .define('B', ResourceItemsME.BURZUM_STEEL_INGOT) + .define('N', ResourceItemsME.BURZUM_STEEL_NUGGET) + .unlockedBy(getHasName(ResourceItemsME.BURZUM_STEEL_INGOT), + has(ResourceItemsME.BURZUM_STEEL_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.TAPPER, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.TAPPER, 1) .pattern(" S ") .pattern("LBL") .pattern(" L ") - .input('S', ResourceItemsME.STEEL_NUGGET) - .input('L', ItemTags.LOGS) - .input('B', Items.BUCKET) - .criterion(hasItem(Items.BUCKET), - conditionsFromItem(Items.BUCKET)); + .define('S', ResourceItemsME.STEEL_NUGGET) + .define('L', ItemTags.LOGS) + .define('B', Items.BUCKET) + .unlockedBy(getHasName(Items.BUCKET), + has(Items.BUCKET)); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.ORCISH_DRUM, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.ORCISH_DRUM, 1) .pattern("SLS") .pattern("W W") .pattern(" W ") - .input('S', Items.STICK) - .input('W', ItemTags.LOGS) - .input('L', Items.LEATHER) - .criterion(hasItem(Items.LEATHER), - conditionsFromItem(Items.LEATHER)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.WATTLE_AND_BRICK_WINDOW, 4) + .define('S', Items.STICK) + .define('W', ItemTags.LOGS) + .define('L', Items.LEATHER) + .unlockedBy(getHasName(Items.LEATHER), + has(Items.LEATHER)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.WATTLE_AND_BRICK_WINDOW, 4) .pattern("BSB") .pattern("SGS") .pattern("BSB") - .input('B', Items.BRICKS) - .input('G', Items.GLASS) - .input('S', Items.STICK) - .criterion(hasItem(Items.BRICKS), - conditionsFromItem(Items.BRICKS)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.WATTLE_FRAMED_WINDOW, 2) + .define('B', Items.BRICKS) + .define('G', Items.GLASS) + .define('S', Items.STICK) + .unlockedBy(getHasName(Items.BRICKS), + has(Items.BRICKS)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.WATTLE_FRAMED_WINDOW, 2) .pattern("SSS") .pattern("SGS") .pattern("SSS") - .input('G', Items.GLASS) - .input('S', Items.STICK) - .criterion(hasItem(Items.STICK), - conditionsFromItem(Items.STICK)) - .offerTo(exporter); - - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.WATTLE_FRAMED_WINDOW.asItem(), Items.GRAY_DYE, ModDecorativeBlocks.DARK_WATTLE_FRAMED_WINDOW.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.WATTLE_FRAMED_WINDOW.asItem(), Items.BLACK_DYE, ModDecorativeBlocks.BLACK_WATTLE_FRAMED_WINDOW.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.WATTLE_FRAMED_WINDOW.asItem(), Items.GREEN_DYE, ModDecorativeBlocks.GREEN_WATTLE_FRAMED_WINDOW.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.WATTLE_FRAMED_WINDOW.asItem(), Items.RED_DYE, ModDecorativeBlocks.RED_WATTLE_FRAMED_WINDOW.asItem(), 8); - createCenterSurroundRecipe(exporter, ModDecorativeBlocks.WATTLE_FRAMED_WINDOW.asItem(), Items.WHITE_DYE, ModDecorativeBlocks.WHITE_WATTLE_FRAMED_WINDOW.asItem(), 8); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.MUD_BRICK_ROUND_WINDOW, 4) + .define('G', Items.GLASS) + .define('S', Items.STICK) + .unlockedBy(getHasName(Items.STICK), + has(Items.STICK)) + .save(recipeOutput); + + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.WATTLE_FRAMED_WINDOW.asItem(), Items.GRAY_DYE, ModDecorativeBlocks.DARK_WATTLE_FRAMED_WINDOW.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.WATTLE_FRAMED_WINDOW.asItem(), Items.BLACK_DYE, ModDecorativeBlocks.BLACK_WATTLE_FRAMED_WINDOW.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.WATTLE_FRAMED_WINDOW.asItem(), Items.GREEN_DYE, ModDecorativeBlocks.GREEN_WATTLE_FRAMED_WINDOW.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.WATTLE_FRAMED_WINDOW.asItem(), Items.RED_DYE, ModDecorativeBlocks.RED_WATTLE_FRAMED_WINDOW.asItem(), 8); + createCenterSurroundRecipe(recipeOutput, ModDecorativeBlocks.WATTLE_FRAMED_WINDOW.asItem(), Items.WHITE_DYE, ModDecorativeBlocks.WHITE_WATTLE_FRAMED_WINDOW.asItem(), 8); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.MUD_BRICK_ROUND_WINDOW, 4) .pattern("MBM") .pattern("BGB") .pattern("MBM") - .input('M', Items.MUD_BRICKS) - .input('G', Items.GLASS) - .input('B', Items.BRICK) - .criterion(hasItem(Items.BRICKS), - conditionsFromItem(Items.BRICKS)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.WHITE_DAUB_ROUND_WINDOW, 4) + .define('M', Items.MUD_BRICKS) + .define('G', Items.GLASS) + .define('B', Items.BRICK) + .unlockedBy(getHasName(Items.BRICKS), + has(Items.BRICKS)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.WHITE_DAUB_ROUND_WINDOW, 4) .pattern("WSW") .pattern("SGS") .pattern("WSW") - .input('W', GenericBlockSets.WHITE_DAUB.blockSet.base()) - .input('G', Items.GLASS) - .input('S', Items.STICK) - .criterion(hasItem(GenericBlockSets.WHITE_DAUB.blockSet.base()), - conditionsFromItem(GenericBlockSets.WHITE_DAUB.blockSet.base())) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.YELLOW_DAUB_ROUND_WINDOW, 4) + .define('W', GenericBlockSets.WHITE_DAUB.blockSet.base()) + .define('G', Items.GLASS) + .define('S', Items.STICK) + .unlockedBy(getHasName(GenericBlockSets.WHITE_DAUB.blockSet.base()), + has(GenericBlockSets.WHITE_DAUB.blockSet.base())) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.YELLOW_DAUB_ROUND_WINDOW, 4) .pattern("WSW") .pattern("SGS") .pattern("WSW") - .input('W', GenericBlockSets.YELLOW_DAUB.blockSet.base()) - .input('G', Items.GLASS) - .input('S', Items.STICK) - .criterion(hasItem(GenericBlockSets.YELLOW_DAUB.blockSet.base()), - conditionsFromItem(GenericBlockSets.YELLOW_DAUB.blockSet.base())) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.PLASTER_ROUND_WINDOW, 4) + .define('W', GenericBlockSets.YELLOW_DAUB.blockSet.base()) + .define('G', Items.GLASS) + .define('S', Items.STICK) + .unlockedBy(getHasName(GenericBlockSets.YELLOW_DAUB.blockSet.base()), + has(GenericBlockSets.YELLOW_DAUB.blockSet.base())) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.PLASTER_ROUND_WINDOW, 4) .pattern("WSW") .pattern("SGS") .pattern("WSW") - .input('W', GenericBlockSets.PLASTER.blockSet.base()) - .input('G', Items.GLASS) - .input('S', Items.STICK) - .criterion(hasItem(GenericBlockSets.PLASTER.blockSet.base()), - conditionsFromItem(GenericBlockSets.PLASTER.blockSet.base())) - .offerTo(exporter); - - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.CUT_BRONZE.blockSet.base(), ModBlocks.BRONZE_BLOCK, 4); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.CUT_CRUDE_PLATES.blockSet.base(), ModBlocks.CRUDE_BLOCK, 4); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.CUT_LEAD.blockSet.base(), ModBlocks.LEAD_BLOCK, 4); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.CUT_SILVER.blockSet.base(), ModBlocks.SILVER_BLOCK, 4); - - createCushionRecipe(exporter, Blocks.BLUE_WOOL, ModDecorativeBlocks.BLUE_CUSHION); - createDyeableItemRecipe(exporter, ModDecorativeBlocks.BLUE_CUSHION, Items.GRAY_DYE, ModDecorativeBlocks.DARK_BLUE_CUSHION); - createCushionRecipe(exporter, Blocks.BROWN_WOOL, ModDecorativeBlocks.BROWN_CUSHION); - createDyeableItemRecipe(exporter, ModDecorativeBlocks.BROWN_CUSHION, Items.GRAY_DYE, ModDecorativeBlocks.DARK_BROWN_CUSHION); - createCushionRecipe(exporter, Blocks.GREEN_WOOL, ModDecorativeBlocks.GREEN_CUSHION); - createDyeableItemRecipe(exporter, ModDecorativeBlocks.GREEN_CUSHION, Items.GRAY_DYE, ModDecorativeBlocks.DARK_GREEN_CUSHION); - createCushionRecipe(exporter, Blocks.RED_WOOL, ModDecorativeBlocks.RED_CUSHION); - createDyeableItemRecipe(exporter, ModDecorativeBlocks.RED_CUSHION, Items.GRAY_DYE, ModDecorativeBlocks.DARK_RED_CUSHION); - - createSmallCurtainRecipe(exporter, Blocks.BLACK_WOOL, ModDecorativeBlocks.SMALL_BLACK_CURTAIN); - createSmallCurtainRecipe(exporter, Blocks.BLUE_WOOL, ModDecorativeBlocks.SMALL_BLUE_CURTAIN); - createSmallCurtainRecipe(exporter, Blocks.BROWN_WOOL, ModDecorativeBlocks.SMALL_BROWN_CURTAIN); - createDyeableItemRecipe(exporter, ModDecorativeBlocks.SMALL_BLUE_CURTAIN, Items.GRAY_DYE, ModDecorativeBlocks.SMALL_DARK_BLUE_CURTAIN); - createDyeableItemRecipe(exporter, ModDecorativeBlocks.SMALL_BROWN_CURTAIN, Items.GRAY_DYE, ModDecorativeBlocks.SMALL_DARK_BROWN_CURTAIN); - createDyeableItemRecipe(exporter, ModDecorativeBlocks.SMALL_GREEN_CURTAIN, Items.GRAY_DYE, ModDecorativeBlocks.SMALL_DARK_GREEN_CURTAIN); - createDyeableItemRecipe(exporter, ModDecorativeBlocks.SMALL_RED_CURTAIN, Items.GRAY_DYE, ModDecorativeBlocks.SMALL_DARK_RED_CURTAIN); - createSmallFancyCurtainRecipe(exporter, Blocks.BLUE_WOOL, ModDecorativeBlocks.SMALL_FANCY_BLUE_CURTAIN); - createSmallFancyCurtainRecipe(exporter, Blocks.GREEN_WOOL, ModDecorativeBlocks.SMALL_FANCY_GREEN_CURTAIN); - createSmallFancyCurtainRecipe(exporter, Blocks.RED_WOOL, ModDecorativeBlocks.SMALL_FANCY_RED_CURTAIN); - createSmallCurtainRecipe(exporter, Blocks.GRAY_WOOL, ModDecorativeBlocks.SMALL_GRAY_CURTAIN); - createSmallCurtainRecipe(exporter, Blocks.GREEN_WOOL, ModDecorativeBlocks.SMALL_GREEN_CURTAIN); - createSmallCurtainRecipe(exporter, Blocks.PURPLE_WOOL, ModDecorativeBlocks.SMALL_PURPLE_CURTAIN); - createSmallCurtainRecipe(exporter, Blocks.RED_WOOL, ModDecorativeBlocks.SMALL_RED_CURTAIN); - createSmallCurtainRecipe(exporter, Blocks.WHITE_WOOL, ModDecorativeBlocks.SMALL_WHITE_CURTAIN); - createSmallCurtainRecipe(exporter, Blocks.YELLOW_WOOL, ModDecorativeBlocks.SMALL_YELLOW_CURTAIN); - - createCurtainRecipe(exporter, Blocks.BLACK_WOOL, ModDecorativeBlocks.BLACK_CURTAIN); - createCurtainRecipe(exporter, Blocks.BLUE_WOOL, ModDecorativeBlocks.BLUE_CURTAIN); - createCurtainRecipe(exporter, Blocks.BROWN_WOOL, ModDecorativeBlocks.BROWN_CURTAIN); - createDyeableItemRecipe(exporter, ModDecorativeBlocks.BLUE_CURTAIN, Items.GRAY_DYE, ModDecorativeBlocks.DARK_BLUE_CURTAIN); - createDyeableItemRecipe(exporter, ModDecorativeBlocks.BROWN_CURTAIN, Items.GRAY_DYE, ModDecorativeBlocks.DARK_BROWN_CURTAIN); - createDyeableItemRecipe(exporter, ModDecorativeBlocks.GREEN_CURTAIN, Items.GRAY_DYE, ModDecorativeBlocks.DARK_GREEN_CURTAIN); - createDyeableItemRecipe(exporter, ModDecorativeBlocks.RED_CURTAIN, Items.GRAY_DYE, ModDecorativeBlocks.DARK_RED_CURTAIN); - createFancyCurtainRecipe(exporter, Blocks.BLUE_WOOL, ModDecorativeBlocks.FANCY_BLUE_CURTAIN); - createFancyCurtainRecipe(exporter, Blocks.GREEN_WOOL, ModDecorativeBlocks.FANCY_GREEN_CURTAIN); - createFancyCurtainRecipe(exporter, Blocks.RED_WOOL, ModDecorativeBlocks.FANCY_RED_CURTAIN); - createCurtainRecipe(exporter, Blocks.GRAY_WOOL, ModDecorativeBlocks.GRAY_CURTAIN); - createCurtainRecipe(exporter, Blocks.GREEN_WOOL, ModDecorativeBlocks.GREEN_CURTAIN); - createCurtainRecipe(exporter, Blocks.PURPLE_WOOL, ModDecorativeBlocks.PURPLE_CURTAIN); - createCurtainRecipe(exporter, Blocks.RED_WOOL, ModDecorativeBlocks.RED_CURTAIN); - createCurtainRecipe(exporter, Blocks.WHITE_WOOL, ModDecorativeBlocks.WHITE_CURTAIN); - createCurtainRecipe(exporter, Blocks.YELLOW_WOOL, ModDecorativeBlocks.YELLOW_CURTAIN); + .define('W', GenericBlockSets.PLASTER.blockSet.base()) + .define('G', Items.GLASS) + .define('S', Items.STICK) + .unlockedBy(getHasName(GenericBlockSets.PLASTER.blockSet.base()), + has(GenericBlockSets.PLASTER.blockSet.base())) + .save(recipeOutput); + + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.CUT_BRONZE.blockSet.base(), ModBlocks.BRONZE_BLOCK, 4); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.CUT_CRUDE_PLATES.blockSet.base(), ModBlocks.CRUDE_BLOCK, 4); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.CUT_LEAD.blockSet.base(), ModBlocks.LEAD_BLOCK, 4); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.CUT_SILVER.blockSet.base(), ModBlocks.SILVER_BLOCK, 4); + + createCushionRecipe(recipeOutput, Blocks.BLUE_WOOL, ModDecorativeBlocks.BLUE_CUSHION); + createDyeableItemRecipe(recipeOutput, ModDecorativeBlocks.BLUE_CUSHION, Items.GRAY_DYE, ModDecorativeBlocks.DARK_BLUE_CUSHION); + createCushionRecipe(recipeOutput, Blocks.BROWN_WOOL, ModDecorativeBlocks.BROWN_CUSHION); + createDyeableItemRecipe(recipeOutput, ModDecorativeBlocks.BROWN_CUSHION, Items.GRAY_DYE, ModDecorativeBlocks.DARK_BROWN_CUSHION); + createCushionRecipe(recipeOutput, Blocks.GREEN_WOOL, ModDecorativeBlocks.GREEN_CUSHION); + createDyeableItemRecipe(recipeOutput, ModDecorativeBlocks.GREEN_CUSHION, Items.GRAY_DYE, ModDecorativeBlocks.DARK_GREEN_CUSHION); + createCushionRecipe(recipeOutput, Blocks.RED_WOOL, ModDecorativeBlocks.RED_CUSHION); + createDyeableItemRecipe(recipeOutput, ModDecorativeBlocks.RED_CUSHION, Items.GRAY_DYE, ModDecorativeBlocks.DARK_RED_CUSHION); + + createSmallCurtainRecipe(recipeOutput, Blocks.BLACK_WOOL, ModDecorativeBlocks.SMALL_BLACK_CURTAIN); + createSmallCurtainRecipe(recipeOutput, Blocks.BLUE_WOOL, ModDecorativeBlocks.SMALL_BLUE_CURTAIN); + createSmallCurtainRecipe(recipeOutput, Blocks.BROWN_WOOL, ModDecorativeBlocks.SMALL_BROWN_CURTAIN); + createDyeableItemRecipe(recipeOutput, ModDecorativeBlocks.SMALL_BLUE_CURTAIN, Items.GRAY_DYE, ModDecorativeBlocks.SMALL_DARK_BLUE_CURTAIN); + createDyeableItemRecipe(recipeOutput, ModDecorativeBlocks.SMALL_BROWN_CURTAIN, Items.GRAY_DYE, ModDecorativeBlocks.SMALL_DARK_BROWN_CURTAIN); + createDyeableItemRecipe(recipeOutput, ModDecorativeBlocks.SMALL_GREEN_CURTAIN, Items.GRAY_DYE, ModDecorativeBlocks.SMALL_DARK_GREEN_CURTAIN); + createDyeableItemRecipe(recipeOutput, ModDecorativeBlocks.SMALL_RED_CURTAIN, Items.GRAY_DYE, ModDecorativeBlocks.SMALL_DARK_RED_CURTAIN); + createSmallFancyCurtainRecipe(recipeOutput, Blocks.BLUE_WOOL, ModDecorativeBlocks.SMALL_FANCY_BLUE_CURTAIN); + createSmallFancyCurtainRecipe(recipeOutput, Blocks.GREEN_WOOL, ModDecorativeBlocks.SMALL_FANCY_GREEN_CURTAIN); + createSmallFancyCurtainRecipe(recipeOutput, Blocks.RED_WOOL, ModDecorativeBlocks.SMALL_FANCY_RED_CURTAIN); + createSmallCurtainRecipe(recipeOutput, Blocks.GRAY_WOOL, ModDecorativeBlocks.SMALL_GRAY_CURTAIN); + createSmallCurtainRecipe(recipeOutput, Blocks.GREEN_WOOL, ModDecorativeBlocks.SMALL_GREEN_CURTAIN); + createSmallCurtainRecipe(recipeOutput, Blocks.PURPLE_WOOL, ModDecorativeBlocks.SMALL_PURPLE_CURTAIN); + createSmallCurtainRecipe(recipeOutput, Blocks.RED_WOOL, ModDecorativeBlocks.SMALL_RED_CURTAIN); + createSmallCurtainRecipe(recipeOutput, Blocks.WHITE_WOOL, ModDecorativeBlocks.SMALL_WHITE_CURTAIN); + createSmallCurtainRecipe(recipeOutput, Blocks.YELLOW_WOOL, ModDecorativeBlocks.SMALL_YELLOW_CURTAIN); + + createCurtainRecipe(recipeOutput, Blocks.BLACK_WOOL, ModDecorativeBlocks.BLACK_CURTAIN); + createCurtainRecipe(recipeOutput, Blocks.BLUE_WOOL, ModDecorativeBlocks.BLUE_CURTAIN); + createCurtainRecipe(recipeOutput, Blocks.BROWN_WOOL, ModDecorativeBlocks.BROWN_CURTAIN); + createDyeableItemRecipe(recipeOutput, ModDecorativeBlocks.BLUE_CURTAIN, Items.GRAY_DYE, ModDecorativeBlocks.DARK_BLUE_CURTAIN); + createDyeableItemRecipe(recipeOutput, ModDecorativeBlocks.BROWN_CURTAIN, Items.GRAY_DYE, ModDecorativeBlocks.DARK_BROWN_CURTAIN); + createDyeableItemRecipe(recipeOutput, ModDecorativeBlocks.GREEN_CURTAIN, Items.GRAY_DYE, ModDecorativeBlocks.DARK_GREEN_CURTAIN); + createDyeableItemRecipe(recipeOutput, ModDecorativeBlocks.RED_CURTAIN, Items.GRAY_DYE, ModDecorativeBlocks.DARK_RED_CURTAIN); + createFancyCurtainRecipe(recipeOutput, Blocks.BLUE_WOOL, ModDecorativeBlocks.FANCY_BLUE_CURTAIN); + createFancyCurtainRecipe(recipeOutput, Blocks.GREEN_WOOL, ModDecorativeBlocks.FANCY_GREEN_CURTAIN); + createFancyCurtainRecipe(recipeOutput, Blocks.RED_WOOL, ModDecorativeBlocks.FANCY_RED_CURTAIN); + createCurtainRecipe(recipeOutput, Blocks.GRAY_WOOL, ModDecorativeBlocks.GRAY_CURTAIN); + createCurtainRecipe(recipeOutput, Blocks.GREEN_WOOL, ModDecorativeBlocks.GREEN_CURTAIN); + createCurtainRecipe(recipeOutput, Blocks.PURPLE_WOOL, ModDecorativeBlocks.PURPLE_CURTAIN); + createCurtainRecipe(recipeOutput, Blocks.RED_WOOL, ModDecorativeBlocks.RED_CURTAIN); + createCurtainRecipe(recipeOutput, Blocks.WHITE_WOOL, ModDecorativeBlocks.WHITE_CURTAIN); + createCurtainRecipe(recipeOutput, Blocks.YELLOW_WOOL, ModDecorativeBlocks.YELLOW_CURTAIN); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.ROPE_LADDER, 3) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.ROPE_LADDER, 3) .pattern("R R") .pattern("RSR") .pattern("R R") - .input('R', ModDecorativeBlocks.ROPE) - .input('S', Items.STRING) - .criterion(hasItem(ModDecorativeBlocks.ROPE), - conditionsFromItem(ModDecorativeBlocks.ROPE)) - .offerTo(exporter); + .define('R', ModDecorativeBlocks.ROPE) + .define('S', Items.STRING) + .unlockedBy(getHasName(ModDecorativeBlocks.ROPE), + has(ModDecorativeBlocks.ROPE)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.FANCY_BED, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.FANCY_BED, 1) .pattern("FFW") .pattern("FFW") .pattern("PPP") - .input('W', TagKey.of(RegistryKeys.ITEM, Identifier.of("wool"))) - .input('F', ResourceItemsME.FABRIC) - .input('P', TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.FABRIC), - conditionsFromItem(ResourceItemsME.FABRIC)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.STRAW_BED, 1) + .define('W', TagKey.create(Registries.ITEM, ResourceLocation.parse("wool"))) + .define('F', ResourceItemsME.FABRIC) + .define('P', TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.FABRIC), + has(ResourceItemsME.FABRIC)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.STRAW_BED, 1) .pattern("SSS") .pattern("PPP") - .input('S', ResourceItemsME.STRAW) - .input('P', TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.STRAW), - conditionsFromItem(ResourceItemsME.STRAW)) - .offerTo(exporter); + .define('S', ResourceItemsME.STRAW) + .define('P', TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.STRAW), + has(ResourceItemsME.STRAW)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.FUR_BED, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.FUR_BED, 1) .pattern("FFF") .pattern("PPP") - .input('F', ResourceItemsME.FUR) - .input('P', TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ResourceItemsME.FUR), - conditionsFromItem(ResourceItemsME.FUR)) - .offerTo(exporter); - - createCenterSurroundRecipe(exporter, ResourceItemsME.SILVER_NUGGET, Items.TORCH, DecorativeItemsME.SILVER_LANTERN, 1); - createCenterSurroundRecipe(exporter, ResourceItemsME.KHAZAD_STEEL_NUGGET, Items.TORCH, DecorativeItemsME.DWARVEN_LANTERN, 1); - createCenterSurroundRecipe(exporter, ResourceItemsME.EDHEL_STEEL_NUGGET, Items.TORCH, DecorativeItemsME.ELVEN_LANTERN, 1); - createCenterSurroundRecipe(exporter, ResourceItemsME.STEEL_NUGGET, Items.TORCH, DecorativeItemsME.TREATED_STEEL_LANTERN, 1); - createCenterSurroundRecipe(exporter, ResourceItemsME.CRUDE_NUGGET, Items.TORCH, DecorativeItemsME.CRUDE_LANTERN, 1); - createCenterSurroundRecipe(exporter, ResourceItemsME.LEAD_NUGGET, Items.TORCH, DecorativeItemsME.LEAD_LANTERN, 1); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, DecorativeItemsME.CRYSTAL_LAMP, 1) + .define('F', ResourceItemsME.FUR) + .define('P', TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ResourceItemsME.FUR), + has(ResourceItemsME.FUR)) + .save(recipeOutput); + + createCenterSurroundRecipe(recipeOutput, ResourceItemsME.SILVER_NUGGET, Items.TORCH, DecorativeItemsME.SILVER_LANTERN, 1); + createCenterSurroundRecipe(recipeOutput, ResourceItemsME.KHAZAD_STEEL_NUGGET, Items.TORCH, DecorativeItemsME.DWARVEN_LANTERN, 1); + createCenterSurroundRecipe(recipeOutput, ResourceItemsME.EDHEL_STEEL_NUGGET, Items.TORCH, DecorativeItemsME.ELVEN_LANTERN, 1); + createCenterSurroundRecipe(recipeOutput, ResourceItemsME.STEEL_NUGGET, Items.TORCH, DecorativeItemsME.TREATED_STEEL_LANTERN, 1); + createCenterSurroundRecipe(recipeOutput, ResourceItemsME.CRUDE_NUGGET, Items.TORCH, DecorativeItemsME.CRUDE_LANTERN, 1); + createCenterSurroundRecipe(recipeOutput, ResourceItemsME.LEAD_NUGGET, Items.TORCH, DecorativeItemsME.LEAD_LANTERN, 1); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, DecorativeItemsME.CRYSTAL_LAMP, 1) .pattern("NGN") .pattern("GLG") .pattern("NIN") - .input('N', ResourceItemsME.BRONZE_NUGGET) - .input('I', ResourceItemsME.BRONZE_INGOT) - .input('L', TagKey.of(RegistryKeys.ITEM, Identifier.of("candles"))) - .input('G', ResourceItemsME.QUARTZ_SHARD) - .criterion(hasItem(ResourceItemsME.QUARTZ_SHARD), - conditionsFromItem(ResourceItemsME.QUARTZ_SHARD)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, DecorativeItemsME.SCONCE, 4) + .define('N', ResourceItemsME.BRONZE_NUGGET) + .define('I', ResourceItemsME.BRONZE_INGOT) + .define('L', TagKey.create(Registries.ITEM, ResourceLocation.parse("candles"))) + .define('G', ResourceItemsME.QUARTZ_SHARD) + .unlockedBy(getHasName(ResourceItemsME.QUARTZ_SHARD), + has(ResourceItemsME.QUARTZ_SHARD)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, DecorativeItemsME.SCONCE, 4) .pattern("NTN") .pattern(" I ") - .input('N', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_nuggets"))) - .input('I', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_ingots"))) - .input('T', Items.TORCH) - .criterion(hasItem(Items.TORCH), - conditionsFromItem(Items.TORCH)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, DecorativeItemsME.GILDED_SCONCE, 4) + .define('N', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_nuggets"))) + .define('I', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_ingots"))) + .define('T', Items.TORCH) + .unlockedBy(getHasName(Items.TORCH), + has(Items.TORCH)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, DecorativeItemsME.GILDED_SCONCE, 4) .pattern("NTN") .pattern(" I ") - .input('N', Items.GOLD_NUGGET) - .input('I', Items.GOLD_INGOT) - .input('T', Items.TORCH) - .criterion(hasItem(Items.TORCH), - conditionsFromItem(Items.TORCH)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, DecorativeItemsME.ORCISH_SCONCE, 2) + .define('N', Items.GOLD_NUGGET) + .define('I', Items.GOLD_INGOT) + .define('T', Items.TORCH) + .unlockedBy(getHasName(Items.TORCH), + has(Items.TORCH)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, DecorativeItemsME.ORCISH_SCONCE, 2) .pattern("NTN") .pattern(" S ") - .input('N', ResourceItemsME.CRUDE_NUGGET) - .input('S', Items.STICK) - .input('T', Items.TORCH) - .criterion(hasItem(Items.TORCH), - conditionsFromItem(Items.TORCH)) - .offerTo(exporter); - - createWoodStoolRecipe(exporter, GenericBlockSets.TREATED_WOOD_PLANKS.blockSet.base().asItem(), ModDecorativeBlocks.TREATED_WOOD_STOOL); - createWoodBenchRecipe(exporter, GenericBlockSets.TREATED_WOOD_PLANKS.blockSet.base().asItem(), ModDecorativeBlocks.TREATED_WOOD_BENCH); - createWoodTableRecipe(exporter, GenericBlockSets.TREATED_WOOD_PLANKS.blockSet.base().asItem(), ModDecorativeBlocks.TREATED_WOOD_TABLE); - createWoodChairRecipe(exporter, GenericBlockSets.TREATED_WOOD_PLANKS.blockSet.base().asItem(), ModDecorativeBlocks.TREATED_WOOD_CHAIR); - createWoodLadderRecipe(exporter, GenericBlockSets.TREATED_WOOD_PLANKS.blockSet.base().asItem(), ModDecorativeBlocks.TREATED_WOOD_LADDER); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.LARCH_HOBBIT_DOOR, 1) + .define('N', ResourceItemsME.CRUDE_NUGGET) + .define('S', Items.STICK) + .define('T', Items.TORCH) + .unlockedBy(getHasName(Items.TORCH), + has(Items.TORCH)) + .save(recipeOutput); + + createWoodStoolRecipe(recipeOutput, GenericBlockSets.TREATED_WOOD_PLANKS.blockSet.base().asItem(), ModDecorativeBlocks.TREATED_WOOD_STOOL); + createWoodBenchRecipe(recipeOutput, GenericBlockSets.TREATED_WOOD_PLANKS.blockSet.base().asItem(), ModDecorativeBlocks.TREATED_WOOD_BENCH); + createWoodTableRecipe(recipeOutput, GenericBlockSets.TREATED_WOOD_PLANKS.blockSet.base().asItem(), ModDecorativeBlocks.TREATED_WOOD_TABLE); + createWoodChairRecipe(recipeOutput, GenericBlockSets.TREATED_WOOD_PLANKS.blockSet.base().asItem(), ModDecorativeBlocks.TREATED_WOOD_CHAIR); + createWoodLadderRecipe(recipeOutput, GenericBlockSets.TREATED_WOOD_PLANKS.blockSet.base().asItem(), ModDecorativeBlocks.TREATED_WOOD_LADDER); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.LARCH_HOBBIT_DOOR, 1) .pattern("LLL") .pattern("LSL") .pattern("LLL") - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_ingots"))) - .input('L', WoodBlockSets.LARCH_SET.planksBlocks.base()) - .criterion(hasItem(WoodBlockSets.LARCH_SET.planksBlocks.base()), - conditionsFromItem(WoodBlockSets.LARCH_SET.planksBlocks.base())) - .offerTo(exporter); + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_ingots"))) + .define('L', WoodBlockSets.LARCH_SET.planksBlocks.base()) + .unlockedBy(getHasName(WoodBlockSets.LARCH_SET.planksBlocks.base()), + has(WoodBlockSets.LARCH_SET.planksBlocks.base())) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SPRUCE_HOBBIT_DOOR, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SPRUCE_HOBBIT_DOOR, 1) .pattern("LSL") .pattern("SLL") .pattern("LSL") - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_ingots"))) - .input('L', Items.SPRUCE_PLANKS) - .criterion(hasItem(Items.SPRUCE_PLANKS), - conditionsFromItem(Items.SPRUCE_PLANKS)) - .offerTo(exporter); + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_ingots"))) + .define('L', Items.SPRUCE_PLANKS) + .unlockedBy(getHasName(Items.SPRUCE_PLANKS), + has(Items.SPRUCE_PLANKS)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BLUE_HOBBIT_DOOR, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BLUE_HOBBIT_DOOR, 1) .pattern(" BG") .pattern("BDG") .pattern(" BG") - .input('D', ModDecorativeBlocks.LARCH_HOBBIT_DOOR) - .input('B', Items.BLUE_DYE) - .input('G', Items.GOLD_NUGGET) - .criterion(hasItem(ModDecorativeBlocks.LARCH_HOBBIT_DOOR), - conditionsFromItem(ModDecorativeBlocks.LARCH_HOBBIT_DOOR)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GREEN_HOBBIT_DOOR, 1) + .define('D', ModDecorativeBlocks.LARCH_HOBBIT_DOOR) + .define('B', Items.BLUE_DYE) + .define('G', Items.GOLD_NUGGET) + .unlockedBy(getHasName(ModDecorativeBlocks.LARCH_HOBBIT_DOOR), + has(ModDecorativeBlocks.LARCH_HOBBIT_DOOR)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GREEN_HOBBIT_DOOR, 1) .pattern(" BG") .pattern("BDG") .pattern(" BG") - .input('D', ModDecorativeBlocks.LARCH_HOBBIT_DOOR) - .input('B', Items.GREEN_DYE) - .input('G', Items.GOLD_NUGGET) - .criterion(hasItem(ModDecorativeBlocks.LARCH_HOBBIT_DOOR), - conditionsFromItem(ModDecorativeBlocks.LARCH_HOBBIT_DOOR)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.LIGHT_BLUE_HOBBIT_DOOR, 1) + .define('D', ModDecorativeBlocks.LARCH_HOBBIT_DOOR) + .define('B', Items.GREEN_DYE) + .define('G', Items.GOLD_NUGGET) + .unlockedBy(getHasName(ModDecorativeBlocks.LARCH_HOBBIT_DOOR), + has(ModDecorativeBlocks.LARCH_HOBBIT_DOOR)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.LIGHT_BLUE_HOBBIT_DOOR, 1) .pattern(" B ") .pattern("BDB") .pattern(" B ") - .input('D', ModDecorativeBlocks.LARCH_HOBBIT_DOOR) - .input('B', Items.LIGHT_BLUE_DYE) - .criterion(hasItem(ModDecorativeBlocks.LARCH_HOBBIT_DOOR), - conditionsFromItem(ModDecorativeBlocks.LARCH_HOBBIT_DOOR)) - .offerTo(exporter); + .define('D', ModDecorativeBlocks.LARCH_HOBBIT_DOOR) + .define('B', Items.LIGHT_BLUE_DYE) + .unlockedBy(getHasName(ModDecorativeBlocks.LARCH_HOBBIT_DOOR), + has(ModDecorativeBlocks.LARCH_HOBBIT_DOOR)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.RED_HOBBIT_DOOR, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.RED_HOBBIT_DOOR, 1) .pattern(" BG") .pattern("BDG") .pattern(" BG") - .input('D', ModDecorativeBlocks.LARCH_HOBBIT_DOOR) - .input('B', Items.RED_DYE) - .input('G', Items.GOLD_NUGGET) - .criterion(hasItem(ModDecorativeBlocks.LARCH_HOBBIT_DOOR), - conditionsFromItem(ModDecorativeBlocks.LARCH_HOBBIT_DOOR)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.YELLOW_HOBBIT_DOOR, 1) + .define('D', ModDecorativeBlocks.LARCH_HOBBIT_DOOR) + .define('B', Items.RED_DYE) + .define('G', Items.GOLD_NUGGET) + .unlockedBy(getHasName(ModDecorativeBlocks.LARCH_HOBBIT_DOOR), + has(ModDecorativeBlocks.LARCH_HOBBIT_DOOR)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.YELLOW_HOBBIT_DOOR, 1) .pattern(" BG") .pattern("BDG") .pattern(" BG") - .input('D', ModDecorativeBlocks.LARCH_HOBBIT_DOOR) - .input('B', Items.YELLOW_DYE) - .input('G', Items.GOLD_NUGGET) - .criterion(hasItem(ModDecorativeBlocks.LARCH_HOBBIT_DOOR), - conditionsFromItem(ModDecorativeBlocks.LARCH_HOBBIT_DOOR)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.TALL_BLACK_PINE_DOOR, 1) + .define('D', ModDecorativeBlocks.LARCH_HOBBIT_DOOR) + .define('B', Items.YELLOW_DYE) + .define('G', Items.GOLD_NUGGET) + .unlockedBy(getHasName(ModDecorativeBlocks.LARCH_HOBBIT_DOOR), + has(ModDecorativeBlocks.LARCH_HOBBIT_DOOR)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.TALL_BLACK_PINE_DOOR, 1) .pattern("SP") .pattern("PP") .pattern("SP") - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_nuggets"))) - .input('P', WoodBlockSets.BLACK_PINE_SET.planksBlocks.base()) - .criterion(hasItem(WoodBlockSets.BLACK_PINE_SET.planksBlocks.base()), - conditionsFromItem(WoodBlockSets.BLACK_PINE_SET.planksBlocks.base())) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.TALL_FIR_DOOR, 1) + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_nuggets"))) + .define('P', WoodBlockSets.BLACK_PINE_SET.planksBlocks.base()) + .unlockedBy(getHasName(WoodBlockSets.BLACK_PINE_SET.planksBlocks.base()), + has(WoodBlockSets.BLACK_PINE_SET.planksBlocks.base())) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.TALL_FIR_DOOR, 1) .pattern("SP") .pattern("PP") .pattern("SP") - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_nuggets"))) - .input('P', WoodBlockSets.FIR_SET.planksBlocks.base()) - .criterion(hasItem(WoodBlockSets.FIR_SET.planksBlocks.base()), - conditionsFromItem(WoodBlockSets.FIR_SET.planksBlocks.base())) - .offerTo(exporter); + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_nuggets"))) + .define('P', WoodBlockSets.FIR_SET.planksBlocks.base()) + .unlockedBy(getHasName(WoodBlockSets.FIR_SET.planksBlocks.base()), + has(WoodBlockSets.FIR_SET.planksBlocks.base())) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.OAK_STABLE_DOOR, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.OAK_STABLE_DOOR, 1) .pattern("SPP") .pattern("PPP") .pattern("SPP") - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_nuggets"))) - .input('P', Items.OAK_PLANKS) - .criterion(hasItem(Items.OAK_PLANKS), - conditionsFromItem(Items.OAK_PLANKS)) - .offerTo(exporter); + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_nuggets"))) + .define('P', Items.OAK_PLANKS) + .unlockedBy(getHasName(Items.OAK_PLANKS), + has(Items.OAK_PLANKS)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.REINFORCED_BLACK_PINE_DOOR, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.REINFORCED_BLACK_PINE_DOOR, 1) .pattern("SPP") .pattern("SPS") .pattern("SPP") - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_ingots"))) - .input('P', WoodBlockSets.BLACK_PINE_SET.planksBlocks.base()) - .criterion(hasItem(WoodBlockSets.BLACK_PINE_SET.planksBlocks.base()), - conditionsFromItem(WoodBlockSets.BLACK_PINE_SET.planksBlocks.base())) - .offerTo(exporter); + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_ingots"))) + .define('P', WoodBlockSets.BLACK_PINE_SET.planksBlocks.base()) + .unlockedBy(getHasName(WoodBlockSets.BLACK_PINE_SET.planksBlocks.base()), + has(WoodBlockSets.BLACK_PINE_SET.planksBlocks.base())) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.REINFORCED_SPRUCE_DOOR, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.REINFORCED_SPRUCE_DOOR, 1) .pattern("SPP") .pattern("SPS") .pattern("SPP") - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_ingots"))) - .input('P', Items.SPRUCE_PLANKS) - .criterion(hasItem(Items.SPRUCE_PLANKS), - conditionsFromItem(Items.SPRUCE_PLANKS)) - .offerTo(exporter); + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_ingots"))) + .define('P', Items.SPRUCE_PLANKS) + .unlockedBy(getHasName(Items.SPRUCE_PLANKS), + has(Items.SPRUCE_PLANKS)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SIMPLE_LARCH_GATE, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SIMPLE_LARCH_GATE, 1) .pattern("SPP") .pattern("PPP") .pattern("SPP") - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_nuggets"))) - .input('P', WoodBlockSets.LARCH_SET.planksBlocks.base()) - .criterion(hasItem(WoodBlockSets.LARCH_SET.planksBlocks.base()), - conditionsFromItem(WoodBlockSets.LARCH_SET.planksBlocks.base())) - .offerTo(exporter); + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_nuggets"))) + .define('P', WoodBlockSets.LARCH_SET.planksBlocks.base()) + .unlockedBy(getHasName(WoodBlockSets.LARCH_SET.planksBlocks.base()), + has(WoodBlockSets.LARCH_SET.planksBlocks.base())) + .save(recipeOutput); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.RICKETY_SIMPLE_LARCH_DOOR, ModDecorativeBlocks.SIMPLE_LARCH_GATE); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.RICKETY_SIMPLE_LARCH_DOOR, ModDecorativeBlocks.SIMPLE_LARCH_GATE); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SPRUCE_STABLE_DOOR, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SPRUCE_STABLE_DOOR, 1) .pattern("SPP") .pattern("PPP") .pattern("SPP") - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_nuggets"))) - .input('P', Items.SPRUCE_PLANKS) - .criterion(hasItem(Items.SPRUCE_PLANKS), - conditionsFromItem(Items.SPRUCE_PLANKS)) - .offerTo(exporter); + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_nuggets"))) + .define('P', Items.SPRUCE_PLANKS) + .unlockedBy(getHasName(Items.SPRUCE_PLANKS), + has(Items.SPRUCE_PLANKS)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.LARGE_STURDY_DOOR, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.LARGE_STURDY_DOOR, 1) .pattern("SPP") .pattern("PPP") .pattern("SPP") - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_ingots"))) - .input('P', TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(Items.OAK_PLANKS), - conditionsFromItem(Items.OAK_PLANKS)) - .offerTo(exporter); + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_ingots"))) + .define('P', TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(Items.OAK_PLANKS), + has(Items.OAK_PLANKS)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.LARGE_BEECH_FENCE_GATE, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.LARGE_BEECH_FENCE_GATE, 1) .pattern("FF") - .input('F', WoodBlockSets.BEECH_SET.planksBlocks.gate()) - .criterion(hasItem(WoodBlockSets.BEECH_SET.planksBlocks.gate()), - conditionsFromItem(WoodBlockSets.BEECH_SET.planksBlocks.gate())) - .offerTo(exporter); + .define('F', WoodBlockSets.BEECH_SET.planksBlocks.gate()) + .unlockedBy(getHasName(WoodBlockSets.BEECH_SET.planksBlocks.gate()), + has(WoodBlockSets.BEECH_SET.planksBlocks.gate())) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GREAT_GONDORIAN_GATE, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GREAT_GONDORIAN_GATE, 1) .pattern("LCL") .pattern("CCS") .pattern("LCL") - .input('L', WoodBlockSets.BLACK_LEBETHRON_SET.planksBlocks.base()) - .input('C', Items.OXIDIZED_COPPER) - .input('S', ResourceItemsME.STEEL_INGOT) - .criterion(hasItem(Items.OXIDIZED_COPPER), - conditionsFromItem(Items.OXIDIZED_COPPER)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GREAT_DWARVEN_GATE, 1) + .define('L', WoodBlockSets.BLACK_LEBETHRON_SET.planksBlocks.base()) + .define('C', Items.OXIDIZED_COPPER) + .define('S', ResourceItemsME.STEEL_INGOT) + .unlockedBy(getHasName(Items.OXIDIZED_COPPER), + has(Items.OXIDIZED_COPPER)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GREAT_DWARVEN_GATE, 1) .pattern("BTB") .pattern("BTS") .pattern("BTB") - .input('B', ResourceItemsME.BRONZE_INGOT) - .input('T', GenericBlockSets.TREATED_WOOD.blockSet.base()) - .input('S', ResourceItemsME.KHAZAD_STEEL_INGOT) - .criterion(hasItem(ResourceItemsME.BRONZE_INGOT), - conditionsFromItem(ResourceItemsME.BRONZE_INGOT)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.VARNISHED_DWARVEN_DOOR, 1) + .define('B', ResourceItemsME.BRONZE_INGOT) + .define('T', GenericBlockSets.TREATED_WOOD.blockSet.base()) + .define('S', ResourceItemsME.KHAZAD_STEEL_INGOT) + .unlockedBy(getHasName(ResourceItemsME.BRONZE_INGOT), + has(ResourceItemsME.BRONZE_INGOT)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.VARNISHED_DWARVEN_DOOR, 1) .pattern("TNT") .pattern("TTS") .pattern("TNT") - .input('N', ResourceItemsME.STEEL_NUGGET) - .input('T', GenericBlockSets.TREATED_WOOD.blockSet.base()) - .input('S', ResourceItemsME.KHAZAD_STEEL_INGOT) - .criterion(hasItem(ResourceItemsME.BRONZE_INGOT), - conditionsFromItem(ResourceItemsME.BRONZE_INGOT)) - .offerTo(exporter); + .define('N', ResourceItemsME.STEEL_NUGGET) + .define('T', GenericBlockSets.TREATED_WOOD.blockSet.base()) + .define('S', ResourceItemsME.KHAZAD_STEEL_INGOT) + .unlockedBy(getHasName(ResourceItemsME.BRONZE_INGOT), + has(ResourceItemsME.BRONZE_INGOT)) + .save(recipeOutput); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.RUINED_DWARVEN_DOOR, ModDecorativeBlocks.VARNISHED_DWARVEN_DOOR); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.RUINED_DWARVEN_DOOR, ModDecorativeBlocks.VARNISHED_DWARVEN_DOOR); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.HIDDEN_DWARVEN_DOOR, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.HIDDEN_DWARVEN_DOOR, 1) .pattern("SSG") .pattern("GDL") .pattern("DSS") - .input('L', Items.LEVER) - .input('G', StoneBlockSets.DOLOMITE_SET.smoothBlocks.base()) - .input('D', StoneBlockSets.DOLOMITE_SET.baseBlocks.base()) - .input('S', Items.STONE) - .criterion(hasItem(StoneBlockSets.DOLOMITE_SET.smoothBlocks.base()), - conditionsFromItem(StoneBlockSets.DOLOMITE_SET.smoothBlocks.base())) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GREAT_ELVEN_GATE, 1) + .define('L', Items.LEVER) + .define('G', StoneBlockSets.DOLOMITE_SET.smoothBlocks.base()) + .define('D', StoneBlockSets.DOLOMITE_SET.baseBlocks.base()) + .define('S', Items.STONE) + .unlockedBy(getHasName(StoneBlockSets.DOLOMITE_SET.smoothBlocks.base()), + has(StoneBlockSets.DOLOMITE_SET.smoothBlocks.base())) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GREAT_ELVEN_GATE, 1) .pattern("BTB") .pattern("BTS") .pattern("BTB") - .input('B', Items.CYAN_DYE) - .input('T', GenericBlockSets.TREATED_WOOD.blockSet.base()) - .input('S', ResourceItemsME.EDHEL_STEEL_INGOT) - .criterion(hasItem(GenericBlockSets.TREATED_WOOD.blockSet.base()), - conditionsFromItem(GenericBlockSets.TREATED_WOOD.blockSet.base())) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GREAT_ORCISH_GATE, 1) + .define('B', Items.CYAN_DYE) + .define('T', GenericBlockSets.TREATED_WOOD.blockSet.base()) + .define('S', ResourceItemsME.EDHEL_STEEL_INGOT) + .unlockedBy(getHasName(GenericBlockSets.TREATED_WOOD.blockSet.base()), + has(GenericBlockSets.TREATED_WOOD.blockSet.base())) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GREAT_ORCISH_GATE, 1) .pattern("SSS") .pattern("SNS") .pattern("NNN") - .input('N', ModBlocks.BURZUM_STEEL_BLOCK) - .input('S', ResourceItemsME.BURZUM_STEEL_INGOT) - .criterion(hasItem(ResourceItemsME.BURZUM_STEEL_INGOT), - conditionsFromItem(ResourceItemsME.BURZUM_STEEL_INGOT)) - .offerTo(exporter); + .define('N', ModBlocks.BURZUM_STEEL_BLOCK) + .define('S', ResourceItemsME.BURZUM_STEEL_INGOT) + .unlockedBy(getHasName(ResourceItemsME.BURZUM_STEEL_INGOT), + has(ResourceItemsME.BURZUM_STEEL_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.TURF, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.TURF, 4) .pattern("MM") .pattern("MD") - .input('M', Items.MOSS_BLOCK) - .input('D', Items.DIRT) - .criterion(hasItem(Items.MOSS_BLOCK), - conditionsFromItem(Items.MOSS_BLOCK)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.CORRUPTED_MOSS_CARPET, 3) + .define('M', Items.MOSS_BLOCK) + .define('D', Items.DIRT) + .unlockedBy(getHasName(Items.MOSS_BLOCK), + has(Items.MOSS_BLOCK)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, + ModNatureBlocks.CORRUPTED_MOSS_CARPET, 3) .pattern("MM") - .input('M', ModNatureBlocks.CORRUPTED_MOSS_BLOCK) - .criterion(hasItem(ModNatureBlocks.CORRUPTED_MOSS_BLOCK), - conditionsFromItem(ModNatureBlocks.CORRUPTED_MOSS_BLOCK)) - .offerTo(exporter); + .define('M', ModNatureBlocks.CORRUPTED_MOSS_BLOCK) + .unlockedBy(getHasName(ModNatureBlocks.CORRUPTED_MOSS_BLOCK), + has(ModNatureBlocks.CORRUPTED_MOSS_BLOCK)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.FOREST_MOSS_CARPET, 3) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, + ModNatureBlocks.FOREST_MOSS_CARPET, 3) .pattern("MM") - .input('M', ModNatureBlocks.FOREST_MOSS_BLOCK) - .criterion(hasItem(ModNatureBlocks.FOREST_MOSS_BLOCK), - conditionsFromItem(ModNatureBlocks.FOREST_MOSS_BLOCK)) - .offerTo(exporter); + .define('M', ModNatureBlocks.FOREST_MOSS_BLOCK) + .unlockedBy(getHasName(ModNatureBlocks.FOREST_MOSS_BLOCK), + has(ModNatureBlocks.FOREST_MOSS_BLOCK)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_DIRT, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_DIRT, 4) .pattern("DM") .pattern("MD") - .input('M', Items.MOSS_BLOCK) - .input('D', Items.DIRT) - .criterion(hasItem(Items.MOSS_BLOCK), - conditionsFromItem(Items.MOSS_BLOCK)) - .offerTo(exporter); + .define('M', Items.MOSS_BLOCK) + .define('D', Items.DIRT) + .unlockedBy(getHasName(Items.MOSS_BLOCK), + has(Items.MOSS_BLOCK)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_CHALKSOIL, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_CHALKSOIL, 4) .pattern("DM") .pattern("MD") - .input('M', Items.MOSS_BLOCK) - .input('D', ModBlocks.CHALKSOIL) - .criterion(hasItem(Items.MOSS_BLOCK), - conditionsFromItem(Items.MOSS_BLOCK)) - .offerTo(exporter); + .define('M', Items.MOSS_BLOCK) + .define('D', ModBlocks.CHALKSOIL) + .unlockedBy(getHasName(Items.MOSS_BLOCK), + has(Items.MOSS_BLOCK)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_SILT, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_SILT, 4) .pattern("DM") .pattern("MD") - .input('M', Items.MOSS_BLOCK) - .input('D', ModBlocks.SILT) - .criterion(hasItem(Items.MOSS_BLOCK), - conditionsFromItem(Items.MOSS_BLOCK)) - .offerTo(exporter); + .define('M', Items.MOSS_BLOCK) + .define('D', ModBlocks.SILT) + .unlockedBy(getHasName(Items.MOSS_BLOCK), + has(Items.MOSS_BLOCK)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_LOAM, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_LOAM, 4) .pattern("DM") .pattern("MD") - .input('M', Items.MOSS_BLOCK) - .input('D', ModBlocks.LOAM) - .criterion(hasItem(Items.MOSS_BLOCK), - conditionsFromItem(Items.MOSS_BLOCK)) - .offerTo(exporter); + .define('M', Items.MOSS_BLOCK) + .define('D', ModBlocks.LOAM) + .unlockedBy(getHasName(Items.MOSS_BLOCK), + has(Items.MOSS_BLOCK)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_PEAT, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.GRASSY_PEAT, 4) .pattern("DM") .pattern("MD") - .input('M', Items.MOSS_BLOCK) - .input('D', ModBlocks.LOAM) - .criterion(hasItem(Items.MOSS_BLOCK), - conditionsFromItem(Items.MOSS_BLOCK)) - .offerTo(exporter); + .define('M', Items.MOSS_BLOCK) + .define('D', ModBlocks.LOAM) + .unlockedBy(getHasName(Items.MOSS_BLOCK), + has(Items.MOSS_BLOCK)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.PEBBLED_GRASS, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.PEBBLED_GRASS, 4) .pattern("DM") .pattern("MD") - .input('M', Items.MOSS_BLOCK) - .input('D', TagKey.of(RegistryKeys.ITEM, Identifier.of("stone_crafting_materials"))) - .criterion(hasItem(Items.MOSS_BLOCK), - conditionsFromItem(Items.MOSS_BLOCK)) - .offerTo(exporter); + .define('M', Items.MOSS_BLOCK) + .define('D', TagKey.create(Registries.ITEM, ResourceLocation.parse("stone_crafting_materials"))) + .unlockedBy(getHasName(Items.MOSS_BLOCK), + has(Items.MOSS_BLOCK)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.WASTE_PILE, 8) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.WASTE_PILE, 8) .pattern("DDD") .pattern("DWD") .pattern("DDD") - .input('W', Items.ROTTEN_FLESH) - .input('D', ItemTagsME.DIRT) - .criterion(hasItem(Items.MOSS_BLOCK), - conditionsFromItem(Items.MOSS_BLOCK)) - .offerTo(exporter); + .define('W', Items.ROTTEN_FLESH) + .define('D', ItemTagsME.DIRT) + .unlockedBy(getHasName(Items.MOSS_BLOCK), + has(Items.MOSS_BLOCK)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.SKELETAL_PILE, 8) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.SKELETAL_PILE, 8) .pattern("DDD") .pattern("DBD") .pattern("DDD") - .input('B', ItemTagsME.BONES) - .input('D', ModBlocks.WASTE_PILE) - .criterion(hasItem(ModBlocks.WASTE_PILE), - conditionsFromItem(ModBlocks.WASTE_PILE)) - .offerTo(exporter); + .define('B', ItemTagsME.BONES) + .define('D', ModBlocks.WASTE_PILE) + .unlockedBy(getHasName(ModBlocks.WASTE_PILE), + has(ModBlocks.WASTE_PILE)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.FOUL_DIRT, 8) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.FOUL_DIRT, 8) .pattern("DDD") .pattern("DAD") .pattern("DDD") - .input('A', ResourceItemsME.ASH) - .input('D', ModBlocks.WASTE_PILE) - .criterion(hasItem(ModBlocks.WASTE_PILE), - conditionsFromItem(ModBlocks.WASTE_PILE)) - .offerTo(exporter); + .define('A', ResourceItemsME.ASH) + .define('D', ModBlocks.WASTE_PILE) + .unlockedBy(getHasName(ModBlocks.WASTE_PILE), + has(ModBlocks.WASTE_PILE)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.SNOWY_DIRT, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.SNOWY_DIRT, 4) .pattern("DS") .pattern("SD") - .input('D', Items.DIRT) - .input('S', Items.SNOW_BLOCK) - .criterion(hasItem(Items.DIRT), - conditionsFromItem(Items.DIRT)) - .offerTo(exporter); + .define('D', Items.DIRT) + .define('S', Items.SNOW_BLOCK) + .unlockedBy(getHasName(Items.DIRT), + has(Items.DIRT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.DRYSTONE_SET.cobblestoneBlocks.base(), 2) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.DRYSTONE_SET.cobblestoneBlocks.base(), 2) .pattern("CC") - .input('C', TagKey.of(RegistryKeys.ITEM, Identifier.of("stone_crafting_materials"))) - .criterion(hasItem(Items.COBBLESTONE), - conditionsFromItem(Items.COBBLESTONE)) - .offerTo(exporter); + .define('C', TagKey.create(Registries.ITEM, ResourceLocation.parse("stone_crafting_materials"))) + .unlockedBy(getHasName(Items.COBBLESTONE), + has(Items.COBBLESTONE)) + .save(recipeOutput); //createMossyRecipe(exporter, StoneBlockSets.DRYSTONE_SET.cobblestoneBlocks.base(), StoneBlockSets.DRYSTONE_SET.mossyCobblestoneBlocks.base()); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.FRAMED_DRYSTONE.blockSet.base(), 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, GenericBlockSets.FRAMED_DRYSTONE.blockSet.base(), 1) .pattern(" S ") .pattern("SCS") .pattern(" S ") - .input('S', Items.STICK) - .input('C', TagKey.of(RegistryKeys.ITEM, Identifier.of("stone_crafting_materials"))) - .criterion(hasItem(StoneBlockSets.DRYSTONE_SET.cobblestoneBlocks.base()), - conditionsFromItem(StoneBlockSets.DRYSTONE_SET.cobblestoneBlocks.base())) - .offerTo(exporter); + .define('S', Items.STICK) + .define('C', TagKey.create(Registries.ITEM, ResourceLocation.parse("stone_crafting_materials"))) + .unlockedBy(getHasName(StoneBlockSets.DRYSTONE_SET.cobblestoneBlocks.base()), + has(StoneBlockSets.DRYSTONE_SET.cobblestoneBlocks.base())) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.COBBLY_DIRT, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.COBBLY_DIRT, 4) .pattern("DC") .pattern("CD") - .input('D', Items.DIRT) - .input('C', TagKey.of(RegistryKeys.ITEM, Identifier.of("stone_crafting_materials"))) - .criterion(hasItem(Items.DIRT), - conditionsFromItem(Items.DIRT)) - .offerTo(exporter); + .define('D', Items.DIRT) + .define('C', TagKey.create(Registries.ITEM, ResourceLocation.parse("stone_crafting_materials"))) + .unlockedBy(getHasName(Items.DIRT), + has(Items.DIRT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.COBBLY_ASHEN_DIRT, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.COBBLY_ASHEN_DIRT, 4) .pattern("DC") .pattern("CD") - .input('D', ModBlocks.ASHEN_DIRT) - .input('C', StoneBlockSets.ASHENSTONE_SET.cobblestoneBlocks.base()) - .criterion(hasItem(Items.DIRT), - conditionsFromItem(Items.DIRT)) - .offerTo(exporter); + .define('D', ModBlocks.ASHEN_DIRT) + .define('C', StoneBlockSets.ASHENSTONE_SET.cobblestoneBlocks.base()) + .unlockedBy(getHasName(Items.DIRT), + has(Items.DIRT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.DIRTY_ROOTS, 2) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModBlocks.DIRTY_ROOTS, 2) .pattern(" R ") .pattern("RDR") .pattern(" R ") - .input('D', Items.ROOTED_DIRT) - .input('R', Items.HANGING_ROOTS) - .criterion(hasItem(Items.ROOTED_DIRT), - conditionsFromItem(Items.ROOTED_DIRT)) - .offerTo(exporter); + .define('D', Items.ROOTED_DIRT) + .define('R', Items.HANGING_ROOTS) + .unlockedBy(getHasName(Items.ROOTED_DIRT), + has(Items.ROOTED_DIRT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.WATERING_CAN, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.WATERING_CAN, 1) .pattern(" N ") .pattern("NII") .pattern(" II") - .input('N', ResourceItemsME.TIN_NUGGET) - .input('I', ResourceItemsME.TIN_INGOT) - .criterion(hasItem(ResourceItemsME.TIN_INGOT), - conditionsFromItem(ResourceItemsME.TIN_INGOT)) - .offerTo(exporter); + .define('N', ResourceItemsME.TIN_NUGGET) + .define('I', ResourceItemsME.TIN_INGOT) + .unlockedBy(getHasName(ResourceItemsME.TIN_INGOT), + has(ResourceItemsME.TIN_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.WOODEN_BUCKET, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.WOODEN_BUCKET, 1) .pattern(" R ") .pattern("P P") .pattern(" P ") - .input('R', ModDecorativeBlocks.ROPE) - .input('P', TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(ModDecorativeBlocks.ROPE), - conditionsFromItem(ModDecorativeBlocks.ROPE)) - .offerTo(exporter); + .define('R', ModDecorativeBlocks.ROPE) + .define('P', TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(ModDecorativeBlocks.ROPE), + has(ModDecorativeBlocks.ROPE)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CRUDE_ROD, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CRUDE_ROD, 1) .pattern("S") .pattern("S") .pattern("S") - .input('S', ResourceItemsME.CRUDE_INGOT) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.CRUDE_INGOT)) - .offerTo(exporter); + .define('S', ResourceItemsME.CRUDE_INGOT) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.CRUDE_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.TREATED_STEEL_ROD, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.TREATED_STEEL_ROD, 1) .pattern("S") .pattern("S") .pattern("S") - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_ingots"))) - .criterion(hasItem(ResourceItemsME.STEEL_INGOT), - conditionsFromItem(ResourceItemsME.STEEL_INGOT)) - .offerTo(exporter); + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_ingots"))) + .unlockedBy(getHasName(ResourceItemsME.STEEL_INGOT), + has(ResourceItemsME.STEEL_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, Items.CHAIN, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Items.CHAIN, 4) .pattern("N") .pattern("I") .pattern("N") - .input('N', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_ingots"))) - .input('I', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_nuggets"))) - .criterion(hasItem(ResourceItemsME.STEEL_INGOT), - conditionsFromItem(ResourceItemsME.STEEL_INGOT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, Registries.ITEM.getId(Items.CHAIN).getPath() + "_alt"))); + .define('N', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_ingots"))) + .define('I', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_nuggets"))) + .unlockedBy(getHasName(ResourceItemsME.STEEL_INGOT), + has(ResourceItemsME.STEEL_INGOT)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, BuiltInRegistries.ITEM.getKey(Items.CHAIN).getPath() + "_alt"))); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BRONZE_CHAIN, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BRONZE_CHAIN, 4) .pattern("N") .pattern("I") .pattern("N") - .input('N', ResourceItemsME.BRONZE_NUGGET) - .input('I', ResourceItemsME.BRONZE_INGOT) - .criterion(hasItem(ResourceItemsME.BRONZE_INGOT), - conditionsFromItem(ResourceItemsME.STEEL_INGOT)) - .offerTo(exporter); + .define('N', ResourceItemsME.BRONZE_NUGGET) + .define('I', ResourceItemsME.BRONZE_INGOT) + .unlockedBy(getHasName(ResourceItemsME.BRONZE_INGOT), + has(ResourceItemsME.STEEL_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BRONZE_BROAD_CHAIN, 8) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BRONZE_BROAD_CHAIN, 8) .pattern("NN") .pattern("II") .pattern("NN") - .input('N', ResourceItemsME.BRONZE_NUGGET) - .input('I', ResourceItemsME.BRONZE_INGOT) - .criterion(hasItem(ResourceItemsME.BRONZE_INGOT), - conditionsFromItem(ResourceItemsME.STEEL_INGOT)) - .offerTo(exporter); + .define('N', ResourceItemsME.BRONZE_NUGGET) + .define('I', ResourceItemsME.BRONZE_INGOT) + .unlockedBy(getHasName(ResourceItemsME.BRONZE_INGOT), + has(ResourceItemsME.STEEL_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CRUDE_CHAIN, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CRUDE_CHAIN, 4) .pattern("N") .pattern("I") .pattern("N") - .input('N', ResourceItemsME.CRUDE_NUGGET) - .input('I', ResourceItemsME.CRUDE_INGOT) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.STEEL_INGOT)) - .offerTo(exporter); + .define('N', ResourceItemsME.CRUDE_NUGGET) + .define('I', ResourceItemsME.CRUDE_INGOT) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.STEEL_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CRUDE_BROAD_CHAIN, 8) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CRUDE_BROAD_CHAIN, 8) .pattern("NN") .pattern("II") .pattern("NN") - .input('N', ResourceItemsME.CRUDE_NUGGET) - .input('I', ResourceItemsME.CRUDE_INGOT) - .criterion(hasItem(ResourceItemsME.CRUDE_INGOT), - conditionsFromItem(ResourceItemsME.STEEL_INGOT)) - .offerTo(exporter); + .define('N', ResourceItemsME.CRUDE_NUGGET) + .define('I', ResourceItemsME.CRUDE_INGOT) + .unlockedBy(getHasName(ResourceItemsME.CRUDE_INGOT), + has(ResourceItemsME.STEEL_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SPIKY_CHAIN, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SPIKY_CHAIN, 4) .pattern(" N ") .pattern("NIN") .pattern(" N ") - .input('I', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_ingots"))) - .input('N', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_nuggets"))) - .criterion(hasItem(ResourceItemsME.STEEL_INGOT), - conditionsFromItem(ResourceItemsME.STEEL_INGOT)) - .offerTo(exporter); + .define('I', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_ingots"))) + .define('N', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_nuggets"))) + .unlockedBy(getHasName(ResourceItemsME.STEEL_INGOT), + has(ResourceItemsME.STEEL_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ResourceItemsME.DWARVEN_KEY, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ResourceItemsME.DWARVEN_KEY, 1) .pattern("IN") - .input('N', ResourceItemsME.KHAZAD_STEEL_NUGGET) - .input('I', ResourceItemsME.KHAZAD_STEEL_INGOT) - .criterion(hasItem(ResourceItemsME.KHAZAD_STEEL_INGOT), - conditionsFromItem(ResourceItemsME.KHAZAD_STEEL_INGOT)) - .offerTo(exporter); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModBlocks.EMBERS, 1) - .input(Items.MAGMA_BLOCK, 1) - .input(ResourceItemsME.ASH, 1) - .criterion(hasItem(Items.MAGMA_BLOCK), - conditionsFromItem(Items.MAGMA_BLOCK)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CHIMNEY, 2) + .define('N', ResourceItemsME.KHAZAD_STEEL_NUGGET) + .define('I', ResourceItemsME.KHAZAD_STEEL_INGOT) + .unlockedBy(getHasName(ResourceItemsME.KHAZAD_STEEL_INGOT), + has(ResourceItemsME.KHAZAD_STEEL_INGOT)) + .save(recipeOutput); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ModBlocks.EMBERS, 1) + .requires(Items.MAGMA_BLOCK, 1) + .requires(ResourceItemsME.ASH, 1) + .unlockedBy(getHasName(Items.MAGMA_BLOCK), + has(Items.MAGMA_BLOCK)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CHIMNEY, 2) .pattern(" B ") .pattern(" B ") .pattern("PPP") - .input('B', Items.BRICKS) - .input('P', StoneBlockSets.DOLOMITE_SET.polishedBlocks.base()) - .criterion(hasItem(Items.BRICKS), - conditionsFromItem(Items.BRICKS)) - .offerTo(exporter); + .define('B', Items.BRICKS) + .define('P', StoneBlockSets.DOLOMITE_SET.polishedBlocks.base()) + .unlockedBy(getHasName(Items.BRICKS), + has(Items.BRICKS)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BIG_BRAZIER, 2) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BIG_BRAZIER, 2) .pattern("B B") .pattern("BCB") .pattern("SSS") - .input('B', ModBlocks.TREATED_STEEL_BARS) - .input('C', Items.CAMPFIRE) - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_ingots"))) - .criterion(hasItem(Items.CAMPFIRE), - conditionsFromItem(Items.CAMPFIRE)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GILDED_BIG_BRAZIER, 2) + .define('B', ModBlocks.TREATED_STEEL_BARS) + .define('C', Items.CAMPFIRE) + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_ingots"))) + .unlockedBy(getHasName(Items.CAMPFIRE), + has(Items.CAMPFIRE)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GILDED_BIG_BRAZIER, 2) .pattern("B B") .pattern("BCB") .pattern("SSS") - .input('B', ModBlocks.GILDED_BARS) - .input('C', Items.CAMPFIRE) - .input('S', Items.GOLD_INGOT) - .criterion(hasItem(Items.CAMPFIRE), - conditionsFromItem(Items.CAMPFIRE)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SMALL_BRAZIER, 2) + .define('B', ModBlocks.GILDED_BARS) + .define('C', Items.CAMPFIRE) + .define('S', Items.GOLD_INGOT) + .unlockedBy(getHasName(Items.CAMPFIRE), + has(Items.CAMPFIRE)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SMALL_BRAZIER, 2) .pattern("BCB") .pattern("SSS") - .input('B', ModBlocks.TREATED_STEEL_BARS) - .input('C', Items.CAMPFIRE) - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_ingots"))) - .criterion(hasItem(Items.CAMPFIRE), - conditionsFromItem(Items.CAMPFIRE)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GILDED_SMALL_BRAZIER, 2) + .define('B', ModBlocks.TREATED_STEEL_BARS) + .define('C', Items.CAMPFIRE) + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_ingots"))) + .unlockedBy(getHasName(Items.CAMPFIRE), + has(Items.CAMPFIRE)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GILDED_SMALL_BRAZIER, 2) .pattern("BCB") .pattern("SSS") - .input('B', ModBlocks.GILDED_BARS) - .input('C', Items.CAMPFIRE) - .input('S', Items.GOLD_INGOT) - .criterion(hasItem(Items.CAMPFIRE), - conditionsFromItem(Items.CAMPFIRE)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.FIRE_BOWL, 2) + .define('B', ModBlocks.GILDED_BARS) + .define('C', Items.CAMPFIRE) + .define('S', Items.GOLD_INGOT) + .unlockedBy(getHasName(Items.CAMPFIRE), + has(Items.CAMPFIRE)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.FIRE_BOWL, 2) .pattern("SCS") .pattern("SSS") - .input('C', Items.CAMPFIRE) - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "steel_ingots"))) - .criterion(hasItem(Items.CAMPFIRE), - conditionsFromItem(Items.CAMPFIRE)) - .offerTo(exporter); + .define('C', Items.CAMPFIRE) + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "steel_ingots"))) + .unlockedBy(getHasName(Items.CAMPFIRE), + has(Items.CAMPFIRE)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BONFIRE, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BONFIRE, 1) .pattern(" L ") .pattern("LCL") - .input('C', Items.CAMPFIRE) - .input('L', TagKey.of(RegistryKeys.ITEM, Identifier.of("logs"))) - .criterion(hasItem(Items.CAMPFIRE), - conditionsFromItem(Items.CAMPFIRE)) - .offerTo(exporter); + .define('C', Items.CAMPFIRE) + .define('L', TagKey.create(Registries.ITEM, ResourceLocation.parse("logs"))) + .unlockedBy(getHasName(Items.CAMPFIRE), + has(Items.CAMPFIRE)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GROUND_BOOK, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GROUND_BOOK, 1) .pattern("BSR") - .input('B', Items.BOOK) - .input('S', Items.STRING) - .input('R', Items.RED_DYE) - .criterion(hasItem(Items.BOOK), - conditionsFromItem(Items.BOOK)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.DWARVEN_GROUND_BOOK, 1) + .define('B', Items.BOOK) + .define('S', Items.STRING) + .define('R', Items.RED_DYE) + .unlockedBy(getHasName(Items.BOOK), + has(Items.BOOK)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.DWARVEN_GROUND_BOOK, 1) .pattern("BG") - .input('B', Items.BOOK) - .input('G', Items.GOLD_NUGGET) - .criterion(hasItem(Items.BOOK), - conditionsFromItem(Items.BOOK)) - .offerTo(exporter); + .define('B', Items.BOOK) + .define('G', Items.GOLD_NUGGET) + .unlockedBy(getHasName(Items.BOOK), + has(Items.BOOK)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SMALL_CRATE, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SMALL_CRATE, 1) .pattern("SSS") .pattern("PPP") - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_slabs"))) - .input('P', TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(Items.OAK_PLANKS), - conditionsFromItem(Items.OAK_PLANKS)) - .offerTo(exporter); + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_slabs"))) + .define('P', TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(Items.OAK_PLANKS), + has(Items.OAK_PLANKS)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.THIN_BARREL, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.THIN_BARREL, 1) .pattern("VSV") .pattern("V V") .pattern("VSV") - .input('S', TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_slabs"))) - .input('V', TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "wooden_vertical_slabs"))) - .criterion(hasItem(Items.OAK_SLAB), - conditionsFromItem(Items.OAK_SLAB)) - .offerTo(exporter); + .define('S', TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_slabs"))) + .define('V', TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "wooden_vertical_slabs"))) + .unlockedBy(getHasName(Items.OAK_SLAB), + has(Items.OAK_SLAB)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.LARCH_COFFER, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.LARCH_COFFER, 1) .pattern("TLT") .pattern("L L") .pattern("LLL") - .input('T', ResourceItemsME.TIN_NUGGET) - .input('L', WoodBlockSets.LARCH_SET.planksBlocks.base()) - .criterion(hasItem(WoodBlockSets.LARCH_SET.planksBlocks.base()), - conditionsFromItem(WoodBlockSets.LARCH_SET.planksBlocks.base())) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.PINE_COFFER, 1) + .define('T', ResourceItemsME.TIN_NUGGET) + .define('L', WoodBlockSets.LARCH_SET.planksBlocks.base()) + .unlockedBy(getHasName(WoodBlockSets.LARCH_SET.planksBlocks.base()), + has(WoodBlockSets.LARCH_SET.planksBlocks.base())) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.PINE_COFFER, 1) .pattern("TLT") .pattern("L L") .pattern("LLL") - .input('T', ResourceItemsME.TIN_NUGGET) - .input('L', WoodBlockSets.PINE_SET.planksBlocks.base()) - .criterion(hasItem(WoodBlockSets.PINE_SET.planksBlocks.base()), - conditionsFromItem(WoodBlockSets.PINE_SET.planksBlocks.base())) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SPRUCE_COFFER, 1) + .define('T', ResourceItemsME.TIN_NUGGET) + .define('L', WoodBlockSets.PINE_SET.planksBlocks.base()) + .unlockedBy(getHasName(WoodBlockSets.PINE_SET.planksBlocks.base()), + has(WoodBlockSets.PINE_SET.planksBlocks.base())) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SPRUCE_COFFER, 1) .pattern("TLT") .pattern("L L") .pattern("LLL") - .input('T', ResourceItemsME.TIN_NUGGET) - .input('L', Blocks.SPRUCE_PLANKS) - .criterion(hasItem(Blocks.SPRUCE_PLANKS), - conditionsFromItem(Blocks.SPRUCE_PLANKS)) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.FIR_COFFER, 1) + .define('T', ResourceItemsME.TIN_NUGGET) + .define('L', Blocks.SPRUCE_PLANKS) + .unlockedBy(getHasName(Blocks.SPRUCE_PLANKS), + has(Blocks.SPRUCE_PLANKS)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.FIR_COFFER, 1) .pattern("TLT") .pattern("L L") .pattern("LLL") - .input('T', ResourceItemsME.TIN_NUGGET) - .input('L', WoodBlockSets.FIR_SET.planksBlocks.base()) - .criterion(hasItem(WoodBlockSets.FIR_SET.planksBlocks.base()), - conditionsFromItem(WoodBlockSets.FIR_SET.planksBlocks.base())) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BEECH_COFFER, 1) + .define('T', ResourceItemsME.TIN_NUGGET) + .define('L', WoodBlockSets.FIR_SET.planksBlocks.base()) + .unlockedBy(getHasName(WoodBlockSets.FIR_SET.planksBlocks.base()), + has(WoodBlockSets.FIR_SET.planksBlocks.base())) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BEECH_COFFER, 1) .pattern("TLT") .pattern("L L") .pattern("LLL") - .input('T', ResourceItemsME.TIN_NUGGET) - .input('L', WoodBlockSets.BEECH_SET.planksBlocks.base()) - .criterion(hasItem(WoodBlockSets.BEECH_SET.planksBlocks.base()), - conditionsFromItem(WoodBlockSets.BEECH_SET.planksBlocks.base())) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CHESTNUT_COFFER, 1) + .define('T', ResourceItemsME.TIN_NUGGET) + .define('L', WoodBlockSets.BEECH_SET.planksBlocks.base()) + .unlockedBy(getHasName(WoodBlockSets.BEECH_SET.planksBlocks.base()), + has(WoodBlockSets.BEECH_SET.planksBlocks.base())) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CHESTNUT_COFFER, 1) .pattern("TLT") .pattern("L L") .pattern("LLL") - .input('T', ResourceItemsME.TIN_NUGGET) - .input('L', WoodBlockSets.CHESTNUT_SET.planksBlocks.base()) - .criterion(hasItem(WoodBlockSets.CHESTNUT_SET.planksBlocks.base()), - conditionsFromItem(WoodBlockSets.CHESTNUT_SET.planksBlocks.base())) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.OAK_COFFER, 1) + .define('T', ResourceItemsME.TIN_NUGGET) + .define('L', WoodBlockSets.CHESTNUT_SET.planksBlocks.base()) + .unlockedBy(getHasName(WoodBlockSets.CHESTNUT_SET.planksBlocks.base()), + has(WoodBlockSets.CHESTNUT_SET.planksBlocks.base())) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.OAK_COFFER, 1) .pattern("TLT") .pattern("L L") .pattern("LLL") - .input('T', ResourceItemsME.TIN_NUGGET) - .input('L', WoodBlockSets.OAK_SET.planksBlocks.base()) - .criterion(hasItem(WoodBlockSets.OAK_SET.planksBlocks.base()), - conditionsFromItem(WoodBlockSets.OAK_SET.planksBlocks.base())) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.WILLOW_COFFER, 1) + .define('T', ResourceItemsME.TIN_NUGGET) + .define('L', WoodBlockSets.OAK_SET.planksBlocks.base()) + .unlockedBy(getHasName(WoodBlockSets.OAK_SET.planksBlocks.base()), + has(WoodBlockSets.OAK_SET.planksBlocks.base())) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.WILLOW_COFFER, 1) .pattern("TLT") .pattern("L L") .pattern("LLL") - .input('T', ResourceItemsME.TIN_NUGGET) - .input('L', WoodBlockSets.WILLOW_SET.planksBlocks.base()) - .criterion(hasItem(WoodBlockSets.WILLOW_SET.planksBlocks.base()), - conditionsFromItem(WoodBlockSets.WILLOW_SET.planksBlocks.base())) - .offerTo(exporter); + .define('T', ResourceItemsME.TIN_NUGGET) + .define('L', WoodBlockSets.WILLOW_SET.planksBlocks.base()) + .unlockedBy(getHasName(WoodBlockSets.WILLOW_SET.planksBlocks.base()), + has(WoodBlockSets.WILLOW_SET.planksBlocks.base())) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SACK, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SACK, 1) .pattern("C C") .pattern("CRC") .pattern("CCC") - .input('C', GenericBlockSets.CANVAS.blockSet.base()) - .input('R', Items.RESIN_CLUMP) - .criterion(hasItem(Items.RESIN_CLUMP), - conditionsFromItem(Items.RESIN_CLUMP)) - .offerTo(exporter); + .define('C', GenericBlockSets.CANVAS.blockSet.base()) + .define('R', ModNatureBlocks.RESIN_CLUMP) + .unlockedBy(getHasName(ModNatureBlocks.RESIN_CLUMP), + has(ModNatureBlocks.RESIN_CLUMP)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, Items.BELL, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Items.BELL, 1) .pattern("VSV") .pattern("VGV") - .input('S', Items.STICK) - .input('V', StoneBlockSets.STONE_SET.baseBlocks.verticalSlab()) - .input('G', Items.GOLD_INGOT) - .criterion(hasItem(Items.GOLD_INGOT), - conditionsFromItem(Items.GOLD_INGOT)) - .offerTo(exporter); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.STICKY_SNOW, 8) - .input(Items.SNOWBALL, 8) - .input(Items.WATER_BUCKET, 1) - .criterion(hasItem(Items.SNOWBALL), - conditionsFromItem(Items.SNOWBALL)) - .offerTo(exporter); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.STICKY_ICE, 4) + .define('S', Items.STICK) + .define('V', StoneBlockSets.STONE_SET.baseBlocks.verticalSlab()) + .define('G', Items.GOLD_INGOT) + .unlockedBy(getHasName(Items.GOLD_INGOT), + has(Items.GOLD_INGOT)) + .save(recipeOutput); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.STICKY_SNOW, 8) + .requires(Items.SNOWBALL, 8) + .requires(Items.WATER_BUCKET, 1) + .unlockedBy(getHasName(Items.SNOWBALL), + has(Items.SNOWBALL)) + .save(recipeOutput); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.STICKY_ICE, 4) .pattern("II") .pattern("II") - .input('I', Items.ICE) - .criterion(hasItem(Items.ICE), - conditionsFromItem(Items.ICE)) - .offerTo(exporter); - - createBannerPatternRecipe(exporter, ResourceItemsME.PIPEWEED, ResourceItemsME.PIPEWEED_BANNER_PATTERN); - createBannerPatternRecipe(exporter, ModNatureBlocks.LEBETHRON_SAPLING.asItem(), ResourceItemsME.GONDOR_BANNER_PATTERN); - createBannerPatternRecipe(exporter, ModNatureBlocks.MALLORN_SAPLING.asItem(), ResourceItemsME.LOTHLORIEN_BANNER_PATTERN); - createBannerPatternRecipe(exporter, Items.MAGMA_BLOCK, ResourceItemsME.MORDOR_BANNER_PATTERN); - createBannerPatternRecipe(exporter, Items.HAY_BLOCK, ResourceItemsME.ROHAN_BANNER_PATTERN); - createBannerPatternRecipe(exporter, Items.BONE, ResourceItemsME.MISTY_MOUNTAINS_ORCS_BANNER_PATTERN); - createBannerPatternRecipe(exporter, Items.BONE_BLOCK, ResourceItemsME.GOBLIN_SKULL_BANNER_PATTERN); - createBannerPatternRecipe(exporter, Items.SKELETON_SKULL, ResourceItemsME.SCREECHING_SKULL_BANNER_PATTERN); - createBannerPatternRecipe(exporter, Items.WHITE_DYE, ResourceItemsME.ISENGARD_BANNER_PATTERN); - createBannerPatternRecipe(exporter, ToolItemsME.DWARVEN_SMITHING_HAMMER, ResourceItemsME.ANVIL_BANNER_PATTERN); - createBannerPatternRecipe(exporter, ResourceItemsME.BRONZE_INGOT, ResourceItemsME.BELL_BANNER_PATTERN); - createBannerPatternRecipe(exporter, Items.GOLD_NUGGET, ResourceItemsME.DWARF_CROWN_BANNER_PATTERN); - createBannerPatternRecipe(exporter, Items.SPIDER_EYE, ResourceItemsME.SPIDER_BANNER_PATTERN); - createBannerPatternRecipe(exporter, Items.BOW, ResourceItemsME.BOW_BANNER_PATTERN); - createBannerPatternRecipe(exporter, Items.OAK_LEAVES, ResourceItemsME.OAK_LEAF_BANNER_PATTERN); - - createBrickRecipe(exporter, ModBlocks.POINTED_DOLOMITE.asItem(), StoneBlockSets.DOLOMITE_SET.baseBlocks.base(), 1); - createBrickRecipe(exporter, ModBlocks.POINTED_GALONN.asItem(), StoneBlockSets.GALONN_SET.baseBlocks.base(), 1); - createBrickRecipe(exporter, ModBlocks.POINTED_IZHERABAN.asItem(), StoneBlockSets.IZHERABAN_SET.baseBlocks.base(), 1); - createBrickRecipe(exporter, ModBlocks.POINTED_LIMESTONE.asItem(), StoneBlockSets.LIMESTONE_SET.baseBlocks.base(), 1); - - CookingRecipeJsonBuilder.createSmoking(Ingredient.ofTag(itemLookup.getOrThrow(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks")))), RecipeCategory.BUILDING_BLOCKS, WoodBlockSets.SCORCHED_SET.planksBlocks.base(), 0.0f, 100) - .criterion(hasItem(Items.OAK_PLANKS), - conditionsFromItem(Items.OAK_PLANKS)).offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, Registries.BLOCK.getId(WoodBlockSets.SCORCHED_SET.planksBlocks.base()).getPath() + "_from_smoking"))); - CookingRecipeJsonBuilder.createSmoking(Ingredient.ofTag(itemLookup.getOrThrow(TagKey.of(RegistryKeys.ITEM, Identifier.of("logs")))), RecipeCategory.BUILDING_BLOCKS, WoodBlockSets.SCORCHED_SET.logBlocks.log(), 0.0f, 100) - .criterion(hasItem(Items.OAK_LOG), - conditionsFromItem(Items.OAK_LOG)).offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, Registries.BLOCK.getId(WoodBlockSets.SCORCHED_SET.logBlocks.log()).getPath() + "_from_smoking"))); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.SHORT_ICICLES, 4) + .define('I', Items.ICE) + .unlockedBy(getHasName(Items.ICE), + has(Items.ICE)) + .save(recipeOutput); + + createBannerPatternRecipe(recipeOutput, ResourceItemsME.PIPEWEED, ResourceItemsME.PIPEWEED_BANNER_PATTERN); + createBannerPatternRecipe(recipeOutput, ModNatureBlocks.LEBETHRON_SAPLING.asItem(), ResourceItemsME.GONDOR_BANNER_PATTERN); + createBannerPatternRecipe(recipeOutput, ModNatureBlocks.MALLORN_SAPLING.asItem(), ResourceItemsME.LOTHLORIEN_BANNER_PATTERN); + createBannerPatternRecipe(recipeOutput, Items.MAGMA_BLOCK, ResourceItemsME.MORDOR_BANNER_PATTERN); + createBannerPatternRecipe(recipeOutput, Items.HAY_BLOCK, ResourceItemsME.ROHAN_BANNER_PATTERN); + createBannerPatternRecipe(recipeOutput, Items.BONE, ResourceItemsME.MISTY_MOUNTAINS_ORCS_BANNER_PATTERN); + createBannerPatternRecipe(recipeOutput, Items.BONE_BLOCK, ResourceItemsME.GOBLIN_SKULL_BANNER_PATTERN); + createBannerPatternRecipe(recipeOutput, Items.SKELETON_SKULL, ResourceItemsME.SCREECHING_SKULL_BANNER_PATTERN); + createBannerPatternRecipe(recipeOutput, Items.WHITE_DYE, ResourceItemsME.ISENGARD_BANNER_PATTERN); + createBannerPatternRecipe(recipeOutput, ToolItemsME.DWARVEN_SMITHING_HAMMER, ResourceItemsME.ANVIL_BANNER_PATTERN); + createBannerPatternRecipe(recipeOutput, ResourceItemsME.BRONZE_INGOT, ResourceItemsME.BELL_BANNER_PATTERN); + createBannerPatternRecipe(recipeOutput, Items.GOLD_NUGGET, ResourceItemsME.DWARF_CROWN_BANNER_PATTERN); + createBannerPatternRecipe(recipeOutput, Items.SPIDER_EYE, ResourceItemsME.SPIDER_BANNER_PATTERN); + createBannerPatternRecipe(recipeOutput, Items.BOW, ResourceItemsME.BOW_BANNER_PATTERN); + createBannerPatternRecipe(recipeOutput, Items.OAK_LEAVES, ResourceItemsME.OAK_LEAF_BANNER_PATTERN); + + createBrickRecipe(recipeOutput, ModBlocks.POINTED_DOLOMITE.asItem(), StoneBlockSets.DOLOMITE_SET.baseBlocks.base(), 1); + createBrickRecipe(recipeOutput, ModBlocks.POINTED_GALONN.asItem(), StoneBlockSets.GALONN_SET.baseBlocks.base(), 1); + createBrickRecipe(recipeOutput, ModBlocks.POINTED_IZHERABAN.asItem(), StoneBlockSets.IZHERABAN_SET.baseBlocks.base(), 1); + createBrickRecipe(recipeOutput, ModBlocks.POINTED_LIMESTONE.asItem(), StoneBlockSets.LIMESTONE_SET.baseBlocks.base(), 1); + + SimpleCookingRecipeBuilder.smoking(Ingredient.of(ItemTags.PLANKS), RecipeCategory.BUILDING_BLOCKS, WoodBlockSets.SCORCHED_SET.planksBlocks.base(), 0.0f, 100) + .unlockedBy(getHasName(Items.OAK_PLANKS), + has(Items.OAK_PLANKS)).save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, BuiltInRegistries.BLOCK.getKey(WoodBlockSets.SCORCHED_SET.planksBlocks.base()).getPath() + "_from_smoking"))); + SimpleCookingRecipeBuilder.smoking(Ingredient.of(ItemTags.LOGS), RecipeCategory.BUILDING_BLOCKS, WoodBlockSets.SCORCHED_SET.logBlocks.log(), 0.0f, 100) + .unlockedBy(getHasName(Items.OAK_LOG), + has(Items.OAK_LOG)).save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, BuiltInRegistries.BLOCK.getKey(WoodBlockSets.SCORCHED_SET.logBlocks.log()).getPath() + "_from_smoking"))); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.SHORT_ICICLES, 4) .pattern("III") .pattern(" I ") - .input('I', Items.ICE) - .criterion(hasItem(Items.ICE), - conditionsFromItem(Items.ICE)) - .offerTo(exporter); + .define('I', Items.ICE) + .unlockedBy(getHasName(Items.ICE), + has(Items.ICE)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.DROOPING_ICICLES, 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.DROOPING_ICICLES, 4) .pattern("III") .pattern("III") .pattern(" I ") - .input('I', Items.ICE) - .criterion(hasItem(Items.ICE), - conditionsFromItem(Items.ICE)) - .offerTo(exporter); + .define('I', Items.ICE) + .unlockedBy(getHasName(Items.ICE), + has(Items.ICE)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, Items.BUCKET, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Items.BUCKET, 1) .pattern("T T") .pattern("T T") .pattern(" T ") - .input('T', ResourceItemsME.TIN_INGOT) - .criterion(hasItem(ResourceItemsME.TIN_INGOT), - conditionsFromItem(ResourceItemsME.TIN_INGOT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, Registries.ITEM.getId(Items.BUCKET).getPath() + "_alt"))); + .define('T', ResourceItemsME.TIN_INGOT) + .unlockedBy(getHasName(ResourceItemsME.TIN_INGOT), + has(ResourceItemsME.TIN_INGOT)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, BuiltInRegistries.ITEM.getKey(Items.BUCKET).getPath() + "_alt"))); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, Items.CAULDRON, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, Items.CAULDRON, 1) .pattern("T T") .pattern("T T") .pattern("TBT") - .input('T', ResourceItemsME.TIN_INGOT) - .input('B', ModBlocks.TIN_BLOCK) - .criterion(hasItem(ResourceItemsME.TIN_INGOT), - conditionsFromItem(ResourceItemsME.TIN_INGOT)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, Registries.ITEM.getId(Items.CAULDRON).getPath() + "_alt"))); + .define('T', ResourceItemsME.TIN_INGOT) + .define('B', ModBlocks.TIN_BLOCK) + .unlockedBy(getHasName(ResourceItemsME.TIN_INGOT), + has(ResourceItemsME.TIN_INGOT)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, BuiltInRegistries.ITEM.getKey(Items.CAULDRON).getPath() + "_alt"))); - createCenterSurroundRecipe(exporter, Blocks.TUFF.asItem(), Items.RAW_COPPER, StoneBlockSets.GREEN_TUFF_SET.baseBlocks.base().asItem(), 8); - createCenterSurroundRecipe(exporter, StoneBlockSets.SLATE_SET.baseBlocks.base().asItem(), Items.RAW_COPPER, StoneBlockSets.KHAGALABAN_SET.baseBlocks.base().asItem(), 8); - createCenterSurroundRecipe(exporter, Blocks.TUFF.asItem(), Items.IRON_NUGGET, StoneBlockSets.IRONSTONE_SET.baseBlocks.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, Blocks.TUFF.asItem(), Items.RAW_COPPER, StoneBlockSets.GREEN_TUFF_SET.baseBlocks.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, StoneBlockSets.SLATE_SET.baseBlocks.base().asItem(), Items.RAW_COPPER, StoneBlockSets.KHAGALABAN_SET.baseBlocks.base().asItem(), 8); + createCenterSurroundRecipe(recipeOutput, Blocks.TUFF.asItem(), Items.IRON_NUGGET, StoneBlockSets.IRONSTONE_SET.baseBlocks.base().asItem(), 8); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BROWN_JUG, Items.CLAY); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.LARGE_JUG, Items.CLAY); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GRAY_POT, Items.CLAY); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BROWN_JUG, Items.CLAY); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.LARGE_JUG, Items.CLAY); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GRAY_POT, Items.CLAY); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BROWN_JAR, Items.CLAY); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CLAY_JAR, Items.CLAY); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GRAY_JAR, Items.CLAY); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BROWN_JAR, Items.CLAY); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.CLAY_JAR, Items.CLAY); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GRAY_JAR, Items.CLAY); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.AMPHORA, Items.CLAY); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BROWN_AMPHORA, Items.CLAY); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GRAY_VASE, Items.CLAY); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.AMPHORA, Items.CLAY); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BROWN_AMPHORA, Items.CLAY); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GRAY_VASE, Items.CLAY); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BROWN_FAT_POT, Items.CLAY); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.FAT_POT, Items.CLAY); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GRAY_FAT_POT, Items.CLAY); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.BROWN_FAT_POT, Items.CLAY); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.FAT_POT, Items.CLAY); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GRAY_FAT_POT, Items.CLAY); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.POT_OF_GOLD, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.POT_OF_GOLD, 1) .pattern(" G ") .pattern("GGG") .pattern(" P ") - .input('P', ModDecorativeBlocks.FAT_POT) - .input('G', ResourceItemsME.GOLD_COIN) - .criterion(hasItem(ResourceItemsME.GOLD_COIN), - conditionsFromItem(ResourceItemsME.GOLD_COIN)) - .offerTo(exporter); + .define('P', ModDecorativeBlocks.FAT_POT) + .define('G', ResourceItemsME.GOLD_COIN) + .unlockedBy(getHasName(ResourceItemsME.GOLD_COIN), + has(ResourceItemsME.GOLD_COIN)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.AZALEA_FLOWER_GROWTH.asItem(), 8) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.AZALEA_FLOWER_GROWTH.asItem(), 8) .pattern("lll") .pattern("lll") - .input('l', Items.FLOWERING_AZALEA_LEAVES) - .criterion(hasItem(Items.FLOWERING_AZALEA_LEAVES), - conditionsFromItem(Items.FLOWERING_AZALEA_LEAVES)) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.DRY_GROWTH.asItem(), 4) + .define('l', Items.FLOWERING_AZALEA_LEAVES) + .unlockedBy(getHasName(Items.FLOWERING_AZALEA_LEAVES), + has(Items.FLOWERING_AZALEA_LEAVES)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.DRY_GROWTH.asItem(), 4) .pattern("sss") .pattern("sss") - .input('s', Items.STICK) - .criterion(hasItem(Items.STICK), - conditionsFromItem(Items.STICK)) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.THORNY_GROWTH.asItem(), 6) + .define('s', Items.STICK) + .unlockedBy(getHasName(Items.STICK), + has(Items.STICK)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.THORNY_GROWTH.asItem(), 6) .pattern("sls") .pattern("sls") - .input('s', Items.STICK) - .input('l', FoodItemsME.TOUGH_BERRIES) - .criterion(hasItem(FoodItemsME.TOUGH_BERRIES), - conditionsFromItem(FoodItemsME.TOUGH_BERRIES)) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.GREEN_GROWTH.asItem(), 8) + .define('s', Items.STICK) + .define('l', FoodItemsME.TOUGH_BERRIES) + .unlockedBy(getHasName(FoodItemsME.TOUGH_BERRIES), + has(FoodItemsME.TOUGH_BERRIES)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.GREEN_GROWTH.asItem(), 8) .pattern("lll") .pattern("lll") - .input('l', TagKey.of(RegistryKeys.ITEM, Identifier.of("leaves"))) - .criterion(hasItem(Items.OAK_LEAVES), - conditionsFromItem(Items.OAK_LEAVES)) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.IVY_GROWTH.asItem(), 6) + .define('l', TagKey.create(Registries.ITEM, ResourceLocation.parse("leaves"))) + .unlockedBy(getHasName(Items.OAK_LEAVES), + has(Items.OAK_LEAVES)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.IVY_GROWTH.asItem(), 6) .pattern("sls") .pattern("sls") - .input('s', Items.STICK) - .input('l', TagKey.of(RegistryKeys.ITEM, Identifier.of("leaves"))) - .criterion(hasItem(Items.OAK_LEAVES), - conditionsFromItem(Items.OAK_LEAVES)) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.LILAC_FLOWER_GROWTH.asItem(), 8) + .define('s', Items.STICK) + .define('l', TagKey.create(Registries.ITEM, ResourceLocation.parse("leaves"))) + .unlockedBy(getHasName(Items.OAK_LEAVES), + has(Items.OAK_LEAVES)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.LILAC_FLOWER_GROWTH.asItem(), 8) .pattern("lfl") .pattern("lfl") - .input('f', Items.LILAC) - .input('l', TagKey.of(RegistryKeys.ITEM, Identifier.of("leaves"))) - .criterion(hasItem(Items.OAK_LEAVES), - conditionsFromItem(Items.OAK_LEAVES)) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.PINK_FLOWER_GROWTH.asItem(), 8) + .define('f', Items.LILAC) + .define('l', TagKey.create(Registries.ITEM, ResourceLocation.parse("leaves"))) + .unlockedBy(getHasName(Items.OAK_LEAVES), + has(Items.OAK_LEAVES)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.PINK_FLOWER_GROWTH.asItem(), 8) .pattern("lfl") .pattern("lfl") - .input('f', ModNatureBlocks.PINK_FLOWERS) - .input('l', TagKey.of(RegistryKeys.ITEM, Identifier.of("leaves"))) - .criterion(hasItem(ModNatureBlocks.PINK_FLOWERS), - conditionsFromItem(ModNatureBlocks.PINK_FLOWERS)) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.RED_FLOWER_GROWTH.asItem(), 8) + .define('f', ModNatureBlocks.PINK_FLOWERS) + .define('l', TagKey.create(Registries.ITEM, ResourceLocation.parse("leaves"))) + .unlockedBy(getHasName(ModNatureBlocks.PINK_FLOWERS), + has(ModNatureBlocks.PINK_FLOWERS)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.RED_FLOWER_GROWTH.asItem(), 8) .pattern("lfl") .pattern("lfl") - .input('f', ModNatureBlocks.RED_FLOWERS) - .input('l', TagKey.of(RegistryKeys.ITEM, Identifier.of("leaves"))) - .criterion(hasItem(ModNatureBlocks.RED_FLOWERS), - conditionsFromItem(ModNatureBlocks.RED_FLOWERS)) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.WHITE_FLOWER_GROWTH.asItem(), 8) + .define('f', ModNatureBlocks.RED_FLOWERS) + .define('l', TagKey.create(Registries.ITEM, ResourceLocation.parse("leaves"))) + .unlockedBy(getHasName(ModNatureBlocks.RED_FLOWERS), + has(ModNatureBlocks.RED_FLOWERS)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.WHITE_FLOWER_GROWTH.asItem(), 8) .pattern("lfl") .pattern("lfl") - .input('f', ModNatureBlocks.WHITE_FLOWERS) - .input('l', TagKey.of(RegistryKeys.ITEM, Identifier.of("leaves"))) - .criterion(hasItem(ModNatureBlocks.WHITE_FLOWERS), - conditionsFromItem(ModNatureBlocks.WHITE_FLOWERS)) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.YELLOW_FLOWER_GROWTH.asItem(), 8) + .define('f', ModNatureBlocks.WHITE_FLOWERS) + .define('l', TagKey.create(Registries.ITEM, ResourceLocation.parse("leaves"))) + .unlockedBy(getHasName(ModNatureBlocks.WHITE_FLOWERS), + has(ModNatureBlocks.WHITE_FLOWERS)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.YELLOW_FLOWER_GROWTH.asItem(), 8) .pattern("lfl") .pattern("lfl") - .input('f', ModNatureBlocks.YELLOW_FLOWERS) - .input('l', TagKey.of(RegistryKeys.ITEM, Identifier.of("leaves"))) - .criterion(hasItem(ModNatureBlocks.YELLOW_FLOWERS), - conditionsFromItem(ModNatureBlocks.YELLOW_FLOWERS)) - .offerTo(exporter); + .define('f', ModNatureBlocks.YELLOW_FLOWERS) + .define('l', TagKey.create(Registries.ITEM, ResourceLocation.parse("leaves"))) + .unlockedBy(getHasName(ModNatureBlocks.YELLOW_FLOWERS), + has(ModNatureBlocks.YELLOW_FLOWERS)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.FROZEN_GROWTH.asItem(), 8) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.FROZEN_GROWTH.asItem(), 8) .pattern("sis") .pattern("sis") - .input('i', ModNatureBlocks.STICKY_SNOW) - .input('s', ModNatureBlocks.DRY_GROWTH) - .criterion(hasItem(ModNatureBlocks.DRY_GROWTH), - conditionsFromItem(ModNatureBlocks.DRY_GROWTH)) - .offerTo(exporter); + .define('i', ModNatureBlocks.STICKY_SNOW) + .define('s', ModNatureBlocks.DRY_GROWTH) + .unlockedBy(getHasName(ModNatureBlocks.DRY_GROWTH), + has(ModNatureBlocks.DRY_GROWTH)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GOLDEN_CHALICE, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GOLDEN_CHALICE, 1) .pattern("I") .pattern("N") .pattern("N") - .input('I', Items.GOLD_INGOT) - .input('N', Items.GOLD_NUGGET) - .criterion(hasItem(Items.GOLD_INGOT), - conditionsFromItem(Items.GOLD_INGOT)) - .offerTo(exporter); + .define('I', Items.GOLD_INGOT) + .define('N', Items.GOLD_NUGGET) + .unlockedBy(getHasName(Items.GOLD_INGOT), + has(Items.GOLD_INGOT)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.COPPER_TREASURE_HEAP_LAYER, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.COPPER_TREASURE_HEAP_LAYER, 1) .pattern("NNN") - .input('N', ResourceItemsME.COPPER_COIN) - .criterion(hasItem(ResourceItemsME.COPPER_COIN), - conditionsFromItem(ResourceItemsME.COPPER_COIN)) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SILVER_TREASURE_HEAP_LAYER, 1) + .define('N', ResourceItemsME.COPPER_COIN) + .unlockedBy(getHasName(ResourceItemsME.COPPER_COIN), + has(ResourceItemsME.COPPER_COIN)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SILVER_TREASURE_HEAP_LAYER, 1) .pattern("NNN") - .input('N', ResourceItemsME.SILVER_COIN) - .criterion(hasItem(ResourceItemsME.SILVER_COIN), - conditionsFromItem(ResourceItemsME.SILVER_COIN)) - .offerTo(exporter); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GOLD_TREASURE_HEAP_LAYER, 1) + .define('N', ResourceItemsME.SILVER_COIN) + .unlockedBy(getHasName(ResourceItemsME.SILVER_COIN), + has(ResourceItemsME.SILVER_COIN)) + .save(recipeOutput); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GOLD_TREASURE_HEAP_LAYER, 1) .pattern("NNN") - .input('N', ResourceItemsME.GOLD_COIN) - .criterion(hasItem(ResourceItemsME.GOLD_COIN), - conditionsFromItem(ResourceItemsME.GOLD_COIN)) - .offerTo(exporter); + .define('N', ResourceItemsME.GOLD_COIN) + .unlockedBy(getHasName(ResourceItemsME.GOLD_COIN), + has(ResourceItemsME.GOLD_COIN)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.COPPER_COIN_PILE, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.COPPER_COIN_PILE, 1) .pattern("NN") .pattern("NN") - .input('N', ResourceItemsME.COPPER_COIN) - .criterion(hasItem(ResourceItemsME.COPPER_COIN), - conditionsFromItem(ResourceItemsME.COPPER_COIN)) - .offerTo(exporter); + .define('N', ResourceItemsME.COPPER_COIN) + .unlockedBy(getHasName(ResourceItemsME.COPPER_COIN), + has(ResourceItemsME.COPPER_COIN)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SILVER_COIN_PILE, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.SILVER_COIN_PILE, 1) .pattern("NN") .pattern("NN") - .input('N', ResourceItemsME.SILVER_COIN) - .criterion(hasItem(ResourceItemsME.SILVER_COIN), - conditionsFromItem(ResourceItemsME.SILVER_COIN)) - .offerTo(exporter); + .define('N', ResourceItemsME.SILVER_COIN) + .unlockedBy(getHasName(ResourceItemsME.SILVER_COIN), + has(ResourceItemsME.SILVER_COIN)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GOLD_COIN_PILE, 1) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, ModDecorativeBlocks.GOLD_COIN_PILE, 1) .pattern("NN") .pattern("NN") - .input('N', ResourceItemsME.GOLD_COIN) - .criterion(hasItem(ResourceItemsME.GOLD_COIN), - conditionsFromItem(ResourceItemsME.GOLD_COIN)) - .offerTo(exporter); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ResourceItemsME.COPPER_COIN, 3) - .input(ModDecorativeBlocks.COPPER_TREASURE_HEAP_LAYER) - .criterion(hasItem(ModDecorativeBlocks.COPPER_TREASURE_HEAP_LAYER), - conditionsFromItem(ModDecorativeBlocks.COPPER_TREASURE_HEAP_LAYER)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "copper_coin_from_treasure"))); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ResourceItemsME.SILVER_COIN, 3) - .input(ModDecorativeBlocks.SILVER_TREASURE_HEAP_LAYER) - .criterion(hasItem(ModDecorativeBlocks.SILVER_TREASURE_HEAP_LAYER), - conditionsFromItem(ModDecorativeBlocks.SILVER_TREASURE_HEAP_LAYER)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "silver_coin_from_treasure"))); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ResourceItemsME.GOLD_COIN, 3) - .input(ModDecorativeBlocks.GOLD_TREASURE_HEAP_LAYER) - .criterion(hasItem(ModDecorativeBlocks.GOLD_TREASURE_HEAP_LAYER), - conditionsFromItem(ModDecorativeBlocks.GOLD_TREASURE_HEAP_LAYER)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "gold_nugget_from_treasure"))); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ResourceItemsME.COPPER_COIN, 4) - .input(ModDecorativeBlocks.COPPER_COIN_PILE) - .criterion(hasItem(ModDecorativeBlocks.COPPER_COIN_PILE), - conditionsFromItem(ModDecorativeBlocks.COPPER_COIN_PILE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "copper_coin_from_pile"))); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ResourceItemsME.SILVER_COIN, 4) - .input(ModDecorativeBlocks.SILVER_COIN_PILE) - .criterion(hasItem(ModDecorativeBlocks.SILVER_COIN_PILE), - conditionsFromItem(ModDecorativeBlocks.SILVER_COIN_PILE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "silver_coin_from_pile"))); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ResourceItemsME.GOLD_COIN, 4) - .input(ModDecorativeBlocks.GOLD_COIN_PILE) - .criterion(hasItem(ModDecorativeBlocks.GOLD_COIN_PILE), - conditionsFromItem(ModDecorativeBlocks.GOLD_COIN_PILE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "gold_nugget_from_pile"))); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.SHORT_BULRUSH, 2) - .input(ModNatureBlocks.TALL_BULRUSH) - .criterion(hasItem(ModNatureBlocks.TALL_BULRUSH), - conditionsFromItem(ModNatureBlocks.TALL_BULRUSH)) - .offerTo(exporter); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.SHORT_REEDS, 2) - .input(ResourceItemsME.REEDS) - .criterion(hasItem(ResourceItemsME.REEDS), - conditionsFromItem(ResourceItemsME.REEDS)) - .offerTo(exporter); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.SHORT_DEAD_RUSHES, 2) - .input(ModNatureBlocks.DEAD_RUSHES) - .criterion(hasItem(ModNatureBlocks.DEAD_RUSHES), - conditionsFromItem(ModNatureBlocks.DEAD_RUSHES)) - .offerTo(exporter); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.SHORT_RUSHES, 2) - .input(ModNatureBlocks.RUSHES) - .criterion(hasItem(ModNatureBlocks.RUSHES), - conditionsFromItem(ModNatureBlocks.RUSHES)) - .offerTo(exporter); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.SHORT_CATTAILS, 2) - .input(ModNatureBlocks.TALL_CATTAILS) - .criterion(hasItem(ModNatureBlocks.TALL_CATTAILS), - conditionsFromItem(ModNatureBlocks.TALL_CATTAILS)) - .offerTo(exporter); - - ShapelessRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, ResourceItemsME.GOLD_COIN, 4) - .input(ModDecorativeBlocks.POT_OF_GOLD) - .criterion(hasItem(ModDecorativeBlocks.POT_OF_GOLD), - conditionsFromItem(ModDecorativeBlocks.POT_OF_GOLD)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, "gold_from_pot_of_gold"))); - - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, WeaponItemsME.HELD_BANNER, 1) + .define('N', ResourceItemsME.GOLD_COIN) + .unlockedBy(getHasName(ResourceItemsME.GOLD_COIN), + has(ResourceItemsME.GOLD_COIN)) + .save(recipeOutput); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ResourceItemsME.COPPER_COIN, 3) + .requires(ModDecorativeBlocks.COPPER_TREASURE_HEAP_LAYER) + .unlockedBy(getHasName(ModDecorativeBlocks.COPPER_TREASURE_HEAP_LAYER), + has(ModDecorativeBlocks.COPPER_TREASURE_HEAP_LAYER)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "copper_coin_from_treasure"))); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ResourceItemsME.SILVER_COIN, 3) + .requires(ModDecorativeBlocks.SILVER_TREASURE_HEAP_LAYER) + .unlockedBy(getHasName(ModDecorativeBlocks.SILVER_TREASURE_HEAP_LAYER), + has(ModDecorativeBlocks.SILVER_TREASURE_HEAP_LAYER)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "silver_coin_from_treasure"))); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ResourceItemsME.GOLD_COIN, 3) + .requires(ModDecorativeBlocks.GOLD_TREASURE_HEAP_LAYER) + .unlockedBy(getHasName(ModDecorativeBlocks.GOLD_TREASURE_HEAP_LAYER), + has(ModDecorativeBlocks.GOLD_TREASURE_HEAP_LAYER)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "gold_nugget_from_treasure"))); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ResourceItemsME.COPPER_COIN, 4) + .requires(ModDecorativeBlocks.COPPER_COIN_PILE) + .unlockedBy(getHasName(ModDecorativeBlocks.COPPER_COIN_PILE), + has(ModDecorativeBlocks.COPPER_COIN_PILE)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "copper_coin_from_pile"))); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ResourceItemsME.SILVER_COIN, 4) + .requires(ModDecorativeBlocks.SILVER_COIN_PILE) + .unlockedBy(getHasName(ModDecorativeBlocks.SILVER_COIN_PILE), + has(ModDecorativeBlocks.SILVER_COIN_PILE)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "silver_coin_from_pile"))); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ResourceItemsME.GOLD_COIN, 4) + .requires(ModDecorativeBlocks.GOLD_COIN_PILE) + .unlockedBy(getHasName(ModDecorativeBlocks.GOLD_COIN_PILE), + has(ModDecorativeBlocks.GOLD_COIN_PILE)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "gold_nugget_from_pile"))); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.SHORT_BULRUSH, 2) + .requires(ModNatureBlocks.TALL_BULRUSH) + .unlockedBy(getHasName(ModNatureBlocks.TALL_BULRUSH), + has(ModNatureBlocks.TALL_BULRUSH)) + .save(recipeOutput); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.SHORT_REEDS, 2) + .requires(ResourceItemsME.REEDS) + .unlockedBy(getHasName(ResourceItemsME.REEDS), + has(ResourceItemsME.REEDS)) + .save(recipeOutput); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.SHORT_DEAD_RUSHES, 2) + .requires(ModNatureBlocks.DEAD_RUSHES) + .unlockedBy(getHasName(ModNatureBlocks.DEAD_RUSHES), + has(ModNatureBlocks.DEAD_RUSHES)) + .save(recipeOutput); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.SHORT_RUSHES, 2) + .requires(ModNatureBlocks.RUSHES) + .unlockedBy(getHasName(ModNatureBlocks.RUSHES), + has(ModNatureBlocks.RUSHES)) + .save(recipeOutput); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ModNatureBlocks.SHORT_CATTAILS, 2) + .requires(ModNatureBlocks.TALL_CATTAILS) + .unlockedBy(getHasName(ModNatureBlocks.TALL_CATTAILS), + has(ModNatureBlocks.TALL_CATTAILS)) + .save(recipeOutput); + + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ResourceItemsME.GOLD_COIN, 4) + .requires(ModDecorativeBlocks.POT_OF_GOLD) + .unlockedBy(getHasName(ModDecorativeBlocks.POT_OF_GOLD), + has(ModDecorativeBlocks.POT_OF_GOLD)) + .save(recipeOutput, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "gold_from_pot_of_gold"))); + + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, WeaponItemsME.HELD_BANNER, 1) .pattern("WWW") .pattern("WWW") .pattern("WSW") - .input('W', TagKey.of(RegistryKeys.ITEM, Identifier.of("wool"))) - .input('S', Items.STICK) - .criterion(hasItem(ResourceItemsME.GOLD_COIN), - conditionsFromItem(ResourceItemsME.GOLD_COIN)) - .offerTo(exporter); + .define('W', TagKey.create(Registries.ITEM, ResourceLocation.parse("wool"))) + .define('S', Items.STICK) + .unlockedBy(getHasName(ResourceItemsME.GOLD_COIN), + has(ResourceItemsME.GOLD_COIN)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.SLATE_SET.baseBlocks.base(), 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.SLATE_SET.baseBlocks.base(), 4) .pattern("DS") .pattern("SD") - .input('D', Items.DEEPSLATE) - .input('S', Items.STONE) - .criterion(hasItem(Items.DEEPSLATE), - conditionsFromItem(Items.DEEPSLATE)) - .offerTo(exporter); + .define('D', Items.DEEPSLATE) + .define('S', Items.STONE) + .unlockedBy(getHasName(Items.DEEPSLATE), + has(Items.DEEPSLATE)) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.BLUE_TUFF_SET.baseBlocks.base(), 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.BLUE_TUFF_SET.baseBlocks.base(), 4) .pattern("TG") .pattern("GT") - .input('T', Items.TUFF) - .input('G', StoneBlockSets.KHAGALABAN_SET.baseBlocks.base()) - .criterion(hasItem(StoneBlockSets.KHAGALABAN_SET.baseBlocks.base()), - conditionsFromItem(StoneBlockSets.KHAGALABAN_SET.baseBlocks.base())) - .offerTo(exporter); + .define('T', Items.TUFF) + .define('G', StoneBlockSets.KHAGALABAN_SET.baseBlocks.base()) + .unlockedBy(getHasName(StoneBlockSets.KHAGALABAN_SET.baseBlocks.base()), + has(StoneBlockSets.KHAGALABAN_SET.baseBlocks.base())) + .save(recipeOutput); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.HEMATITE_SET.baseBlocks.base(), 4) + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, StoneBlockSets.HEMATITE_SET.baseBlocks.base(), 4) .pattern("SI") .pattern("IS") - .input('S', Items.STONE) - .input('I', StoneBlockSets.IRONSTONE_SET.baseBlocks.base()) - .criterion(hasItem(StoneBlockSets.IRONSTONE_SET.baseBlocks.base()), - conditionsFromItem(StoneBlockSets.IRONSTONE_SET.baseBlocks.base())) - .offerTo(exporter); - - createSmokingRecipe(exporter, Items.SHORT_GRASS, ModNatureBlocks.SCORCHED_GRASS.asItem()); - createSmokingRecipe(exporter, ModNatureBlocks.GRASS_TUFT.asItem(), ModNatureBlocks.SCORCHED_TUFT.asItem()); - createSmokingRecipe(exporter, ModNatureBlocks.GREEN_SHRUB.asItem(), ModNatureBlocks.SCORCHED_SHRUB.asItem()); + .define('S', Items.STONE) + .define('I', StoneBlockSets.IRONSTONE_SET.baseBlocks.base()) + .unlockedBy(getHasName(StoneBlockSets.IRONSTONE_SET.baseBlocks.base()), + has(StoneBlockSets.IRONSTONE_SET.baseBlocks.base())) + .save(recipeOutput); + + createSmokingRecipe(recipeOutput, Items.SHORT_GRASS, ModNatureBlocks.SCORCHED_GRASS.asItem()); + createSmokingRecipe(recipeOutput, ModNatureBlocks.GRASS_TUFT.asItem(), ModNatureBlocks.SCORCHED_TUFT.asItem()); + createSmokingRecipe(recipeOutput, ModNatureBlocks.GREEN_SHRUB.asItem(), ModNatureBlocks.SCORCHED_SHRUB.asItem()); //endregion //region SMOKING-ONLY - createSmokingRecipe(exporter, ResourceItemsME.PIPEWEED, ResourceItemsME.DRIED_PIPEWEED); + createSmokingRecipe(recipeOutput, ResourceItemsME.PIPEWEED, ResourceItemsME.DRIED_PIPEWEED); //endregion - ComplexRecipeJsonBuilder.create(CustomItemDecorationRecipe::new).offerTo(exporter, "custom_shield_decoration"); + SpecialRecipeBuilder.special(CustomItemDecorationRecipe::new).save(recipeOutput, "custom_shield_decoration"); } //region Refactored Methods private void createStoneSetRecipes(BlockRecordTypes.RegularSet base) { if (base != null) { - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, base.slab(), base.base()); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, base.slab(), base.base(), 2); - createVerticalSlabsRecipe(exporter, base.slab(), base.verticalSlab()); - createSlabsFromVerticalRecipe(exporter, base.verticalSlab(), base.slab()); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, base.verticalSlab(), base.base(), 2); - createStairsRecipe(exporter, base.base(), base.stairs()); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, base.stairs(), base.base()); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, base.wall(), 6) - .pattern("lll") - .pattern("lll") - .input('l', base.base()) - .criterion(hasItem(base.base()), - conditionsFromItem(base.base())) - .offerTo(exporter); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, base.wall(), base.base()); + if(!isVanillaBlock(base.slab())) { + slab(RecipeCategory.BUILDING_BLOCKS, base.slab(), base.base()); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, base.slab(), base.base(), 2); + } + if(!isVanillaBlock(base.verticalSlab())) { + createVerticalSlabsRecipe(recipeOutput, base.slab(), base.verticalSlab()); + createSlabsFromVerticalRecipe(recipeOutput, base.verticalSlab(), base.slab()); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, base.verticalSlab(), base.base(), 2); + } + if(!isVanillaBlock(base.stairs())) { + createStairsRecipe(recipeOutput, base.base(), base.stairs()); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, base.stairs(), base.base()); + } + if(!isVanillaBlock(base.wall())) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, base.wall(), 6) + .pattern("lll") + .pattern("lll") + .define('l', base.base()) + .unlockedBy(getHasName(base.base()), + has(base.base())) + .save(recipeOutput); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, base.wall(), base.base()); + } } } private void createStoneSetRecipes(BlockRecordTypes.BaseStoneSet base) { if (base != null) { - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, base.slab(), base.base()); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, base.slab(), base.base(), 2); - createVerticalSlabsRecipe(exporter, base.slab(), base.verticalSlab()); - createSlabsFromVerticalRecipe(exporter, base.verticalSlab(), base.slab()); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, base.verticalSlab(), base.base(), 2); - createStairsRecipe(exporter, base.base(), base.stairs()); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, base.stairs(), base.base()); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, base.wall(), 6) - .pattern("lll") - .pattern("lll") - .input('l', base.base()) - .criterion(hasItem(base.base()), - conditionsFromItem(base.base())) - .offerTo(exporter); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, base.wall(), base.base()); + if(!isVanillaBlock(base.slab())) { + slab(RecipeCategory.BUILDING_BLOCKS, base.slab(), base.base()); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, base.slab(), base.base(), 2); + } + if(!isVanillaBlock(base.verticalSlab())) { + createVerticalSlabsRecipe(recipeOutput, base.slab(), base.verticalSlab()); + createSlabsFromVerticalRecipe(recipeOutput, base.verticalSlab(), base.slab()); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, base.verticalSlab(), base.base(), 2); + } + if(!isVanillaBlock(base.stairs())) { + createStairsRecipe(recipeOutput, base.base(), base.stairs()); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, base.stairs(), base.base()); + } + if(!isVanillaBlock(base.wall())) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, base.wall(), 6) + .pattern("lll") + .pattern("lll") + .define('l', base.base()) + .unlockedBy(getHasName(base.base()), + has(base.base())) + .save(recipeOutput); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, base.wall(), base.base()); + } } } private void createStoneSetRecipes(BlockRecordTypes.PillarSet base) { if (base != null) { - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, base.verticalSlab(), base.base(), 2); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, base.wall(), 6) - .pattern("lll") - .pattern("lll") - .input('l', base.base()) - .criterion(hasItem(base.base()), - conditionsFromItem(base.base())) - .offerTo(exporter); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, base.wall(), base.base()); + if(!isVanillaBlock(base.verticalSlab())) { + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, base.verticalSlab(), base.base(), 2); + } + if(!isVanillaBlock(base.wall())) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, base.wall(), 6) + .pattern("lll") + .pattern("lll") + .define('l', base.base()) + .unlockedBy(getHasName(base.base()), + has(base.base())) + .save(recipeOutput); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, base.wall(), base.base()); + } } } + + private boolean isVanillaBlock(Block block) { + return BuiltInRegistries.BLOCK.getKey(block).getNamespace().equals(ResourceLocation.DEFAULT_NAMESPACE); + } private void createChiseledStoneSetRecipes(BlockRecordTypes.PillarSet base) { if (base != null) { - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, base.verticalSlab(), base.base(), 2); - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, base.wall(), 6) + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, base.verticalSlab(), base.base(), 2); + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, base.wall(), 6) .pattern("lll") .pattern("lll") - .input('l', base.base()) - .criterion(hasItem(base.base()), - conditionsFromItem(base.base())) - .offerTo(exporter); - offerStonecuttingRecipe(RecipeCategory.BUILDING_BLOCKS, base.wall(), base.base()); + .define('l', base.base()) + .unlockedBy(getHasName(base.base()), + has(base.base())) + .save(recipeOutput); + stonecutterResultFromBase(RecipeCategory.BUILDING_BLOCKS, base.wall(), base.base()); } } //endregion //region BLOCK RECIPE METHODS - private void createBrickRecipe(RecipeExporter exporter, Item input, Block output, int count) { - ShapedRecipeJsonBuilder.create(itemLookup, RecipeCategory.BUILDING_BLOCKS, output, count) + private void createBrickRecipe(RecipeOutput exporter, Item input, Block recipeOutput, int count) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, count) .pattern("ll") .pattern("ll") - .input('l', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('l', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createPillarRecipe(RecipeExporter exporter, Block input, Block output, int count) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, count) + private void createPillarRecipe(RecipeOutput exporter, Block input, Block recipeOutput, int count) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, count) .pattern("l") .pattern("l") .pattern("l") - .input('l', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('l', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createChiseledRecipe(RecipeExporter exporter, Block input, Block output, int count) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, count) + private void createChiseledRecipe(RecipeOutput exporter, Block input, Block recipeOutput, int count) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, count) .pattern("l") .pattern("l") - .input('l', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('l', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createCutPolishedRecipe(RecipeExporter exporter, Block input, Block output, int count) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, count) + private void createCutPolishedRecipe(RecipeOutput exporter, Block input, Block recipeOutput, int count) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, count) .pattern("l") .pattern("l") - .input('l', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('l', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createMossyRecipe(RecipeExporter exporter, Block input, Block output) { - ShapelessRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 1) - .input(input) - .input(Items.VINE) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, Registries.BLOCK.getId(output).getPath() + "_vine"))); + private void createMossyRecipe(RecipeOutput exporter, Block input, Block recipeOutput) { + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 1) + .requires(input) + .requires(Items.VINE) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, BuiltInRegistries.BLOCK.getKey(recipeOutput).getPath() + "_vine"))); - ShapelessRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 1) - .input(input) - .input(Blocks.MOSS_BLOCK) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, Registries.BLOCK.getId(output).getPath() + "_moss"))); + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 1) + .requires(input) + .requires(Blocks.MOSS_BLOCK) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, BuiltInRegistries.BLOCK.getKey(recipeOutput).getPath() + "_moss"))); + } + + private void createSmeltingRecipe(RecipeOutput exporter, Item input, Item recipeOutput) { + SimpleCookingRecipeBuilder.smelting(Ingredient.of(input), RecipeCategory.BUILDING_BLOCKS, recipeOutput, 0.1f, 200) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createSmeltingRecipe(RecipeExporter exporter, Item input, Item output) { - CookingRecipeJsonBuilder.createSmelting(Ingredient.ofItems(input), RecipeCategory.BUILDING_BLOCKS, output, 0.1f, 200) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + private void createSmeltingRecipeIdentifier(RecipeOutput exporter, Item input, Item recipeOutput) { + SimpleCookingRecipeBuilder.smelting(Ingredient.of(input), RecipeCategory.BUILDING_BLOCKS, recipeOutput, 0.1f, 200) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, BuiltInRegistries.ITEM.getKey(recipeOutput).getPath() + "_from_smelting"))); } - private void createSmeltingRecipeIdentifier(RecipeExporter exporter, Item input, Item output) { - CookingRecipeJsonBuilder.createSmelting(Ingredient.ofItems(input), RecipeCategory.BUILDING_BLOCKS, output, 0.1f, 200) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, Registries.ITEM.getId(output).getPath() + "_from_smelting"))); + private void createCobbledBaseSmeltingRecipe(RecipeOutput exporter, Block input, Block recipeOutput) { + String inputPath = BuiltInRegistries.BLOCK.getKey(input).getPath(); + String outputPath = BuiltInRegistries.BLOCK.getKey(recipeOutput).getPath(); + SimpleCookingRecipeBuilder.smelting(Ingredient.of(input), RecipeCategory.BUILDING_BLOCKS, + recipeOutput, 0.1f, 200) + .unlockedBy(getHasName(input), has(input)) + .save(exporter, String.valueOf(MiddleEarth.of(inputPath + "_to_" + outputPath))); } - private void createMeltBulkRecipe(RecipeExporter exporter, Item input, String output) { - createMeltRecipe(exporter, input, output, 1, INGOT_LIQUID_VALUE); - createMeltRecipe(exporter, input, output, 2, INGOT_LIQUID_VALUE); - createMeltRecipe(exporter, input, output, 3, INGOT_LIQUID_VALUE); - createMeltRecipe(exporter, input, output, 4, INGOT_LIQUID_VALUE); + private void createMeltBulkRecipe(RecipeOutput exporter, Item input, String recipeOutput) { + createMeltRecipe(exporter, input, recipeOutput, 1, INGOT_LIQUID_VALUE); + createMeltRecipe(exporter, input, recipeOutput, 2, INGOT_LIQUID_VALUE); + createMeltRecipe(exporter, input, recipeOutput, 3, INGOT_LIQUID_VALUE); + createMeltRecipe(exporter, input, recipeOutput, 4, INGOT_LIQUID_VALUE); } - private void createMeltRecipe(RecipeExporter exporter, Item input, String output, int ingots, int amount) { + private void createMeltRecipe(RecipeOutput exporter, Item input, String recipeOutput, int ingots, int amount) { switch (ingots) { - case 1 -> AlloyRecipeJsonBuilder.createAlloyRecipe(this.itemLookup, RecipeCategory.MISC, output, amount, 0) + case 1 -> AlloyRecipeJsonBuilder.createAlloyRecipe(this.itemLookup, RecipeCategory.MISC, recipeOutput, amount, 0) .input(input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, output + "_from_melting_1_" + Registries.ITEM.getId(input).getPath()))); - case 2 -> AlloyRecipeJsonBuilder.createAlloyRecipe(this.itemLookup, RecipeCategory.MISC, output, amount * 2, 0) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, recipeOutput + "_from_melting_1_" + BuiltInRegistries.ITEM.getKey(input).getPath()))); + case 2 -> AlloyRecipeJsonBuilder.createAlloyRecipe(this.itemLookup, RecipeCategory.MISC, recipeOutput, amount * 2, 0) .input(input) .input(input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, output + "_from_melting_2_" + Registries.ITEM.getId(input).getPath()))); - case 3 -> AlloyRecipeJsonBuilder.createAlloyRecipe(this.itemLookup, RecipeCategory.MISC, output, amount * 3,0) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, recipeOutput + "_from_melting_2_" + BuiltInRegistries.ITEM.getKey(input).getPath()))); + case 3 -> AlloyRecipeJsonBuilder.createAlloyRecipe(this.itemLookup, RecipeCategory.MISC, recipeOutput, amount * 3,0) .input(input) .input(input) .input(input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, output + "_from_melting_3_" + Registries.ITEM.getId(input).getPath()))); - case 4 -> AlloyRecipeJsonBuilder.createAlloyRecipe(this.itemLookup, RecipeCategory.MISC, output, amount * 4, 0) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, recipeOutput + "_from_melting_3_" + BuiltInRegistries.ITEM.getKey(input).getPath()))); + case 4 -> AlloyRecipeJsonBuilder.createAlloyRecipe(this.itemLookup, RecipeCategory.MISC, recipeOutput, amount * 4, 0) .input(input) .input(input) .input(input) .input(input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, output + "_from_melting_4_" + Registries.ITEM.getId(input).getPath()))); + .unlockedBy(getHasName(input), + has(input)) + .save(exporter, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, recipeOutput + "_from_melting_4_" + BuiltInRegistries.ITEM.getKey(input).getPath()))); } } - private void createMeltBulkRecipeTag(RecipeExporter exporter, TagKey input, String output) { - createMeltRecipeTag(exporter, input, output, 1, INGOT_LIQUID_VALUE); - createMeltRecipeTag(exporter, input, output, 2, INGOT_LIQUID_VALUE); - createMeltRecipeTag(exporter, input, output, 3, INGOT_LIQUID_VALUE); - createMeltRecipeTag(exporter, input, output, 4, INGOT_LIQUID_VALUE); + private void createMeltBulkRecipeTag(RecipeOutput exporter, TagKey input, String recipeOutput) { + createMeltRecipeTag(exporter, input, recipeOutput, 1, INGOT_LIQUID_VALUE); + createMeltRecipeTag(exporter, input, recipeOutput, 2, INGOT_LIQUID_VALUE); + createMeltRecipeTag(exporter, input, recipeOutput, 3, INGOT_LIQUID_VALUE); + createMeltRecipeTag(exporter, input, recipeOutput, 4, INGOT_LIQUID_VALUE); } - private void createMeltRecipeTag(RecipeExporter exporter, TagKey input, String output, int ingots, int amount) { + private void createMeltRecipeTag(RecipeOutput exporter, TagKey input, String recipeOutput, int ingots, int amount) { switch (ingots) { - case 1 -> AlloyRecipeJsonBuilder.createAlloyRecipe(this.itemLookup, RecipeCategory.MISC, output, amount, 0) + case 1 -> AlloyRecipeJsonBuilder.createAlloyRecipe(this.itemLookup, RecipeCategory.MISC, recipeOutput, amount, 0) .input(input) - .criterion(hasItem(DecorativeItemsME.FORGE), - conditionsFromItem(DecorativeItemsME.FORGE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, output + "_from_melting_1_" + input.id().getPath()))); - case 2 -> AlloyRecipeJsonBuilder.createAlloyRecipe(this.itemLookup, RecipeCategory.MISC, output, amount * 2, 0) + .unlockedBy(getHasName(DecorativeItemsME.FORGE), + has(DecorativeItemsME.FORGE)) + .save(exporter, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, recipeOutput + "_from_melting_1_" + input.location().getPath()))); + case 2 -> AlloyRecipeJsonBuilder.createAlloyRecipe(this.itemLookup, RecipeCategory.MISC, recipeOutput, amount * 2, 0) .input(input) .input(input) - .criterion(hasItem(DecorativeItemsME.FORGE), - conditionsFromItem(DecorativeItemsME.FORGE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, output + "_from_melting_2_" + input.id().getPath()))); - case 3 -> AlloyRecipeJsonBuilder.createAlloyRecipe(this.itemLookup, RecipeCategory.MISC, output, amount * 3, 0) + .unlockedBy(getHasName(DecorativeItemsME.FORGE), + has(DecorativeItemsME.FORGE)) + .save(exporter, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, recipeOutput + "_from_melting_2_" + input.location().getPath()))); + case 3 -> AlloyRecipeJsonBuilder.createAlloyRecipe(this.itemLookup, RecipeCategory.MISC, recipeOutput, amount * 3, 0) .input(input) .input(input) .input(input) - .criterion(hasItem(DecorativeItemsME.FORGE), - conditionsFromItem(DecorativeItemsME.FORGE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, output + "_from_melting_3_" + input.id().getPath()))); - case 4 -> AlloyRecipeJsonBuilder.createAlloyRecipe(this.itemLookup, RecipeCategory.MISC, output, amount * 4, 0) + .unlockedBy(getHasName(DecorativeItemsME.FORGE), + has(DecorativeItemsME.FORGE)) + .save(exporter, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, recipeOutput + "_from_melting_3_" + input.location().getPath()))); + case 4 -> AlloyRecipeJsonBuilder.createAlloyRecipe(this.itemLookup, RecipeCategory.MISC, recipeOutput, amount * 4, 0) .input(input) .input(input) .input(input) .input(input) - .criterion(hasItem(DecorativeItemsME.FORGE), - conditionsFromItem(DecorativeItemsME.FORGE)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, output + "_from_melting_4_" + input.id().getPath()))); + .unlockedBy(getHasName(DecorativeItemsME.FORGE), + has(DecorativeItemsME.FORGE)) + .save(exporter, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, recipeOutput + "_from_melting_4_" + input.location().getPath()))); } } - private void createAnvilShapingRecipeTag(RecipeExporter exporter, TagKey input, Item output, int amount) { - AnvilShapingRecipeJsonBuilder.createAnvilShapingRecipe(this.itemLookup, RecipeCategory.MISC, output, amount) + private void createAnvilShapingRecipeTag(RecipeOutput exporter, TagKey input, Item recipeOutput, int amount) { + AnvilShapingRecipeJsonBuilder.createAnvilShapingRecipe(this.itemLookup, RecipeCategory.MISC, recipeOutput, amount) .input(input) - .criterion(hasItem(Items.COPPER_INGOT), - conditionsFromItem(Items.COPPER_INGOT)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.COPPER_INGOT), + has(Items.COPPER_INGOT)) + .save(exporter); } - private void createAnvilShapingRecipeItem(RecipeExporter exporter, Item input, Item output, int amount) { - AnvilShapingRecipeJsonBuilder.createAnvilShapingRecipe(this.itemLookup, RecipeCategory.MISC, output, amount) + private void createAnvilShapingRecipeItem(RecipeOutput exporter, Item input, Item recipeOutput, int amount) { + AnvilShapingRecipeJsonBuilder.createAnvilShapingRecipe(this.itemLookup, RecipeCategory.MISC, recipeOutput, amount) .input(input) - .criterion(hasItem(Items.COPPER_INGOT), - conditionsFromItem(Items.COPPER_INGOT)) - .offerTo(exporter); + .unlockedBy(getHasName(Items.COPPER_INGOT), + has(Items.COPPER_INGOT)) + .save(exporter); } - private void createAnvilRecipe(RecipeExporter exporter, Item inputBlock, Item inputIngot, Item output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 1) + private void createAnvilRecipe(RecipeOutput exporter, Item inputBlock, Item inputIngot, Item recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 1) .pattern("IBI") .pattern(" I ") .pattern("LLL") - .input('I', inputIngot) - .input('B', inputBlock) - .input('L', TagKey.of(RegistryKeys.ITEM, Identifier.of("logs"))) - .criterion(hasItem(inputIngot), - conditionsFromItem(inputIngot)) - .offerTo(exporter); + .define('I', inputIngot) + .define('B', inputBlock) + .define('L', TagKey.create(Registries.ITEM, ResourceLocation.parse("logs"))) + .unlockedBy(getHasName(inputIngot), + has(inputIngot)) + .save(exporter); } private void createGenericRecipes(GenericBlockSetBuilder set) { - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, set.blockSet.slab().asItem(), set.blockSet.base().asItem()); - createVerticalSlabsRecipe(exporter, set.blockSet.slab(), set.blockSet.verticalSlab()); - createSlabsFromVerticalRecipe(exporter, set.blockSet.verticalSlab(), set.blockSet.slab()); - createStairsRecipe(exporter, set.blockSet.base(), set.blockSet.stairs()); - offerWallRecipe(RecipeCategory.BUILDING_BLOCKS, set.blockSet.wall(), set.blockSet.base()); + slab(RecipeCategory.BUILDING_BLOCKS, set.blockSet.slab().asItem(), set.blockSet.base().asItem()); + createVerticalSlabsRecipe(recipeOutput, set.blockSet.slab(), set.blockSet.verticalSlab()); + createSlabsFromVerticalRecipe(recipeOutput, set.blockSet.verticalSlab(), set.blockSet.slab()); + createStairsRecipe(recipeOutput, set.blockSet.base(), set.blockSet.stairs()); + wall(RecipeCategory.BUILDING_BLOCKS, set.blockSet.wall(), set.blockSet.base()); } + private void createGenericRecipes(SimpleBlockSetBuilder set) { - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, set.blockSet.slab().asItem(), set.blockSet.base().asItem()); - createVerticalSlabsRecipe(exporter, set.blockSet.slab(), set.blockSet.verticalSlab()); - createSlabsFromVerticalRecipe(exporter, set.blockSet.verticalSlab(), set.blockSet.slab()); - createStairsRecipe(exporter, set.blockSet.base(), set.blockSet.stairs()); + slab(RecipeCategory.BUILDING_BLOCKS, set.blockSet.slab().asItem(), set.blockSet.base().asItem()); + createVerticalSlabsRecipe(recipeOutput, set.blockSet.slab(), set.blockSet.verticalSlab()); + createSlabsFromVerticalRecipe(recipeOutput, set.blockSet.verticalSlab(), set.blockSet.slab()); + createStairsRecipe(recipeOutput, set.blockSet.base(), set.blockSet.stairs()); + } + + private void createGildedStoneRecipe(Block input, Block output) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, output, 5) + .pattern("TNT") + .pattern("NTN") + .pattern("TNT") + .define('T', input) + .define('N', Items.GOLD_NUGGET) + .unlockedBy(getHasName(input), has(input)) + .save(recipeOutput); } private void createRegularSetRecipes(BlockRecordTypes.RegularSet set) { - offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, set.slab().asItem(), set.base().asItem()); - createVerticalSlabsRecipe(exporter, set.slab(), set.verticalSlab()); - createSlabsFromVerticalRecipe(exporter, set.verticalSlab(), set.slab()); - createStairsRecipe(exporter, set.base(), set.stairs()); - offerWallRecipe(RecipeCategory.BUILDING_BLOCKS, set.wall(), set.base()); + slab(RecipeCategory.BUILDING_BLOCKS, set.slab().asItem(), set.base().asItem()); + createVerticalSlabsRecipe(recipeOutput, set.slab(), set.verticalSlab()); + createSlabsFromVerticalRecipe(recipeOutput, set.verticalSlab(), set.slab()); + createStairsRecipe(recipeOutput, set.base(), set.stairs()); + wall(RecipeCategory.BUILDING_BLOCKS, set.wall(), set.base()); } - private void createStairsRecipe(RecipeExporter exporter, Block input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 4) + private void createStairsRecipe(RecipeOutput exporter, Block input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 4) .pattern("l ") .pattern("ll ") .pattern("lll") - .input('l', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('l', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createSlabsFromVerticalRecipe(RecipeExporter exporter, Block input, Block output) { - ShapelessRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 1) - .input(input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, Registries.BLOCK.getId(input).getPath() + "_from_vertical"))); + private void createSlabsFromVerticalRecipe(RecipeOutput exporter, Block input, Block recipeOutput) { + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 1) + .requires(input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, BuiltInRegistries.BLOCK.getKey(input).getPath() + "_from_vertical"))); } - private void createVerticalSlabsRecipe(RecipeExporter exporter, Block input, Block output) { - ShapelessRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 1) - .input(input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + private void createVerticalSlabsRecipe(RecipeOutput exporter, Block input, Block recipeOutput) { + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 1) + .requires(input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createShinglesRecipe(RecipeExporter exporter, Block input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 7) + private void createShinglesRecipe(RecipeOutput exporter, Block input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 7) .pattern(" w ") .pattern("www") .pattern("www") - .input('w', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('w', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createRoofingRecipe(RecipeExporter exporter, Block input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 2) + private void createRoofingRecipe(RecipeOutput exporter, Block input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 2) .pattern(" w ") .pattern("www") - .input('w', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('w', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createDoorRecipe(RecipeExporter exporter, Block input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 3) + private void createDoorRecipe(RecipeOutput exporter, Block input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 3) .pattern("ll") .pattern("ll") .pattern("ll") - .input('l', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('l', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createTrapdoorRecipe(RecipeExporter exporter, Block input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 2) + private void createTrapdoorRecipe(RecipeOutput exporter, Block input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 2) .pattern("lll") .pattern("lll") - .input('l', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('l', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createCenterSurroundRecipe(RecipeExporter exporter, Item surroundInput, Item centerItem, Item output, int count) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, count) + private void createCenterSurroundRecipe(RecipeOutput exporter, Item surroundInput, Item centerItem, Item recipeOutput, int count) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, count) .pattern("BBB") .pattern("BDB") .pattern("BBB") - .input('B', surroundInput) - .input('D', centerItem) - .criterion(hasItem(surroundInput), - conditionsFromItem(surroundInput)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, Registries.ITEM.getId(output).getPath() + "_alt"))); + .define('B', surroundInput) + .define('D', centerItem) + .unlockedBy(getHasName(surroundInput), + has(surroundInput)) + .save(exporter, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, BuiltInRegistries.ITEM.getKey(recipeOutput).getPath() + "_alt"))); } - private void createDyeableItemRecipe(RecipeExporter exporter, Block blockInput, Item dyeItem, Block output) { - ShapelessRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 1) - .input(blockInput) - .input(dyeItem) - .criterion(hasItem(blockInput), - conditionsFromItem(blockInput)) - .offerTo(exporter); + private void createDyeableItemRecipe(RecipeOutput exporter, Block blockInput, Item dyeItem, Block recipeOutput) { + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 1) + .requires(blockInput) + .requires(dyeItem) + .unlockedBy(getHasName(blockInput), + has(blockInput)) + .save(exporter); } - private void createCombinedItemRecipe(RecipeExporter exporter, Block blockInput, TagKey addition, Block output) { - ShapelessRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 1) - .input(blockInput) - .input(addition) - .criterion(hasItem(blockInput), - conditionsFromItem(blockInput)) - .offerTo(exporter); + private void createCombinedItemRecipe(RecipeOutput exporter, Block blockInput, TagKey addition, Block recipeOutput) { + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 1) + .requires(blockInput) + .requires(addition) + .unlockedBy(getHasName(blockInput), + has(blockInput)) + .save(exporter); } - private void createPaneRecipe(RecipeExporter exporter, Item blockInput, Block output, int count) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, count) + private void createPaneRecipe(RecipeOutput exporter, Item blockInput, Block recipeOutput, int count) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, count) .pattern("BBB") .pattern("BBB") - .input('B', blockInput) - .criterion(hasItem(blockInput), - conditionsFromItem(blockInput)) - .offerTo(exporter); + .define('B', blockInput) + .unlockedBy(getHasName(blockInput), + has(blockInput)) + .save(exporter); } - private void createWoodStoolRecipe(RecipeExporter exporter, Item inputPlanks, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 3) + private void createWoodStoolRecipe(RecipeOutput exporter, Item inputPlanks, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 3) .pattern("PP") .pattern("SS") - .input('P', inputPlanks) - .input('S', Items.STICK) - .criterion(hasItem(inputPlanks), - conditionsFromItem(inputPlanks)) - .offerTo(exporter); + .define('P', inputPlanks) + .define('S', Items.STICK) + .unlockedBy(getHasName(inputPlanks), + has(inputPlanks)) + .save(exporter); } - private void createWoodBenchRecipe(RecipeExporter exporter, Item inputPlanks, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 3) + private void createWoodBenchRecipe(RecipeOutput exporter, Item inputPlanks, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 3) .pattern("PPP") .pattern("S S") - .input('P', inputPlanks) - .input('S', Items.STICK) - .criterion(hasItem(inputPlanks), - conditionsFromItem(inputPlanks)) - .offerTo(exporter); + .define('P', inputPlanks) + .define('S', Items.STICK) + .unlockedBy(getHasName(inputPlanks), + has(inputPlanks)) + .save(exporter); } - private void createWoodTableRecipe(RecipeExporter exporter, Item inputPlanks, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 3) + private void createWoodTableRecipe(RecipeOutput exporter, Item inputPlanks, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 3) .pattern("PPP") .pattern("S S") .pattern("S S") - .input('P', inputPlanks) - .input('S', Items.STICK) - .criterion(hasItem(inputPlanks), - conditionsFromItem(inputPlanks)) - .offerTo(exporter); + .define('P', inputPlanks) + .define('S', Items.STICK) + .unlockedBy(getHasName(inputPlanks), + has(inputPlanks)) + .save(exporter); } - private void createWoodChairRecipe(RecipeExporter exporter, Item inputPlanks, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 3) + private void createWoodChairRecipe(RecipeOutput exporter, Item inputPlanks, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 3) .pattern("P ") .pattern("PPP") .pattern("S S") - .input('P', inputPlanks) - .input('S', Items.STICK) - .criterion(hasItem(inputPlanks), - conditionsFromItem(inputPlanks)) - .offerTo(exporter); + .define('P', inputPlanks) + .define('S', Items.STICK) + .unlockedBy(getHasName(inputPlanks), + has(inputPlanks)) + .save(exporter); } - private void createWoodLadderRecipe(RecipeExporter exporter, Item inputPlanks, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 3) + private void createWoodLadderRecipe(RecipeOutput exporter, Item inputPlanks, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 3) .pattern("P P") .pattern("PSP") .pattern("P P") - .input('P', inputPlanks) - .input('S', Items.STICK) - .criterion(hasItem(inputPlanks), - conditionsFromItem(inputPlanks)) - .offerTo(exporter); + .define('P', inputPlanks) + .define('S', Items.STICK) + .unlockedBy(getHasName(inputPlanks), + has(inputPlanks)) + .save(exporter); } - private void createStoneStoolRecipe(RecipeExporter exporter, Item input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 1) + private void createStoneStoolRecipe(RecipeOutput exporter, Item input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 1) .pattern("SSS") .pattern("S S") - .input('S', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('S', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createStoneTableRecipe(RecipeExporter exporter, Item input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 1) + private void createStoneTableRecipe(RecipeOutput exporter, Item input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 1) .pattern("SSS") .pattern(" S ") .pattern(" S ") - .input('S', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('S', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createStoneChairRecipe(RecipeExporter exporter, Item input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 1) + private void createStoneChairRecipe(RecipeOutput exporter, Item input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 1) .pattern("S ") .pattern("SSS") .pattern("SSS") - .input('S', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('S', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createLayerRecipe(RecipeExporter exporter, Item input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 6) + private void createLayerRecipe(RecipeOutput exporter, Item input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 6) .pattern("BBB") - .input('B', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('B', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createButtonRecipe(RecipeExporter exporter, Block input, Block output) { - ShapelessRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 1) - .input(input, 1) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + private void createButtonRecipe(RecipeOutput exporter, Block input, Block recipeOutput) { + ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 1) + .requires(input, 1) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createPressurePlateRecipe(RecipeExporter exporter, Block input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 1) + private void createPressurePlateRecipe(RecipeOutput exporter, Block input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 1) .pattern("BB") - .input('B', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('B', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createFenceRecipe(RecipeExporter exporter, Item input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 3) + private void createFenceRecipe(RecipeOutput exporter, Item input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 3) .pattern("lsl") .pattern("lsl") - .input('l', input) - .input('s', Items.STICK) - .criterion(hasItem(input), - conditionsFromItem(input)) - .criterion(hasItem(Items.STICK), - conditionsFromItem(Items.STICK)) - .offerTo(exporter); + .define('l', input) + .define('s', Items.STICK) + .unlockedBy(getHasName(input), + has(input)) + .unlockedBy(getHasName(Items.STICK), + has(Items.STICK)) + .save(exporter); } - private void createGildedBlockRecipe(RecipeExporter exporter, Block input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 1) + private void createGildedBlockRecipe(RecipeOutput exporter, Block input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 1) .pattern(" N ") .pattern("NBN") .pattern(" N ") - .input('B', input) - .input('N', Items.GOLD_NUGGET) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('B', input) + .define('N', Items.GOLD_NUGGET) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createBrickworkBlockRecipe(RecipeExporter exporter, Block input, Block inputBinder, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 2) + private void createBrickworkBlockRecipe(RecipeOutput exporter, Block input, Block inputBinder, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 2) .pattern("SB") - .input('S', inputBinder) - .input('B', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('S', inputBinder) + .define('B', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createWattleRecipes(RecipeExporter exporter, Item input, Block outputBase, + private void createWattleRecipes(RecipeOutput exporter, Item input, Block outputBase, Block outputCross, Block outputRight, Block outputLeft, Block outputPillar, Block outputDiamond) { createBaseWattleRecipe(exporter, input, outputBase); createCrossWattleRecipe(exporter, input, outputCross); @@ -3459,343 +3611,409 @@ private void createWattleRecipes(RecipeExporter exporter, Item input, Block outp createDiamondWattleRecipe(exporter, input, outputDiamond); } - private void createBaseWattleRecipe(RecipeExporter exporter, Item input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 1) + private void createBaseWattleRecipe(RecipeOutput exporter, Item input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 1) .pattern(" S ") .pattern("SDS") .pattern(" S ") - .input('S', Items.STICK) - .input('D', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('S', Items.STICK) + .define('D', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createCrossWattleRecipe(RecipeExporter exporter, Item input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 4) + private void createCrossWattleRecipe(RecipeOutput exporter, Item input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 4) .pattern("SDS") .pattern("DSD") .pattern("SDS") - .input('S', Items.STICK) - .input('D', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('S', Items.STICK) + .define('D', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createRightWattleRecipe(RecipeExporter exporter, Item input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 6) + private void createRightWattleRecipe(RecipeOutput exporter, Item input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 6) .pattern("DDS") .pattern("DSD") .pattern("SDD") - .input('S', Items.STICK) - .input('D', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('S', Items.STICK) + .define('D', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createLeftWattleRecipe(RecipeExporter exporter, Item input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 6) + private void createLeftWattleRecipe(RecipeOutput exporter, Item input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 6) .pattern("SDD") .pattern("DSD") .pattern("DDS") - .input('S', Items.STICK) - .input('D', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('S', Items.STICK) + .define('D', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createPillarWattleRecipe(RecipeExporter exporter, Item input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 6) + private void createPillarWattleRecipe(RecipeOutput exporter, Item input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 6) .pattern("DSD") .pattern("DSD") .pattern("DSD") - .input('S', Items.STICK) - .input('D', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('S', Items.STICK) + .define('D', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createDiamondWattleRecipe(RecipeExporter exporter, Item input, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 5) + private void createDiamondWattleRecipe(RecipeOutput exporter, Item input, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 5) .pattern("DSD") .pattern("SDS") .pattern("DSD") - .input('S', Items.STICK) - .input('D', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + .define('S', Items.STICK) + .define('D', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createStatueRecipe(RecipeExporter exporter, Block polishedInput, Block stoneInput, Block wallInput, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 1) + private void createStatueRecipe(RecipeOutput exporter, Block polishedInput, Block stoneInput, Block wallInput, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 1) .pattern("WSW") .pattern("WSW") .pattern("WPW") - .input('W', wallInput) - .input('S', stoneInput) - .input('P', polishedInput) - .criterion(hasItem(polishedInput), - conditionsFromItem(polishedInput)) - .offerTo(exporter); + .define('W', wallInput) + .define('S', stoneInput) + .define('P', polishedInput) + .unlockedBy(getHasName(polishedInput), + has(polishedInput)) + .save(exporter); } - private void createCushionRecipe(RecipeExporter exporter, Block woolBlock, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 1) + private void createCushionRecipe(RecipeOutput exporter, Block woolBlock, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 1) .pattern("WW") .pattern("PP") - .input('W', woolBlock) - .input('P', TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))) - .criterion(hasItem(woolBlock), - conditionsFromItem(woolBlock)) - .offerTo(exporter); + .define('W', woolBlock) + .define('P', TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))) + .unlockedBy(getHasName(woolBlock), + has(woolBlock)) + .save(exporter); } - private void createSmallCurtainRecipe(RecipeExporter exporter, Block woolBlock, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 2) + private void createSmallCurtainRecipe(RecipeOutput exporter, Block woolBlock, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 2) .pattern("SSS") .pattern("W W") - .input('W', woolBlock) - .input('S', Items.STICK) - .criterion(hasItem(woolBlock), - conditionsFromItem(woolBlock)) - .offerTo(exporter); - } - private void createSmallFancyCurtainRecipe(RecipeExporter exporter, Block woolBlock, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 2) + .define('W', woolBlock) + .define('S', Items.STICK) + .unlockedBy(getHasName(woolBlock), + has(woolBlock)) + .save(exporter); + } + private void createSmallFancyCurtainRecipe(RecipeOutput exporter, Block woolBlock, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 2) .pattern("SGS") .pattern("W W") - .input('W', woolBlock) - .input('S', Items.STICK) - .input('G', Items.GOLD_NUGGET) - .criterion(hasItem(woolBlock), - conditionsFromItem(woolBlock)) - .offerTo(exporter); + .define('W', woolBlock) + .define('S', Items.STICK) + .define('G', Items.GOLD_NUGGET) + .unlockedBy(getHasName(woolBlock), + has(woolBlock)) + .save(exporter); } - private void createCurtainRecipe(RecipeExporter exporter, Block woolBlock, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 4) + private void createCurtainRecipe(RecipeOutput exporter, Block woolBlock, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 4) .pattern("SSS") .pattern("W W") .pattern("W W") - .input('W', woolBlock) - .input('S', Items.STICK) - .criterion(hasItem(woolBlock), - conditionsFromItem(woolBlock)) - .offerTo(exporter); - } - private void createFancyCurtainRecipe(RecipeExporter exporter, Block woolBlock, Block output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 4) + .define('W', woolBlock) + .define('S', Items.STICK) + .unlockedBy(getHasName(woolBlock), + has(woolBlock)) + .save(exporter); + } + private void createFancyCurtainRecipe(RecipeOutput exporter, Block woolBlock, Block recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 4) .pattern("SGS") .pattern("W W") .pattern("W W") - .input('W', woolBlock) - .input('G', Items.GOLD_NUGGET) - .input('S', Items.STICK) - .criterion(hasItem(woolBlock), - conditionsFromItem(woolBlock)) - .offerTo(exporter); + .define('W', woolBlock) + .define('G', Items.GOLD_NUGGET) + .define('S', Items.STICK) + .unlockedBy(getHasName(woolBlock), + has(woolBlock)) + .save(exporter); } - private void createBannerPatternRecipe(RecipeExporter exporter, Item input, Item output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.MISC, output, 1) + private void createBannerPatternRecipe(RecipeOutput exporter, Item input, Item recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, recipeOutput, 1) .pattern("PF") .pattern("BI") - .input('I', input) - .input('B', Items.BLACK_DYE) - .input('F', Items.FEATHER) - .input('P', Items.PAPER) - .criterion(hasItem(Items.PAPER), - conditionsFromItem(Items.PAPER)) - .offerTo(exporter); + .define('I', input) + .define('B', Items.BLACK_DYE) + .define('F', Items.FEATHER) + .define('P', Items.PAPER) + .unlockedBy(getHasName(Items.PAPER), + has(Items.PAPER)) + .save(exporter); } //endregion //region ITEM RECIPE METHODS - private void createSeedsRecipe(RecipeExporter exporter, Item input, Item output) { - ShapelessRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.MISC, output, 1) - .input(input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); + private void createSeedsRecipe(RecipeOutput exporter, Item input, Item recipeOutput) { + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, recipeOutput, 1) + .requires(input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); } - private void createPickaxeRecipe(RecipeExporter exporter, Item inputRod, Item inputMaterial, Item output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.TOOLS, output, 1) + private void createPickaxeRecipe(RecipeOutput exporter, Item inputRod, Item inputMaterial, Item recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, recipeOutput, 1) .pattern("MMM") .pattern(" R ") .pattern(" R ") - .input('M', inputMaterial) - .input('R', inputRod) - .criterion(hasItem(inputMaterial), - conditionsFromItem(inputMaterial)) - .offerTo(exporter); + .define('M', inputMaterial) + .define('R', inputRod) + .unlockedBy(getHasName(inputMaterial), + has(inputMaterial)) + .save(exporter); } - private void createAxeRecipe(RecipeExporter exporter, Item inputRod, Item inputMaterial, Item output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.TOOLS, output, 1) + private void createAxeRecipe(RecipeOutput exporter, Item inputRod, Item inputMaterial, Item recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, recipeOutput, 1) .pattern("MM ") .pattern("MR ") .pattern(" R ") - .input('M', inputMaterial) - .input('R', inputRod) - .criterion(hasItem(inputMaterial), - conditionsFromItem(inputMaterial)) - .offerTo(exporter); + .define('M', inputMaterial) + .define('R', inputRod) + .unlockedBy(getHasName(inputMaterial), + has(inputMaterial)) + .save(exporter); } - private void createShovelRecipe(RecipeExporter exporter, Item inputRod, Item inputMaterial, Item output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.TOOLS, output, 1) + private void createShovelRecipe(RecipeOutput exporter, Item inputRod, Item inputMaterial, Item recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, recipeOutput, 1) .pattern(" M ") .pattern(" R ") .pattern(" R ") - .input('M', inputMaterial) - .input('R', inputRod) - .criterion(hasItem(inputMaterial), - conditionsFromItem(inputMaterial)) - .offerTo(exporter); + .define('M', inputMaterial) + .define('R', inputRod) + .unlockedBy(getHasName(inputMaterial), + has(inputMaterial)) + .save(exporter); } - private void createHoeRecipe(RecipeExporter exporter, Item inputRod, Item inputMaterial, Item output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.TOOLS, output, 1) + private void createHoeRecipe(RecipeOutput exporter, Item inputRod, Item inputMaterial, Item recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.TOOLS, recipeOutput, 1) .pattern("MM ") .pattern(" R ") .pattern(" R ") - .input('M', inputMaterial) - .input('R', inputRod) - .criterion(hasItem(inputMaterial), - conditionsFromItem(inputMaterial)) - .offerTo(exporter); + .define('M', inputMaterial) + .define('R', inputRod) + .unlockedBy(getHasName(inputMaterial), + has(inputMaterial)) + .save(exporter); } - private void createSwordRecipe(RecipeExporter exporter, Item inputRod, Item inputMaterial, Item output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.COMBAT, output, 1) + private void createSwordRecipe(RecipeOutput exporter, Item inputRod, Item inputMaterial, Item recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, recipeOutput, 1) .pattern(" M ") .pattern(" M ") .pattern(" R ") - .input('M', inputMaterial) - .input('R', inputRod) - .criterion(hasItem(inputMaterial), - conditionsFromItem(inputMaterial)) - .offerTo(exporter); + .define('M', inputMaterial) + .define('R', inputRod) + .unlockedBy(getHasName(inputMaterial), + has(inputMaterial)) + .save(exporter); } - private void createDaggerRecipe(RecipeExporter exporter, Item inputRod, Item inputMaterial, Item output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.COMBAT, output, 1) + private void createDaggerRecipe(RecipeOutput exporter, Item inputRod, Item inputMaterial, Item recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, recipeOutput, 1) .pattern(" M ") .pattern(" R ") - .input('M', inputMaterial) - .input('R', inputRod) - .criterion(hasItem(inputMaterial), - conditionsFromItem(inputMaterial)) - .offerTo(exporter); + .define('M', inputMaterial) + .define('R', inputRod) + .unlockedBy(getHasName(inputMaterial), + has(inputMaterial)) + .save(exporter); } - private void createDaggerRecipeTag(RecipeExporter exporter, Item inputRod, TagKey inputMaterial, Item output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.COMBAT, output, 1) + private void createDaggerRecipeTag(RecipeOutput exporter, Item inputRod, TagKey inputMaterial, Item recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, recipeOutput, 1) .pattern(" M ") .pattern(" R ") - .input('M', inputMaterial) - .input('R', inputRod) - .criterion(hasItem(Items.OAK_PLANKS), - conditionsFromItem(Items.OAK_PLANKS)) - .offerTo(exporter); + .define('M', inputMaterial) + .define('R', inputRod) + .unlockedBy(getHasName(Items.OAK_PLANKS), + has(Items.OAK_PLANKS)) + .save(exporter); } - private void createSpearRecipe(RecipeExporter exporter, Item inputRod, Item inputMaterial, Item output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.COMBAT, output, 1) + private void createSpearRecipe(RecipeOutput exporter, Item inputRod, Item inputMaterial, Item recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, recipeOutput, 1) .pattern(" M") .pattern(" R ") .pattern("R ") - .input('M', inputMaterial) - .input('R', inputRod) - .criterion(hasItem(inputMaterial), - conditionsFromItem(inputMaterial)) - .offerTo(exporter); + .define('M', inputMaterial) + .define('R', inputRod) + .unlockedBy(getHasName(inputMaterial), + has(inputMaterial)) + .save(exporter); } - private void createSpearRecipeTag(RecipeExporter exporter, Item inputRod, TagKey inputMaterial, Item output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.COMBAT, output, 1) + private void createSpearRecipeTag(RecipeOutput exporter, Item inputRod, TagKey inputMaterial, Item recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.COMBAT, recipeOutput, 1) .pattern(" M") .pattern(" R ") .pattern("R ") - .input('M', inputMaterial) - .input('R', inputRod) - .criterion(hasItem(Items.OAK_PLANKS), - conditionsFromItem(Items.OAK_PLANKS)) - .offerTo(exporter); + .define('M', inputMaterial) + .define('R', inputRod) + .unlockedBy(getHasName(Items.OAK_PLANKS), + has(Items.OAK_PLANKS)) + .save(exporter); } - private void createBucketRecipe(RecipeExporter exporter, Item inputMaterial, Item output) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, 1) + private void createBucketRecipe(RecipeOutput exporter, Item inputMaterial, Item recipeOutput) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, 1) .pattern("M M") .pattern(" M ") - .input('M', inputMaterial) - .criterion(hasItem(inputMaterial), - conditionsFromItem(inputMaterial)) - .offerTo(exporter); + .define('M', inputMaterial) + .unlockedBy(getHasName(inputMaterial), + has(inputMaterial)) + .save(exporter); } - private void createToolSetRecipes(RecipeExporter exporter, Item inputRod, Item inputMaterial, Item outputPickaxe, Item outputAxe, Item outputShovel, Item outputHoe) { + private void createToolSetRecipes(RecipeOutput exporter, Item inputRod, Item inputMaterial, Item outputPickaxe, Item outputAxe, Item outputShovel, Item outputHoe) { createPickaxeRecipe(exporter, inputRod, inputMaterial, outputPickaxe); createAxeRecipe(exporter, inputRod, inputMaterial, outputAxe); createShovelRecipe(exporter, inputRod, inputMaterial, outputShovel); createHoeRecipe(exporter, inputRod, inputMaterial, outputHoe); } - private void createCookedFoodRecipes(RecipeExporter exporter, Item rawFood, Item cookedFood) { - offerFoodCookingRecipe("smelting", RecipeSerializer.SMELTING, SmeltingRecipe::new, 200, rawFood, cookedFood, 0.35f); - offerFoodCookingRecipe("smoking", RecipeSerializer.SMOKING, SmokingRecipe::new, 100, rawFood, cookedFood, 0.35f); - offerFoodCookingRecipe("campfire_cooking", RecipeSerializer.CAMPFIRE_COOKING, CampfireCookingRecipe::new, 600, rawFood, cookedFood, 0.35f); + private void createCookedFoodRecipes(RecipeOutput exporter, Item rawFood, Item cookedFood) { + simpleCookingRecipe(recipeOutput, "smelting", RecipeSerializer.SMELTING_RECIPE, SmeltingRecipe::new, 200, rawFood, cookedFood, 0.35f); + simpleCookingRecipe(recipeOutput, "smoking", RecipeSerializer.SMOKING_RECIPE, SmokingRecipe::new, 100, rawFood, cookedFood, 0.35f); + simpleCookingRecipe(recipeOutput, "campfire_cooking", RecipeSerializer.CAMPFIRE_COOKING_RECIPE, CampfireCookingRecipe::new, 600, rawFood, cookedFood, 0.35f); } - private void createSmokingRecipe(RecipeExporter exporter, Item rawFood, Item cookedFood) { - offerFoodCookingRecipe("smoking", RecipeSerializer.SMOKING, SmokingRecipe::new, 100, rawFood, cookedFood, 0.35f); + private void createSmokingRecipe(RecipeOutput exporter, Item rawFood, Item cookedFood) { + simpleCookingRecipe(recipeOutput, "smoking", RecipeSerializer.SMOKING_RECIPE, SmokingRecipe::new, 100, rawFood, cookedFood, 0.35f); } - private void createMetalsRecipe(RecipeExporter exporter, Item nugget, Item ingot, Block block) { - ShapelessRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.MISC, ingot, 1) - .input(nugget, 9) - .criterion(hasItem(nugget), - conditionsFromItem(nugget)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, Registries.ITEM.getId(ingot).getPath() + "_from_nuggets"))); + private void createMetalsRecipe(RecipeOutput exporter, Item nugget, Item ingot, Block block) { + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ingot, 1) + .requires(nugget, 9) + .unlockedBy(getHasName(nugget), + has(nugget)) + .save(exporter, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, BuiltInRegistries.ITEM.getKey(ingot).getPath() + "_from_nuggets"))); - ShapelessRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.MISC, nugget, 9) - .input(ingot) - .criterion(hasItem(ingot), - conditionsFromItem(ingot)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, Registries.ITEM.getId(nugget).getPath() + "_from_ingot"))); + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, nugget, 9) + .requires(ingot) + .unlockedBy(getHasName(ingot), + has(ingot)) + .save(exporter, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, BuiltInRegistries.ITEM.getKey(nugget).getPath() + "_from_ingot"))); createFilledRecipe(exporter, ingot, block, 1); - ShapelessRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.MISC, ingot, 9) - .input(block) - .criterion(hasItem(block), - conditionsFromItem(block)) - .offerTo(exporter, String.valueOf(Identifier.of(MiddleEarth.MOD_ID, Registries.ITEM.getId(ingot).getPath() + "_from_block"))); + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ingot, 9) + .requires(block) + .unlockedBy(getHasName(block), + has(block)) + .save(exporter, String.valueOf(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, BuiltInRegistries.ITEM.getKey(ingot).getPath() + "_from_block"))); } //endregion - private void createFilledRecipe(RecipeExporter exporter, Item input, Block output, int count) { - ShapedRecipeJsonBuilder.create(this.itemLookup, RecipeCategory.BUILDING_BLOCKS, output, count) - .pattern("lll") - .pattern("lll") - .pattern("lll") - .input('l', input) - .criterion(hasItem(input), - conditionsFromItem(input)) - .offerTo(exporter); - } - }; + private void createFilledRecipe(RecipeOutput exporter, Item input, Block recipeOutput, int count) { + ShapedRecipeBuilder.shaped(RecipeCategory.BUILDING_BLOCKS, recipeOutput, count) + .pattern("lll") + .pattern("lll") + .pattern("lll") + .define('l', input) + .unlockedBy(getHasName(input), + has(input)) + .save(exporter); + } + private void slab(RecipeCategory category, ItemLike result, ItemLike ingredient) { + net.minecraft.data.recipes.RecipeProvider.slab(recipeOutput, category, result, ingredient); } - @Override - public String getName() { - return "RecipeProvider"; + private void wall(RecipeCategory category, ItemLike result, ItemLike ingredient) { + net.minecraft.data.recipes.RecipeProvider.wall(recipeOutput, category, result, ingredient); + } + + private void stonecutterResultFromBase( + RecipeCategory category, + ItemLike result, + ItemLike ingredient + ) { + net.minecraft.data.recipes.RecipeProvider.stonecutterResultFromBase( + recipeOutput, + category, + result, + ingredient + ); + } + + private void stonecutterResultFromBase( + RecipeCategory category, + ItemLike result, + ItemLike ingredient, + int count + ) { + net.minecraft.data.recipes.RecipeProvider.stonecutterResultFromBase( + recipeOutput, + category, + result, + ingredient, + count + ); + } + + private void oreSmelting( + List ingredients, + RecipeCategory category, + ItemLike result, + float experience, + int cookingTime, + String group + ) { + net.minecraft.data.recipes.RecipeProvider.oreSmelting( + recipeOutput, + List.copyOf(ingredients), + category, + result, + experience, + cookingTime, + group + ); + } + + private void oreBlasting( + List ingredients, + RecipeCategory category, + ItemLike result, + float experience, + int cookingTime, + String group + ) { + net.minecraft.data.recipes.RecipeProvider.oreBlasting( + recipeOutput, + List.copyOf(ingredients), + category, + result, + experience, + cookingTime, + group + ); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/tags/BlockTagProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/tags/BlockTagProvider.java index e26ab9b625..f373607fd5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/tags/BlockTagProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/tags/BlockTagProvider.java @@ -1,14 +1,15 @@ package net.sevenstars.middleearth.datageneration.providers.tags; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; +import net.minecraft.core.HolderLookup; +import net.minecraft.data.PackOutput; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.neoforged.neoforge.common.data.BlockTagsProvider; +import net.neoforged.neoforge.common.data.ExistingFileHelper; import net.sevenstars.middleearth.MiddleEarth; -import net.minecraft.block.Block; -import net.minecraft.block.Blocks; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.util.Identifier; import net.sevenstars.middleearth.block.registration.*; import net.sevenstars.middleearth.block.utils.BlockRecordTypes; import net.sevenstars.middleearth.datageneration.content.models.*; @@ -16,45 +17,46 @@ import java.util.concurrent.CompletableFuture; -public class BlockTagProvider extends FabricTagProvider.BlockTagProvider { +public class BlockTagProvider extends BlockTagsProvider { - public BlockTagProvider(FabricDataOutput output, CompletableFuture registriesFuture) { - super(output, registriesFuture); + public BlockTagProvider(PackOutput output, CompletableFuture registriesFuture, + ExistingFileHelper existingFileHelper) { + super(output, registriesFuture, MiddleEarth.MOD_ID, existingFileHelper); } @Override - protected void configure(RegistryWrapper.WrapperLookup arg) { - var mineablePickaxe = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of( "mineable/pickaxe"))); - var mineableAxe = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of( "mineable/axe"))); - var mineableShovel = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of("mineable/shovel"))); - var mineableHoe = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of("mineable/hoe"))); - var swordEfficient = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of("sword_efficient"))); + protected void addTags(HolderLookup.Provider arg) { + var mineablePickaxe = tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse( "mineable/pickaxe"))); + var mineableAxe = tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse( "mineable/axe"))); + var mineableShovel = tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse("mineable/shovel"))); + var mineableHoe = tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse("mineable/hoe"))); + var swordEfficient = tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse("sword_efficient"))); - var needsStoneTools = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of("needs_stone_tool"))); - var needsIronTools = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of("needs_iron_tool"))); - var needsDiamondTools = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of("needs_diamond_tool"))); - var needsNetheriteTools = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of("fabric", "needs_tool_level_4"))); + var needsStoneTools = tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse("needs_stone_tool"))); + var needsIronTools = tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse("needs_iron_tool"))); + var needsDiamondTools = tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse("needs_diamond_tool"))); + var needsNetheriteTools = tag(net.neoforged.neoforge.common.Tags.Blocks.NEEDS_NETHERITE_TOOL); - var baseStoneOverworld = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of("base_stone_overworld"))); + var baseStoneOverworld = tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse("base_stone_overworld"))); - var climbable = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of("climbable"))); - var impermeable = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of("impermeable"))); + var climbable = tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse("climbable"))); + var impermeable = tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse("impermeable"))); - var seat = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of(MiddleEarth.MOD_ID, "seat"))); - var table = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of(MiddleEarth.MOD_ID, "table"))); + var seat = tag(TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "seat"))); + var table = tag(TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "table"))); - var leaves = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of("leaves"))); + var leaves = tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse("leaves"))); - var wool = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of("wool"))); + var wool = tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse("wool"))); - var snapsGoatHorn = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of("snaps_goat_horn"))); + var snapsGoatHorn = tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse("snaps_goat_horn"))); - var cobwebs = valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of(MiddleEarth.MOD_ID, "cobwebs"))); + var cobwebs = tag(TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "cobwebs"))); mineableAxe.add(MineableAxe.blocks.toArray(new Block[0])); mineablePickaxe.add(MineablePickaxe.blocks.toArray(new Block[0])); - mineableHoe.add(MineableHoe.blocks.toArray(new Block[0])); mineableShovel.add(MineableShovel.blocks.toArray(new Block[0])); + mineableHoe.add(MineableHoe.blocks.toArray(new Block[0])); wool.add(Wool.blocks.toArray(new Block[0])); @@ -62,64 +64,64 @@ protected void configure(RegistryWrapper.WrapperLookup arg) { swordEfficient.add(LeavesSets.leaves.toArray(new Block[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of( "saplings"))).add(Saplings.saplings.toArray(new Block[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of( "doors"))).add(Doors.doors.toArray(new Block[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of( "trapdoors"))).add(Trapdoors.trapdoors.toArray(new Block[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of( "stone_buttons"))).add(Buttons.stoneButtons.toArray(new Block[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of( "wooden_buttons"))).add(Buttons.woodButtons.toArray(new Block[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of( "fences"))).add(Fences.fences.toArray(new Block[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of( "wooden_fences"))).add(Fences.fences.toArray(new Block[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of( "fence_gates"))).add(FenceGates.fenceGates.toArray(new Block[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of( "leaves"))).add(LeavesSets.leaves.toArray(new Block[0])).add(LeavesSets.grayscaleLeaves.toArray(new Block[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of( "logs"))).add(Logs.logs.toArray(new Block[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of( "logs_that_burn"))).add(Logs.logs.toArray(new Block[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of( "pressure_plates"))).add(PressurePlates.pressurePlates.toArray(new Block[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of( "walls"))).add(Walls.walls.toArray(new Block[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of( "planks"))).add(Planks.planks.toArray(new Block[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.BLOCK, Identifier.of( "crops"))).add(Crops.crops.toArray(new Block[0])); + tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse( "saplings"))).add(Saplings.saplings.toArray(new Block[0])); + tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse( "doors"))).add(Doors.doors.toArray(new Block[0])); + tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse( "trapdoors"))).add(Trapdoors.trapdoors.toArray(new Block[0])); + tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse("stone_buttons"))).add(Buttons.stoneButtons.toArray(new Block[0])); + tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse("wooden_buttons"))).add(Buttons.woodButtons.toArray(new Block[0])); + tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse( "fences"))).add(Fences.fences.toArray(new Block[0])); + tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse( "wooden_fences"))).add(Fences.fences.toArray(new Block[0])); + tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse( "fence_gates"))).add(FenceGates.fenceGates.toArray(new Block[0])); + tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse( "leaves"))).add(LeavesSets.leaves.toArray(new Block[0])).add(LeavesSets.grayscaleLeaves.toArray(new Block[0])); + tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse( "logs"))).add(Logs.logs.toArray(new Block[0])); + tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse( "logs_that_burn"))).add(Logs.logs.toArray(new Block[0])); + tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse( "pressure_plates"))).add(PressurePlates.pressurePlates.toArray(new Block[0])); + tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse( "walls"))).add(Walls.walls.toArray(new Block[0])); + tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse( "planks"))).add(Planks.planks.toArray(new Block[0])); + tag(TagKey.create(Registries.BLOCK, ResourceLocation.parse( "crops"))).add(Crops.crops.toArray(new Block[0])); //Ores - TagKey iron_ores = TagKey.of(RegistryKeys.BLOCK, Identifier.of( "iron_ores")); - TagKey gold_ores = TagKey.of(RegistryKeys.BLOCK, Identifier.of( "gold_ores")); - TagKey copper_ores = TagKey.of(RegistryKeys.BLOCK, Identifier.of( "copper_ores")); - TagKey coal_ores = TagKey.of(RegistryKeys.BLOCK, Identifier.of( "coal_ores")); + TagKey iron_ores = TagKey.create(Registries.BLOCK, ResourceLocation.parse( "iron_ores")); + TagKey gold_ores = TagKey.create(Registries.BLOCK, ResourceLocation.parse( "gold_ores")); + TagKey copper_ores = TagKey.create(Registries.BLOCK, ResourceLocation.parse( "copper_ores")); + TagKey coal_ores = TagKey.create(Registries.BLOCK, ResourceLocation.parse( "coal_ores")); - TagKey tin_ores = TagKey.of(RegistryKeys.BLOCK, Identifier.of(MiddleEarth.MOD_ID, "tin_ores")); - TagKey lead_ores = TagKey.of(RegistryKeys.BLOCK, Identifier.of(MiddleEarth.MOD_ID, "lead_ores")); - TagKey silver_ores = TagKey.of(RegistryKeys.BLOCK, Identifier.of(MiddleEarth.MOD_ID, "silver_ores")); - TagKey mithril_ores = TagKey.of(RegistryKeys.BLOCK, Identifier.of(MiddleEarth.MOD_ID, "mithril_ores")); + TagKey tin_ores = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "tin_ores")); + TagKey lead_ores = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "lead_ores")); + TagKey silver_ores = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "silver_ores")); + TagKey mithril_ores = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "mithril_ores")); for (OreRockSets.OreRockSet set : OreRockSets.sets) { if(set.coal_ore() != null) { - valueLookupBuilder(coal_ores) + tag(coal_ores) .add(set.coal_ore()); } if(set.copper_ore() != null) { - valueLookupBuilder(copper_ores) + tag(copper_ores) .add(set.copper_ore()); } if(set.tin_ore() != null) { - valueLookupBuilder(tin_ores) + tag(tin_ores) .add(set.tin_ore()); } if(set.lead_ore() != null) { - valueLookupBuilder(lead_ores) + tag(lead_ores) .add(set.lead_ore()); } if(set.silver_ore() != null) { - valueLookupBuilder(silver_ores) + tag(silver_ores) .add(set.silver_ore()); } if(set.gold_ore() != null) { - valueLookupBuilder(gold_ores) + tag(gold_ores) .add(set.gold_ore()); } if(set.iron_ore() != null) { - valueLookupBuilder(iron_ores) + tag(iron_ores) .add(set.iron_ore()); } if(set.mithril_ore() != null) { - valueLookupBuilder(mithril_ores) + tag(mithril_ores) .add(set.mithril_ore()); } } @@ -375,11 +377,11 @@ protected void configure(RegistryWrapper.WrapperLookup arg) { mineablePickaxe.add(ModBlocks.PEBBLED_GRASS_SLAB); mineablePickaxe.add(ModBlocks.PEBBLED_GRASS_STAIRS); + mineablePickaxe.add(ModBlocks.EMBERS); + mineablePickaxe.add(ModBlocks.SKELETAL_PILE); mineablePickaxe.add(ModBlocks.SKELETAL_PILE_LAYER); - mineablePickaxe.add(ModBlocks.EMBERS); - mineableAxe.add(ModDecorativeBlocks.WOOD_PILE); mineableAxe.add(ModDecorativeBlocks.ARTISAN_TABLE); mineableAxe.add(ModDecorativeBlocks.ORCISH_ARTISAN_TABLE); @@ -436,8 +438,6 @@ protected void configure(RegistryWrapper.WrapperLookup arg) { mineableShovel.add(ModBlocks.COARSE_DIRT_STAIRS); mineableShovel.add(ModBlocks.ROOTED_DIRT_SLAB); - mineableShovel.add(ModBlocks.ROOTED_DIRT_SLAB); - mineablePickaxe.add(ModBlocks.PACKED_MUD_SLAB); mineablePickaxe.add(ModBlocks.PACKED_MUD_VERTICAL_SLAB); mineablePickaxe.add(ModBlocks.PACKED_MUD_STAIRS); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/tags/ItemTagProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/tags/ItemTagProvider.java index 53a8007f6a..f7c2cc7457 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/tags/ItemTagProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/datageneration/providers/tags/ItemTagProvider.java @@ -1,14 +1,16 @@ package net.sevenstars.middleearth.datageneration.providers.tags; -import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; -import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; -import net.minecraft.block.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.Items; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.util.Identifier; +import net.minecraft.core.HolderLookup; +import net.minecraft.data.PackOutput; +import net.minecraft.data.tags.ItemTagsProvider; +import net.minecraft.data.tags.TagsProvider; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.block.Blocks; +import net.neoforged.neoforge.common.data.ExistingFileHelper; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import net.sevenstars.middleearth.block.registration.OreRockSets; @@ -16,7 +18,11 @@ import net.sevenstars.middleearth.datageneration.content.models.HotMetalsModel; import net.sevenstars.middleearth.datageneration.content.models.SimpleDyeableItemModel; import net.sevenstars.middleearth.datageneration.content.tags.*; -import net.sevenstars.middleearth.item.*; +import net.sevenstars.middleearth.item.EquipmentItemsME; +import net.sevenstars.middleearth.item.FoodItemsME; +import net.sevenstars.middleearth.item.ResourceItemsME; +import net.sevenstars.middleearth.item.ToolItemsME; +import net.sevenstars.middleearth.item.WeaponItemsME; import net.sevenstars.middleearth.utils.ItemTagsME; import net.sevenstars.of_beasts_and_wild_things.item.ItemsWT; @@ -24,87 +30,89 @@ import java.util.List; import java.util.concurrent.CompletableFuture; -public class ItemTagProvider extends FabricTagProvider.ItemTagProvider { +public class ItemTagProvider extends ItemTagsProvider { - public ItemTagProvider(FabricDataOutput output, CompletableFuture registriesFuture) { - super(output, registriesFuture); + public ItemTagProvider(PackOutput output, CompletableFuture registriesFuture, + CompletableFuture> blockTags, + ExistingFileHelper existingFileHelper) { + super(output, registriesFuture, blockTags, MiddleEarth.MOD_ID, existingFileHelper); } @Override - protected void configure(RegistryWrapper.WrapperLookup arg) { - var bones = valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))); - var feathers = valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "feathers"))); - var cloaks = valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "cloaks"))); - var warg_food = valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "warg_food"))); - var warg_armor = valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "warg_armor"))); - var broadhoof_goat_armor = valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "broadhoof_goat_armor"))); - var great_horn_armor = valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "great_horn_armor"))); - var dyeable = valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("dyeable"))); - var chains = valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "chains"))); - var troll_weapons = valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "troll_weapons"))); - var troll_food = valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "troll_food"))); - - var characterHideHair = valueLookupBuilder(ItemTagsME.CHARACTER_HELMET_HIDE_HAIR); - var characterHideBeard = valueLookupBuilder(ItemTagsME.CHARACTER_HELMET_HIDE_BEARD); - var characterShowEars = valueLookupBuilder(ItemTagsME.CHARACTER_HELMET_SHOW_EARS); - - TagKey iron_ores = TagKey.of(RegistryKeys.ITEM, Identifier.of("iron_ores")); - TagKey gold_ores = TagKey.of(RegistryKeys.ITEM, Identifier.of("gold_ores")); - TagKey copper_ores = TagKey.of(RegistryKeys.ITEM, Identifier.of("copper_ores")); - TagKey coal_ores = TagKey.of(RegistryKeys.ITEM, Identifier.of("coal_ores")); - - TagKey saplings = TagKey.of(RegistryKeys.ITEM, Identifier.of("saplings")); - TagKey wooden_slabs = TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_slabs")); - TagKey wooden_vertical_slabs = TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "wooden_vertical_slabs")); - TagKey wooden_fences = TagKey.of(RegistryKeys.ITEM, Identifier.of( "wooden_fences")); - TagKey logs_that_burn = TagKey.of(RegistryKeys.ITEM, Identifier.of("logs_that_burn")); - TagKey stone_crafting_materials = TagKey.of(RegistryKeys.ITEM, Identifier.of("stone_crafting_materials")); - TagKey stone_tool_materials = TagKey.of(RegistryKeys.ITEM, Identifier.of("stone_tool_materials")); - TagKey leaves = TagKey.of(RegistryKeys.ITEM, Identifier.of("leaves")); - - TagKey ingot_shaping = TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "ingot_shaping")); - TagKey nugget_shaping = TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "nugget_shaping")); - - TagKey tin_ores = TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "tin_ores")); - TagKey lead_ores = TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "lead_ores")); - TagKey silver_ores = TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "silver_ores")); - TagKey mithril_ores = TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "mithril_ores")); - TagKey shingles = TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "shingles")); - - TagKey mod_stripped_logs = TagKey.of(RegistryKeys.ITEM, MiddleEarth.of("mod_stripped_logs")); - TagKey stripped_logs = TagKey.of(RegistryKeys.ITEM, Identifier.of("c", "stripped_logs")); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, MiddleEarth.of("mod_planks"))).add(Planks.getItemPlanksWithoutVanilla().toArray(new Item[0])); - - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("planks"))).add(Planks.getItemPlanks().toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("wooden_slabs"))).add(Planks.getItemPlanksSlabs().toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("logs"))).add(Logs.getItemLogs().toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("logs_that_burn"))).add(Logs.getItemLogs().toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("leaves"))).add(LeavesSets.getItemLeaves().toArray(new Item[0])); - - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("axes"))).add(WeaponEnchants.axes.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, MiddleEarth.of("daggers"))).add(WeaponEnchants.daggers.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("swords"))).add(WeaponEnchants.swords.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, MiddleEarth.of("spears"))).add(WeaponItemsME.spears.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("minecraft", "enchantable/weapon"))).add(WeaponEnchants.weapons.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("minecraft", "enchantable/sword"))).add(WeaponEnchants.sharpWeapons.toArray(new Item[0])); - - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("minecraft", "enchantable/bow"))).add(Bows.bows.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("c", "tools/ranged_weapon"))).add(Bows.bows.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("c", "tools/bow"))).add(Bows.bows.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("c", "tools/bows"))).add(Bows.bows.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("minecraft", "enchantable/crossbow"))).add(Crossbows.crossbows.toArray(new Item[0])); - - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("minecraft", "enchantable/durability"))).add(ArmorTags.armors.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("minecraft", "enchantable/durability"))).add(WeaponEnchants.weapons.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("minecraft", "enchantable/durability"))).add(ToolItemsME.smithingHammers.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("minecraft", "enchantable/durability"))).add(Crossbows.crossbows.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("minecraft", "enchantable/vanishing"))).add(ArmorTags.armors.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("minecraft", "enchantable/vanishing"))).add(WeaponEnchants.weapons.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("minecraft", "enchantable/vanishing"))).add(ToolItemsME.smithingHammers.toArray(new Item[0])); - - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("c", "tools/shields"))).add(WeaponItemsME.shields.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("c", "tools/shield"))).add(WeaponItemsME.shields.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("minecraft", "enchantable/equippable"))).add(ArmorTags.armors.toArray(new Item[0])); + protected void addTags(HolderLookup.Provider arg) { + var bones = tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))); + var feathers = tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "feathers"))); + var cloaks = tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "cloaks"))); + var warg_food = tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "warg_food"))); + var warg_armor = tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "warg_armor"))); + var broadhoof_goat_armor = tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "broadhoof_goat_armor"))); + var great_horn_armor = tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "great_horn_armor"))); + var dyeable = tag(TagKey.create(Registries.ITEM, ResourceLocation.parse("dyeable"))); + var chains = tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "chains"))); + var troll_weapons = tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "troll_weapons"))); + var troll_food = tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "troll_food"))); + + var characterHideHair = tag(ItemTagsME.CHARACTER_HELMET_HIDE_HAIR); + var characterHideBeard = tag(ItemTagsME.CHARACTER_HELMET_HIDE_BEARD); + var characterShowEars = tag(ItemTagsME.CHARACTER_HELMET_SHOW_EARS); + + TagKey iron_ores = TagKey.create(Registries.ITEM, ResourceLocation.parse("iron_ores")); + TagKey gold_ores = TagKey.create(Registries.ITEM, ResourceLocation.parse("gold_ores")); + TagKey copper_ores = TagKey.create(Registries.ITEM, ResourceLocation.parse("copper_ores")); + TagKey coal_ores = TagKey.create(Registries.ITEM, ResourceLocation.parse("coal_ores")); + + TagKey saplings = TagKey.create(Registries.ITEM, ResourceLocation.parse("saplings")); + TagKey wooden_slabs = TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_slabs")); + TagKey wooden_vertical_slabs = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "wooden_vertical_slabs")); + TagKey wooden_fences = TagKey.create(Registries.ITEM, ResourceLocation.parse( "wooden_fences")); + TagKey logs_that_burn = TagKey.create(Registries.ITEM, ResourceLocation.parse("logs_that_burn")); + TagKey stone_crafting_materials = TagKey.create(Registries.ITEM, ResourceLocation.parse("stone_crafting_materials")); + TagKey stone_tool_materials = TagKey.create(Registries.ITEM, ResourceLocation.parse("stone_tool_materials")); + TagKey leaves = TagKey.create(Registries.ITEM, ResourceLocation.parse("leaves")); + + TagKey ingot_shaping = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "ingot_shaping")); + TagKey nugget_shaping = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "nugget_shaping")); + + TagKey tin_ores = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "tin_ores")); + TagKey lead_ores = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "lead_ores")); + TagKey silver_ores = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "silver_ores")); + TagKey mithril_ores = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "mithril_ores")); + TagKey shingles = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "shingles")); + + TagKey mod_stripped_logs = TagKey.create(Registries.ITEM, MiddleEarth.of("mod_stripped_logs")); + TagKey stripped_logs = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("c", "stripped_logs")); + tag(TagKey.create(Registries.ITEM, MiddleEarth.of("mod_planks"))).add(Planks.getItemPlanksWithoutVanilla().toArray(new Item[0])); + + tag(TagKey.create(Registries.ITEM, ResourceLocation.parse("planks"))).add(Planks.getItemPlanks().toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.parse("wooden_slabs"))).add(Planks.getItemPlanksSlabs().toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.parse("logs"))).add(Logs.getItemLogs().toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.parse("logs_that_burn"))).add(Logs.getItemLogs().toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.parse("leaves"))).add(LeavesSets.getItemLeaves().toArray(new Item[0])); + + tag(TagKey.create(Registries.ITEM, ResourceLocation.parse("axes"))).add(WeaponEnchants.axes.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, MiddleEarth.of("daggers"))).add(WeaponEnchants.daggers.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.parse("swords"))).add(WeaponEnchants.swords.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, MiddleEarth.of("spears"))).add(WeaponItemsME.spears.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("minecraft", "enchantable/weapon"))).add(WeaponEnchants.weapons.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("minecraft", "enchantable/sword"))).add(WeaponEnchants.sharpWeapons.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("minecraft", "enchantable/bow"))).add(Bows.bows.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("c", "tools/ranged_weapon"))) + .add(Bows.bows.toArray(new Item[0])) + .add(Crossbows.crossbows.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("c", "tools/bow"))).add(Bows.bows.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("c", "tools/bows"))).add(Bows.bows.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("c", "tools/crossbow"))).add(Crossbows.crossbows.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("minecraft", "enchantable/crossbow"))).add(Crossbows.crossbows.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("minecraft", "enchantable/durability"))).add(ArmorTags.armors.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("minecraft", "enchantable/durability"))).add(WeaponEnchants.weapons.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("minecraft", "enchantable/durability"))).add(ToolItemsME.smithingHammers.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("minecraft", "enchantable/durability"))).add(Crossbows.crossbows.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("minecraft", "enchantable/vanishing"))).add(ArmorTags.armors.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("minecraft", "enchantable/vanishing"))).add(WeaponEnchants.weapons.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("minecraft", "enchantable/vanishing"))).add(ToolItemsME.smithingHammers.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("c", "tools/shields"))).add(WeaponItemsME.shields.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("c", "tools/shield"))).add(WeaponItemsME.shields.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("minecraft", "enchantable/equippable"))).add(ArmorTags.armors.toArray(new Item[0])); ArmorTags.basicArmors.addAll(List.of(new Item[]{Items.LEATHER_HELMET, Items.LEATHER_CHESTPLATE, Items.LEATHER_LEGGINGS, Items.LEATHER_BOOTS})); ArmorTags.mediumArmors.addAll(List.of(new Item[]{Items.GOLDEN_HELMET, Items.GOLDEN_CHESTPLATE, Items.GOLDEN_LEGGINGS, Items.GOLDEN_BOOTS, @@ -118,19 +126,19 @@ protected void configure(RegistryWrapper.WrapperLookup arg) { Items.CHAINMAIL_HELMET, Items.CHAINMAIL_CHESTPLATE, Items.CHAINMAIL_LEGGINGS, Items.CHAINMAIL_BOOTS, Items.IRON_HELMET, Items.IRON_CHESTPLATE, Items.IRON_LEGGINGS, Items.IRON_BOOTS, Items.TURTLE_HELMET)); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of("minecraft", "enchantable/armor"))).add(ArmorTags.armors.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, Identifier.of( "minecraft", "enchantable/head_armor"))).add(ArmorTags.headArmors.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM,Identifier.of( "minecraft", "enchantable/chest_armor"))).add(ArmorTags.chestArmors.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM,Identifier.of( "minecraft", "enchantable/leg_armor"))).add(ArmorTags.legArmors.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM,Identifier.of( "minecraft", "enchantable/foot_armor"))).add(ArmorTags.footArmors.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("minecraft", "enchantable/armor"))).add(ArmorTags.armors.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath( "minecraft", "enchantable/head_armor"))).add(ArmorTags.headArmors.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM,ResourceLocation.fromNamespaceAndPath( "minecraft", "enchantable/chest_armor"))).add(ArmorTags.chestArmors.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM,ResourceLocation.fromNamespaceAndPath( "minecraft", "enchantable/leg_armor"))).add(ArmorTags.legArmors.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM,ResourceLocation.fromNamespaceAndPath( "minecraft", "enchantable/foot_armor"))).add(ArmorTags.footArmors.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, MiddleEarth.ofPath( "enchantable", "basic_armor"))).add(ArmorTags.basicArmors.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, MiddleEarth.ofPath( "enchantable", "light_armor"))).add(ArmorTags.lightArmors.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, MiddleEarth.ofPath( "enchantable", "medium_armor"))).add(ArmorTags.mediumArmors.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, MiddleEarth.ofPath( "enchantable", "sturdy_armor"))).add(ArmorTags.sturdyArmors.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, MiddleEarth.ofPath( "enchantable", "basic_armor"))).add(ArmorTags.basicArmors.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, MiddleEarth.ofPath( "enchantable", "light_armor"))).add(ArmorTags.lightArmors.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, MiddleEarth.ofPath( "enchantable", "medium_armor"))).add(ArmorTags.mediumArmors.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, MiddleEarth.ofPath( "enchantable", "sturdy_armor"))).add(ArmorTags.sturdyArmors.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, MiddleEarth.ofPath( "enchantable", "heavy_armor"))).add(ArmorTags.heavyArmors.toArray(new Item[0])); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, MiddleEarth.ofPath( "enchantable", "incomplete_armors"))).add(ArmorTags.incompleteArmors.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, MiddleEarth.ofPath( "enchantable", "heavy_armor"))).add(ArmorTags.heavyArmors.toArray(new Item[0])); + tag(TagKey.create(Registries.ITEM, MiddleEarth.ofPath( "enchantable", "incomplete_armors"))).add(ArmorTags.incompleteArmors.toArray(new Item[0])); ArrayList upToArmor = (ArrayList) ArmorTags.basicArmors; upToArmor.addAll(ArmorTags.lightArmors); @@ -147,8 +155,8 @@ protected void configure(RegistryWrapper.WrapperLookup arg) { lightLegging.add(legItem); } } - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, MiddleEarth.ofPath( "enchantable", "light_chest"))).add(lightChest); - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, MiddleEarth.ofPath( "enchantable", "light_leg"))).add(lightLegging); + tag(TagKey.create(Registries.ITEM, MiddleEarth.ofPath( "enchantable", "light_chest"))).add(lightChest.toArray(Item[]::new)); + tag(TagKey.create(Registries.ITEM, MiddleEarth.ofPath( "enchantable", "light_leg"))).add(lightLegging.toArray(Item[]::new)); upToArmor.addAll(ArmorTags.mediumArmors); @@ -158,7 +166,7 @@ protected void configure(RegistryWrapper.WrapperLookup arg) { mediumBoots.add(bootItem); } } - valueLookupBuilder(TagKey.of(RegistryKeys.ITEM, MiddleEarth.ofPath( "enchantable", "medium_foot"))).add(mediumBoots); + tag(TagKey.create(Registries.ITEM, MiddleEarth.ofPath( "enchantable", "medium_foot"))).add(mediumBoots.toArray(Item[]::new)); warg_food.add(Items.RABBIT); warg_food.add(Items.CHICKEN); @@ -274,35 +282,35 @@ protected void configure(RegistryWrapper.WrapperLookup arg) { for (OreRockSets.OreRockSet set : OreRockSets.sets) { if(set.coal_ore() != null) { - valueLookupBuilder(coal_ores) + tag(coal_ores) .add(set.coal_ore().asItem()); } if(set.copper_ore() != null) { - valueLookupBuilder(copper_ores) + tag(copper_ores) .add(set.copper_ore().asItem()); } if(set.tin_ore() != null) { - valueLookupBuilder(tin_ores) + tag(tin_ores) .add(set.tin_ore().asItem()); } if(set.lead_ore() != null) { - valueLookupBuilder(lead_ores) + tag(lead_ores) .add(set.lead_ore().asItem()); } if(set.silver_ore() != null) { - valueLookupBuilder(silver_ores) + tag(silver_ores) .add(set.silver_ore().asItem()); } if(set.gold_ore() != null) { - valueLookupBuilder(gold_ores) + tag(gold_ores) .add(set.gold_ore().asItem()); } if(set.iron_ore() != null) { - valueLookupBuilder(iron_ores) + tag(iron_ores) .add(set.iron_ore().asItem()); } if(set.mithril_ore() != null) { - valueLookupBuilder(mithril_ores) + tag(mithril_ores) .add(set.mithril_ore().asItem()); } } @@ -310,52 +318,52 @@ protected void configure(RegistryWrapper.WrapperLookup arg) { SimpleDyeableItemModel.items.forEach(dyeable::add); WoodenSlabs.woodenSlabs.forEach(block -> { - valueLookupBuilder(wooden_slabs).add(block.asItem()); + tag(wooden_slabs).add(block.asItem()); }); WoodenVerticalSlabs.woodenVericalSlabs.forEach(block -> { - valueLookupBuilder(wooden_vertical_slabs).add(block.asItem()); + tag(wooden_vertical_slabs).add(block.asItem()); }); Fences.fences.forEach(block -> { - valueLookupBuilder(wooden_fences).add(block.asItem()); + tag(wooden_fences).add(block.asItem()); }); ModdedStrippedLogs.strippedLogs.forEach(block -> { - valueLookupBuilder(mod_stripped_logs).add(block.asItem()); + tag(mod_stripped_logs).add(block.asItem()); }); ModdedStrippedLogs.strippedLogs.forEach(block -> { - valueLookupBuilder(stripped_logs).add(block.asItem()); + tag(stripped_logs).add(block.asItem()); }); Shingles.shingles.forEach(block -> { - valueLookupBuilder(shingles).add(block.asItem()); + tag(shingles).add(block.asItem()); }); Saplings.saplings.forEach(sapling -> { - valueLookupBuilder(saplings).add(sapling.asItem()); + tag(saplings).add(sapling.asItem()); }); LogsThatBurn.logsThatBurn.forEach(log -> { - valueLookupBuilder(logs_that_burn).add(log.asItem()); + tag(logs_that_burn).add(log.asItem()); }); HotMetalsModel.ingots.forEach(ingot -> { - valueLookupBuilder(ingot_shaping).add(ingot); + tag(ingot_shaping).add(ingot); }); HotMetalsModel.nuggets.forEach(nugget -> { - valueLookupBuilder(nugget_shaping).add(nugget); + tag(nugget_shaping).add(nugget); }); StoneBlockSets.stoneSetsList.forEach(stone -> { if(stone.cobblestoneBlocks != null) { - valueLookupBuilder(stone_crafting_materials).add(stone.cobblestoneBlocks.base().asItem()); - valueLookupBuilder(stone_tool_materials).add(stone.cobblestoneBlocks.base().asItem()); + tag(stone_crafting_materials).add(stone.cobblestoneBlocks.base().asItem()); + tag(stone_tool_materials).add(stone.cobblestoneBlocks.base().asItem()); } }); - valueLookupBuilder(stone_crafting_materials).add(Blocks.BLACKSTONE.asItem()); - valueLookupBuilder(stone_tool_materials).add(Blocks.BLACKSTONE.asItem()); + tag(stone_crafting_materials).add(Blocks.BLACKSTONE.asItem()); + tag(stone_tool_materials).add(Blocks.BLACKSTONE.asItem()); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/enchantments/EnchantmentsME.java b/middle-earth/src/main/java/net/sevenstars/middleearth/enchantments/EnchantmentsME.java index ca0566fba0..5222b63a90 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/enchantments/EnchantmentsME.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/enchantments/EnchantmentsME.java @@ -1,174 +1,180 @@ package net.sevenstars.middleearth.enchantments; -import net.minecraft.component.EnchantmentEffectComponentTypes; -import net.minecraft.component.type.AttributeModifierSlot; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentLevelBasedValue; -import net.minecraft.enchantment.effect.AttributeEnchantmentEffect; -import net.minecraft.enchantment.effect.value.AddEnchantmentEffect; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.attribute.EntityAttributeModifier; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.item.Item; -import net.minecraft.loot.condition.EntityPropertiesLootCondition; -import net.minecraft.loot.context.LootContext; -import net.minecraft.predicate.entity.EntityPredicate; -import net.minecraft.predicate.entity.EntityTypePredicate; -import net.minecraft.registry.*; -import net.minecraft.registry.tag.EnchantmentTags; -import net.minecraft.registry.tag.EntityTypeTags; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.util.Identifier; +import net.minecraft.advancements.critereon.EntityPredicate; +import net.minecraft.advancements.critereon.EntityTypePredicate; +import net.minecraft.core.HolderGetter; +import net.minecraft.core.registries.Registries; +import net.minecraft.data.worldgen.BootstrapContext; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.EnchantmentTags; +import net.minecraft.tags.EntityTypeTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.tags.TagKey; +import net.minecraft.world.entity.EquipmentSlotGroup; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.EnchantmentEffectComponents; +import net.minecraft.world.item.enchantment.LevelBasedValue; +import net.minecraft.world.item.enchantment.effects.AddValue; +import net.minecraft.world.item.enchantment.effects.EnchantmentAttributeEffect; +import net.minecraft.world.level.storage.loot.LootContext; +import net.minecraft.world.level.storage.loot.predicates.LootItemEntityPropertyCondition; import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.middleearth.utils.ItemTagsME; /** * Middle-earth mod enchantment effects registry *


*/ public class EnchantmentsME { - public static final RegistryKey AILMENT_PROTECTION = of("ailment_protection"); - public static final RegistryKey AULE_BLESSING = of("aule_blessing"); - public static final RegistryKey BANE_OF_GIANTS = of("bane_of_giants"); - public static final RegistryKey BEHEADING = of("beheading"); - public static final RegistryKey CELERITY = of("celerity"); - public static final RegistryKey FIRST_STRIKE = of("first_strike"); - public static final RegistryKey GROUNDED = of("grounded"); - public static final RegistryKey HEWING = of("hewing"); - public static final RegistryKey HIGH_STEP = of("high_step"); - public static final RegistryKey MINER_REACH = of("miner_reach"); - public static final RegistryKey STEALTHY_TRAIL = of("stealthy_trail"); - public static final RegistryKey STALWART = of("stalwart"); - public static final RegistryKey STRIDE = of("stride"); - public static final RegistryKey TREE_FELLER = of("tree_feller"); - public static final RegistryKey VANTAGE = of("vantage"); - - private static RegistryKey of(String path) { - Identifier id = MiddleEarth.of(path); - return RegistryKey.of(RegistryKeys.ENCHANTMENT, id); + public static final ResourceKey AILMENT_PROTECTION = of("ailment_protection"); + public static final ResourceKey AULE_BLESSING = of("aule_blessing"); + public static final ResourceKey BANE_OF_GIANTS = of("bane_of_giants"); + public static final ResourceKey BEHEADING = of("beheading"); + public static final ResourceKey CELERITY = of("celerity"); + public static final ResourceKey FIRST_STRIKE = of("first_strike"); + public static final ResourceKey GROUNDED = of("grounded"); + public static final ResourceKey HEWING = of("hewing"); + public static final ResourceKey HIGH_STEP = of("high_step"); + public static final ResourceKey MINER_REACH = of("miner_reach"); + public static final ResourceKey STEALTHY_TRAIL = of("stealthy_trail"); + public static final ResourceKey STALWART = of("stalwart"); + public static final ResourceKey STRIDE = of("stride"); + public static final ResourceKey TREE_FELLER = of("tree_feller"); + public static final ResourceKey VANTAGE = of("vantage"); + private static final TagKey SMITHING_HAMMER_EXCLUSIVE = TagKey.create( + Registries.ENCHANTMENT, + MiddleEarth.of("exclusive_set/smithing_hammer") + ); + + private static ResourceKey of(String path) { + ResourceLocation id = MiddleEarth.of(path); + return ResourceKey.create(Registries.ENCHANTMENT, id); } - public static void bootstrap(Registerable registry) { - RegistryEntryLookup registryEntryLookup2 = registry.getRegistryLookup(RegistryKeys.ENCHANTMENT); - RegistryEntryLookup registryEntryLookup3 = registry.getRegistryLookup(RegistryKeys.ITEM); - RegistryEntryLookup> registryEntryLookup5 = registry.getRegistryLookup(RegistryKeys.ENTITY_TYPE); - - register(registry, AILMENT_PROTECTION, Enchantment.builder( + public static void bootstrap(BootstrapContext registry) { + HolderGetter registryEntryLookup2 = registry.lookup(Registries.ENCHANTMENT); + HolderGetter registryEntryLookup3 = registry.lookup(Registries.ITEM); + register(registry, AILMENT_PROTECTION, Enchantment.enchantment( Enchantment.definition(registryEntryLookup3.getOrThrow(ItemTags.ARMOR_ENCHANTABLE), 5, 4, - Enchantment.leveledCost(18, 8), - Enchantment.leveledCost(10, 8), 2, - AttributeModifierSlot.ARMOR)) - .exclusiveSet(registryEntryLookup2.getOrThrow(EnchantmentTags.ARMOR_EXCLUSIVE_SET))); - - register(registry, AULE_BLESSING, Enchantment.builder( - Enchantment.definition(registryEntryLookup3.getOrThrow(ItemTags.ARMOR_ENCHANTABLE), 5, 3, - Enchantment.leveledCost(12, 7), - Enchantment.leveledCost(5, 7), 2, - AttributeModifierSlot.MAINHAND)) - .exclusiveSet(registryEntryLookup2.getOrThrow(EnchantmentTags.MINING_EXCLUSIVE_SET))); - - register(registry, BANE_OF_GIANTS, Enchantment.builder( + Enchantment.dynamicCost(18, 8), + Enchantment.dynamicCost(10, 8), 2, + EquipmentSlotGroup.ARMOR)) + .exclusiveWith(registryEntryLookup2.getOrThrow(EnchantmentTags.ARMOR_EXCLUSIVE))); + + register(registry, AULE_BLESSING, Enchantment.enchantment( + Enchantment.definition(registryEntryLookup3.getOrThrow(ItemTagsME.SMITHING_HAMMER_ENCHANTABLE), 10, 3, + Enchantment.dynamicCost(1, 5), + Enchantment.dynamicCost(1, 12), 3, + EquipmentSlotGroup.MAINHAND)) + .exclusiveWith(registryEntryLookup2.getOrThrow(SMITHING_HAMMER_EXCLUSIVE))); + + register(registry, BANE_OF_GIANTS, Enchantment.enchantment( Enchantment.definition(registryEntryLookup3.getOrThrow(ItemTags.WEAPON_ENCHANTABLE), registryEntryLookup3.getOrThrow(ItemTags.SWORD_ENCHANTABLE), 5, 5, - Enchantment.leveledCost(5, 8), - Enchantment.leveledCost(25, 8), 2, - AttributeModifierSlot.MAINHAND)) - .exclusiveSet(registryEntryLookup2.getOrThrow(EnchantmentTags.DAMAGE_EXCLUSIVE_SET)) - .addEffect(EnchantmentEffectComponentTypes.DAMAGE, - new AddEnchantmentEffect(EnchantmentLevelBasedValue.linear(2.5F)), - EntityPropertiesLootCondition.builder(LootContext.EntityTarget.THIS, - EntityPredicate.Builder.create().type(EntityTypePredicate - .create(registryEntryLookup5, EntityTypeTags.SENSITIVE_TO_SMITE))))); - - register(registry, CELERITY, Enchantment.builder( - Enchantment.definition(registryEntryLookup3.getOrThrow(ItemTags.SWORD_ENCHANTABLE), 2, 1, - Enchantment.leveledCost(10, 20), - Enchantment.leveledCost(40, 20), 4, - AttributeModifierSlot.MAINHAND)) - .addEffect(EnchantmentEffectComponentTypes.ATTRIBUTES, - new AttributeEnchantmentEffect(MiddleEarth.of("enchantment.celerity"), - EntityAttributes.ATTACK_SPEED, new EnchantmentLevelBasedValue.Linear(0.2f, 0.2f), EntityAttributeModifier.Operation.ADD_VALUE))); - - register(registry, FIRST_STRIKE, Enchantment.builder( + Enchantment.dynamicCost(5, 8), + Enchantment.dynamicCost(25, 8), 2, + EquipmentSlotGroup.MAINHAND)) + .exclusiveWith(registryEntryLookup2.getOrThrow(EnchantmentTags.DAMAGE_EXCLUSIVE)) + .withEffect(EnchantmentEffectComponents.DAMAGE, + new AddValue(LevelBasedValue.perLevel(2.5F)), + LootItemEntityPropertyCondition.hasProperties(LootContext.EntityTarget.THIS, + EntityPredicate.Builder.entity().entityType(EntityTypePredicate + .of(EntityTypeTags.SENSITIVE_TO_SMITE))))); + + register(registry, CELERITY, Enchantment.enchantment( + Enchantment.definition(registryEntryLookup3.getOrThrow(ItemTagsME.CELERITY_ENCHANTABLE), 2, 1, + Enchantment.dynamicCost(10, 20), + Enchantment.dynamicCost(40, 20), 4, + EquipmentSlotGroup.MAINHAND)) + .withEffect(EnchantmentEffectComponents.ATTRIBUTES, + new EnchantmentAttributeEffect(MiddleEarth.of("enchantment.celerity"), + Attributes.ATTACK_SPEED, new LevelBasedValue.Linear(0.2f, 0.2f), AttributeModifier.Operation.ADD_VALUE))); + + register(registry, FIRST_STRIKE, Enchantment.enchantment( Enchantment.definition(registryEntryLookup3.getOrThrow(ItemTags.WEAPON_ENCHANTABLE), 3, 1, - Enchantment.leveledCost(15, 7), - Enchantment.leveledCost(30, 15), 3, - AttributeModifierSlot.MAINHAND))); + Enchantment.dynamicCost(15, 7), + Enchantment.dynamicCost(30, 15), 3, + EquipmentSlotGroup.MAINHAND))); - register(registry, GROUNDED, Enchantment.builder( + register(registry, GROUNDED, Enchantment.enchantment( Enchantment.definition(registryEntryLookup3.getOrThrow(ItemTags.ARMOR_ENCHANTABLE), registryEntryLookup3.getOrThrow(ItemTags.ARMOR_ENCHANTABLE), 5, 4, - Enchantment.leveledCost(5, 8), - Enchantment.leveledCost(25, 8), 2, - AttributeModifierSlot.ARMOR)) - .exclusiveSet(registryEntryLookup2.getOrThrow(EnchantmentTags.ARMOR_EXCLUSIVE_SET)) - .addEffect(EnchantmentEffectComponentTypes.ATTRIBUTES, - new AttributeEnchantmentEffect(MiddleEarth.of("enchantment.grounded"), - EntityAttributes.KNOCKBACK_RESISTANCE, EnchantmentLevelBasedValue.linear(0.025F), - EntityAttributeModifier.Operation.ADD_VALUE))); - - register(registry, HEWING, Enchantment.builder( + Enchantment.dynamicCost(5, 8), + Enchantment.dynamicCost(25, 8), 2, + EquipmentSlotGroup.ARMOR)) + .exclusiveWith(registryEntryLookup2.getOrThrow(EnchantmentTags.ARMOR_EXCLUSIVE)) + .withEffect(EnchantmentEffectComponents.ATTRIBUTES, + new EnchantmentAttributeEffect(MiddleEarth.of("enchantment.grounded"), + Attributes.KNOCKBACK_RESISTANCE, LevelBasedValue.perLevel(0.025F), + AttributeModifier.Operation.ADD_VALUE))); + + register(registry, HEWING, Enchantment.enchantment( Enchantment.definition(registryEntryLookup3.getOrThrow(ItemTags.MINING_ENCHANTABLE), 5, 4, - Enchantment.leveledCost(18, 8), - Enchantment.leveledCost(10, 8), 2, - AttributeModifierSlot.MAINHAND)) - .exclusiveSet(registryEntryLookup2.getOrThrow(EnchantmentTags.MINING_EXCLUSIVE_SET))); + Enchantment.dynamicCost(18, 8), + Enchantment.dynamicCost(10, 8), 2, + EquipmentSlotGroup.MAINHAND)) + .exclusiveWith(registryEntryLookup2.getOrThrow(EnchantmentTags.MINING_EXCLUSIVE))); - register(registry, TREE_FELLER, Enchantment.builder( + register(registry, TREE_FELLER, Enchantment.enchantment( Enchantment.definition(registryEntryLookup3.getOrThrow(ItemTags.MINING_ENCHANTABLE), 5, 4, - Enchantment.leveledCost(18, 8), - Enchantment.leveledCost(10, 8), 2, - AttributeModifierSlot.MAINHAND)) - .exclusiveSet(registryEntryLookup2.getOrThrow(EnchantmentTags.MINING_EXCLUSIVE_SET))); + Enchantment.dynamicCost(18, 8), + Enchantment.dynamicCost(10, 8), 2, + EquipmentSlotGroup.MAINHAND)) + .exclusiveWith(registryEntryLookup2.getOrThrow(EnchantmentTags.MINING_EXCLUSIVE))); - register(registry, HIGH_STEP, Enchantment.builder( + register(registry, HIGH_STEP, Enchantment.enchantment( Enchantment.definition(registryEntryLookup3.getOrThrow(ItemTags.FOOT_ARMOR), 1, 3, - Enchantment.leveledCost(30, 30), - Enchantment.leveledCost(85, 30), 9, - AttributeModifierSlot.CHEST))); + Enchantment.dynamicCost(30, 30), + Enchantment.dynamicCost(85, 30), 9, + EquipmentSlotGroup.CHEST))); - register(registry, MINER_REACH, Enchantment.builder( + register(registry, MINER_REACH, Enchantment.enchantment( Enchantment.definition(registryEntryLookup3.getOrThrow(ItemTags.MINING_ENCHANTABLE), 1, 1, - Enchantment.leveledCost(18, 15), - Enchantment.leveledCost(25, 15), 8, - AttributeModifierSlot.MAINHAND)) - .exclusiveSet(registryEntryLookup2.getOrThrow(EnchantmentTags.MINING_EXCLUSIVE_SET))); + Enchantment.dynamicCost(18, 15), + Enchantment.dynamicCost(25, 15), 8, + EquipmentSlotGroup.MAINHAND)) + .exclusiveWith(registryEntryLookup2.getOrThrow(EnchantmentTags.MINING_EXCLUSIVE))); - register(registry, STEALTHY_TRAIL, Enchantment.builder( + register(registry, STEALTHY_TRAIL, Enchantment.enchantment( Enchantment.definition(registryEntryLookup3.getOrThrow(ItemTags.CHEST_ARMOR_ENCHANTABLE), 1, 3, - Enchantment.leveledCost(25, 25), - Enchantment.leveledCost(75, 25), 8, - AttributeModifierSlot.CHEST))); + Enchantment.dynamicCost(25, 25), + Enchantment.dynamicCost(75, 25), 8, + EquipmentSlotGroup.CHEST))); - register(registry, STRIDE, Enchantment.builder( + register(registry, STRIDE, Enchantment.enchantment( Enchantment.definition(registryEntryLookup3.getOrThrow(ItemTags.LEG_ARMOR_ENCHANTABLE), 1, 3, - Enchantment.leveledCost(15, 15), - Enchantment.leveledCost(45, 15), 7, - AttributeModifierSlot.LEGS))); + Enchantment.dynamicCost(15, 15), + Enchantment.dynamicCost(45, 15), 7, + EquipmentSlotGroup.LEGS))); - register(registry, STALWART, Enchantment.builder( + register(registry, STALWART, Enchantment.enchantment( Enchantment.definition(registryEntryLookup3.getOrThrow(ItemTags.ARMOR_ENCHANTABLE), registryEntryLookup3.getOrThrow(ItemTags.ARMOR_ENCHANTABLE), 5, 1, - Enchantment.leveledCost(10, 8), - Enchantment.leveledCost(25, 8), 3, - AttributeModifierSlot.ARMOR)) - .exclusiveSet(registryEntryLookup2.getOrThrow(EnchantmentTags.ARMOR_EXCLUSIVE_SET)) - .addEffect(EnchantmentEffectComponentTypes.ATTRIBUTES, - new AttributeEnchantmentEffect(Identifier.ofVanilla("enchantment.stalwart"), - EntityAttributes.ARMOR, EnchantmentLevelBasedValue.linear(1F), - EntityAttributeModifier.Operation.ADD_VALUE))); - - register(registry, VANTAGE, Enchantment.builder( + Enchantment.dynamicCost(10, 8), + Enchantment.dynamicCost(25, 8), 3, + EquipmentSlotGroup.ARMOR)) + .exclusiveWith(registryEntryLookup2.getOrThrow(EnchantmentTags.ARMOR_EXCLUSIVE)) + .withEffect(EnchantmentEffectComponents.ATTRIBUTES, + new EnchantmentAttributeEffect(ResourceLocation.withDefaultNamespace("enchantment.stalwart"), + Attributes.ARMOR, LevelBasedValue.perLevel(1F), + AttributeModifier.Operation.ADD_VALUE))); + + register(registry, VANTAGE, Enchantment.enchantment( Enchantment.definition(registryEntryLookup3.getOrThrow(ItemTags.SWORD_ENCHANTABLE), 2, 1, - Enchantment.leveledCost(10, 20), - Enchantment.leveledCost(40, 20), 4, - AttributeModifierSlot.MAINHAND)) - .addEffect(EnchantmentEffectComponentTypes.ATTRIBUTES, - new AttributeEnchantmentEffect(MiddleEarth.of("enchantment.vantage"), - EntityAttributes.ENTITY_INTERACTION_RANGE, new EnchantmentLevelBasedValue.Linear(0.5f, 0.5f), EntityAttributeModifier.Operation.ADD_VALUE))); + Enchantment.dynamicCost(10, 20), + Enchantment.dynamicCost(40, 20), 4, + EquipmentSlotGroup.MAINHAND)) + .withEffect(EnchantmentEffectComponents.ATTRIBUTES, + new EnchantmentAttributeEffect(MiddleEarth.of("enchantment.vantage"), + Attributes.ENTITY_INTERACTION_RANGE, new LevelBasedValue.Linear(0.5f, 0.5f), AttributeModifier.Operation.ADD_VALUE))); } - private static void register(Registerable registry, RegistryKey key, Enchantment.Builder builder) { - registry.register(key, builder.build(key.getValue())); + private static void register(BootstrapContext registry, ResourceKey key, Enchantment.Builder builder) { + registry.register(key, builder.build(key.location())); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntitiesME.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntitiesME.java index de5549f023..01f5beb54a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntitiesME.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntitiesME.java @@ -1,16 +1,17 @@ package net.sevenstars.middleearth.entity; -import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry; -import net.minecraft.entity.*; -import net.minecraft.entity.mob.HostileEntity; -import net.minecraft.item.Item; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.Heightmap; +import net.minecraft.core.registries.BuiltInRegistries; +import net.neoforged.neoforge.event.entity.EntityAttributeCreationEvent; +import net.sevenstars.api.registries.RegistrationBridge; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.MobCategory; +import net.minecraft.world.entity.SpawnPlacementType; +import net.minecraft.world.entity.SpawnPlacementTypes; +import net.minecraft.world.entity.animal.Animal; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.levelgen.Heightmap; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.fire_of_orthanc.FireOfOrthancEntity; import net.sevenstars.middleearth.datageneration.content.TranslationEntries; @@ -36,64 +37,67 @@ import net.sevenstars.middleearth.entity.spider.spawn.SpawnOfShelobEntity; import net.sevenstars.middleearth.item.ResourceItemsME; import net.sevenstars.middleearth.registries.RegistryAliasesME; +import net.neoforged.fml.ModList; +import net.neoforged.neoforge.event.entity.RegisterSpawnPlacementsEvent; import java.util.function.Supplier; public class EntitiesME { // Npc - public static final EntityType NPC = register("npc", EntityType.Builder.create(NpcEntity::new, SpawnGroup.MONSTER).dimensions(0.8f, 1.8f)); + public static final EntityType NPC = register("npc", EntityType.Builder.of(NpcEntity::new, MobCategory.MONSTER).sized(0.8f, 1.8f)); // Mounts - public static final EntityType WARG = register("warg", EntityType.Builder.create(WargEntity::new, SpawnGroup.CREATURE).dimensions(1.4f, 1.4f)); - public static final EntityType BROADHOOF_GOAT = register("broadhoof_goat", EntityType.Builder.create(BroadhoofGoatEntity::new, SpawnGroup.CREATURE).dimensions(1.4f, 1.4f)); - public static final EntityType GREAT_HORN = register("great_horn", EntityType.Builder.create(GreatHornEntity::new, SpawnGroup.CREATURE).dimensions(1.3f, 1.8f)); + public static final EntityType WARG = register("warg", EntityType.Builder.of(WargEntity::new, MobCategory.CREATURE).sized(1.4f, 1.4f)); + public static final EntityType BROADHOOF_GOAT = register("broadhoof_goat", EntityType.Builder.of(BroadhoofGoatEntity::new, MobCategory.CREATURE).sized(1.4f, 1.4f)); + public static final EntityType GREAT_HORN = register("great_horn", EntityType.Builder.of(GreatHornEntity::new, MobCategory.CREATURE).sized(1.3f, 1.8f)); public static final EntityType REINFORCED_BARREL; // Spiders public static final EntityType SHELOBITE_LARVA = register("shelobite_larva", - EntityType.Builder.create(ShelobiteLarvaEntity::new, SpawnGroup.MONSTER).dimensions(0.4f, 0.3f)); + EntityType.Builder.of(ShelobiteLarvaEntity::new, MobCategory.MONSTER).sized(0.4f, 0.3f)); public static final EntityType SHELOBITE_SCUTTLER = register("shelobite_scuttler", - EntityType.Builder.create(ShelobiteScuttlerEntity::new, SpawnGroup.MONSTER).dimensions(1.15f, 0.9f)); + EntityType.Builder.of(ShelobiteScuttlerEntity::new, MobCategory.MONSTER).sized(1.15f, 0.9f)); public static final EntityType SPAWN_OF_SHELOB = register("spawn_of_shelob", - EntityType.Builder.create(SpawnOfShelobEntity::new, SpawnGroup.MONSTER).dimensions(1.75f, 1.4f)); + EntityType.Builder.of(SpawnOfShelobEntity::new, MobCategory.MONSTER).sized(1.75f, 1.4f)); // Trolls public static final EntityType SNOW_TROLL = register("snow_troll", - EntityType.Builder.create(SnowTrollEntity::new, SpawnGroup.CREATURE).dimensions(2.2f, 2.5f)); - public static final EntityType CAVE_TROLL = register("cave_troll", EntityType.Builder.create(CaveTrollEntity::new, SpawnGroup.MONSTER).dimensions(2.2f, 3.5f) - .passengerAttachments(new Vec3d(0, 3.825, -0.65), new Vec3d(-0.8, 3.4, -1.2), new Vec3d(0.8, 3.4, -1.2))); + EntityType.Builder.of(SnowTrollEntity::new, MobCategory.MONSTER).sized(2.2f, 2.5f)); + public static final EntityType CAVE_TROLL = register("cave_troll", EntityType.Builder.of(CaveTrollEntity::new, MobCategory.MONSTER).sized(2.2f, 3.5f) + .passengerAttachments(new Vec3(0, 3.825, -0.65), new Vec3(-0.8, 3.4, -1.2), new Vec3(0.8, 3.4, -1.2))); public static final EntityType STONE_TROLL = register("stone_troll", - EntityType.Builder.create(StoneTrollEntity::new, SpawnGroup.CREATURE).dimensions(1.4f, 3.4f)); + EntityType.Builder.of(StoneTrollEntity::new, MobCategory.MONSTER).sized(1.4f, 3.4f)); public static final EntityType PETRIFIED_TROLL = register("petrified_troll", - EntityType.Builder.create(PetrifiedTrollEntity::new, SpawnGroup.CREATURE).dimensions(1.4f, 3.4f)); + EntityType.Builder.of(PetrifiedTrollEntity::new, MobCategory.CREATURE).sized(1.4f, 3.4f)); ///* Weapons */// - public static final EntityType FIRE_OF_ORTHANC = registerEntity("fire_of_orthanc", FireOfOrthancEntity::new, SpawnGroup.MISC, 0.65F, 0.65F); - public static final EntityType PEBBLE = registerEntity("pebble", PebbleEntity::new, SpawnGroup.MISC, 0.25F, 0.25F); - public static final EntityType PINECONE = registerEntity("pinecone", PineconeEntity::new, SpawnGroup.MISC, 0.25F, 0.25F); - public static final EntityType LIT_PINECONE = registerEntity("lit_pinecone", LitPineconeEntity::new, SpawnGroup.MISC, 0.25F, 0.25F); - public static final EntityType BOULDER = registerEntity("boulder", BoulderEntity::new, SpawnGroup.MISC, 1f, 1f); - public static final EntityType WEB = registerEntity("web", WebbedEntity::new, SpawnGroup.MISC, 0.5F, 0.5F); + public static final EntityType FIRE_OF_ORTHANC = registerEntity("fire_of_orthanc", FireOfOrthancEntity::new, MobCategory.MISC, 0.65F, 0.65F); + public static final EntityType PEBBLE = registerEntity("pebble", PebbleEntity::new, MobCategory.MISC, 0.25F, 0.25F); + public static final EntityType PINECONE = registerEntity("pinecone", PineconeEntity::new, MobCategory.MISC, 0.25F, 0.25F); + public static final EntityType LIT_PINECONE = registerEntity("lit_pinecone", LitPineconeEntity::new, MobCategory.MISC, 0.25F, 0.25F); + public static final EntityType BOULDER = registerEntity("boulder", BoulderEntity::new, MobCategory.MISC, 1f, 1f); + public static final EntityType WEB = registerEntity("web", WebbedEntity::new, MobCategory.MISC, 0.5F, 0.5F); /// * Projectiles */// - public static final EntityType SMOKE_RING_PROJECTILE = registerEntity("smoke_ring_projectile", SmokeRingProjectileEntity::new, SpawnGroup.MISC, 0.5F, 0.5F); + public static final EntityType SMOKE_RING_PROJECTILE = registerEntity("smoke_ring_projectile", SmokeRingProjectileEntity::new, MobCategory.MISC, 0.5F, 0.5F); - public static final EntityType SPEAR = registerEntity("spear", SpearEntity::new, SpawnGroup.MISC, 1f, 1f); + public static final EntityType SPEAR = registerEntity("spear", SpearEntity::new, MobCategory.MISC, 1f, 1f); // Seat - public static final EntityType SEAT_ENTITY = register("seat_entity", EntityType.Builder.create(SeatEntity::new, SpawnGroup.MISC).dimensions(0.1F, 0.1F)); + public static final EntityType SEAT_ENTITY = register("seat_entity", EntityType.Builder.of(SeatEntity::new, MobCategory.MISC).sized(0.1F, 0.1F)); - public static EntityType registerEntity(String name, EntityType.EntityFactory entity, SpawnGroup spawnGroup, + public static EntityType registerEntity(String name, EntityType.EntityFactory entity, MobCategory spawnGroup, float width, float height) { - return Registry.register(Registries.ENTITY_TYPE, MiddleEarth.of(name), EntityType.Builder.create(entity, spawnGroup).dimensions(width, height).build(keyOf("name"))); + return register(name, EntityType.Builder.of(entity, spawnGroup).sized(width, height)); } - private static EntityType register(RegistryKey> key, EntityType.Builder type) { - EntityType entityType = Registry.register(Registries.ENTITY_TYPE, key, type.build(key)); + private static EntityType register(String id, EntityType.Builder type) { + EntityType entityType = RegistrationBridge.register( + BuiltInRegistries.ENTITY_TYPE, MiddleEarth.of(id), type.build(id)); TranslationEntries.entityEntries.add(entityType); - RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(Registries.ENTITY_TYPE, entityType.getUntranslatedName())); + RegistryAliasesME.aliases.add(new RegistryAliasesME.Alias(BuiltInRegistries.ENTITY_TYPE, id)); return entityType; } @@ -101,56 +105,70 @@ private static EntityType.EntityFactory getBoatFactory(Supplier new BarrelEntity(type, world, itemSupplier); } - private static RegistryKey> keyOf(String id) { - return RegistryKey.of(RegistryKeys.ENTITY_TYPE, Identifier.of(MiddleEarth.MOD_ID, id)); - } - - private static EntityType register(String id, EntityType.Builder type) { - return register(keyOf(id), type); - } - - public static void registerModEntities() { MiddleEarth.LOGGER.logDebugMsg("Registering Mod Entities for " + MiddleEarth.MOD_ID); - - FabricDefaultAttributeRegistry.register(STONE_TROLL, StoneTrollEntity.setAttributes()); - FabricDefaultAttributeRegistry.register(PETRIFIED_TROLL, PetrifiedTrollEntity.setAttributes()); - FabricDefaultAttributeRegistry.register(SNOW_TROLL, SnowTrollEntity.setAttributes()); - FabricDefaultAttributeRegistry.register(CAVE_TROLL, CaveTrollEntity.setAttributes()); - - FabricDefaultAttributeRegistry.register(BROADHOOF_GOAT, BroadhoofGoatEntity.setAttributes()); - FabricDefaultAttributeRegistry.register(GREAT_HORN, GreatHornEntity.setAttributes()); - FabricDefaultAttributeRegistry.register(WARG, WargEntity.setAttributes()); - - FabricDefaultAttributeRegistry.register(SHELOBITE_LARVA, ShelobiteLarvaEntity.setAttributes()); - FabricDefaultAttributeRegistry.register(SHELOBITE_SCUTTLER, ShelobiteScuttlerEntity.setAttributes()); - FabricDefaultAttributeRegistry.register(SPAWN_OF_SHELOB, SpawnOfShelobEntity.setAttributes()); - - FabricDefaultAttributeRegistry.register(STONE_TROLL, StoneTrollEntity.setAttributes()); - FabricDefaultAttributeRegistry.register(PETRIFIED_TROLL, PetrifiedTrollEntity.setAttributes()); - - FabricDefaultAttributeRegistry.register(SNOW_TROLL, SnowTrollEntity.setAttributes()); - - FabricDefaultAttributeRegistry.register(NPC, NpcEntity.setAttributes()); - registerSpawnRestrictions(); } - private static void registerSpawnRestrictions(){ - SpawnLocation onGroundLocation = SpawnLocationTypes.ON_GROUND; - Heightmap.Type heightmapType = Heightmap.Type.MOTION_BLOCKING_NO_LEAVES; + public static void registerAttributes(EntityAttributeCreationEvent event) { + event.put(STONE_TROLL, StoneTrollEntity.setAttributes().build()); + event.put(PETRIFIED_TROLL, PetrifiedTrollEntity.setAttributes().build()); + event.put(SNOW_TROLL, SnowTrollEntity.setAttributes().build()); + event.put(CAVE_TROLL, CaveTrollEntity.setAttributes().build()); + event.put(BROADHOOF_GOAT, BroadhoofGoatEntity.setAttributes().build()); + event.put(GREAT_HORN, GreatHornEntity.setAttributes().build()); + event.put(WARG, WargEntity.setAttributes().build()); + event.put(SHELOBITE_LARVA, ShelobiteLarvaEntity.setAttributes().build()); + event.put(SHELOBITE_SCUTTLER, ShelobiteScuttlerEntity.setAttributes().build()); + event.put(SPAWN_OF_SHELOB, SpawnOfShelobEntity.setAttributes().build()); + event.put(NPC, NpcEntity.setAttributes().build()); + } - SpawnRestriction.register(SHELOBITE_LARVA, onGroundLocation, heightmapType, ShelobiteLarvaEntity::canSpawn); - SpawnRestriction.register(SHELOBITE_SCUTTLER, onGroundLocation, heightmapType, ShelobiteScuttlerEntity::canSpawn); - SpawnRestriction.register(SPAWN_OF_SHELOB, onGroundLocation, heightmapType, SpawnOfShelobEntity::canSpawn); + public static void registerSpawnPlacements(RegisterSpawnPlacementsEvent event) { + SpawnPlacementType onGround = SpawnPlacementTypes.ON_GROUND; + Heightmap.Types heightmap = Heightmap.Types.MOTION_BLOCKING_NO_LEAVES; + event.register(WARG, onGround, heightmap, Animal::checkAnimalSpawnRules, + RegisterSpawnPlacementsEvent.Operation.REPLACE); + event.register(BROADHOOF_GOAT, onGround, heightmap, Animal::checkAnimalSpawnRules, + RegisterSpawnPlacementsEvent.Operation.REPLACE); + event.register(GREAT_HORN, onGround, heightmap, GreatHornEntity::canSpawn, + RegisterSpawnPlacementsEvent.Operation.REPLACE); + event.register(STONE_TROLL, onGround, heightmap, StoneTrollEntity::canSpawn, + RegisterSpawnPlacementsEvent.Operation.REPLACE); + event.register(SHELOBITE_LARVA, onGround, heightmap, ShelobiteLarvaEntity::canSpawn, + RegisterSpawnPlacementsEvent.Operation.REPLACE); + event.register(SHELOBITE_SCUTTLER, onGround, heightmap, ShelobiteScuttlerEntity::canSpawn, + RegisterSpawnPlacementsEvent.Operation.REPLACE); + event.register(SPAWN_OF_SHELOB, onGround, heightmap, SpawnOfShelobEntity::canSpawn, + RegisterSpawnPlacementsEvent.Operation.REPLACE); + event.register(CAVE_TROLL, onGround, heightmap, CaveTrollEntity::canSpawn, + RegisterSpawnPlacementsEvent.Operation.REPLACE); + event.register(NPC, onGround, heightmap, NpcEntity::canSpawn, + RegisterSpawnPlacementsEvent.Operation.REPLACE); + + if (shouldRegisterVanillaCamelSpawnPlacement()) { + event.register( + EntityType.CAMEL, + SpawnPlacementTypes.ON_GROUND, + Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, + Animal::checkAnimalSpawnRules, + RegisterSpawnPlacementsEvent.Operation.REPLACE + ); + } else { + MiddleEarth.LOGGER.logDebugMsg( + "Skipping vanilla camel spawn placement because a compatibility provider is loaded." + ); + } + } - SpawnRestriction.register(CAVE_TROLL, onGroundLocation, heightmapType, CaveTrollEntity::canSpawn); - SpawnRestriction.register(NPC, onGroundLocation, heightmapType, NpcEntity::canSpawn); + private static boolean shouldRegisterVanillaCamelSpawnPlacement() { + return !ModList.get().isLoaded("vanillabackport") + && !ModList.get().isLoaded("platform"); } static { - REINFORCED_BARREL = register("reinforced_barrel", EntityType.Builder.create(getBoatFactory(() -> { + REINFORCED_BARREL = register("reinforced_barrel", EntityType.Builder.of(getBoatFactory(() -> { return ResourceItemsME.REINFORCED_BARREL; - }), SpawnGroup.MISC).dropsNothing().dimensions(1.2F, 1.2F).eyeHeight(0.625F).maxTrackingRange(10)); + }), MobCategory.MISC).sized(1.2F, 1.2F).eyeHeight(0.625F).clientTrackingRange(10)); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntityAttributesME.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntityAttributesME.java index 665c678b9e..806d93a918 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntityAttributesME.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntityAttributesME.java @@ -1,24 +1,24 @@ package net.sevenstars.middleearth.entity; -import net.minecraft.entity.attribute.ClampedEntityAttribute; -import net.minecraft.entity.attribute.EntityAttribute; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.util.Identifier; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.ai.attributes.RangedAttribute; import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.api.registries.RegistrationBridge; public class EntityAttributesME { - public static final RegistryEntry POWDERED_SNOW_IMMUNITY; - public static final RegistryEntry DELVERS_FEAR_STRENGTH; - public static final RegistryEntry CLIMBING_STRENGTH; - public static final RegistryEntry DETECTION_RANGE; - public static final RegistryEntry WIDTH_SCALE; + public static final Holder POWDERED_SNOW_IMMUNITY; + public static final Holder DELVERS_FEAR_STRENGTH; + public static final Holder CLIMBING_STRENGTH; + public static final Holder DETECTION_RANGE; + public static final Holder WIDTH_SCALE; - private static RegistryEntry register(String name, double defaultValue, double minValue , double MaxValue, boolean tracked) { - Identifier id = MiddleEarth.of(name); - EntityAttribute attribute = new ClampedEntityAttribute(id.toTranslationKey(), defaultValue, minValue, MaxValue).setTracked(tracked); - return Registry.registerReference(Registries.ATTRIBUTE, id, attribute); + private static Holder register(String name, double defaultValue, double minValue , double MaxValue, boolean tracked) { + ResourceLocation id = MiddleEarth.of(name); + Attribute attribute = new RangedAttribute(id.toLanguageKey(), defaultValue, minValue, MaxValue).setSyncable(tracked); + return RegistrationBridge.registerForHolder(BuiltInRegistries.ATTRIBUTE, id, attribute); } public static void register() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntityModelLayersME.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntityModelLayersME.java index dbfedd86d1..ff1dd68c6c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntityModelLayersME.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntityModelLayersME.java @@ -1,15 +1,10 @@ package net.sevenstars.middleearth.entity; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry; -import net.minecraft.client.model.Dilation; -import net.minecraft.client.model.TexturedModelData; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.render.block.entity.SkullBlockEntityModel; -import net.minecraft.client.render.block.entity.SkullBlockEntityRenderer; -import net.minecraft.client.render.entity.model.EntityModelLayer; -import net.minecraft.util.Identifier; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.neoforge.client.event.EntityRenderersEvent; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.bellows.BellowsBlockEntityRenderer; import net.sevenstars.middleearth.block.special.coffers.*; @@ -39,74 +34,81 @@ import net.sevenstars.middleearth.entity.spider.scuttler.ShelobiteScuttlerModel; import net.sevenstars.middleearth.entity.spider.spawn.SpawnOfShelobModel; -@Environment(value= EnvType.CLIENT) +import java.util.LinkedHashMap; +import java.util.Map; + public final class EntityModelLayersME { private static final String MAIN = "main"; + private static final Map LAYERS = new LinkedHashMap<>(); // region NPC - public static final EntityModelLayer NPC = registerEntityModelLayer("npc", NpcEntityModel.getTexturedModelData(Dilation.NONE)); - public static final EntityModelLayer NPC_ENTITY_HAIR = registerEntityModelLayer("npc_entity_hair", HairModel.getTexturedModelData()); - public static final EntityModelLayer NPC_ENTITY_EAR = registerEntityModelLayer("npc_entity_ear", EarModel.getTexturedModelData()); - public static final EntityModelLayer NPC_ENTITY_NOSE = registerEntityModelLayer("npc_entity_nose", NoseModel.getTexturedModelData()); - public static final EntityModelLayer NPC_ENTITY_FEET = registerEntityModelLayer("npc_entity_feet", FeetModel.getTexturedModelData()); + public static final ModelLayerLocation NPC = registerEntityModelLayer("npc", NpcEntityModel.getTexturedModelData(CubeDeformation.NONE)); + public static final ModelLayerLocation NPC_ENTITY_HAIR = registerEntityModelLayer("npc_entity_hair", HairModel.getTexturedModelData()); + public static final ModelLayerLocation NPC_ENTITY_EAR = registerEntityModelLayer("npc_entity_ear", EarModel.getTexturedModelData()); + public static final ModelLayerLocation NPC_ENTITY_NOSE = registerEntityModelLayer("npc_entity_nose", NoseModel.getTexturedModelData()); + public static final ModelLayerLocation NPC_ENTITY_FEET = registerEntityModelLayer("npc_entity_feet", FeetModel.getTexturedModelData()); // endregion - public static final EntityModelLayer BROADHOOF_GOAT = EntityModelLayersME.registerEntityModelLayer("broadhoof_goat", BroadhoofGoatModel.getTexturedModelData()); - public static final EntityModelLayer BROADHOOF_GOAT_ARMOR = EntityModelLayersME.registerEntityModelLayer("broadhoof_goat_armor", BroadhoofGoatArmorModel.getTexturedModelData()); - public static final EntityModelLayer BROADHOOF_GOAT_SADDLE = EntityModelLayersME.registerEntityModelLayer("broadhoof_goat_saddle", BroadhoofGoatSaddleModel.getTexturedModelData()); - public static final EntityModelLayer GREAT_HORN = EntityModelLayersME.registerEntityModelLayer("great_horn", GreatHornModel.getTexturedModelData()); - public static final EntityModelLayer GREAT_HORN_BABY = EntityModelLayersME.registerEntityModelLayer("great_horn_baby", GreatHornModel.getTexturedModelData().transform(GreatHornModel.BABY_TRANSFORMER)); - public static final EntityModelLayer GREAT_HORN_SADDLE = EntityModelLayersME.registerEntityModelLayer("great_horn_saddle", GreatHornSaddleModel.getTexturedModelData()); - public static final EntityModelLayer GREAT_HORN_ARMOR = EntityModelLayersME.registerEntityModelLayer("great_horn_armor", GreatHornArmorModel.getTexturedModelData()); - public static final EntityModelLayer WARG = EntityModelLayersME.registerEntityModelLayer("warg", WargModel.getTexturedModelData()); - public static final EntityModelLayer WARG_ARMOR = EntityModelLayersME.registerEntityModelLayer("warg_armor", WargArmorModel.getTexturedModelData()); - public static final EntityModelLayer WARG_ARMOR_ADDONS_FRONT = EntityModelLayersME.registerEntityModelLayer("warg_armor_addons_front", WargArmorTopAddonsModel.getTexturedModelDataFront()); - public static final EntityModelLayer WARG_ARMOR_ADDONS_BACK = EntityModelLayersME.registerEntityModelLayer("warg_armor_addons_back", WargArmorTopAddonsModel.getTexturedModelDataBack()); - public static final EntityModelLayer WARG_ARMOR_ADDONS_SPINE = EntityModelLayersME.registerEntityModelLayer("warg_armor_addons_spine", WargArmorBaseAddonsModel.getTexturedModelDataSpine()); - public static final EntityModelLayer WARG_ARMOR_ADDONS_SIDE_SKULL = EntityModelLayersME.registerEntityModelLayer("warg_armor_addons_side_skull", WargArmorSideAddonsModel.getTexturedModelDataSideSkulls()); - public static final EntityModelLayer WARG_SADDLE = EntityModelLayersME.registerEntityModelLayer("warg_saddle", WargSaddleModel.getTexturedModelData()); - public static final EntityModelLayer SNOW_TROLL = EntityModelLayersME.registerEntityModelLayer("snow_troll", SnowTrollModel.getTexturedModelData()); - public static final EntityModelLayer CAVE_TROLL = EntityModelLayersME.registerEntityModelLayer("cave_troll", CaveTrollEntityModel.getTexturedModelData()); - public static final EntityModelLayer CAVE_TROLL_SADDLE = EntityModelLayersME.registerEntityModelLayer("cave_troll_sddle", CaveTrollSaddleModel.getTexturedModelData()); - public static final EntityModelLayer STONE_TROLL = EntityModelLayersME.registerEntityModelLayer("stone_troll", StoneTrollModel.getTexturedModelData()); - public static final EntityModelLayer PETRIFIED_TROLL = EntityModelLayersME.registerEntityModelLayer("petrified_troll", PetrifiedTrollModel.getTexturedModelData()); - public static final EntityModelLayer SHELOBITE_LARVA = EntityModelLayersME.registerEntityModelLayer("shelobite_larva", ShelobiteLarvaModel.getTexturedModelData()); - public static final EntityModelLayer SHELOBITE_SCUTTLER = EntityModelLayersME.registerEntityModelLayer("shelobite_scuttler", ShelobiteScuttlerModel.getTexturedModelData()); - public static final EntityModelLayer SPAWN_OF_SHELOB = EntityModelLayersME.registerEntityModelLayer("spawn_of_shelob", SpawnOfShelobModel.getTexturedModelData()); + public static final ModelLayerLocation BROADHOOF_GOAT = EntityModelLayersME.registerEntityModelLayer("broadhoof_goat", BroadhoofGoatModel.getTexturedModelData()); + public static final ModelLayerLocation BROADHOOF_GOAT_ARMOR = EntityModelLayersME.registerEntityModelLayer("broadhoof_goat_armor", BroadhoofGoatArmorModel.getTexturedModelData()); + public static final ModelLayerLocation BROADHOOF_GOAT_SADDLE = EntityModelLayersME.registerEntityModelLayer("broadhoof_goat_saddle", BroadhoofGoatSaddleModel.getTexturedModelData()); + public static final ModelLayerLocation GREAT_HORN = EntityModelLayersME.registerEntityModelLayer("great_horn", GreatHornModel.getTexturedModelData()); + public static final ModelLayerLocation GREAT_HORN_SADDLE = EntityModelLayersME.registerEntityModelLayer("great_horn_saddle", GreatHornSaddleModel.getTexturedModelData()); + public static final ModelLayerLocation GREAT_HORN_ARMOR = EntityModelLayersME.registerEntityModelLayer("great_horn_armor", GreatHornArmorModel.getTexturedModelData()); + public static final ModelLayerLocation WARG = EntityModelLayersME.registerEntityModelLayer("warg", WargModel.getTexturedModelData()); + public static final ModelLayerLocation WARG_ARMOR = EntityModelLayersME.registerEntityModelLayer("warg_armor", WargArmorModel.getTexturedModelData()); + public static final ModelLayerLocation WARG_ARMOR_ADDONS_FRONT = EntityModelLayersME.registerEntityModelLayer("warg_armor_addons_front", WargArmorTopAddonsModel.getTexturedModelDataFront()); + public static final ModelLayerLocation WARG_ARMOR_ADDONS_BACK = EntityModelLayersME.registerEntityModelLayer("warg_armor_addons_back", WargArmorTopAddonsModel.getTexturedModelDataBack()); + public static final ModelLayerLocation WARG_ARMOR_ADDONS_SPINE = EntityModelLayersME.registerEntityModelLayer("warg_armor_addons_spine", WargArmorBaseAddonsModel.getTexturedModelDataSpine()); + public static final ModelLayerLocation WARG_ARMOR_ADDONS_SIDE_SKULL = EntityModelLayersME.registerEntityModelLayer("warg_armor_addons_side_skull", WargArmorSideAddonsModel.getTexturedModelDataSideSkulls()); + public static final ModelLayerLocation WARG_SADDLE = EntityModelLayersME.registerEntityModelLayer("warg_saddle", WargSaddleModel.getTexturedModelData()); + public static final ModelLayerLocation SNOW_TROLL = EntityModelLayersME.registerEntityModelLayer("snow_troll", SnowTrollModel.getTexturedModelData()); + public static final ModelLayerLocation CAVE_TROLL = EntityModelLayersME.registerEntityModelLayer("cave_troll", CaveTrollEntityModel.getTexturedModelData()); + public static final ModelLayerLocation CAVE_TROLL_SADDLE = EntityModelLayersME.registerEntityModelLayer("cave_troll_sddle", CaveTrollSaddleModel.getTexturedModelData()); + public static final ModelLayerLocation STONE_TROLL = EntityModelLayersME.registerEntityModelLayer("stone_troll", StoneTrollModel.getTexturedModelData()); + public static final ModelLayerLocation PETRIFIED_TROLL = EntityModelLayersME.registerEntityModelLayer("petrified_troll", PetrifiedTrollModel.getTexturedModelData()); + public static final ModelLayerLocation SHELOBITE_LARVA = EntityModelLayersME.registerEntityModelLayer("shelobite_larva", ShelobiteLarvaModel.getTexturedModelData()); + public static final ModelLayerLocation SHELOBITE_SCUTTLER = EntityModelLayersME.registerEntityModelLayer("shelobite_scuttler", ShelobiteScuttlerModel.getTexturedModelData()); + public static final ModelLayerLocation SPAWN_OF_SHELOB = EntityModelLayersME.registerEntityModelLayer("spawn_of_shelob", SpawnOfShelobModel.getTexturedModelData()); - public static final EntityModelLayer ENWEBBED = EntityModelLayersME.registerEntityModelLayer("enwebbed", EnwebbedModel.getTexturedModelData()); + public static final ModelLayerLocation ENWEBBED = EntityModelLayersME.registerEntityModelLayer("enwebbed", EnwebbedModel.getTexturedModelData()); // Blocks - public static final EntityModelLayer BELLOWS = EntityModelLayersME.registerEntityModelLayer("bellows", BellowsBlockEntityRenderer.getTexturedModelData()); - public static final EntityModelLayer LARCH_COFFER = EntityModelLayersME.registerEntityModelLayer("larch_coffer", LarchCofferEntityRenderer.getTexturedModelData()); - public static final EntityModelLayer PINE_COFFER = EntityModelLayersME.registerEntityModelLayer("pine_coffer", PineCofferEntityRenderer.getTexturedModelData()); - public static final EntityModelLayer SPRUCE_COFFER = EntityModelLayersME.registerEntityModelLayer("spruce_coffer", SpruceCofferEntityRenderer.getTexturedModelData()); - public static final EntityModelLayer FIR_COFFER = EntityModelLayersME.registerEntityModelLayer("fir_coffer", FirCofferEntityRenderer.getTexturedModelData()); - public static final EntityModelLayer BEECH_COFFER = EntityModelLayersME.registerEntityModelLayer("beech_coffer", BeechCofferEntityRenderer.getTexturedModelData()); - public static final EntityModelLayer CHESTNUT_COFFER = EntityModelLayersME.registerEntityModelLayer("chestnut_coffer", ChestnutCofferEntityRenderer.getTexturedModelData()); - public static final EntityModelLayer OAK_COFFER = EntityModelLayersME.registerEntityModelLayer("oak_coffer", OakCofferEntityRenderer.getTexturedModelData()); - public static final EntityModelLayer WILLOW_COFFER = EntityModelLayersME.registerEntityModelLayer("willow_coffer", WillowCofferEntityRenderer.getTexturedModelData()); - public static final EntityModelLayer REINFORCED_CHEST = EntityModelLayersME.registerEntityModelLayer("reinforced_chest", ReinforcedChestEntityRenderer.getTexturedModelData()); - public static final EntityModelLayer OLD_SKULL = EntityModelLayersME.registerEntityModelLayer("old_skull", OldSkullBlockEntityRenderer.getTexturedModelData()); + public static final ModelLayerLocation BELLOWS = EntityModelLayersME.registerEntityModelLayer("bellows", BellowsBlockEntityRenderer.getTexturedModelData()); + public static final ModelLayerLocation LARCH_COFFER = EntityModelLayersME.registerEntityModelLayer("larch_coffer", LarchCofferEntityRenderer.getTexturedModelData()); + public static final ModelLayerLocation PINE_COFFER = EntityModelLayersME.registerEntityModelLayer("pine_coffer", PineCofferEntityRenderer.getTexturedModelData()); + public static final ModelLayerLocation SPRUCE_COFFER = EntityModelLayersME.registerEntityModelLayer("spruce_coffer", SpruceCofferEntityRenderer.getTexturedModelData()); + public static final ModelLayerLocation FIR_COFFER = EntityModelLayersME.registerEntityModelLayer("fir_coffer", FirCofferEntityRenderer.getTexturedModelData()); + public static final ModelLayerLocation BEECH_COFFER = EntityModelLayersME.registerEntityModelLayer("beech_coffer", BeechCofferEntityRenderer.getTexturedModelData()); + public static final ModelLayerLocation CHESTNUT_COFFER = EntityModelLayersME.registerEntityModelLayer("chestnut_coffer", ChestnutCofferEntityRenderer.getTexturedModelData()); + public static final ModelLayerLocation OAK_COFFER = EntityModelLayersME.registerEntityModelLayer("oak_coffer", OakCofferEntityRenderer.getTexturedModelData()); + public static final ModelLayerLocation WILLOW_COFFER = EntityModelLayersME.registerEntityModelLayer("willow_coffer", WillowCofferEntityRenderer.getTexturedModelData()); + public static final ModelLayerLocation REINFORCED_CHEST = EntityModelLayersME.registerEntityModelLayer("reinforced_chest", ReinforcedChestEntityRenderer.getTexturedModelData()); + public static final ModelLayerLocation OLD_SKULL = EntityModelLayersME.registerEntityModelLayer("old_skull", OldSkullBlockEntityRenderer.getTexturedModelData()); - public static final EntityModelLayer REINFORCED_BARREL = EntityModelLayersME.registerEntityModelLayer("reinforced_barrel", BarrelEntityModel.getTexturedModelData()); - public static final EntityModelLayer REINFORCED_BARREL_WATER_MASK = EntityModelLayersME.registerEntityModelLayer("reinforced_barrel_water_mask", BarrelEntityModel.getBaseTexturedModelData()); + public static final ModelLayerLocation REINFORCED_BARREL = EntityModelLayersME.registerEntityModelLayer("reinforced_barrel", BarrelEntityModel.getTexturedModelData()); + public static final ModelLayerLocation REINFORCED_BARREL_WATER_MASK = EntityModelLayersME.registerEntityModelLayer("reinforced_barrel_water_mask", BarrelEntityModel.getBaseTexturedModelData()); /** * The modelData is used to know the UV map to use for the 3D model * **/ - private static EntityModelLayer registerEntityModelLayer(String registryName, TexturedModelData modelData) { - EntityModelLayer entityModelLayer = new EntityModelLayer(Identifier.of(MiddleEarth.MOD_ID, registryName), MAIN); - EntityModelLayerRegistry.registerModelLayer(entityModelLayer, () -> modelData); + private static ModelLayerLocation registerEntityModelLayer(String registryName, LayerDefinition modelData) { + ModelLayerLocation entityModelLayer = new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, registryName), MAIN); + LAYERS.put(entityModelLayer, modelData); return entityModelLayer; } /** * The modelData is used to know the UV map to use for the 3D model * **/ - private static EntityModelLayer registerEntityModelLayer(String id, String layer, TexturedModelData modelData) { - EntityModelLayer entityModelLayer = new EntityModelLayer(Identifier.of(MiddleEarth.MOD_ID, id), layer); - EntityModelLayerRegistry.registerModelLayer(entityModelLayer, () -> modelData); + private static ModelLayerLocation registerEntityModelLayer(String id, String layer, LayerDefinition modelData) { + ModelLayerLocation entityModelLayer = new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, id), layer); + LAYERS.put(entityModelLayer, modelData); return entityModelLayer; } + + public static void registerLayerDefinitions(EntityRenderersEvent.RegisterLayerDefinitions event) { + LAYERS.forEach((location, definition) -> + event.registerLayerDefinition(location, () -> definition)); + } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntityModelsME.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntityModelsME.java index ccddd45541..d4031899a6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntityModelsME.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntityModelsME.java @@ -1,9 +1,9 @@ package net.sevenstars.middleearth.entity; import com.google.common.collect.ImmutableMap; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.entity.model.BipedEntityModel; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.LayerDefinition; import net.sevenstars.middleearth.block.special.bellows.BellowsBlockEntityRenderer; import net.sevenstars.middleearth.block.special.coffers.*; import net.sevenstars.middleearth.block.special.reinforcedChest.ReinforcedChestEntityRenderer; @@ -18,19 +18,14 @@ import net.sevenstars.middleearth.entity.spider.EnwebbedModel; import net.sevenstars.middleearth.entity.spider.larva.ShelobiteLarvaModel; import net.sevenstars.middleearth.entity.spider.scuttler.ShelobiteScuttlerModel; -import net.minecraft.client.model.Dilation; -import net.minecraft.client.model.TexturedModelData; -import net.minecraft.client.render.entity.model.EntityModelLayer; import net.sevenstars.middleearth.entity.spider.spawn.SpawnOfShelobModel; import java.util.Map; - -@Environment(value= EnvType.CLIENT) public class EntityModelsME { - public static Map getModels() { - ImmutableMap.Builder builder = ImmutableMap.builder(); + public static Map getModels() { + ImmutableMap.Builder builder = ImmutableMap.builder(); - builder.put(EntityModelLayersME.NPC, NpcEntityModel.getTexturedModelData(Dilation.NONE)); + builder.put(EntityModelLayersME.NPC, NpcEntityModel.getTexturedModelData(CubeDeformation.NONE)); builder.put(EntityModelLayersME.NPC_ENTITY_HAIR, HairModel.getTexturedModelData()); builder.put(EntityModelLayersME.NPC_ENTITY_EAR, EarModel.getTexturedModelData()); builder.put(EntityModelLayersME.NPC_ENTITY_NOSE, NoseModel.getTexturedModelData()); @@ -44,6 +39,7 @@ public static Map getModels() { builder.put(EntityModelLayersME.ENWEBBED, EnwebbedModel.getTexturedModelData()); builder.put(EntityModelLayersME.REINFORCED_CHEST, ReinforcedChestEntityRenderer.getTexturedModelData()); + builder.put(EntityModelLayersME.OLD_SKULL, OldSkullBlockEntityRenderer.getTexturedModelData()); builder.put(EntityModelLayersME.BELLOWS, BellowsBlockEntityRenderer.getTexturedModelData()); builder.put(EntityModelLayersME.LARCH_COFFER, LarchCofferEntityRenderer.getTexturedModelData()); builder.put(EntityModelLayersME.PINE_COFFER, PineCofferEntityRenderer.getTexturedModelData()); @@ -53,11 +49,10 @@ public static Map getModels() { builder.put(EntityModelLayersME.CHESTNUT_COFFER, ChestnutCofferEntityRenderer.getTexturedModelData()); builder.put(EntityModelLayersME.OAK_COFFER, OakCofferEntityRenderer.getTexturedModelData()); builder.put(EntityModelLayersME.WILLOW_COFFER, WillowCofferEntityRenderer.getTexturedModelData()); - builder.put(EntityModelLayersME.OLD_SKULL, OldSkullBlockEntityRenderer.getTexturedModelData()); builder.put(EntityModelLayersME.REINFORCED_BARREL, BarrelEntityModel.getTexturedModelData()); builder.put(EntityModelLayersME.REINFORCED_BARREL_WATER_MASK, BarrelEntityModel.getBaseTexturedModelData()); - ImmutableMap immutableMap = builder.build(); + ImmutableMap immutableMap = builder.build(); return immutableMap; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntityTypeTagsME.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntityTypeTagsME.java index 7d54a46abe..24bd2f3d50 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntityTypeTagsME.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/EntityTypeTagsME.java @@ -1,15 +1,15 @@ package net.sevenstars.middleearth.entity; -import net.minecraft.entity.EntityType; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.util.Identifier; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.entity.EntityType; import net.sevenstars.middleearth.MiddleEarth; public class EntityTypeTagsME { public static TagKey> UNGOLIENI = of("ungolieni"); private static TagKey> of(String id) { - return TagKey.of(RegistryKeys.ENTITY_TYPE, Identifier.of(MiddleEarth.MOD_ID, id)); + return TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, id)); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/TrackedDataHandlerRegistryME.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/TrackedDataHandlerRegistryME.java index 59a9af3579..77b0d71014 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/TrackedDataHandlerRegistryME.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/TrackedDataHandlerRegistryME.java @@ -1,12 +1,13 @@ package net.sevenstars.middleearth.entity; -import net.fabricmc.fabric.api.object.builder.v1.entity.FabricTrackedDataRegistry; -import net.minecraft.entity.data.TrackedDataHandler; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.syncher.EntityDataSerializer; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.api.registries.RegistrationBridge; +import net.neoforged.neoforge.registries.NeoForgeRegistries; import net.sevenstars.middleearth.entity.beasts.great_horn.GreatHornVariant; import net.sevenstars.middleearth.entity.npcs.data.NpcData; import net.sevenstars.middleearth.entity.npcs.data.NpcInitializationData; @@ -14,18 +15,18 @@ import net.sevenstars.middleearth.entity.spider.SpiderVariant; public class TrackedDataHandlerRegistryME { - public static final TrackedDataHandler NPC_DATA; - public static final TrackedDataHandler NPC_INITIALIZATION_DATA; - public static final TrackedDataHandler NPC_TEXTURE_DATA; + public static final EntityDataSerializer NPC_DATA; + public static final EntityDataSerializer NPC_INITIALIZATION_DATA; + public static final EntityDataSerializer NPC_TEXTURE_DATA; - public static final TrackedDataHandler INITIALIZATION_TICK; - public static final TrackedDataHandler FACTION_ID; - public static final TrackedDataHandler NPC_DATA_ID; - public static final TrackedDataHandler CATEGORY; - public static final TrackedDataHandler STRUCTURE_MANAGER_HOST_POS; - public static final TrackedDataHandler> SPIDER_VARIANT; - public static final TrackedDataHandler> GREAT_HORN_VARIANT; + public static final EntityDataSerializer INITIALIZATION_TICK; + public static final EntityDataSerializer FACTION_ID; + public static final EntityDataSerializer NPC_DATA_ID; + public static final EntityDataSerializer CATEGORY; + public static final EntityDataSerializer STRUCTURE_MANAGER_HOST_POS; + public static final EntityDataSerializer> SPIDER_VARIANT; + public static final EntityDataSerializer> GREAT_HORN_VARIANT; public static void register() { of("npc_data", NPC_DATA); @@ -40,20 +41,21 @@ public static void register() { of("great_horn_variant", GREAT_HORN_VARIANT); } - private static void of(String name, TrackedDataHandler dataHandler) { - FabricTrackedDataRegistry.register(Identifier.of(MiddleEarth.MOD_ID, name), dataHandler); + private static void of(String name, EntityDataSerializer dataHandler) { + RegistrationBridge.register(NeoForgeRegistries.ENTITY_DATA_SERIALIZERS, + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, name), dataHandler); } static { - NPC_INITIALIZATION_DATA = TrackedDataHandler.create(NpcInitializationData.PACKET_CODEC); - NPC_DATA = TrackedDataHandler.create(NpcData.PACKET_CODEC); - INITIALIZATION_TICK = TrackedDataHandler.create(PacketCodecs.LONG); - FACTION_ID = TrackedDataHandler.create(PacketCodecs.STRING); - NPC_DATA_ID = TrackedDataHandler.create(PacketCodecs.STRING); - CATEGORY = TrackedDataHandler.create(PacketCodecs.STRING); - NPC_TEXTURE_DATA = TrackedDataHandler.create(NpcTextureData.PACKET_CODEC); - STRUCTURE_MANAGER_HOST_POS = TrackedDataHandler.create(BlockPos.PACKET_CODEC); - SPIDER_VARIANT = TrackedDataHandler.create(SpiderVariant.PACKET_CODEC); - GREAT_HORN_VARIANT = TrackedDataHandler.create(GreatHornVariant.PACKET_CODEC); + NPC_INITIALIZATION_DATA = EntityDataSerializer.forValueType(NpcInitializationData.PACKET_CODEC); + NPC_DATA = EntityDataSerializer.forValueType(NpcData.PACKET_CODEC); + INITIALIZATION_TICK = EntityDataSerializer.forValueType(ByteBufCodecs.VAR_LONG); + FACTION_ID = EntityDataSerializer.forValueType(ByteBufCodecs.STRING_UTF8); + NPC_DATA_ID = EntityDataSerializer.forValueType(ByteBufCodecs.STRING_UTF8); + CATEGORY = EntityDataSerializer.forValueType(ByteBufCodecs.STRING_UTF8); + NPC_TEXTURE_DATA = EntityDataSerializer.forValueType(NpcTextureData.PACKET_CODEC); + STRUCTURE_MANAGER_HOST_POS = EntityDataSerializer.forValueType(BlockPos.STREAM_CODEC); + SPIDER_VARIANT = EntityDataSerializer.forValueType(SpiderVariant.PACKET_CODEC); + GREAT_HORN_VARIANT = EntityDataSerializer.forValueType(GreatHornVariant.PACKET_CODEC); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/VariantHolderUtils.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/VariantHolderUtils.java new file mode 100644 index 0000000000..10e1a34785 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/VariantHolderUtils.java @@ -0,0 +1,45 @@ +package net.sevenstars.middleearth.entity; + +import net.minecraft.core.Holder; +import net.minecraft.core.Registry; +import net.minecraft.core.RegistryAccess; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; + +import java.util.Optional; + +public final class VariantHolderUtils { + private static final String VARIANT_KEY = "variant"; + + private VariantHolderUtils() {} + + public static Holder getDefaultOrAny(RegistryAccess registryAccess, ResourceKey defaultKey) { + Registry registry = registryAccess.registryOrThrow(defaultKey.registryKey()); + return registry.getHolder(defaultKey) + .map(Holder.class::cast) + .orElseGet(() -> registry.holders().findFirst() + .orElseThrow(() -> new IllegalStateException("Empty variant registry: " + defaultKey.registry()))); + } + + public static void writeVariant(CompoundTag tag, Holder variant) { + variant.unwrapKey().ifPresent(key -> tag.putString(VARIANT_KEY, key.location().toString())); + } + + public static Optional> readVariant( + CompoundTag tag, + RegistryAccess registryAccess, + ResourceKey> registryKey) { + if (!tag.contains(VARIANT_KEY, Tag.TAG_STRING)) { + return Optional.empty(); + } + ResourceLocation id = ResourceLocation.tryParse(tag.getString(VARIANT_KEY)); + if (id == null) { + return Optional.empty(); + } + return registryAccess.registryOrThrow(registryKey) + .getHolder(ResourceKey.create(registryKey, id)) + .map(Holder.class::cast); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/ActivitiesME.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/ActivitiesME.java index 31a0a24f45..b4bae90d4b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/ActivitiesME.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/ActivitiesME.java @@ -1,16 +1,16 @@ package net.sevenstars.middleearth.entity.ai.brain; -import net.minecraft.entity.ai.brain.Activity; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.entity.schedule.Activity; import net.sevenstars.api.SevenStarsApi; import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.api.registries.RegistrationBridge; public class ActivitiesME { public static final Activity TAMED = register("tamed"); private static Activity register(String id) { - return Registry.register(Registries.ACTIVITY, id, new Activity(id)); + return RegistrationBridge.register(BuiltInRegistries.ACTIVITY, MiddleEarth.of(id), new Activity(id)); } public static void registerModActivities() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/MemoryModulesME.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/MemoryModulesME.java index 62e460cfaf..53e3537e7d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/MemoryModulesME.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/MemoryModulesME.java @@ -2,13 +2,13 @@ import com.google.common.annotations.VisibleForTesting; import com.mojang.serialization.Codec; -import net.minecraft.entity.ai.brain.Memory; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; +import net.minecraft.core.BlockPos; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.ai.memory.ExpirableValue; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.api.registries.RegistrationBridge; import java.util.Optional; @@ -22,23 +22,23 @@ public class MemoryModulesME { public static final MemoryModuleType SITTING = register("sitting", Codec.BOOL); public static final MemoryModuleType ASSIGNED_BED_POS = register("assigned_bed_pos", BlockPos.CODEC); public static final MemoryModuleType STRUCTURE_MANAGER_HOST_POS = register("structure_manager_host_pos", BlockPos.CODEC); - private final Optional>> codec; + private final Optional>> codec; @VisibleForTesting public MemoryModulesME(Optional> codec) { - this.codec = codec.map(Memory::createCodec); + this.codec = codec.map(ExpirableValue::codec); } - public Optional>> getCodec() { + public Optional>> getCodec() { return this.codec; } private static MemoryModuleType register(String id, Codec codec) { - return Registry.register(Registries.MEMORY_MODULE_TYPE, Identifier.of(MiddleEarth.MOD_ID, id), new MemoryModuleType<>(Optional.of(codec))); + return RegistrationBridge.register(BuiltInRegistries.MEMORY_MODULE_TYPE, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, id), new MemoryModuleType<>(Optional.of(codec))); } private static MemoryModuleType register(String id) { - return Registry.register(Registries.MEMORY_MODULE_TYPE, Identifier.of(MiddleEarth.MOD_ID, id), new MemoryModuleType<>(Optional.empty())); + return RegistrationBridge.register(BuiltInRegistries.MEMORY_MODULE_TYPE, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, id), new MemoryModuleType<>(Optional.empty())); } public static void registerModMemoryModules() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/SensorsME.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/SensorsME.java index 04dddf3523..0984eefd6d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/SensorsME.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/SensorsME.java @@ -1,13 +1,13 @@ package net.sevenstars.middleearth.entity.ai.brain; -import net.minecraft.entity.ai.brain.sensor.Sensor; -import net.minecraft.entity.ai.brain.sensor.SensorType; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.util.Identifier; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.ai.sensing.Sensor; +import net.minecraft.world.entity.ai.sensing.SensorType; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.ai.brain.sensor.CaveTrollAttackablesSensor; import net.sevenstars.middleearth.entity.ai.brain.sensor.NpcAttackablesSensor; +import net.sevenstars.api.registries.RegistrationBridge; import java.util.function.Supplier; @@ -16,7 +16,7 @@ public class SensorsME { public static final SensorType NPC_ATTACKABLES = register("npc_attackables", NpcAttackablesSensor::new); private static > SensorType register(String id, Supplier factory) { - return Registry.register(Registries.SENSOR_TYPE, Identifier.of(MiddleEarth.MOD_ID, id), new SensorType<>(factory)); + return RegistrationBridge.register(BuiltInRegistries.SENSOR_TYPE, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, id), new SensorType<>(factory)); } public static void registerModSensors() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/sensor/CaveTrollAttackablesSensor.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/sensor/CaveTrollAttackablesSensor.java index edb97d13c5..30e67d4e20 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/sensor/CaveTrollAttackablesSensor.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/sensor/CaveTrollAttackablesSensor.java @@ -1,23 +1,22 @@ package net.sevenstars.middleearth.entity.ai.brain.sensor; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.sensor.NearestVisibleLivingEntitySensor; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.sensing.NearestVisibleLivingEntitySensor; import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntity; public class CaveTrollAttackablesSensor extends NearestVisibleLivingEntitySensor { @Override - protected boolean matches(ServerWorld world, LivingEntity entity, LivingEntity target) { - return CaveTrollEntity.shouldTarget(target) && !((CaveTrollEntity)entity).isTame() && !isPassenger(entity, target); + protected boolean isMatchingEntity(LivingEntity entity, LivingEntity target) { + return CaveTrollEntity.shouldTarget(target) && !((CaveTrollEntity)entity).isTamed() && !isPassenger(entity, target); } private boolean isPassenger(LivingEntity troll, LivingEntity target) { - return ((CaveTrollEntity)troll).getPassengerList().contains(target); + return ((CaveTrollEntity)troll).getPassengers().contains(target); } @Override - protected MemoryModuleType getOutputMemoryModule() { + protected MemoryModuleType getMemory() { return MemoryModuleType.NEAREST_ATTACKABLE; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/sensor/NpcAttackablesSensor.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/sensor/NpcAttackablesSensor.java index 76c24d0120..19449f1f89 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/sensor/NpcAttackablesSensor.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/sensor/NpcAttackablesSensor.java @@ -1,19 +1,18 @@ package net.sevenstars.middleearth.entity.ai.brain.sensor; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.sensor.NearestVisibleLivingEntitySensor; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.sensing.NearestVisibleLivingEntitySensor; import net.sevenstars.middleearth.entity.npcs.NpcEntity; public class NpcAttackablesSensor extends NearestVisibleLivingEntitySensor { @Override - protected boolean matches(ServerWorld world, LivingEntity entity, LivingEntity target) { + protected boolean isMatchingEntity(LivingEntity entity, LivingEntity target) { return NpcEntity.shouldTarget((NpcEntity) entity, target); } @Override - protected MemoryModuleType getOutputMemoryModule() { + protected MemoryModuleType getMemory() { return MemoryModuleType.NEAREST_ATTACKABLE; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/BeastChargeTask.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/BeastChargeTask.java index 6cd37bcf05..389bf5079a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/BeastChargeTask.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/BeastChargeTask.java @@ -1,19 +1,19 @@ package net.sevenstars.middleearth.entity.ai.brain.task; import com.google.common.collect.ImmutableMap; -import net.minecraft.entity.ai.brain.MemoryModuleState; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.task.MultiTickTask; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.ai.behavior.Behavior; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.MemoryStatus; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; -public class BeastChargeTask extends MultiTickTask { +public class BeastChargeTask extends Behavior { private final int MAX_COOLDOWN; public BeastChargeTask(int runtime, int maxCooldown) { super( ImmutableMap.of( MemoryModuleType.ATTACK_TARGET, - MemoryModuleState.VALUE_PRESENT + MemoryStatus.VALUE_PRESENT ), runtime ); @@ -22,27 +22,27 @@ public BeastChargeTask(int runtime, int maxCooldown) { } @Override - protected boolean shouldRun(ServerWorld world, AbstractBeastEntity entity) { + protected boolean checkExtraStartConditions(ServerLevel world, AbstractBeastEntity entity) { return entity.getTarget() != null && entity.getChargeTimeout() == 0 && - entity.canSee(entity.getTarget()) && + entity.hasLineOfSight(entity.getTarget()) && entity.canCharge() && - entity.squaredDistanceTo(entity.getTarget()) > 20; + entity.distanceToSqr(entity.getTarget()) > 20; } @Override - protected boolean shouldKeepRunning(ServerWorld world, AbstractBeastEntity entity, long time) { + protected boolean canStillUse(ServerLevel world, AbstractBeastEntity entity, long time) { return entity.isCharging(); } @Override - protected void run(ServerWorld world, AbstractBeastEntity entity, long time) { + protected void start(ServerLevel world, AbstractBeastEntity entity, long time) { entity.setCharging(true); entity.setChargeTimeout(MAX_COOLDOWN); } @Override - protected void finishRunning(ServerWorld world, AbstractBeastEntity entity, long time) { + protected void stop(ServerLevel world, AbstractBeastEntity entity, long time) { entity.setCharging(false); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollDigForFoodTask.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollDigForFoodTask.java index 5ed1a0a42d..1450f36b74 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollDigForFoodTask.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollDigForFoodTask.java @@ -1,67 +1,56 @@ package net.sevenstars.middleearth.entity.ai.brain.task; import com.google.common.collect.ImmutableMap; -import net.fabricmc.fabric.impl.loot.FabricLootTable; -import net.fabricmc.fabric.mixin.loot.LootTableAccessor; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.ai.brain.MemoryModuleState; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.task.MultiTickTask; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.loot.LootPool; -import net.minecraft.loot.LootTable; -import net.minecraft.loot.LootTables; -import net.minecraft.loot.entry.LootPoolEntry; -import net.minecraft.loot.entry.LootTableEntry; -import net.minecraft.loot.provider.number.LootNumberProvider; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.collection.Pool; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.ai.behavior.Behavior; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.MemoryStatus; +import net.minecraft.world.item.ItemStack; import net.sevenstars.middleearth.entity.ai.brain.MemoryModulesME; import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntity; import net.sevenstars.middleearth.item.WeaponItemsME; import java.util.List; -public class CaveTrollDigForFoodTask extends MultiTickTask { +public class CaveTrollDigForFoodTask extends Behavior { public CaveTrollDigForFoodTask() { super( ImmutableMap.of( MemoryModuleType.WALK_TARGET, - MemoryModuleState.VALUE_ABSENT, + MemoryStatus.VALUE_ABSENT, MemoryModuleType.ATTACK_TARGET, - MemoryModuleState.VALUE_ABSENT, + MemoryStatus.VALUE_ABSENT, MemoryModulesME.DIG_FOR_FOOD_COOLDOWN, - MemoryModuleState.VALUE_ABSENT + MemoryStatus.VALUE_ABSENT ), 100 ); } @Override - protected void run(ServerWorld world, CaveTrollEntity entity, long time) { + protected void start(ServerLevel world, CaveTrollEntity entity, long time) { entity.setScavenging(true); - entity.getBrain().forget(MemoryModuleType.WALK_TARGET); + entity.getBrain().eraseMemory(MemoryModuleType.WALK_TARGET); } @Override - protected void finishRunning(ServerWorld world, CaveTrollEntity entity, long time) { + protected void stop(ServerLevel world, CaveTrollEntity entity, long time) { entity.setScavenging(false); - entity.getBrain().remember(MemoryModulesME.DIG_FOR_FOOD_COOLDOWN, 2400 + entity.getRandom().nextInt(1200)); - entity.getBrain().remember(MemoryModulesME.ACTION_TIMEOUT, 200); + entity.getBrain().setMemory(MemoryModulesME.DIG_FOR_FOOD_COOLDOWN, 2400 + entity.getRandom().nextInt(1200)); + entity.getBrain().setMemory(MemoryModulesME.ACTION_TIMEOUT, 200); - List items = entity.scavengeLootTable.generateLoot(entity.lootWorldContext); + List items = entity.scavengeLootTable.getRandomItems(entity.lootWorldContext); if(!items.isEmpty()) { ItemStack itemStack = items.getFirst(); - entity.equipStack(EquipmentSlot.MAINHAND, itemStack); + entity.setItemSlot(EquipmentSlot.MAINHAND, itemStack); } } @Override - protected boolean shouldKeepRunning(ServerWorld world, CaveTrollEntity entity, long time) { - return hasRequiredMemoryState(entity); + protected boolean canStillUse(ServerLevel world, CaveTrollEntity entity, long time) { + return hasRequiredMemories(entity); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollEatFoodTask.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollEatFoodTask.java index 2dc5ace10e..5c4679359d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollEatFoodTask.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollEatFoodTask.java @@ -1,76 +1,76 @@ package net.sevenstars.middleearth.entity.ai.brain.task; import com.google.common.collect.ImmutableMap; -import net.minecraft.entity.ai.brain.MemoryModuleState; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.task.MultiTickTask; -import net.minecraft.item.Item; -import net.minecraft.particle.ItemStackParticleEffect; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.Vec3d; +import net.minecraft.core.particles.ItemParticleOption; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.tags.TagKey; +import net.minecraft.world.entity.ai.behavior.Behavior; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.MemoryStatus; +import net.minecraft.world.item.Item; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.ai.brain.MemoryModulesME; import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntity; import java.util.Optional; -public class CaveTrollEatFoodTask extends MultiTickTask { +public class CaveTrollEatFoodTask extends Behavior { private long startTime; - public static TagKey TROLL_FOOD = TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "troll_food")); + public static TagKey TROLL_FOOD = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "troll_food")); public CaveTrollEatFoodTask() { super( ImmutableMap.of( MemoryModuleType.WALK_TARGET, - MemoryModuleState.VALUE_ABSENT, + MemoryStatus.VALUE_ABSENT, MemoryModuleType.ATTACK_TARGET, - MemoryModuleState.VALUE_ABSENT, + MemoryStatus.VALUE_ABSENT, MemoryModulesME.FOOD_EATEN_COUNT, - MemoryModuleState.REGISTERED + MemoryStatus.REGISTERED ), 200 ); } @Override - protected boolean shouldRun(ServerWorld world, CaveTrollEntity entity) { - return !entity.getMainHandStack().isEmpty() && entity.getMainHandStack().isIn(TROLL_FOOD); + protected boolean checkExtraStartConditions(ServerLevel world, CaveTrollEntity entity) { + return !entity.getMainHandItem().isEmpty() && entity.getMainHandItem().is(TROLL_FOOD); } @Override - protected boolean shouldKeepRunning(ServerWorld world, CaveTrollEntity entity, long time) { - return hasRequiredMemoryState(entity) && !entity.getMainHandStack().isEmpty(); + protected boolean canStillUse(ServerLevel world, CaveTrollEntity entity, long time) { + return hasRequiredMemories(entity) && !entity.getMainHandItem().isEmpty(); } @Override - protected void run(ServerWorld world, CaveTrollEntity entity, long time) { + protected void start(ServerLevel world, CaveTrollEntity entity, long time) { entity.setSitting(true); this.startTime = time; } @Override - protected void keepRunning(ServerWorld world, CaveTrollEntity entity, long time) { - if((time - startTime) > 60 && !entity.getMainHandStack().isEmpty()) { - ItemStackParticleEffect particles = new ItemStackParticleEffect(ParticleTypes.ITEM, entity.getMainHandStack()); - Vec3d position = new Vec3d(entity.getX() - Math.sin(Math.toRadians(entity.getBodyYaw())), entity.getEyeY(), entity.getZ() + Math.cos(Math.toRadians(entity.getBodyYaw()))); - world.spawnParticles(particles, position.getX(), position.getY() - 1.0, position.getZ(),7, 0.0, 0.0, 0.0, 0.1); + protected void tick(ServerLevel world, CaveTrollEntity entity, long time) { + if((time - startTime) > 60 && !entity.getMainHandItem().isEmpty()) { + ItemParticleOption particles = new ItemParticleOption(ParticleTypes.ITEM, entity.getMainHandItem()); + Vec3 position = new Vec3(entity.getX() - Math.sin(Math.toRadians(entity.getVisualRotationYInDegrees())), entity.getEyeY(), entity.getZ() + Math.cos(Math.toRadians(entity.getVisualRotationYInDegrees()))); + world.sendParticles(particles, position.x(), position.y() - 1.0, position.z(),7, 0.0, 0.0, 0.0, 0.1); } } @Override - protected void finishRunning(ServerWorld world, CaveTrollEntity entity, long time) { - Optional foodCount = entity.getBrain().getOptionalRegisteredMemory(MemoryModulesME.FOOD_EATEN_COUNT); + protected void stop(ServerLevel world, CaveTrollEntity entity, long time) { + Optional foodCount = entity.getBrain().getMemory(MemoryModulesME.FOOD_EATEN_COUNT); foodCount.ifPresentOrElse( - count -> entity.getBrain().remember(MemoryModulesME.FOOD_EATEN_COUNT, count + 1), // If present - () -> entity.getBrain().remember(MemoryModulesME.FOOD_EATEN_COUNT, 1)); // If absent + count -> entity.getBrain().setMemory(MemoryModulesME.FOOD_EATEN_COUNT, count + 1), // If present + () -> entity.getBrain().setMemory(MemoryModulesME.FOOD_EATEN_COUNT, 1)); // If absent - entity.getBrain().remember(MemoryModulesME.ACTION_TIMEOUT, 200); + entity.getBrain().setMemory(MemoryModulesME.ACTION_TIMEOUT, 200); entity.setSitting(false); - entity.getMainHandStack().decrement(1); + entity.getMainHandItem().shrink(1); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollRoarTask.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollRoarTask.java index 8aa07f4c7c..874b2db4ef 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollRoarTask.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollRoarTask.java @@ -1,71 +1,70 @@ package net.sevenstars.middleearth.entity.ai.brain.task; import com.google.common.collect.ImmutableMap; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.brain.MemoryModuleState; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.task.MultiTickTask; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundEvents; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.behavior.Behavior; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.MemoryStatus; import net.sevenstars.middleearth.entity.ai.brain.MemoryModulesME; import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntity; import java.util.List; -public class CaveTrollRoarTask extends MultiTickTask { +public class CaveTrollRoarTask extends Behavior { long startTime; public CaveTrollRoarTask() { super( ImmutableMap.of( MemoryModuleType.ATTACK_TARGET, - MemoryModuleState.VALUE_PRESENT, + MemoryStatus.VALUE_PRESENT, MemoryModulesME.ROAR_COOLDOWN, - MemoryModuleState.VALUE_ABSENT + MemoryStatus.VALUE_ABSENT ), 35 ); } @Override - protected boolean shouldKeepRunning(ServerWorld world, CaveTrollEntity entity, long time) { + protected boolean canStillUse(ServerLevel world, CaveTrollEntity entity, long time) { return true; } @Override - protected void run(ServerWorld world, CaveTrollEntity troll, long time) { + protected void start(ServerLevel world, CaveTrollEntity troll, long time) { this.startTime = time; troll.setRoaring(true); - troll.getBrain().forget(MemoryModuleType.WALK_TARGET); + troll.getBrain().eraseMemory(MemoryModuleType.WALK_TARGET); - List entities = world.getOtherEntities(troll, troll.getBoundingBox().expand(15, 15, 15)); // Get nearby entities - for(Entity entity : entities) { // Run through all entities - if(troll.isValidTarget(entity)) { // Apply bad effects if entity is valid target - ((LivingEntity)entity).addStatusEffect(new StatusEffectInstance(StatusEffects.WEAKNESS, 200), troll); - ((LivingEntity)entity).addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 100), troll); - } + List entities = world.getEntitiesOfClass( + LivingEntity.class, + troll.getBoundingBox().inflate(15, 15, 15), + troll::isValidTarget + ); + for(LivingEntity entity : entities) { + entity.addEffect(new MobEffectInstance(MobEffects.WEAKNESS, 200), troll); + entity.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 100), troll); } } @Override - protected void keepRunning(ServerWorld world, CaveTrollEntity entity, long time) { + protected void tick(ServerLevel world, CaveTrollEntity entity, long time) { if(time - startTime == 10) { entity.playRoarSound(); } } @Override - protected boolean isTimeLimitExceeded(long time) { - return super.isTimeLimitExceeded(time); + protected boolean timedOut(long time) { + return super.timedOut(time); } @Override - protected void finishRunning(ServerWorld world, CaveTrollEntity entity, long time) { + protected void stop(ServerLevel world, CaveTrollEntity entity, long time) { entity.setRoaring(false); - entity.getBrain().remember(MemoryModulesME.ROAR_COOLDOWN, 600); + entity.getBrain().setMemory(MemoryModulesME.ROAR_COOLDOWN, 600); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollSleepTask.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollSleepTask.java index 3fe9af51af..a766fb38e4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollSleepTask.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollSleepTask.java @@ -1,53 +1,53 @@ package net.sevenstars.middleearth.entity.ai.brain.task; import com.google.common.collect.ImmutableMap; -import net.minecraft.entity.ai.brain.MemoryModuleState; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.task.MultiTickTask; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.ai.behavior.Behavior; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.MemoryStatus; import net.sevenstars.middleearth.entity.ai.brain.MemoryModulesME; import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntity; import java.util.Optional; -public class CaveTrollSleepTask extends MultiTickTask { +public class CaveTrollSleepTask extends Behavior { public CaveTrollSleepTask() { super( ImmutableMap.of( MemoryModuleType.WALK_TARGET, - MemoryModuleState.VALUE_ABSENT, + MemoryStatus.VALUE_ABSENT, MemoryModuleType.ATTACK_TARGET, - MemoryModuleState.VALUE_ABSENT, + MemoryStatus.VALUE_ABSENT, MemoryModuleType.HURT_BY_ENTITY, - MemoryModuleState.REGISTERED, + MemoryStatus.REGISTERED, MemoryModulesME.FOOD_EATEN_COUNT, - MemoryModuleState.VALUE_PRESENT + MemoryStatus.VALUE_PRESENT ),1200, 3600 ); } @Override - protected boolean shouldRun(ServerWorld world, CaveTrollEntity entity) { - Optional foodCount = entity.getBrain().getOptionalRegisteredMemory(MemoryModulesME.FOOD_EATEN_COUNT); + protected boolean checkExtraStartConditions(ServerLevel world, CaveTrollEntity entity) { + Optional foodCount = entity.getBrain().getMemory(MemoryModulesME.FOOD_EATEN_COUNT); return foodCount.isPresent() && foodCount.get() >= 3; } @Override - protected boolean shouldKeepRunning(ServerWorld world, CaveTrollEntity entity, long time) { - return entity.getBrain().getOptionalRegisteredMemory(MemoryModuleType.ATTACK_TARGET).isEmpty(); + protected boolean canStillUse(ServerLevel world, CaveTrollEntity entity, long time) { + return entity.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).isEmpty(); } @Override - protected void run(ServerWorld world, CaveTrollEntity entity, long time) { - entity.getBrain().remember(MemoryModulesME.FOOD_EATEN_COUNT, 0); + protected void start(ServerLevel world, CaveTrollEntity entity, long time) { + entity.getBrain().setMemory(MemoryModulesME.FOOD_EATEN_COUNT, 0); entity.startSleeping(); } @Override - protected void finishRunning(ServerWorld world, CaveTrollEntity entity, long time) { + protected void stop(ServerLevel world, CaveTrollEntity entity, long time) { entity.stopSleeping(); - entity.getBrain().remember(MemoryModulesME.DIG_FOR_FOOD_COOLDOWN, 600); - entity.getBrain().remember(MemoryModulesME.ACTION_TIMEOUT, 200); + entity.getBrain().setMemory(MemoryModulesME.DIG_FOR_FOOD_COOLDOWN, 600); + entity.getBrain().setMemory(MemoryModulesME.ACTION_TIMEOUT, 200); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollSmashTask.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollSmashTask.java index bf80311390..7101876f68 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollSmashTask.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/CaveTrollSmashTask.java @@ -1,44 +1,44 @@ package net.sevenstars.middleearth.entity.ai.brain.task; import com.google.common.collect.ImmutableMap; -import net.minecraft.entity.ai.brain.MemoryModuleState; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.task.MultiTickTask; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.ai.behavior.Behavior; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.MemoryStatus; import net.sevenstars.middleearth.entity.ai.brain.MemoryModulesME; import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntity; -public class CaveTrollSmashTask extends MultiTickTask { +public class CaveTrollSmashTask extends Behavior { public CaveTrollSmashTask() { super( ImmutableMap.of( MemoryModuleType.ATTACK_TARGET, - MemoryModuleState.VALUE_PRESENT, + MemoryStatus.VALUE_PRESENT, MemoryModulesME.SMASH_COOLDOWN, - MemoryModuleState.VALUE_ABSENT + MemoryStatus.VALUE_ABSENT ),30 ); } @Override - protected boolean shouldRun(ServerWorld world, CaveTrollEntity entity) { - return entity.getTarget() != null && entity.squaredDistanceTo(entity.getTarget()) < 16; + protected boolean checkExtraStartConditions(ServerLevel world, CaveTrollEntity entity) { + return entity.getTarget() != null && entity.distanceToSqr(entity.getTarget()) < 16; } @Override - protected boolean shouldKeepRunning(ServerWorld world, CaveTrollEntity entity, long time) { + protected boolean canStillUse(ServerLevel world, CaveTrollEntity entity, long time) { return true; } @Override - protected void run(ServerWorld world, CaveTrollEntity entity, long time) { + protected void start(ServerLevel world, CaveTrollEntity entity, long time) { entity.setSmashing(true); - entity.getBrain().forget(MemoryModuleType.WALK_TARGET); + entity.getBrain().eraseMemory(MemoryModuleType.WALK_TARGET); } @Override - protected void finishRunning(ServerWorld world, CaveTrollEntity entity, long time) { - entity.smashAttack(entity.getRandom().nextBetween(75, 125)); - entity.getBrain().remember(MemoryModulesME.SMASH_COOLDOWN, 200); + protected void stop(ServerLevel world, CaveTrollEntity entity, long time) { + entity.smashAttack(entity.getRandom().nextIntBetweenInclusive(75, 125)); + entity.getBrain().setMemory(MemoryModulesME.SMASH_COOLDOWN, 200); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcMountedApproachTask.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcMountedApproachTask.java index e6a4142afc..8b8a4a0411 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcMountedApproachTask.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcMountedApproachTask.java @@ -1,46 +1,46 @@ package net.sevenstars.middleearth.entity.ai.brain.task.npc; import com.google.common.collect.ImmutableMap; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.brain.MemoryModuleState; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.task.MultiTickTask; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.behavior.Behavior; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.MemoryStatus; import net.sevenstars.middleearth.entity.ai.brain.MemoryModulesME; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; import net.sevenstars.middleearth.entity.npcs.NpcEntity; -public class NpcMountedApproachTask extends MultiTickTask { +public class NpcMountedApproachTask extends Behavior { public NpcMountedApproachTask() { super( ImmutableMap.of( MemoryModuleType.ATTACK_TARGET, - MemoryModuleState.VALUE_PRESENT, + MemoryStatus.VALUE_PRESENT, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, - MemoryModuleState.VALUE_PRESENT, + MemoryStatus.VALUE_PRESENT, MemoryModuleType.ATTACK_COOLING_DOWN, - MemoryModuleState.VALUE_PRESENT, + MemoryStatus.VALUE_PRESENT, MemoryModuleType.WALK_TARGET, - MemoryModuleState.VALUE_PRESENT + MemoryStatus.VALUE_PRESENT ),35 ); } @Override - protected boolean shouldRun(ServerWorld world, NpcEntity entity) { - return entity.getTarget() != null && entity.hasVehicle() && entity.squaredDistanceTo(entity.getTarget()) < 16; + protected boolean checkExtraStartConditions(ServerLevel world, NpcEntity entity) { + return entity.getTarget() != null && entity.isPassenger() && entity.distanceToSqr(entity.getTarget()) < 16; } @Override - protected boolean shouldKeepRunning(ServerWorld world, NpcEntity entity, long time) { - return entity.hasVehicle(); + protected boolean canStillUse(ServerLevel world, NpcEntity entity, long time) { + return entity.isPassenger(); } @Override - protected void run(ServerWorld world, NpcEntity entity, long time) { + protected void start(ServerLevel world, NpcEntity entity, long time) { LivingEntity target = entity.getTarget(); - if(target == null || !entity.hasVehicle()){ - entity.getBrain().forget(MemoryModuleType.WALK_TARGET); + if(target == null || !entity.isPassenger()){ + entity.getBrain().eraseMemory(MemoryModuleType.WALK_TARGET); return; } float distance = target.distanceTo(entity); @@ -53,12 +53,12 @@ protected void run(ServerWorld world, NpcEntity entity, long time) { } } - entity.getBrain().forget(MemoryModuleType.WALK_TARGET); + entity.getBrain().eraseMemory(MemoryModuleType.WALK_TARGET); } @Override - protected void finishRunning(ServerWorld world, NpcEntity entity, long time) { - entity.getBrain().remember(MemoryModulesME.SMASH_COOLDOWN, 200); + protected void stop(ServerLevel world, NpcEntity entity, long time) { + entity.getBrain().setMemory(MemoryModulesME.SMASH_COOLDOWN, 200); entity.setBlocking(false); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcOnGroundApproachTask.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcOnGroundApproachTask.java index 2f398f9ed2..7071b150d7 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcOnGroundApproachTask.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcOnGroundApproachTask.java @@ -1,52 +1,52 @@ package net.sevenstars.middleearth.entity.ai.brain.task.npc; import com.google.common.collect.ImmutableMap; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.brain.MemoryModuleState; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.task.MultiTickTask; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.behavior.Behavior; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.MemoryStatus; import net.sevenstars.middleearth.entity.ai.brain.MemoryModulesME; import net.sevenstars.middleearth.entity.npcs.NpcEntity; -public class NpcOnGroundApproachTask extends MultiTickTask { +public class NpcOnGroundApproachTask extends Behavior { public NpcOnGroundApproachTask() { super( ImmutableMap.of( MemoryModuleType.ATTACK_TARGET, - MemoryModuleState.VALUE_PRESENT, + MemoryStatus.VALUE_PRESENT, MemoryModulesME.SMASH_COOLDOWN, - MemoryModuleState.VALUE_ABSENT + MemoryStatus.VALUE_ABSENT ) ); } @Override - protected boolean shouldRun(ServerWorld world, NpcEntity entity) { - return entity.getTarget() != null && !entity.hasVehicle() && entity.squaredDistanceTo(entity.getTarget()) < 16; + protected boolean checkExtraStartConditions(ServerLevel world, NpcEntity entity) { + return entity.getTarget() != null && !entity.isPassenger() && entity.distanceToSqr(entity.getTarget()) < 16; } @Override - protected boolean shouldKeepRunning(ServerWorld world, NpcEntity entity, long time) { - return !entity.hasVehicle(); + protected boolean canStillUse(ServerLevel world, NpcEntity entity, long time) { + return !entity.isPassenger(); } @Override - protected void run(ServerWorld world, NpcEntity entity, long time) { + protected void start(ServerLevel world, NpcEntity entity, long time) { LivingEntity target = entity.getTarget(); - if(target == null || entity.hasVehicle()){ - entity.getBrain().forget(MemoryModuleType.WALK_TARGET); + if(target == null || entity.isPassenger()){ + entity.getBrain().eraseMemory(MemoryModuleType.WALK_TARGET); return; } float distance = target.distanceTo(entity); entity.setBlocking(true); - entity.getBrain().forget(MemoryModuleType.WALK_TARGET); + entity.getBrain().eraseMemory(MemoryModuleType.WALK_TARGET); } @Override - protected void finishRunning(ServerWorld world, NpcEntity entity, long time) { + protected void stop(ServerLevel world, NpcEntity entity, long time) { entity.setBlocking(false); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcRangedApproachTask.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcRangedApproachTask.java index a282488c39..3152b86b7e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcRangedApproachTask.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcRangedApproachTask.java @@ -1,38 +1,37 @@ package net.sevenstars.middleearth.entity.ai.brain.task.npc; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.brain.EntityLookTarget; -import net.minecraft.entity.ai.brain.LivingTargetCache; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.WalkTarget; -import net.minecraft.entity.ai.brain.task.TargetUtil; -import net.minecraft.entity.ai.brain.task.Task; -import net.minecraft.entity.ai.brain.task.TaskTriggerer; -import net.minecraft.entity.mob.MobEntity; - import java.util.Optional; import java.util.function.Function; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.behavior.BehaviorControl; +import net.minecraft.world.entity.ai.behavior.BehaviorUtils; +import net.minecraft.world.entity.ai.behavior.EntityTracker; +import net.minecraft.world.entity.ai.behavior.declarative.BehaviorBuilder; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.NearestVisibleLivingEntities; +import net.minecraft.world.entity.ai.memory.WalkTarget; public class NpcRangedApproachTask { - public static Task create(float speed, int distance) { + public static BehaviorControl create(float speed, int distance) { return create((entity) -> speed, (entity) -> distance); } - public static Task create(Function speed, Function distance) { - return TaskTriggerer.task((context) -> context.group( - context.queryMemoryOptional(MemoryModuleType.WALK_TARGET), - context.queryMemoryOptional(MemoryModuleType.LOOK_TARGET), - context.queryMemoryValue(MemoryModuleType.ATTACK_TARGET), - context.queryMemoryOptional(MemoryModuleType.VISIBLE_MOBS) + public static BehaviorControl create(Function speed, Function distance) { + return BehaviorBuilder.create((context) -> context.group( + context.registered(MemoryModuleType.WALK_TARGET), + context.registered(MemoryModuleType.LOOK_TARGET), + context.present(MemoryModuleType.ATTACK_TARGET), + context.registered(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES) ) .apply(context, (walkTarget, lookTarget, attackTarget, visibleMobs) -> (world, entity, time) -> { - LivingEntity livingEntity = context.getValue(attackTarget); - Optional optionalVisibleAttackTargets = context.getOptionalValue(visibleMobs); - if (optionalVisibleAttackTargets.isPresent() && (optionalVisibleAttackTargets.get()).contains(livingEntity) && TargetUtil.isTargetWithinAttackRange(entity, livingEntity, 1)) { - walkTarget.forget(); + LivingEntity livingEntity = context.get(attackTarget); + Optional optionalVisibleAttackTargets = context.tryGet(visibleMobs); + if (optionalVisibleAttackTargets.isPresent() && (optionalVisibleAttackTargets.get()).contains(livingEntity) && BehaviorUtils.isWithinAttackRange(entity, livingEntity, 1)) { + walkTarget.erase(); } else { - lookTarget.remember(new EntityLookTarget(livingEntity, true)); - walkTarget.remember(new WalkTarget(new EntityLookTarget(livingEntity, false), speed.apply(entity), distance.apply(entity))); + lookTarget.set(new EntityTracker(livingEntity, true)); + walkTarget.set(new WalkTarget(new EntityTracker(livingEntity, false), speed.apply(entity), distance.apply(entity))); } return true; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcRangedAttackTask.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcRangedAttackTask.java index d8ec0abf58..e7b5884d41 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcRangedAttackTask.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcRangedAttackTask.java @@ -1,53 +1,52 @@ package net.sevenstars.middleearth.entity.ai.brain.task.npc; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.brain.EntityLookTarget; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.task.SingleTickTask; -import net.minecraft.entity.ai.brain.task.TaskTriggerer; -import net.minecraft.entity.mob.MobEntity; -import net.minecraft.item.BowItem; -import net.minecraft.item.Item; -import net.minecraft.item.RangedWeaponItem; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.behavior.EntityTracker; +import net.minecraft.world.entity.ai.behavior.OneShot; +import net.minecraft.world.entity.ai.behavior.declarative.BehaviorBuilder; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ProjectileWeaponItem; import net.sevenstars.middleearth.entity.npcs.NpcEntity; import java.util.function.Predicate; public class NpcRangedAttackTask { - public static SingleTickTask create(int cooldown) { + public static OneShot create(int cooldown) { return create((target) -> true, cooldown); } - public static SingleTickTask create(Predicate targetPredicate, int cooldown) { - return TaskTriggerer.task((context) -> context.group( - context.queryMemoryOptional(MemoryModuleType.LOOK_TARGET), - context.queryMemoryValue(MemoryModuleType.ATTACK_TARGET), - context.queryMemoryAbsent(MemoryModuleType.ATTACK_COOLING_DOWN), - context.queryMemoryValue(MemoryModuleType.VISIBLE_MOBS)).apply(context, + public static OneShot create(Predicate targetPredicate, int cooldown) { + return BehaviorBuilder.create((context) -> context.group( + context.registered(MemoryModuleType.LOOK_TARGET), + context.present(MemoryModuleType.ATTACK_TARGET), + context.absent(MemoryModuleType.ATTACK_COOLING_DOWN), + context.present(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES)).apply(context, (lookTarget, attackTarget, attackCoolingDown, visibleMobs) -> (world, entity, time) -> { - LivingEntity targetEntity = context.getValue(attackTarget); - entity.lookAtEntity(targetEntity, 30.0F, 30.0F); + LivingEntity targetEntity = context.get(attackTarget); + entity.lookAt(targetEntity, 30.0F, 30.0F); boolean targetPredicateResult = targetPredicate.test(entity); boolean isHoldingRangedWeapon = isHoldingUsableRangedWeapon(entity); - boolean isInAttackRange = entity.isInAttackRange(targetEntity); - boolean canSeeIt = (context.getValue(visibleMobs)).contains(targetEntity); + boolean isInAttackRange = entity.isWithinMeleeAttackRange(targetEntity); + boolean canSeeIt = (context.get(visibleMobs)).contains(targetEntity); if (targetPredicateResult && isHoldingRangedWeapon && isInAttackRange && canSeeIt) { - lookTarget.remember(new EntityLookTarget(targetEntity, true)); - attackCoolingDown.remember(true, cooldown); + lookTarget.set(new EntityTracker(targetEntity, true)); + attackCoolingDown.setWithExpiry(true, cooldown); entity.aim(); if(entity.isReadyToShoot()){ entity.shootAt(targetEntity); - entity.getBrain().forget(MemoryModuleType.ATTACK_TARGET); + entity.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET); entity.stopAiming(); } return true; } else { boolean canForget = false; - if(targetEntity.isDead()) + if(targetEntity.isDeadOrDying()) canForget = true; else { float distanceToEntity = entity.distanceTo(targetEntity); @@ -57,17 +56,17 @@ public static SingleTickTask create(Predicate target if(canForget) - entity.getBrain().forget(MemoryModuleType.ATTACK_TARGET); + entity.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET); return false; } })); } - private static boolean isHoldingUsableRangedWeapon(MobEntity mob) { + private static boolean isHoldingUsableRangedWeapon(Mob mob) { return mob.isHolding((stack) -> { Item item = stack.getItem(); - return item instanceof RangedWeaponItem && mob.canUseRangedWeapon((RangedWeaponItem)item); + return item instanceof ProjectileWeaponItem && mob.canFireProjectileWeapon((ProjectileWeaponItem)item); }); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcWalkTowardsTask.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcWalkTowardsTask.java index ad227b6799..6c12a49a12 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcWalkTowardsTask.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/ai/brain/task/npc/NpcWalkTowardsTask.java @@ -1,47 +1,47 @@ package net.sevenstars.middleearth.entity.ai.brain.task.npc; -import net.minecraft.entity.ai.NoPenaltyTargeting; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.WalkTarget; -import net.minecraft.entity.ai.brain.task.SingleTickTask; -import net.minecraft.entity.ai.brain.task.TaskTriggerer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.GlobalPos; -import net.minecraft.util.math.Vec3d; +import net.minecraft.core.BlockPos; +import net.minecraft.core.GlobalPos; +import net.minecraft.world.entity.ai.behavior.OneShot; +import net.minecraft.world.entity.ai.behavior.declarative.BehaviorBuilder; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.WalkTarget; +import net.minecraft.world.entity.ai.util.DefaultRandomPos; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.entity.npcs.NpcEntity; import java.util.Optional; public class NpcWalkTowardsTask { - public static SingleTickTask create(MemoryModuleType destination, float speed, int completionRange, int maxDistance, int maxRunTime) { - return TaskTriggerer.task((context) -> context.group(context.queryMemoryOptional(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE), context.queryMemoryAbsent(MemoryModuleType.WALK_TARGET), context.queryMemoryValue(destination)).apply(context, (cantReachWalkTargetSince, walkTarget, destinationResult) -> (world, entity, time) -> { - GlobalPos globalPos = (GlobalPos)context.getValue(destinationResult); - Optional optional = context.getOptionalValue(cantReachWalkTargetSince); - if (globalPos.dimension() == world.getRegistryKey() && (!optional.isPresent() || world.getTime() - (Long)optional.get() <= (long)maxRunTime)) { - if (globalPos.pos().getManhattanDistance(entity.getBlockPos()) > maxDistance) { - Vec3d vec3d = null; + public static OneShot create(MemoryModuleType destination, float speed, int completionRange, int maxDistance, int maxRunTime) { + return BehaviorBuilder.create((context) -> context.group(context.registered(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE), context.absent(MemoryModuleType.WALK_TARGET), context.present(destination)).apply(context, (cantReachWalkTargetSince, walkTarget, destinationResult) -> (world, entity, time) -> { + GlobalPos globalPos = (GlobalPos)context.get(destinationResult); + Optional optional = context.tryGet(cantReachWalkTargetSince); + if (globalPos.dimension() == world.dimension() && (!optional.isPresent() || world.getGameTime() - (Long)optional.get() <= (long)maxRunTime)) { + if (globalPos.pos().distManhattan(entity.blockPosition()) > maxDistance) { + Vec3 vec3d = null; int l = 0; int m = 1000; - while(vec3d == null || BlockPos.ofFloored(vec3d).getManhattanDistance(entity.getBlockPos()) > maxDistance) { - vec3d = NoPenaltyTargeting.findTo(entity, 15, 7, Vec3d.ofBottomCenter(globalPos.pos()), (double)((float)Math.PI / 2F)); + while(vec3d == null || BlockPos.containing(vec3d).distManhattan(entity.blockPosition()) > maxDistance) { + vec3d = DefaultRandomPos.getPosTowards(entity, 15, 7, Vec3.atBottomCenterOf(globalPos.pos()), (double)((float)Math.PI / 2F)); ++l; if (l == 1000) { //entity.releaseTicketFor(destination); - destinationResult.forget(); - cantReachWalkTargetSince.remember(time); + destinationResult.erase(); + cantReachWalkTargetSince.set(time); return true; } } - walkTarget.remember(new WalkTarget(vec3d, speed, completionRange)); - } else if (globalPos.pos().getManhattanDistance(entity.getBlockPos()) > completionRange) { - walkTarget.remember(new WalkTarget(globalPos.pos(), speed, completionRange)); + walkTarget.set(new WalkTarget(vec3d, speed, completionRange)); + } else if (globalPos.pos().distManhattan(entity.blockPosition()) > completionRange) { + walkTarget.set(new WalkTarget(globalPos.pos(), speed, completionRange)); } } else { //entity.releaseTicketFor(destination); - destinationResult.forget(); - cantReachWalkTargetSince.remember(time); + destinationResult.erase(); + cantReachWalkTargetSince.set(time); } return true; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/barrel/BarrelEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/barrel/BarrelEntity.java index 68ef35b77f..e95fb78c55 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/barrel/BarrelEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/barrel/BarrelEntity.java @@ -1,33 +1,36 @@ package net.sevenstars.middleearth.entity.barrel; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityDimensions; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.passive.AnimalEntity; -import net.minecraft.entity.vehicle.AbstractChestBoatEntity; -import net.minecraft.item.Item; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; - import java.util.function.Supplier; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.vehicle.Boat; +import net.minecraft.world.entity.vehicle.ChestBoat; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; + +public class BarrelEntity extends ChestBoat { + private final Supplier itemSupplier; -public class BarrelEntity extends AbstractChestBoatEntity { - public BarrelEntity(EntityType type, World world, Supplier itemSupplier) { - super(type, world, itemSupplier); + public BarrelEntity(EntityType type, Level world, Supplier itemSupplier) { + super(type, world); + this.itemSupplier = itemSupplier; } @Override - protected double getPassengerAttachmentY(EntityDimensions dimensions) { - return dimensions.height() / 1.75F; + protected boolean canAddPassenger(Entity passenger) { + return this.getPassengers().size() < this.getMaxPassengers(); } @Override - protected boolean canAddPassenger(Entity passenger) { - return this.getPassengerList().size() < this.getMaxPassengers(); + protected Vec3 getPassengerAttachmentPoint(Entity passenger, EntityDimensions dimensions, float scaleFactor) { + return new Vec3(0.0, dimensions.height() / 1.75F, -0.2F) + .yRot(-this.getYRot() * ((float)Math.PI / 180.0F)); } @Override - protected Vec3d getPassengerAttachmentPos(Entity passenger, EntityDimensions dimensions, float scaleFactor) { - return (new Vec3d(0.0, this.getPassengerAttachmentY(dimensions), -0.2f)).rotateY(-this.getYaw() * 0.017453292F); + public Item getDropItem() { + return this.itemSupplier.get(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/barrel/BarrelEntityModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/barrel/BarrelEntityModel.java index b4c7f74e16..3094806021 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/barrel/BarrelEntityModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/barrel/BarrelEntityModel.java @@ -1,34 +1,35 @@ package net.sevenstars.middleearth.entity.barrel; -import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.render.entity.state.BoatEntityRenderState; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; -public class BarrelEntityModel extends EntityModel { - protected BarrelEntityModel(ModelPart root) { - super(root); - } +public final class BarrelEntityModel { + private BarrelEntityModel() {} - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData main = modelPartData.addChild("main", ModelPartBuilder.create().uv(0, 15) - .cuboid(-7.0F, -16.0F, -7.0F, 2.0F, 15.0F, 14.0F, new Dilation(0.0F)) - .uv(32, 15).cuboid(5.0F, -16.0F, -7.0F, 2.0F, 15.0F, 14.0F, new Dilation(0.0F)) - .uv(0, 44).cuboid(-5.0F, -16.0F, -7.0F, 10.0F, 15.0F, 2.0F, new Dilation(0.0F)) - .uv(24, 44).cuboid(-5.0F, -16.0F, 5.0F, 10.0F, 15.0F, 2.0F, new Dilation(0.0F)) - .uv(0, 0).cuboid(-7.0F, -1.0F, -7.0F, 14.0F, 1.0F, 14.0F, - new Dilation(0.0F)), ModelTransform.origin(0.0F, 24.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition main = modelPartData.addOrReplaceChild("main", CubeListBuilder.create().texOffs(0, 15) + .addBox(-7.0F, -16.0F, -7.0F, 2.0F, 15.0F, 14.0F, new CubeDeformation(0.0F)) + .texOffs(32, 15).addBox(5.0F, -16.0F, -7.0F, 2.0F, 15.0F, 14.0F, new CubeDeformation(0.0F)) + .texOffs(0, 44).addBox(-5.0F, -16.0F, -7.0F, 10.0F, 15.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(24, 44).addBox(-5.0F, -16.0F, 5.0F, 10.0F, 15.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(0, 0).addBox(-7.0F, -1.0F, -7.0F, 14.0F, 1.0F, 14.0F, + new CubeDeformation(0.0F)), PartPose.offset(0.0F, 24.0F, 0.0F)); + return LayerDefinition.create(modelData, 64, 64); } - public static TexturedModelData getBaseTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - modelPartData.addChild("water_patch", ModelPartBuilder.create().uv(0, 0) - .cuboid(-6.0F, 0.0F, -6.0F, 12.0F, 6.0F, 12.0F), - ModelTransform.of(0.0F, 10.0F, 0.0F, 0F, 0.0F, 0.0F)); + public static LayerDefinition getBaseTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + modelPartData.addOrReplaceChild("water_patch", CubeListBuilder.create().texOffs(0, 0) + .addBox(-6.0F, 0.0F, -6.0F, 12.0F, 6.0F, 12.0F), + PartPose.offsetAndRotation(0.0F, 10.0F, 0.0F, 0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 0, 0); + return LayerDefinition.create(modelData, 0, 0); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/barrel/BarrelEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/barrel/BarrelEntityRenderer.java index 1db01b525b..c4226345be 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/barrel/BarrelEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/barrel/BarrelEntityRenderer.java @@ -1,78 +1,64 @@ package net.sevenstars.middleearth.entity.barrel; -import net.minecraft.client.model.Model; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.EntityRenderer; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.state.BoatEntityRenderState; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.RotationAxis; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Axis; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntityModelLayersME; import org.joml.Quaternionf; -public class BarrelEntityRenderer extends EntityRenderer { - private static final Identifier TEXTURE = Identifier.of(MiddleEarth.MOD_ID, "textures/entities/reinforced_barrel/reinforced_barrel.png"); - private ModelPart modelPart; - private final Model waterMaskModel; +public class BarrelEntityRenderer extends EntityRenderer { + private static final ResourceLocation TEXTURE = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "textures/entities/reinforced_barrel/reinforced_barrel.png"); + private final ModelPart modelPart; + private final ModelPart waterMaskPart; - public BarrelEntityRenderer(EntityRendererFactory.Context context) { + public BarrelEntityRenderer(EntityRendererProvider.Context context) { super(context); - modelPart = context.getPart(EntityModelLayersME.REINFORCED_BARREL); - this.waterMaskModel = new Model.SinglePartModel(context.getPart(EntityModelLayersME.REINFORCED_BARREL_WATER_MASK), (id) -> { - return RenderLayer.getWaterMask(); - }); + modelPart = context.bakeLayer(EntityModelLayersME.REINFORCED_BARREL); + this.waterMaskPart = context.bakeLayer(EntityModelLayersME.REINFORCED_BARREL_WATER_MASK).getChild("water_patch"); this.shadowRadius = 0.6F; } @Override - public BoatEntityRenderState createRenderState() { - return new BoatEntityRenderState(); - } - - @Override - public void render(BoatEntityRenderState state, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) { - matrices.push(); + public void render(BarrelEntity entity, float yaw, float tickDelta, PoseStack matrices, MultiBufferSource vertexConsumers, int light) { + matrices.pushPose(); matrices.scale(1.35f, 1.35f, 1.35f); - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180.0F - state.yaw)); - matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(180.0F)); + matrices.mulPose(Axis.YP.rotationDegrees(180.0F - Mth.rotLerp(tickDelta, entity.yRotO, entity.getYRot()))); + matrices.mulPose(Axis.ZP.rotationDegrees(180.0F)); - float f = state.damageWobbleTicks; + float f = entity.getHurtTime() - tickDelta; if (f > 0.0F) { - matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(MathHelper.sin(f) * f * state.damageWobbleStrength / 10.0F * (float)state.damageWobbleSide)); + float damage = Math.max(entity.getDamage() - tickDelta, 0.0F); + matrices.mulPose(Axis.XP.rotationDegrees(Mth.sin(f) * f * damage / 10.0F * entity.getHurtDir())); } - if (!state.submergedInWater && !MathHelper.approximatelyEquals(state.bubbleWobble, 0.0F)) { - matrices.multiply((new Quaternionf()).setAngleAxis(state.bubbleWobble * 0.017453292F, 1.0F, 0.0F, 1.0F)); + float bubbleAngle = entity.getBubbleAngle(tickDelta); + if (!entity.isUnderWater() && !Mth.equal(bubbleAngle, 0.0F)) { + matrices.mulPose((new Quaternionf()).setAngleAxis(bubbleAngle * 0.017453292F, 1.0F, 0.0F, 1.0F)); } matrices.translate(0f, -1.4f, 0f); - modelPart.render(matrices, vertexConsumers.getBuffer(RenderLayer.getEntityCutout(TEXTURE)), light, OverlayTexture.DEFAULT_UV); - this.renderWaterMask(state, matrices, vertexConsumers, light); - matrices.pop(); + modelPart.render(matrices, vertexConsumers.getBuffer(RenderType.entityCutout(TEXTURE)), light, OverlayTexture.NO_OVERLAY); + this.renderWaterMask(entity, matrices, vertexConsumers, light); + matrices.popPose(); + super.render(entity, yaw, tickDelta, matrices, vertexConsumers, light); } - public void updateRenderState(BarrelEntity barrelEntity, BoatEntityRenderState boatEntityRenderState, float f) { - super.updateRenderState(barrelEntity, boatEntityRenderState, f); - boatEntityRenderState.yaw = barrelEntity.getLerpedYaw(f); - boatEntityRenderState.damageWobbleTicks = (float)barrelEntity.getDamageWobbleTicks() - f; - boatEntityRenderState.damageWobbleSide = barrelEntity.getDamageWobbleSide(); - boatEntityRenderState.damageWobbleStrength = Math.max(barrelEntity.getDamageWobbleStrength() - f, 0.0F); - boatEntityRenderState.bubbleWobble = barrelEntity.lerpBubbleWobble(f); - boatEntityRenderState.submergedInWater = barrelEntity.isSubmergedInWater(); - boatEntityRenderState.leftPaddleAngle = barrelEntity.lerpPaddlePhase(0, f); - boatEntityRenderState.rightPaddleAngle = barrelEntity.lerpPaddlePhase(1, f); - } - - protected void renderWaterMask(BoatEntityRenderState state, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) { - if (!state.submergedInWater) { - this.waterMaskModel.render(matrices, vertexConsumers.getBuffer(this.waterMaskModel.getLayer(TEXTURE)), light, OverlayTexture.DEFAULT_UV); + protected void renderWaterMask(BarrelEntity entity, PoseStack matrices, MultiBufferSource vertexConsumers, int light) { + if (!entity.isUnderWater()) { + this.waterMaskPart.render(matrices, vertexConsumers.getBuffer(RenderType.waterMask()), light, OverlayTexture.NO_OVERLAY); } + } + @Override + public ResourceLocation getTextureLocation(BarrelEntity entity) { + return TEXTURE; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/AbstractBeastEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/AbstractBeastEntity.java index 13a0af28a4..49bdcd2e86 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/AbstractBeastEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/AbstractBeastEntity.java @@ -1,53 +1,59 @@ package net.sevenstars.middleearth.entity.beasts; -import net.minecraft.advancement.criterion.Criteria; -import net.minecraft.block.Blocks; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.FoodComponent; -import net.minecraft.entity.*; -import net.minecraft.entity.ai.pathing.EntityNavigation; -import net.minecraft.entity.attribute.EntityAttribute; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.damage.DamageTypes; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.data.TrackedData; -import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.entity.passive.AbstractHorseEntity; -import net.minecraft.entity.passive.PassiveEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.StackReference; -import net.minecraft.inventory.StackWithSlot; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundEvents; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; +import net.minecraft.advancements.CriteriaTriggers; +import net.minecraft.core.Holder; +import net.minecraft.core.component.DataComponents; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.Tag; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.damagesource.DamageTypes; +import net.minecraft.world.entity.AgeableMob; +import net.minecraft.world.entity.AnimationState; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityEvent; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Pose; +import net.minecraft.world.entity.SlotAccess; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.navigation.PathNavigation; +import net.minecraft.world.entity.animal.horse.AbstractHorse; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.entity.ai.brain.MemoryModulesME; import net.sevenstars.middleearth.entity.npcs.NpcEntity; import net.sevenstars.middleearth.resources.datas.common.DispositionType; import net.sevenstars.middleearth.resources.datas.common.RaceType; +import org.jetbrains.annotations.Nullable; import java.util.List; -public abstract class AbstractBeastEntity extends AbstractHorseEntity { - public static final TrackedData CHARGING = DataTracker.registerData(AbstractBeastEntity.class, TrackedDataHandlerRegistry.BOOLEAN); - public static final TrackedData SITTING = DataTracker.registerData(AbstractBeastEntity.class, TrackedDataHandlerRegistry.BOOLEAN); - private static final TrackedData CHEST = DataTracker.registerData(AbstractBeastEntity.class, TrackedDataHandlerRegistry.BOOLEAN); - private static final TrackedData RUNNING = DataTracker.registerData(AbstractBeastEntity.class, TrackedDataHandlerRegistry.BOOLEAN); - private static final TrackedData FIGHTING = DataTracker.registerData(AbstractBeastEntity.class, TrackedDataHandlerRegistry.BOOLEAN); +public abstract class AbstractBeastEntity extends AbstractHorse { + public static final EntityDataAccessor CHARGING = SynchedEntityData.defineId(AbstractBeastEntity.class, EntityDataSerializers.BOOLEAN); + public static final EntityDataAccessor SITTING = SynchedEntityData.defineId(AbstractBeastEntity.class, EntityDataSerializers.BOOLEAN); + private static final EntityDataAccessor CHEST = SynchedEntityData.defineId(AbstractBeastEntity.class, EntityDataSerializers.BOOLEAN); + private static final EntityDataAccessor RUNNING = SynchedEntityData.defineId(AbstractBeastEntity.class, EntityDataSerializers.BOOLEAN); + private static final EntityDataAccessor FIGHTING = SynchedEntityData.defineId(AbstractBeastEntity.class, EntityDataSerializers.BOOLEAN); // The tameness value ranges from 0-100, updating every in-game day. If it reaches 0, the beast will break free from its owner. - private static final TrackedData TAMENESS = DataTracker.registerData(AbstractBeastEntity.class, TrackedDataHandlerRegistry.INTEGER); + private static final EntityDataAccessor TAMENESS = SynchedEntityData.defineId(AbstractBeastEntity.class, EntityDataSerializers.INT); public final AnimationState idleAnimationState = new AnimationState(); public final AnimationState attackAnimationState = new AnimationState(); @@ -64,66 +70,73 @@ public abstract class AbstractBeastEntity extends AbstractHorseEntity { public static final int ATTACK_COOLDOWN = 10; public static final float RESISTANCE = 0.15f; - protected Vec3d targetDir = Vec3d.ZERO; + protected Vec3 targetDir = Vec3.ZERO; // region Initializing - protected AbstractBeastEntity(EntityType entityType, World world) { + protected AbstractBeastEntity(EntityType entityType, Level world) { super(entityType, world); } - protected void initDataTracker(DataTracker.Builder builder) { - super.initDataTracker(builder); - builder.add(CHARGING, false); - builder.add(SITTING, false); - builder.add(CHEST, false); - builder.add(RUNNING, false); - builder.add(FIGHTING, false); - builder.add(TAMENESS, 75); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(CHARGING, false); + builder.define(SITTING, false); + builder.define(CHEST, false); + builder.define(RUNNING, false); + builder.define(FIGHTING, false); + builder.define(TAMENESS, 75); } @Override - protected void initGoals() { + protected void registerGoals() { } protected abstract void setupAnimationStates(); @Override - public void onTrackedDataSet(TrackedData data) { - if (!this.firstUpdate && CHARGING.equals(data)) { + public void onSyncedDataUpdated(EntityDataAccessor data) { + if (!this.firstTick && CHARGING.equals(data)) { this.chargeTimeout = this.chargeTimeout == 0 ? maxChargeCooldown() : this.chargeTimeout; } - super.onTrackedDataSet(data); + super.onSyncedDataUpdated(data); } @Override - protected void writeCustomData(WriteView view) { - super.writeCustomData(view); + public void addAdditionalSaveData(CompoundTag view) { + super.addAdditionalSaveData(view); view.putBoolean("Sitting", this.isSitting()); view.putBoolean("ChestedBeast", this.hasChest()); view.putInt("Tameness", this.getTameness()); if (this.hasChest()) { - WriteView.ListAppender listAppender = view.getListAppender("Items", StackWithSlot.CODEC); - - for (int i = 0; i < this.items.size(); i++) { - ItemStack itemStack = this.items.getStack(i); + ListTag items = new ListTag(); + for (int i = 0; i < this.inventory.getContainerSize(); i++) { + ItemStack itemStack = this.inventory.getItem(i); if (!itemStack.isEmpty()) { - listAppender.add(new StackWithSlot(i, itemStack)); + CompoundTag itemTag = new CompoundTag(); + itemTag.putByte("Slot", (byte)i); + itemStack.save(this.registryAccess(), itemTag); + items.add(itemTag); } } + view.put("Items", items); } } @Override - protected void readCustomData(ReadView view) { - super.readCustomData(view); - this.setSitting(view.getBoolean("Sitting", false)); - this.setHasChest(view.getBoolean("ChestedBeast", false)); - this.setTameness(view.getInt("Tameness", 75)); - this.onChestedStatusChanged(); + public void readAdditionalSaveData(CompoundTag view) { + super.readAdditionalSaveData(view); + this.setSitting(view.getBoolean("Sitting")); + this.setHasChest(view.getBoolean("ChestedBeast")); + this.setTameness(view.contains("Tameness", Tag.TAG_INT) ? view.getInt("Tameness") : 75); + this.createInventory(); if (this.hasChest()) { - for (StackWithSlot stackWithSlot : view.getTypedListView("Items", StackWithSlot.CODEC)) { - if (stackWithSlot.isValidSlot(this.items.size())) { - this.items.setStack(stackWithSlot.slot(), stackWithSlot.stack()); + ListTag items = view.getList("Items", Tag.TAG_COMPOUND); + for (int i = 0; i < items.size(); i++) { + CompoundTag itemTag = items.getCompound(i); + int slot = itemTag.getByte("Slot") & 255; + if (slot < this.inventory.getContainerSize()) { + ItemStack.parse(this.registryAccess(), itemTag) + .ifPresent(itemStack -> this.inventory.setItem(slot, itemStack)); } } } @@ -146,7 +159,7 @@ public boolean isMountable() { return true; } - protected boolean isTamable(PlayerEntity player) { + protected boolean isTamable(Player player) { return true; } @@ -155,7 +168,7 @@ public boolean canCarryChest() { } public final boolean cannotFollowOwner() { - return this.isSitting() || this.hasVehicle() || this.mightBeLeashed() || this.getOwner() != null && this.getOwner().isSpectator(); + return this.isSitting() || this.isPassenger() || this.mayBeLeashed() || this.getOwner() != null && this.getOwner().isSpectator(); } public boolean shouldAttackWhenMounted() { @@ -163,12 +176,12 @@ public boolean shouldAttackWhenMounted() { } public boolean canCharge() { - return !this.isSitting() && !this.hasPassengers(); + return !this.isSitting() && !this.isVehicle(); } @Override - public boolean isPersistent() { - return isTame() || getTameness() <= 0; + public boolean isPersistenceRequired() { + return isTamed() || getTameness() <= 0; } public void resetTameness(){ @@ -176,7 +189,7 @@ public void resetTameness(){ } protected boolean isClientWorld() { - return this.getWorld().isClient(); + return this.level().isClientSide(); } public boolean isOwner(LivingEntity entity) { @@ -190,67 +203,67 @@ public boolean isOwner(LivingEntity entity) { */ public boolean isValidTarget(Entity entity) { return entity instanceof LivingEntity livingEntity && // Entity is LivingEntity - !this.getPassengerList().contains(livingEntity) && // Is not a passenger + !this.getPassengers().contains(livingEntity) && // Is not a passenger !(this.getOwner() != null && this.getOwner().equals(livingEntity)) && // Is not its owner - !(livingEntity instanceof PlayerEntity player && player.isCreative()); // Is not a creative player + !(livingEntity instanceof Player player && player.isCreative()); // Is not a creative player } @Override - public boolean isInvulnerableTo(ServerWorld world, DamageSource source) { - if (source.isOf(DamageTypes.IN_WALL) && this.hasPassengers() && getControllingPassenger() instanceof NpcEntity) { + public boolean isInvulnerableTo(DamageSource source) { + if (source.is(DamageTypes.IN_WALL) && this.isVehicle() && getControllingPassenger() instanceof NpcEntity) { return true; } - return super.isInvulnerableTo(world, source); + return super.isInvulnerableTo(source); } // endregion // region DataTracker public int getTameness() { - return this.dataTracker.get(TAMENESS); + return this.entityData.get(TAMENESS); } public void setTameness(int tameness) { - this.dataTracker.set(TAMENESS, tameness); + this.entityData.set(TAMENESS, tameness); } public boolean hasChest() { - return this.dataTracker.get(CHEST); + return this.entityData.get(CHEST); } public void setHasChest(boolean hasChest) { - this.dataTracker.set(CHEST, hasChest); + this.entityData.set(CHEST, hasChest); } public boolean isRunning() { - return this.dataTracker.get(RUNNING); + return this.entityData.get(RUNNING); } public void setRunning(boolean running) { - this.dataTracker.set(RUNNING, running); + this.entityData.set(RUNNING, running); } public boolean isCharging() { - return this.dataTracker.get(CHARGING); + return this.entityData.get(CHARGING); } public void setCharging(boolean charging) { - this.dataTracker.set(CHARGING, charging); + this.entityData.set(CHARGING, charging); } public boolean isSitting() { - return this.dataTracker.get(SITTING); + return this.entityData.get(SITTING); } public void setSitting(boolean sitting) { - this.dataTracker.set(SITTING, sitting); + this.entityData.set(SITTING, sitting); } public boolean isFighting() { - return dataTracker.get(FIGHTING); + return entityData.get(FIGHTING); } public void setFighting(boolean isFighting) { - dataTracker.set(FIGHTING, isFighting); + entityData.set(FIGHTING, isFighting); } // endregion @@ -278,13 +291,13 @@ public int getJumpCooldown() { } public double getMountedHeightOffset() { - float f = Math.min(0.25F, this.limbAnimator.getSpeed()); - float g = this.limbAnimator.getSpeed(); // TODO : was this.limbAnimator.getPos(); - return (double)this.getHeight() - 0.19 + (double)(0.12F * MathHelper.cos(g * 1.5F) * 2.0F * f); + float f = Math.min(0.25F, this.walkAnimation.speed()); + float g = this.walkAnimation.speed(); // TODO : was this.limbAnimator.getPos(); + return (double)this.getBbHeight() - 0.19 + (double)(0.12F * Mth.cos(g * 1.5F) * 2.0F * f); } - public PlayerEntity getOwner() { - if(super.getOwner() instanceof PlayerEntity playerEntity) + public Player getOwner() { + if(super.getOwner() instanceof Player playerEntity) return playerEntity; return null; } @@ -297,24 +310,24 @@ public int chargeDuration() { } protected float getAttackDamage() { - return (float)this.getAttributeValue(EntityAttributes.ATTACK_DAMAGE); + return (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE); } // endregion // region Equipment - protected void dropInventory(ServerWorld world) { - super.dropInventory(world); + protected void dropEquipment() { + super.dropEquipment(); if (this.hasChest()) { - this.dropItem(world, Blocks.CHEST); + this.spawnAtLocation(Blocks.CHEST); this.setHasChest(false); } } @Override - public StackReference getStackReference(int mappedIndex) { - return mappedIndex == 499 ? new StackReference() { + public SlotAccess getSlot(int mappedIndex) { + return mappedIndex == 499 ? new SlotAccess() { @Override public ItemStack get() { return AbstractBeastEntity.this.hasChest() ? new ItemStack(Items.CHEST) : ItemStack.EMPTY; @@ -325,14 +338,14 @@ public boolean set(ItemStack stack) { if (stack.isEmpty()) { if (AbstractBeastEntity.this.hasChest()) { AbstractBeastEntity.this.setHasChest(false); - AbstractBeastEntity.this.onChestedStatusChanged(); + AbstractBeastEntity.this.createInventory(); } return true; - } else if (stack.isOf(Items.CHEST)) { + } else if (stack.is(Items.CHEST)) { if (!AbstractBeastEntity.this.hasChest()) { AbstractBeastEntity.this.setHasChest(true); - AbstractBeastEntity.this.onChestedStatusChanged(); + AbstractBeastEntity.this.createInventory(); } return true; @@ -340,22 +353,22 @@ public boolean set(ItemStack stack) { return false; } } - } : super.getStackReference(mappedIndex); + } : super.getSlot(mappedIndex); } public int getInventoryColumns() { return this.hasChest() ? 5 : 0; } - private void addChest(PlayerEntity player, ItemStack chest) { + private void addChest(Player player, ItemStack chest) { this.setHasChest(true); this.playAddChestSound(); - chest.decrementUnlessCreative(1, player); - this.onChestedStatusChanged(); + chest.consume(1, player); + this.createInventory(); } protected void playAddChestSound() { - this.playSound(SoundEvents.ENTITY_DONKEY_CHEST, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); + this.playSound(SoundEvents.DONKEY_CHEST, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); } // endregion @@ -363,17 +376,17 @@ protected void playAddChestSound() { // region Move Set and Behavior public void breakFree() { - this.setTame(false); + this.setTamed(false); this.setOwner(null); this.setSitting(false); if(this.getBrain() != null) { - this.getBrain().forget(MemoryModulesME.TAME); + this.getBrain().eraseMemory(MemoryModulesME.TAME); } } @Override - protected void jump(float strength, Vec3d movementInput) { + protected void executeRidersJump(float strength, Vec3 movementInput) { if(this.isSitting()) { this.setSitting(false); } @@ -384,14 +397,14 @@ else if(this.chargeTimeout <= 0) { } @Override - public boolean isAngry() { + public boolean isStanding() { return false; } @Override - public void startJumping(int height) { + public void handleStartJump(int height) { if(!this.isSitting()) { - this.playSound(SoundEvents.ENTITY_CAMEL_DASH, 1.0f, 1.0f); + this.playSound(SoundEvents.CAMEL_DASH, 1.0f, 1.0f); this.setCharging(true); } else { @@ -399,48 +412,52 @@ public void startJumping(int height) { } } - public void tryBonding(PlayerEntity player) { - if(random.nextDouble() <= 0.1d || player.isInCreativeMode()) { + public void tryBonding(Player player) { + if(random.nextDouble() <= 0.1d || player.hasInfiniteMaterials()) { this.tameBeast(player); - this.getWorld().sendEntityStatus(this, EntityStatuses.ADD_POSITIVE_PLAYER_REACTION_PARTICLES); + this.level().broadcastEntityEvent(this, EntityEvent.TAMING_SUCCEEDED); this.chargeTimeout = 0; } else { - this.getWorld().sendEntityStatus(this, EntityStatuses.ADD_NEGATIVE_PLAYER_REACTION_PARTICLES); + this.level().broadcastEntityEvent(this, EntityEvent.TAMING_FAILED); } } - public void tameBeast(PlayerEntity player) { - if (player instanceof ServerPlayerEntity) { + public void tameBeast(Player player) { + if (player instanceof ServerPlayer) { this.setOwner(player); - this.setTame(true); - Criteria.TAME_ANIMAL.trigger((ServerPlayerEntity)player, this); + this.setTamed(true); + CriteriaTriggers.TAME_ANIMAL.trigger((ServerPlayer)player, this); } } public void tameBeast(LivingEntity livingEntity) { this.setOwner(livingEntity); - this.setTame(true); + this.setTamed(true); + } + + public void setOwner(@Nullable LivingEntity entity) { + this.setOwnerUUID(entity == null ? null : entity.getUUID()); } @Override - public ActionResult interactMob(PlayerEntity player, Hand hand) { - ItemStack itemStack = player.getStackInHand(hand); + public InteractionResult mobInteract(Player player, InteractionHand hand) { + ItemStack itemStack = player.getItemInHand(hand); - if(isBondingItem(player.getStackInHand(hand)) && !this.isTame() && this.isTamable(player)) { - if(!this.getWorld().isClient()) { + if(isBondingItem(player.getItemInHand(hand)) && !this.isTamed() && this.isTamable(player)) { + if(!this.level().isClientSide()) { this.tryBonding(player); - this.eat(player, hand, itemStack); + this.usePlayerItem(player, hand, itemStack); } - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } - if(this.isTame()) { + if(this.isTamed()) { if(isFoodItem(itemStack) && getOwner() == player) { int tamenessIncrease; - FoodComponent component = itemStack.get(DataComponentTypes.FOOD); + FoodProperties component = itemStack.get(DataComponents.FOOD); if(component != null) { tamenessIncrease = component.nutrition(); } @@ -453,72 +470,73 @@ public ActionResult interactMob(PlayerEntity player, Hand hand) { this.setTameness(100); } - this.eat(player, hand, itemStack); - playSound(SoundEvents.ENTITY_HORSE_EAT); - return ActionResult.SUCCESS; + this.usePlayerItem(player, hand, itemStack); + makeSound(SoundEvents.HORSE_EAT); + return InteractionResult.SUCCESS; } if(isCommandItem(itemStack) && player == getOwner()) { this.setSitting(!isSitting()); - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } - if (!this.hasChest() && itemStack.isOf(Items.CHEST) && canCarryChest()) { + if (!this.hasChest() && itemStack.is(Items.CHEST) && canCarryChest()) { this.addChest(player, itemStack); - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } - if(!(isCommandItem(itemStack) || isBreedingItem(itemStack) || itemStack.isOf(Items.CHEST)) && this.isMountable()) { - super.interactMob(player, hand); + if(!(isCommandItem(itemStack) || isFood(itemStack) || itemStack.is(Items.CHEST)) && this.isMountable()) { + super.mobInteract(player, hand); } } - return ActionResult.FAIL; + return InteractionResult.FAIL; } @Override - public ActionResult interactHorse(PlayerEntity player, ItemStack stack) { - return ActionResult.PASS; + public InteractionResult fedFood(Player player, ItemStack stack) { + return InteractionResult.PASS; } @Override - protected void putPlayerOnBack(PlayerEntity player) { - ItemStack item = player.getStackInHand(Hand.MAIN_HAND); + protected void doPlayerRide(Player player) { + ItemStack item = player.getItemInHand(InteractionHand.MAIN_HAND); if(this.canAddPassenger(player) && item.isEmpty()) { - super.putPlayerOnBack(player); + super.doPlayerRide(player); } } - public boolean damage(DamageSource source, float amount) { - if(!source.equals(getDamageSources().drown()) && !source.equals(getDamageSources().lava()) - && !source.equals(getDamageSources().cramming()) && !source.equals(getDamageSources().magic())) { + @Override + public boolean hurt(DamageSource source, float amount) { + if(!source.equals(damageSources().drown()) && !source.equals(damageSources().lava()) + && !source.equals(damageSources().cramming()) && !source.equals(damageSources().magic())) { amount *= (1 - RESISTANCE); } - return !this.getWorld().isClient() && super.damage((ServerWorld) this.getWorld(), source, amount); + return super.hurt(source, amount); } public void chargeAttack() { } - public void setChargeVelocity(Vec3d direction) { - this.setVelocity(direction - .getHorizontal().normalize() // Remove the y-axis and normalize the vector - .multiply(1.0d - ((double)(this.chargeTimeout - (maxChargeCooldown() - chargeDuration())) / chargeDuration())) // Progressively get faster during charge (linear) - .add(0, this.getVelocity().y, 0)); // Add y-Velocity to make beast fall and climb steps + public void setChargeVelocity(Vec3 direction) { + this.setDeltaMovement(new Vec3(direction.x, 0.0, direction.z) + .normalize() + .scale(1.0d - ((double)(this.chargeTimeout - (maxChargeCooldown() - chargeDuration())) / chargeDuration())) // Progressively get faster during charge (linear) + .add(0, this.getDeltaMovement().y, 0)); // Add y-Velocity to make beast fall and climb steps } @Override - protected EntityNavigation createNavigation(World world) { + protected PathNavigation createNavigation(Level world) { return new BeastEntityNavigation(this, world); } @Override - protected float getSaddledSpeed(PlayerEntity controllingPlayer) { - return this.isSitting() ? 0 : super.getSaddledSpeed(controllingPlayer); + protected float getRiddenSpeed(Player controllingPlayer) { + return this.isSitting() ? 0 : super.getRiddenSpeed(controllingPlayer); } protected float getNpcSaddledSpeed(NpcEntity controllingNpc) { - return this.isSitting() ? 0 : (float)this.getAttributeValue(EntityAttributes.MOVEMENT_SPEED); + return this.isSitting() ? 0 : (float)this.getAttributeValue(Attributes.MOVEMENT_SPEED); } // endregion @@ -529,18 +547,18 @@ public void tick() { super.tick(); if(this.getTarget() != null) { - this.getLookControl().lookAt(this.getTarget()); + this.getLookControl().setLookAt(this.getTarget()); } if(this.isCharging()) { chargeAttack(); - if(!chargeAnimationState.isRunning()) { - this.chargeAnimationState.start(this.age); + if(!chargeAnimationState.isStarted()) { + this.chargeAnimationState.start(this.tickCount); } } if(this.chargeTimeout <= (maxChargeCooldown() - chargeDuration()) || !isCharging()) { this.setCharging(false); - this.targetDir = Vec3d.ZERO; + this.targetDir = Vec3.ZERO; } if(!this.isCharging()) { this.chargeAnimationState.stop(); @@ -550,21 +568,21 @@ public void tick() { } if(this.hasControllingPassenger() && !this.shouldAttackWhenMounted()) { - this.setAttacker(null); - this.setAttacking(false); + this.setLastHurtByMob(null); + this.setAggressive(false); this.setTarget(null); } - if (this.getWorld().isClient) { + if (this.level().isClientSide) { setupAnimationStates(); } - if (!this.isClientWorld() && isTame() && this.getOwner() != null) { - if(this.getWorld().getTimeOfDay() == 6500) { // Tameness always decreases shortly after noon - List players = this.getWorld().getPlayers(); + if (!this.isClientWorld() && isTamed() && this.getOwner() != null) { + if(this.level().getDayTime() == 6500) { // Tameness always decreases shortly after noon + List players = this.level().players(); if(this.getOwner() != null && players.contains(this.getOwner())) { // Check if owner is online // Get amount of other beasts using the Tameness mechanic in a 25 block radius. The tameness decreases exponentially faster for each of them. - int affectingBeasts = this.getWorld().getEntitiesByClass(AbstractBeastEntity.class, this.getBoundingBox().expand(25), (entity) -> usesTameness() && getOwner() == this.getOwner()).size(); + int affectingBeasts = this.level().getEntitiesOfClass(AbstractBeastEntity.class, this.getBoundingBox().inflate(25), (entity) -> usesTameness() && getOwner() == this.getOwner()).size(); // The number of entities includes itself, therefore the smallest value to decrease is at 10 this.setTameness(this.getTameness() - (int)(5 * Math.pow(2, affectingBeasts))); @@ -578,37 +596,37 @@ public void tick() { } @Override - public void tickMovement() { - super.tickMovement(); + public void aiStep() { + super.aiStep(); if (this.attackTicksLeft > 0) { --this.attackTicksLeft; } if (this.getControllingPassenger() instanceof NpcEntity npc && this.isAlive()) { - Vec3d movementInput = new Vec3d(this.sidewaysSpeed, this.upwardSpeed, this.forwardSpeed); - if (this.canMoveVoluntarily()) { - this.setMovementSpeed(this.getNpcSaddledSpeed(npc)); + Vec3 movementInput = new Vec3(this.xxa, this.yya, this.zza); + if (this.isControlledByLocalInstance()) { + this.setSpeed(this.getNpcSaddledSpeed(npc)); this.travel(movementInput); } else { - this.setVelocity(Vec3d.ZERO); + this.setDeltaMovement(Vec3.ZERO); } } } // endregion - protected void setChildAttribute(PassiveEntity other, AbstractHorseEntity child, RegistryEntry attribute, double min, double max) { - double d = this.calculateAttributeBaseValue(this.getAttributeBaseValue(attribute), other.getAttributeBaseValue(attribute), min, max, this.random); - child.getAttributeInstance(attribute).setBaseValue(d); + protected void setOffspringAttribute(AgeableMob other, AbstractHorse child, Holder attribute, double min, double max) { + double d = this.createOffspringAttribute(this.getAttributeBaseValue(attribute), other.getAttributeBaseValue(attribute), min, max, this.random); + child.getAttribute(attribute).setBaseValue(d); } - static double calculateAttributeBaseValue(double parentBase, double otherParentBase, double min, double max, Random random) { + static double createOffspringAttribute(double parentBase, double otherParentBase, double min, double max, RandomSource random) { double g; if (max <= min) { throw new IllegalArgumentException("Incorrect range for an attribute"); } - parentBase = MathHelper.clamp(parentBase, min, max); - otherParentBase = MathHelper.clamp(otherParentBase, min, max); + parentBase = Mth.clamp(parentBase, min, max); + otherParentBase = Mth.clamp(otherParentBase, min, max); double d = 0.15 * (max - min); double f = (parentBase + otherParentBase) / 2.0; double e = Math.abs(parentBase - otherParentBase) + d * 2.0; @@ -625,23 +643,23 @@ static double calculateAttributeBaseValue(double parentBase, double otherParentB } @Override - public void handleStatus(byte status) { - if (status == EntityStatuses.PLAY_ATTACK_SOUND) { + public void handleEntityEvent(byte status) { + if (status == EntityEvent.START_ATTACKING) { this.attackTicksLeft = ATTACK_COOLDOWN; - this.attackAnimationState.start(this.age); + this.attackAnimationState.start(this.tickCount); } - if (status == EntityStatuses.ADD_POSITIVE_PLAYER_REACTION_PARTICLES) { - this.spawnPlayerReactionParticles(true); - } else if (status == EntityStatuses.ADD_NEGATIVE_PLAYER_REACTION_PARTICLES) { - this.spawnPlayerReactionParticles(false); + if (status == EntityEvent.TAMING_SUCCEEDED) { + this.spawnTamingParticles(true); + } else if (status == EntityEvent.TAMING_FAILED) { + this.spawnTamingParticles(false); } else { - super.handleStatus(status); + super.handleEntityEvent(status); } } @Override - protected void updateLimbs(float posDelta) { - float f = this.getPose() == EntityPose.STANDING ? Math.min(posDelta * 6.0f, 1.0f) : 0.0f; - this.limbAnimator.updateLimbs(f, 0.2f, 1.0f); + protected void updateWalkAnimation(float posDelta) { + float f = this.getPose() == Pose.STANDING ? Math.min(posDelta * 6.0f, 1.0f) : 0.0f; + this.walkAnimation.update(f, 0.2f); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/BeastEntityNavigation.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/BeastEntityNavigation.java index b3199f1aa0..493f129a71 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/BeastEntityNavigation.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/BeastEntityNavigation.java @@ -1,16 +1,16 @@ package net.sevenstars.middleearth.entity.beasts; -import net.minecraft.entity.ai.pathing.MobNavigation; -import net.minecraft.entity.mob.MobEntity; -import net.minecraft.world.World; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.navigation.GroundPathNavigation; +import net.minecraft.world.level.Level; -public class BeastEntityNavigation extends MobNavigation { - public BeastEntityNavigation(MobEntity mobEntity, World world) { +public class BeastEntityNavigation extends GroundPathNavigation { + public BeastEntityNavigation(Mob mobEntity, Level world) { super(mobEntity, world); } @Override - protected boolean isAtValidPosition() { - return super.isAtValidPosition() && !((AbstractBeastEntity)entity).isSitting(); + protected boolean canUpdatePath() { + return super.canUpdatePath() && !((AbstractBeastEntity)mob).isSitting(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/BeastEntityRenderState.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/BeastEntityRenderState.java deleted file mode 100644 index 6b04cb0c8e..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/BeastEntityRenderState.java +++ /dev/null @@ -1,22 +0,0 @@ -package net.sevenstars.middleearth.entity.beasts; - -import net.minecraft.client.render.entity.state.LivingEntityRenderState; -import net.minecraft.entity.AnimationState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; - -public class BeastEntityRenderState extends LivingEntityRenderState { - public AnimationState startSittingAnimationState = new AnimationState(); - public AnimationState stopSittingAnimationState = new AnimationState(); - public AnimationState chargeAnimationState = new AnimationState(); - - public int tameness = 0; - - public boolean isSprinting = false; - public boolean isCharging = false; - public boolean isTame = false; - public LivingEntity conrollingPassenger = null; - - public ItemStack armor = ItemStack.EMPTY; - public ItemStack saddle = ItemStack.EMPTY; -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatAnimations.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatAnimations.java index 7ae8f1582c..8e481ceda9 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatAnimations.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatAnimations.java @@ -1,684 +1,687 @@ package net.sevenstars.middleearth.entity.beasts.broadhoof; -import net.minecraft.client.render.entity.animation.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; +import net.minecraft.client.animation.AnimationChannel; +import net.minecraft.client.animation.AnimationDefinition; +import net.minecraft.client.animation.Keyframe; +import net.minecraft.client.animation.KeyframeAnimations; +import net.minecraft.client.model.geom.PartNames; public class BroadhoofGoatAnimations { - public static final AnimationDefinition WALK = AnimationDefinition.Builder.create(2f).looping() - .addBoneAnimation("broadhoof_goat", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(5f, 0f, -10f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-2.19f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(5f, 0f, 10f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-1.91f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(5f, 0f, -10f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 5f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -5f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 5f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_front_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, -1f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0f, 2f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, -1f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_front_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(15f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.8343333f, AnimationHelper.createRotationalVector(-15f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_hind_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, -1f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, 0f, 2f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_hind_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(15f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.8343334f, AnimationHelper.createRotationalVector(-15f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_front_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, -1f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, 0f, 2f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_front_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(15f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.8343334f, AnimationHelper.createRotationalVector(-15f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_hind_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, -1f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0f, 2f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, -1f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_hind_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(15f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.8343333f, AnimationHelper.createRotationalVector(-15f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))).build(); - public static final AnimationDefinition RUN = AnimationDefinition.Builder.create(0.7440476190476191f).looping() - .addBoneAnimation("broadhoof_goat", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.44642857142857145f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.7440476190476191f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.44642857142857145f, AnimationHelper.createRotationalVector(5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.7440476190476191f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_front_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.24801587301587302f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.3472222222222222f, AnimationHelper.createTranslationalVector(0f, 0.4f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.7440476190476191f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_front_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-45f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.24801587301587302f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.3472222222222222f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.49603174603174605f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.7440476190476191f, AnimationHelper.createRotationalVector(-45f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_hind_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.0992063492063492f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.24801587301587302f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.44642857142857145f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_hind_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(52.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.24801587301587302f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.44642857142857145f, AnimationHelper.createRotationalVector(-30f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5456349206349206f, AnimationHelper.createRotationalVector(-2.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.7440476190476191f, AnimationHelper.createRotationalVector(52.5f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_front_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.24801587301587302f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.3472222222222222f, AnimationHelper.createTranslationalVector(0f, 0.4f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.7440476190476191f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_front_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-45f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.24801587301587302f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.3472222222222222f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.49603174603174605f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.7440476190476191f, AnimationHelper.createRotationalVector(-45f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_hind_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.0992063492063492f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.24801587301587302f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.44642857142857145f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_hind_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(52.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.24801587301587302f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.44642857142857145f, AnimationHelper.createRotationalVector(-30f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5456349206349206f, AnimationHelper.createRotationalVector(-2.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.7440476190476191f, AnimationHelper.createRotationalVector(52.5f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.3968253968253968f, AnimationHelper.createTranslationalVector(0f, -0.5f, -0.5f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.7440476190476191f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.3968253968253968f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.7440476190476191f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))).build(); - public static final AnimationDefinition JUMP = AnimationDefinition.Builder.create(0f).looping() - .addBoneAnimation("broadhoof_goat", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation(EntityModelPartNames.BODY, - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_front_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_front_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-45f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_hind_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_hind_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(52.5f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_front_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_front_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-45f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_hind_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_hind_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(52.5f, 0f, 0f), - Transformation.Interpolations.CUBIC))).build(); - public static final AnimationDefinition LYING = AnimationDefinition.Builder.create(0f) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -8f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_front_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -8f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_front_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, -25f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_hind_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(-1f, -8f, 1f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_hind_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, -40f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_front_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -8f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_front_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, 25f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_hind_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(-1f, -8f, 1f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_hind_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, 40f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition LAY_DOWN = AnimationDefinition.Builder.create(1.75f) - .addBoneAnimation("broadhoof_goat", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, -8f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, -5f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.9583434f, AnimationHelper.createRotationalVector(0f, 0f, 5f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, -0.31f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_front_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, -2f, -2f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, -8f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_front_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(-37.25f, -15.76f, -19.66f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(-90f, -25f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_hind_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(-1f, -8f, 1f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_hind_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(-90f, -40f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_front_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.25f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(1f, -1f, -1f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, -8f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_front_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-39.03f, 9.58f, 11.6f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(-90f, 25f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_hind_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(-1f, -8f, 1f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_hind_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(-90f, 40f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(32.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))).build(); - public static final AnimationDefinition STAND_UP = AnimationDefinition.Builder.create(1.25f) - .addBoneAnimation("broadhoof_goat", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -8f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createTranslationalVector(0f, -2f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.2916767f, AnimationHelper.createRotationalVector(-22.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(27.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_front_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -8f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.2916767f, AnimationHelper.createTranslationalVector(0f, -3f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_front_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, -25f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.2916767f, AnimationHelper.createRotationalVector(-55f, -25f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_hind_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(-1f, -8f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(-1f, -3f, 1f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_hind_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, -40f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(-57.5f, -40f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_front_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -8f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.2916767f, AnimationHelper.createTranslationalVector(0f, -3f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_front_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, 25f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.2916767f, AnimationHelper.createRotationalVector(-55f, 25f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_hind_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(-1f, -8f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(-1f, -3f, 1f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_hind_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, 40f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(-57.5f, 40f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))).build(); - public static final AnimationDefinition RAM_ATTACK = AnimationDefinition.Builder.create(1.25f) - .addBoneAnimation("broadhoof_goat", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.2916767f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.4583433f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.2916767f, AnimationHelper.createRotationalVector(-32.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.2916767f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.2916767f, AnimationHelper.createRotationalVector(22.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(47.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.8343334f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_front_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.2916767f, AnimationHelper.createTranslationalVector(0f, 5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_front_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(-20f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_hind_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.2916767f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("left_hind_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.2916767f, AnimationHelper.createRotationalVector(-1.25f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(57.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_front_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.2916767f, AnimationHelper.createTranslationalVector(0f, 5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_front_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(-20f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_hind_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.2916767f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_hind_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.2916767f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(55f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))).build(); - public static final AnimationDefinition EAT = AnimationDefinition.Builder.create(3.5f) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, -0.5f, -1f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.125f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(51.67f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(64.17f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.0834333f, AnimationHelper.createRotationalVector(69.17f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.375f, AnimationHelper.createRotationalVector(64.17f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.7083433f, AnimationHelper.createRotationalVector(69.17f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(64.17f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.3433335f, AnimationHelper.createRotationalVector(69.17f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.625f, AnimationHelper.createRotationalVector(64.17f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.125f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))).build(); - public static final AnimationDefinition CHARGE_ATTACK = AnimationDefinition.Builder.create(0f) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(37.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition START_CHARGING = AnimationDefinition.Builder.create(0.5f) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(55f, 0f, 0f), - Transformation.Interpolations.CUBIC))).build(); - public static final AnimationDefinition STOP_CHARGING = AnimationDefinition.Builder.create(0.5f) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(55f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))).build(); + public static final AnimationDefinition WALK = AnimationDefinition.Builder.withLength(2f).looping() + .addAnimation("broadhoof_goat", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(5f, 0f, -10f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-2.19f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(5f, 0f, 10f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-1.91f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(5f, 0f, -10f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 5f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_front_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 0f, 2f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 3f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_front_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(15f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.8343333f, KeyframeAnimations.degreeVec(-15f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_hind_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 3f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, 0f, 2f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0f, 3f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_hind_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(15f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.8343334f, KeyframeAnimations.degreeVec(-15f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_front_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 3f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, 0f, 2f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0f, 3f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_front_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(15f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.8343334f, KeyframeAnimations.degreeVec(-15f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_hind_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 0f, 2f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 3f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_hind_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(15f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.8343333f, KeyframeAnimations.degreeVec(-15f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); + public static final AnimationDefinition RUN = AnimationDefinition.Builder.withLength(0.7440476190476191f).looping() + .addAnimation("broadhoof_goat", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.44642857142857145f, KeyframeAnimations.posVec(0f, -1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.7440476190476191f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.44642857142857145f, KeyframeAnimations.degreeVec(5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.7440476190476191f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_front_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.24801587301587302f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.3472222222222222f, KeyframeAnimations.posVec(0f, 0.4f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.7440476190476191f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_front_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-45f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.24801587301587302f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.3472222222222222f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.49603174603174605f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.7440476190476191f, KeyframeAnimations.degreeVec(-45f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_hind_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.0992063492063492f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.24801587301587302f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.44642857142857145f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_hind_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(52.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.24801587301587302f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.44642857142857145f, KeyframeAnimations.degreeVec(-30f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5456349206349206f, KeyframeAnimations.degreeVec(-2.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.7440476190476191f, KeyframeAnimations.degreeVec(52.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_front_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.24801587301587302f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.3472222222222222f, KeyframeAnimations.posVec(0f, 0.4f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.7440476190476191f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_front_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-45f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.24801587301587302f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.3472222222222222f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.49603174603174605f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.7440476190476191f, KeyframeAnimations.degreeVec(-45f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_hind_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.0992063492063492f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.24801587301587302f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.44642857142857145f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_hind_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(52.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.24801587301587302f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.44642857142857145f, KeyframeAnimations.degreeVec(-30f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5456349206349206f, KeyframeAnimations.degreeVec(-2.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.7440476190476191f, KeyframeAnimations.degreeVec(52.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.3968253968253968f, KeyframeAnimations.posVec(0f, -0.5f, -0.5f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.7440476190476191f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.3968253968253968f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.7440476190476191f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); + public static final AnimationDefinition JUMP = AnimationDefinition.Builder.withLength(0f).looping() + .addAnimation("broadhoof_goat", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation(PartNames.BODY, + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_front_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_front_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-45f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_hind_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_hind_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(52.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_front_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_front_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-45f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_hind_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_hind_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(52.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); + public static final AnimationDefinition LYING = AnimationDefinition.Builder.withLength(0f) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -8f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_front_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -8f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_front_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, -25f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_hind_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(-1f, -8f, 1f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_hind_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, -40f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_front_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -8f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_front_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, 25f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_hind_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(-1f, -8f, 1f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_hind_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, 40f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition LAY_DOWN = AnimationDefinition.Builder.withLength(1.75f) + .addAnimation("broadhoof_goat", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, -8f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, -5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.9583434f, KeyframeAnimations.degreeVec(0f, 0f, 5f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, -0.31f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_front_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.posVec(0f, -2f, -2f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, -8f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_front_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(-37.25f, -15.76f, -19.66f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(-90f, -25f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_hind_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(-1f, -8f, 1f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_hind_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(-90f, -40f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_front_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.posVec(1f, -1f, -1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, -8f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_front_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-39.03f, 9.58f, 11.6f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(-90f, 25f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_hind_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(-1f, -8f, 1f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_hind_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(-90f, 40f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(32.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); + public static final AnimationDefinition STAND_UP = AnimationDefinition.Builder.withLength(1.25f) + .addAnimation("broadhoof_goat", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -8f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.posVec(0f, -2f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2916767f, KeyframeAnimations.degreeVec(-22.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(-7.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(27.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_front_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -8f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2916767f, KeyframeAnimations.posVec(0f, -3f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_front_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, -25f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2916767f, KeyframeAnimations.degreeVec(-55f, -25f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_hind_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(-1f, -8f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.posVec(-1f, -3f, 1f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_hind_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, -40f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(-57.5f, -40f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_front_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -8f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2916767f, KeyframeAnimations.posVec(0f, -3f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_front_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, 25f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2916767f, KeyframeAnimations.degreeVec(-55f, 25f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_hind_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(-1f, -8f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.posVec(-1f, -3f, 1f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_hind_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, 40f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(-57.5f, 40f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); + public static final AnimationDefinition RAM_ATTACK = AnimationDefinition.Builder.withLength(1.25f) + .addAnimation("broadhoof_goat", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2916767f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583433f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2916767f, KeyframeAnimations.degreeVec(-32.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2916767f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2916767f, KeyframeAnimations.degreeVec(22.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(47.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.8343334f, KeyframeAnimations.degreeVec(-7.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_front_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2916767f, KeyframeAnimations.posVec(0f, 5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_front_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(-20f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_hind_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2916767f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("left_hind_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2916767f, KeyframeAnimations.degreeVec(-1.25f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(57.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_front_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2916767f, KeyframeAnimations.posVec(0f, 5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_front_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(-20f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_hind_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2916767f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_hind_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2916767f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(55f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); + public static final AnimationDefinition EAT = AnimationDefinition.Builder.withLength(3.5f) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, -0.5f, -1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.125f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(51.67f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(64.17f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0834333f, KeyframeAnimations.degreeVec(69.17f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.375f, KeyframeAnimations.degreeVec(64.17f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.7083433f, KeyframeAnimations.degreeVec(69.17f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(64.17f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.3433335f, KeyframeAnimations.degreeVec(69.17f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.625f, KeyframeAnimations.degreeVec(64.17f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.125f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); + public static final AnimationDefinition CHARGE_ATTACK = AnimationDefinition.Builder.withLength(0f) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(37.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition START_CHARGING = AnimationDefinition.Builder.withLength(0.5f) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(55f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); + public static final AnimationDefinition STOP_CHARGING = AnimationDefinition.Builder.withLength(0.5f) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(55f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatBeads.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatBeads.java index 74cb963c40..84c04afbb3 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatBeads.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatBeads.java @@ -1,9 +1,9 @@ package net.sevenstars.middleearth.entity.beasts.broadhoof; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.util.function.ValueLists; +import net.minecraft.util.ByIdMap; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; import net.sevenstars.middleearth.item.ResourceItemsME; import java.util.Map; @@ -33,8 +33,8 @@ public static BroadhoofGoatBeads getBeads(ItemStack stack) { return BEARD_MATERIALS.get(stack.getItem()); } - private static final IntFunction INDEX_MAPPER = ValueLists.createIndexToValueFunction( - BroadhoofGoatBeads::getIndex, values(), ValueLists.OutOfBoundsHandling.WRAP + private static final IntFunction INDEX_MAPPER = ByIdMap.continuous( + BroadhoofGoatBeads::getIndex, values(), ByIdMap.OutOfBoundsStrategy.WRAP ); private final int index; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatColor.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatColor.java index 426e93c63a..d923a28d9e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatColor.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatColor.java @@ -3,16 +3,15 @@ import com.google.common.collect.Maps; import com.mojang.serialization.Codec; import io.netty.buffer.ByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.util.StringIdentifiable; -import net.minecraft.util.function.ValueLists; - import java.util.Map; import java.util.Set; import java.util.function.IntFunction; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.util.ByIdMap; +import net.minecraft.util.StringRepresentable; -public enum BroadhoofGoatColor implements StringIdentifiable { +public enum BroadhoofGoatColor implements StringRepresentable { WHITE(0, "white"), LIGHT_GRAY(1, "light_gray"), PALE(2, "pale"), @@ -21,11 +20,11 @@ public enum BroadhoofGoatColor implements StringIdentifiable { GRAY(5, "gray"), BLACK(6, "black"); - public static final Codec CODEC = StringIdentifiable.createCodec(BroadhoofGoatColor::values); - private static final IntFunction INDEX_MAPPER = ValueLists.createIndexToValueFunction( - BroadhoofGoatColor::getIndex, values(), ValueLists.OutOfBoundsHandling.WRAP + public static final Codec CODEC = StringRepresentable.fromEnum(BroadhoofGoatColor::values); + private static final IntFunction INDEX_MAPPER = ByIdMap.continuous( + BroadhoofGoatColor::getIndex, values(), ByIdMap.OutOfBoundsStrategy.WRAP ); - public static final PacketCodec PACKET_CODEC = PacketCodecs.indexed(INDEX_MAPPER, BroadhoofGoatColor::getIndex); + public static final StreamCodec PACKET_CODEC = ByteBufCodecs.idMapper(INDEX_MAPPER, BroadhoofGoatColor::getIndex); private final int index; private final String id; @@ -43,7 +42,7 @@ public static BroadhoofGoatColor byIndex(int index) { } @Override - public String asString() { + public String getSerializedName() { return this.id; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatEntity.java index ebc9fc629c..9305ef2455 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatEntity.java @@ -1,45 +1,60 @@ package net.sevenstars.middleearth.entity.beasts.broadhoof; -import net.minecraft.block.BlockState; -import net.minecraft.component.ComponentType; -import net.minecraft.component.ComponentsAccess; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.FoodComponent; -import net.minecraft.entity.*; -import net.minecraft.entity.ai.goal.*; -import net.minecraft.entity.attribute.DefaultAttributeContainer; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.data.TrackedData; -import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.entity.passive.*; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.GoatHornItem; -import net.minecraft.item.Instrument; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.tag.InstrumentTags; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.BlockSoundGroup; -import net.minecraft.sound.SoundEvent; -import net.minecraft.sound.SoundEvents; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.Util; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.LocalDifficulty; -import net.minecraft.world.ServerWorldAccess; -import net.minecraft.world.World; +import net.minecraft.Util; +import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.tags.InstrumentTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.tags.TagKey; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.AgeableMob; +import net.minecraft.world.entity.AnimationState; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntityEvent; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.Pose; +import net.minecraft.world.entity.SpawnGroupData; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.goal.BreedGoal; +import net.minecraft.world.entity.ai.goal.FloatGoal; +import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; +import net.minecraft.world.entity.ai.goal.MeleeAttackGoal; +import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; +import net.minecraft.world.entity.ai.goal.TemptGoal; +import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; +import net.minecraft.world.entity.animal.Animal; +import net.minecraft.world.entity.animal.horse.AbstractHorse; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.Instrument; +import net.minecraft.world.item.InstrumentItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.ServerLevelAccessor; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.config.ModServerConfigs; import net.sevenstars.middleearth.entity.EntitiesME; @@ -48,7 +63,6 @@ import net.sevenstars.middleearth.entity.goals.BeastRevengeGoal; import net.sevenstars.middleearth.entity.goals.ChargeAttackGoal; import net.sevenstars.middleearth.entity.npcs.NpcEntity; -import net.sevenstars.middleearth.item.DataComponentTypesME; import net.sevenstars.middleearth.resources.datas.common.DispositionType; import net.sevenstars.middleearth.resources.datas.common.RaceType; import net.sevenstars.middleearth.utils.PlayerUtil; @@ -59,76 +73,76 @@ import java.util.function.IntUnaryOperator; public class BroadhoofGoatEntity extends AbstractBeastEntity { - private static final float MIN_MOVEMENT_SPEED_BONUS = (float)BroadhoofGoatEntity.getChildMovementSpeedBonus(() -> 0.0); - private static final float MAX_MOVEMENT_SPEED_BONUS = (float)BroadhoofGoatEntity.getChildMovementSpeedBonus(() -> 1.0); - private static final float MIN_JUMP_STRENGTH_BONUS = (float)BroadhoofGoatEntity.getChildJumpStrengthBonus(() -> 0.0); - private static final float MAX_JUMP_STRENGTH_BONUS = (float)BroadhoofGoatEntity.getChildJumpStrengthBonus(() -> 1.0); - private static final float MIN_HEALTH_BONUS = BroadhoofGoatEntity.getChildHealthBonus(max -> 0); - private static final float MAX_HEALTH_BONUS = BroadhoofGoatEntity.getChildHealthBonus(max -> max - 1); - private static final TrackedData VARIANT = DataTracker.registerData(BroadhoofGoatEntity.class, TrackedDataHandlerRegistry.INTEGER); - private static final TrackedData BEADS = DataTracker.registerData(BroadhoofGoatEntity.class, TrackedDataHandlerRegistry.INTEGER); - private static final TrackedData HAIR = DataTracker.registerData(BroadhoofGoatEntity.class, TrackedDataHandlerRegistry.BOOLEAN); - private static final TrackedData LEFT_HORN = DataTracker.registerData(BroadhoofGoatEntity.class, TrackedDataHandlerRegistry.BOOLEAN); - private static final TrackedData RIGHT_HORN = DataTracker.registerData(BroadhoofGoatEntity.class, TrackedDataHandlerRegistry.BOOLEAN); - private static final TrackedData BRUSHED_BEARD = DataTracker.registerData(BroadhoofGoatEntity.class, TrackedDataHandlerRegistry.BOOLEAN); - private static final TrackedData MOUNTABLE = DataTracker.registerData(BroadhoofGoatEntity.class, TrackedDataHandlerRegistry.BOOLEAN); + private static final float MIN_MOVEMENT_SPEED_BONUS = (float)BroadhoofGoatEntity.generateSpeed(() -> 0.0); + private static final float MAX_MOVEMENT_SPEED_BONUS = (float)BroadhoofGoatEntity.generateSpeed(() -> 1.0); + private static final float MIN_JUMP_STRENGTH_BONUS = (float)BroadhoofGoatEntity.generateJumpStrength(() -> 0.0); + private static final float MAX_JUMP_STRENGTH_BONUS = (float)BroadhoofGoatEntity.generateJumpStrength(() -> 1.0); + private static final float MIN_HEALTH_BONUS = BroadhoofGoatEntity.generateMaxHealth(max -> 0); + private static final float MAX_HEALTH_BONUS = BroadhoofGoatEntity.generateMaxHealth(max -> max - 1); + private static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(BroadhoofGoatEntity.class, EntityDataSerializers.INT); + private static final EntityDataAccessor BEADS = SynchedEntityData.defineId(BroadhoofGoatEntity.class, EntityDataSerializers.INT); + private static final EntityDataAccessor HAIR = SynchedEntityData.defineId(BroadhoofGoatEntity.class, EntityDataSerializers.BOOLEAN); + private static final EntityDataAccessor LEFT_HORN = SynchedEntityData.defineId(BroadhoofGoatEntity.class, EntityDataSerializers.BOOLEAN); + private static final EntityDataAccessor RIGHT_HORN = SynchedEntityData.defineId(BroadhoofGoatEntity.class, EntityDataSerializers.BOOLEAN); + private static final EntityDataAccessor BRUSHED_BEARD = SynchedEntityData.defineId(BroadhoofGoatEntity.class, EntityDataSerializers.BOOLEAN); + private static final EntityDataAccessor MOUNTABLE = SynchedEntityData.defineId(BroadhoofGoatEntity.class, EntityDataSerializers.BOOLEAN); public final AnimationState jumpAnimationState = new AnimationState(); - private static final EntityDimensions BABY_BASE_DIMENSIONS = EntitiesME.BROADHOOF_GOAT.getDimensions().scaled(0.5f); + private static final EntityDimensions BABY_BASE_DIMENSIONS = EntitiesME.BROADHOOF_GOAT.getDimensions().scale(0.5f); - public BroadhoofGoatEntity(EntityType entityType, World world) { + public BroadhoofGoatEntity(EntityType entityType, Level world) { super(entityType, world); } - public static DefaultAttributeContainer.Builder setAttributes() { - return AnimalEntity.createAnimalAttributes() - .add(EntityAttributes.MOVEMENT_SPEED, 0.2) - .add(EntityAttributes.MAX_HEALTH, 50.0d) - .add(EntityAttributes.KNOCKBACK_RESISTANCE, 0.4d) - .add(EntityAttributes.ATTACK_SPEED, 1.0d) - .add(EntityAttributes.FOLLOW_RANGE, 38.0d) - .add(EntityAttributes.ATTACK_DAMAGE, 4.0d) - .add(EntityAttributes.STEP_HEIGHT, 1.15d) - .add(EntityAttributes.SAFE_FALL_DISTANCE, 10.0d) + public static AttributeSupplier.Builder setAttributes() { + return Mob.createMobAttributes() + .add(Attributes.MOVEMENT_SPEED, 0.2) + .add(Attributes.MAX_HEALTH, 50.0d) + .add(Attributes.KNOCKBACK_RESISTANCE, 0.4d) + .add(Attributes.ATTACK_SPEED, 1.0d) + .add(Attributes.FOLLOW_RANGE, 38.0d) + .add(Attributes.ATTACK_DAMAGE, 4.0d) + .add(Attributes.STEP_HEIGHT, 1.15d) + .add(Attributes.SAFE_FALL_DISTANCE, 10.0d) .add(EntityAttributesME.POWDERED_SNOW_IMMUNITY, 1.0f) - .add(EntityAttributes.JUMP_STRENGTH, 1); + .add(Attributes.JUMP_STRENGTH, 1); } @Override - protected void initAttributes(Random random) { - this.getAttributeInstance(EntityAttributes.MAX_HEALTH).setBaseValue(this.getChildHealthBonus(random::nextInt)); - this.getAttributeInstance(EntityAttributes.MOVEMENT_SPEED).setBaseValue(this.getChildMovementSpeedBonus(random::nextDouble)); - this.getAttributeInstance(EntityAttributes.JUMP_STRENGTH).setBaseValue(this.getChildJumpStrengthBonus(random::nextDouble)); + protected void randomizeAttributes(RandomSource random) { + this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.generateMaxHealth(random::nextInt)); + this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.generateSpeed(random::nextDouble)); + this.getAttribute(Attributes.JUMP_STRENGTH).setBaseValue(this.generateJumpStrength(random::nextDouble)); } @Override - protected void initGoals() { - this.goalSelector.add(1, new SwimGoal(this)); - this.goalSelector.add(2, new WanderAroundFarGoal(this, 1.0)); - this.goalSelector.add(3, new MeleeAttackGoal(this, 2.5, false)); - this.goalSelector.add(4, new ChargeAttackGoal(this, null, maxChargeCooldown())); - this.goalSelector.add(5, new AnimalMateGoal(this, 1.5)); - this.goalSelector.add(6, new TemptGoal(this, 1.0, (stack) -> {return stack.isIn(ItemTags.COW_FOOD);}, false)); - this.goalSelector.add(7, new LookAtEntityGoal(this, PlayerEntity.class, 6.0f)); - this.goalSelector.add(8, new LookAroundGoal(this)); - this.targetSelector.add(1, new BeastRevengeGoal(this, new Class[0]).setGroupRevenge()); + protected void registerGoals() { + this.goalSelector.addGoal(1, new FloatGoal(this)); + this.goalSelector.addGoal(2, new WaterAvoidingRandomStrollGoal(this, 1.0)); + this.goalSelector.addGoal(3, new MeleeAttackGoal(this, 2.5, false)); + this.goalSelector.addGoal(4, new ChargeAttackGoal(this, null, maxChargeCooldown())); + this.goalSelector.addGoal(5, new BreedGoal(this, 1.5)); + this.goalSelector.addGoal(6, new TemptGoal(this, 1.0, (stack) -> {return stack.is(ItemTags.COW_FOOD);}, false)); + this.goalSelector.addGoal(7, new LookAtPlayerGoal(this, Player.class, 6.0f)); + this.goalSelector.addGoal(8, new RandomLookAroundGoal(this)); + this.targetSelector.addGoal(1, new BeastRevengeGoal(this, new Class[0]).setGroupRevenge()); } @Override - protected void initDataTracker(DataTracker.Builder builder) { - super.initDataTracker(builder); - builder.add(VARIANT, 0); - builder.add(BEADS, 0); - builder.add(HAIR, false); - builder.add(LEFT_HORN, true); - builder.add(RIGHT_HORN, true); - builder.add(BRUSHED_BEARD, false); - builder.add(MOUNTABLE, true); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(VARIANT, 0); + builder.define(BEADS, 0); + builder.define(HAIR, false); + builder.define(LEFT_HORN, true); + builder.define(RIGHT_HORN, true); + builder.define(BRUSHED_BEARD, false); + builder.define(MOUNTABLE, true); } @Override - protected void writeCustomData(WriteView view) { - super.writeCustomData(view); + public void addAdditionalSaveData(CompoundTag view) { + super.addAdditionalSaveData(view); view.putInt("Variant", this.getGoatVariant()); view.putInt("Beads", this.getGoatBeadsIndex()); view.putBoolean("Hair", this.hasHair()); @@ -138,26 +152,26 @@ protected void writeCustomData(WriteView view) { } @Override - protected void readCustomData(ReadView view) { - super.readCustomData(view); - this.dataTracker.set(VARIANT, view.getInt("Variant", 0)); - this.dataTracker.set(BEADS, view.getInt("Beads", 0)); - this.dataTracker.set(HAIR, view.getBoolean("Hair", false)); - this.dataTracker.set(LEFT_HORN, view.getBoolean("HasLeftHorn", true)); - this.dataTracker.set(RIGHT_HORN, view.getBoolean("HasRightHorn", true)); - this.dataTracker.set(BRUSHED_BEARD, view.getBoolean("HasBrushedBeard", false)); - this.dataTracker.set(MOUNTABLE, ModServerConfigs.ENABLE_MOUNT_BROADHOOF_GOAT); + public void readAdditionalSaveData(CompoundTag view) { + super.readAdditionalSaveData(view); + this.entityData.set(VARIANT, view.getInt("Variant")); + this.entityData.set(BEADS, view.getInt("Beads")); + this.entityData.set(HAIR, view.getBoolean("Hair")); + this.entityData.set(LEFT_HORN, !view.contains("HasLeftHorn") || view.getBoolean("HasLeftHorn")); + this.entityData.set(RIGHT_HORN, !view.contains("HasRightHorn") || view.getBoolean("HasRightHorn")); + this.entityData.set(BRUSHED_BEARD, view.getBoolean("HasBrushedBeard")); + this.entityData.set(MOUNTABLE, ModServerConfigs.ENABLE_MOUNT_BROADHOOF_GOAT); } - protected static float getChildHealthBonus(IntUnaryOperator randomIntGetter) { + protected static float generateMaxHealth(IntUnaryOperator randomIntGetter) { return 20.0f + (float)randomIntGetter.applyAsInt(8) + (float)randomIntGetter.applyAsInt(8); } - protected static double getChildJumpStrengthBonus(DoubleSupplier randomDoubleGetter) { + protected static double generateJumpStrength(DoubleSupplier randomDoubleGetter) { return (double)0.8f + randomDoubleGetter.getAsDouble() * 0.2 + randomDoubleGetter.getAsDouble() * 0.2 + randomDoubleGetter.getAsDouble() * 0.2; } - protected static double getChildMovementSpeedBonus(DoubleSupplier randomDoubleGetter) { + protected static double generateSpeed(DoubleSupplier randomDoubleGetter) { return ((double)0.4f + randomDoubleGetter.getAsDouble() * 0.2 + randomDoubleGetter.getAsDouble() * 0.2 + randomDoubleGetter.getAsDouble() * 0.2) * 0.25; } @@ -172,45 +186,45 @@ public List getCompatibleRaces() { } @Override - public ActionResult interactMob(PlayerEntity player, Hand hand) { + public InteractionResult mobInteract(Player player, InteractionHand hand) { - ItemStack itemStack = player.getStackInHand(hand); + ItemStack itemStack = player.getItemInHand(hand); if(this.isClientWorld()) { // Client if(itemStack.isEmpty()) { - return super.interactMob(player, hand); + return super.mobInteract(player, hand); } } else { // Server for(RaceType race : this.getCompatibleRaces()) { // Check for race if(PlayerUtil.isOfRace(player, race) || player.isCreative()) { - if(this.isTame()) { - if (this.isBreedingItem(itemStack)) { // Feed + if(this.isTamed()) { + if (this.isFood(itemStack)) { // Feed if(this.getHealth() < this.getMaxHealth()) { // Food provides health - itemStack.decrementUnlessCreative(1, player); - FoodComponent foodComponent = itemStack.get(DataComponentTypes.FOOD); + itemStack.consume(1, player); + FoodProperties foodComponent = itemStack.get(DataComponents.FOOD); float f = foodComponent != null ? (float)foodComponent.nutrition() : 1.0f; this.heal(2.0f * f); - return ActionResult.SUCCESS_SERVER; + return InteractionResult.SUCCESS; } - else if (this.getBreedingAge() == 0 && this.canEat()) { // Food provides baby - this.eat(player, hand, itemStack); - this.lovePlayer(player); - return ActionResult.SUCCESS_SERVER; + else if (this.getAge() == 0 && this.canFallInLove()) { // Food provides baby + this.usePlayerItem(player, hand, itemStack); + this.setInLove(player); + return InteractionResult.SUCCESS; } } - else if(itemStack.isOf(Items.BRUSH)) { // Brush beard + else if(itemStack.is(Items.BRUSH)) { // Brush beard this.setBrushedBeard(true); - return ActionResult.SUCCESS_SERVER; + return InteractionResult.SUCCESS; } else if(hasBrushedBeard()) { if(BroadhoofGoatBeads.isValidMaterial(itemStack)) { this.setGoatBeads(BroadhoofGoatBeads.getBeads(itemStack)); - itemStack.decrementUnlessCreative(1, player); + itemStack.consume(1, player); - return ActionResult.SUCCESS_SERVER; + return InteractionResult.SUCCESS; } - else if(itemStack.isOf(Items.SHEARS)) { // Un-Brush beard + else if(itemStack.is(Items.SHEARS)) { // Un-Brush beard if(getGoatBeads().equals(BroadhoofGoatBeads.NONE)) { this.setBrushedBeard(false); } @@ -219,25 +233,26 @@ else if(itemStack.isOf(Items.SHEARS)) { // Un-Brush beard } if(!player.isCreative()) { - itemStack.damage(1, player); + itemStack.hurtAndBreak(1, player, + hand == InteractionHand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND); } - return ActionResult.SUCCESS_SERVER; + return InteractionResult.SUCCESS; } } } - return super.interactMob(player, hand); + return super.mobInteract(player, hand); } } } - return ActionResult.PASS; + return InteractionResult.PASS; } @Override - protected Vec3d getPassengerAttachmentPos(Entity passenger, EntityDimensions dimensions, float scaleFactor) { - float animationSpeed = this.limbAnimator.getSpeed(); - float animationProgress = this.limbAnimator.getAnimationProgress() * (MathHelper.PI / 180) * 18; + protected Vec3 getPassengerAttachmentPoint(Entity passenger, EntityDimensions dimensions, float scaleFactor) { + float animationSpeed = this.walkAnimation.speed(); + float animationProgress = this.walkAnimation.position() * (Mth.PI / 180) * 18; boolean sprinting = passenger.isSprinting(); @@ -245,21 +260,21 @@ protected Vec3d getPassengerAttachmentPos(Entity passenger, EntityDimensions dim float frequency = sprinting ? (1.2f/0.74f) : 4; double y = sprinting ? - MathHelper.sin(animationProgress * frequency + MathHelper.PI / 4) * 0.11 * animationSpeed - 0.05 : - MathHelper.cos(animationProgress * frequency) * 0.06 * animationSpeed - 0.05; + Mth.sin(animationProgress * frequency + Mth.PI / 4) * 0.11 * animationSpeed - 0.05 : + Mth.cos(animationProgress * frequency) * 0.06 * animationSpeed - 0.05; if(this.isSitting()) { y = -0.5; } - return super.getPassengerAttachmentPos(passenger, dimensions, scaleFactor).add(0, y,0); + return super.getPassengerAttachmentPoint(passenger, dimensions, scaleFactor).add(0, y,0); } @Override @Nullable - public PassiveEntity createChild(ServerWorld world, PassiveEntity entity) { + public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) { BroadhoofGoatEntity broadhoofEntity = (BroadhoofGoatEntity)entity; - BroadhoofGoatEntity broadhoofEntity2 = EntitiesME.BROADHOOF_GOAT.create(world, SpawnReason.BREEDING); + BroadhoofGoatEntity broadhoofEntity2 = EntitiesME.BROADHOOF_GOAT.create(world); if (broadhoofEntity2 != null) { int i = this.random.nextInt(9); BroadhoofGoatColor goatColor = i < 4 ? this.getGoatColor() : (i < 8 ? broadhoofEntity.getGoatColor() : Util.getRandom(BroadhoofGoatColor.values(), this.random)); @@ -269,118 +284,122 @@ public PassiveEntity createChild(ServerWorld world, PassiveEntity entity) { BroadhoofGoatHorns broadhoofHorns = i < 2 ? this.getHorns() : (i < 4 ? broadhoofEntity.getHorns() : Util.getRandom(BroadhoofGoatHorns.values(), this.random)); broadhoofEntity2.setGoatVariant(goatColor, goatPattern, broadhoofHorns); - this.setChildAttributes(entity, broadhoofEntity2); + this.setOffspringAttributes(entity, broadhoofEntity2); } return broadhoofEntity2; } @Override - protected void setChildAttributes(PassiveEntity other, AbstractHorseEntity child) { - this.setChildAttribute(other, child, EntityAttributes.MAX_HEALTH, MIN_HEALTH_BONUS, MAX_HEALTH_BONUS); - this.setChildAttribute(other, child, EntityAttributes.JUMP_STRENGTH, MIN_JUMP_STRENGTH_BONUS, MAX_JUMP_STRENGTH_BONUS); - this.setChildAttribute(other, child, EntityAttributes.MOVEMENT_SPEED, MIN_MOVEMENT_SPEED_BONUS, MAX_MOVEMENT_SPEED_BONUS); + protected void setOffspringAttributes(AgeableMob other, AbstractHorse child) { + this.setOffspringAttribute(other, child, Attributes.MAX_HEALTH, MIN_HEALTH_BONUS, MAX_HEALTH_BONUS); + this.setOffspringAttribute(other, child, Attributes.JUMP_STRENGTH, MIN_JUMP_STRENGTH_BONUS, MAX_JUMP_STRENGTH_BONUS); + this.setOffspringAttribute(other, child, Attributes.MOVEMENT_SPEED, MIN_MOVEMENT_SPEED_BONUS, MAX_MOVEMENT_SPEED_BONUS); } @Override - public EntityDimensions getBaseDimensions(EntityPose pose) { - return this.isBaby() ? BABY_BASE_DIMENSIONS : super.getBaseDimensions(pose); + public EntityDimensions getDefaultDimensions(Pose pose) { + return this.isBaby() ? BABY_BASE_DIMENSIONS : super.getDefaultDimensions(pose); } @Override public boolean isMountable() { - return this.dataTracker.get(MOUNTABLE); + return this.entityData.get(MOUNTABLE); } @Override - protected boolean isTamable(PlayerEntity player) { + protected boolean isTamable(Player player) { return this.isMountable(); } @Override - public boolean canBreedWith(AnimalEntity other) { + public boolean canMate(Animal other) { return other instanceof BroadhoofGoatEntity; } @Override - public boolean isBreedingItem(ItemStack stack) { - return stack.isIn(ItemTags.GOAT_FOOD); + public boolean isFood(ItemStack stack) { + return stack.is(ItemTags.GOAT_FOOD); } @Override - public boolean tryAttack(ServerWorld world, Entity target) { - if(!world.isClient && super.tryAttack(world, target)) { - this.getWorld().sendEntityStatus(this, EntityStatuses.PLAY_ATTACK_SOUND); + public boolean doHurtTarget(Entity target) { + boolean result = super.doHurtTarget(target); + if (result) { + this.level().broadcastEntityEvent(this, EntityEvent.START_ATTACKING); } - - return super.tryAttack(world, target); + return result; } @Override public void chargeAttack() { - List entities = this.getWorld().getOtherEntities(this, this.getBoundingBox().expand(0.2,0,0.2)); - - if(!this.isTame() && !this.getWorld().isClient) { - if(targetDir == Vec3d.ZERO && this.getTarget() != null) { - targetDir = new Vec3d( this.getTarget().getBlockPos().getX() - this.getBlockPos().getX(), - this.getTarget().getBlockPos().getY() - this.getBlockPos().getY(), - this.getTarget().getBlockPos().getZ() - this.getBlockPos().getZ()); + if(!this.isTamed() && !this.level().isClientSide) { + if(targetDir == Vec3.ZERO && this.getTarget() != null) { + targetDir = new Vec3( this.getTarget().blockPosition().getX() - this.blockPosition().getX(), + this.getTarget().blockPosition().getY() - this.blockPosition().getY(), + this.getTarget().blockPosition().getZ() - this.blockPosition().getZ()); } - this.setYaw((float) Math.toDegrees(Math.atan2(-targetDir.x, targetDir.z))); - this.setVelocity(targetDir.multiply(1,0,1).normalize().multiply(1.0d - ((double)MathHelper.abs(this.chargeTimeout - (maxChargeCooldown() - chargeDuration()) - (chargeDuration() * 0.2f)) / chargeDuration())).add(0, this.getVelocity().y, 0)); + this.setYRot((float) Math.toDegrees(Math.atan2(-targetDir.x, targetDir.z))); + this.setDeltaMovement(targetDir.multiply(1,0,1).normalize().scale(1.0d - ((double)Mth.abs(this.chargeTimeout - (maxChargeCooldown() - chargeDuration()) - (chargeDuration() * 0.2f)) / chargeDuration())).add(0, this.getDeltaMovement().y, 0)); } - else if (this.getWorld().isClient) { - this.setVelocity(this.getRotationVector().multiply(1,0,1).normalize().multiply(1.0d - ((double)MathHelper.abs(this.chargeTimeout - (maxChargeCooldown() - chargeDuration()) - (chargeDuration() * 0.2f)) / chargeDuration())).add(0, this.getVelocity().y, 0)); + else if (this.level().isClientSide) { + this.setDeltaMovement(this.getLookAngle().multiply(1,0,1).normalize().scale(1.0d - ((double)Mth.abs(this.chargeTimeout - (maxChargeCooldown() - chargeDuration()) - (chargeDuration() * 0.2f)) / chargeDuration())).add(0, this.getDeltaMovement().y, 0)); } - for(Entity entity : entities) { - if(entity != this.getOwner() && entity != this && !this.getPassengerList().contains(entity) && !this.getWorld().isClient()) { - entity.damage((ServerWorld) this.getWorld(), entity.getDamageSources().mobAttack(this), getAttackDamage()); - - Vec3d velocity = this.getVelocity(); + if (this.level() instanceof ServerLevel serverLevel) { + Entity owner = this.getOwner(); + List entities = serverLevel.getEntities( + this, + this.getBoundingBox().inflate(0.2, 0, 0.2), + entity -> entity != owner && !this.getPassengers().contains(entity) + ); + for(Entity entity : entities) { + entity.hurt(entity.damageSources().mobAttack(this), getAttackDamage()); + + Vec3 velocity = this.getDeltaMovement(); velocity = velocity.multiply(1.0, 0.0, 1.0); velocity = velocity.normalize(); - Vec3d vec3d = velocity.multiply(2); - if (vec3d.lengthSquared() > 0.0) { - entity.addVelocity(vec3d.x, 0.15, vec3d.z); + Vec3 vec3d = velocity.scale(2); + if (vec3d.lengthSqr() > 0.0) { + entity.push(vec3d.x, 0.15, vec3d.z); } - if(this.random.nextInt(10) == 0 && !this.isTame() && !this.isBaby()) { + if(this.random.nextInt(10) == 0 && !this.isTamed() && !this.isBaby()) { this.dropHorn(); } this.setCharging(false); } } - this.getWorld().addParticleClient(ParticleTypes.EXPLOSION, this.getX(), this.getY(), this.getZ(), 0, 0, 0); - this.chargeAnimationState.startIfNotRunning(this.age); + this.level().addParticle(ParticleTypes.EXPLOSION, this.getX(), this.getY(), this.getZ(), 0, 0, 0); + this.chargeAnimationState.startIfStopped(this.tickCount); } @Override - protected void jump(float strength, Vec3d movementInput) { + protected void executeRidersJump(float strength, Vec3 movementInput) { if(this.hasControllingPassenger() && this.getControllingPassenger().isSprinting()) { - super.jump(strength, movementInput); + super.executeRidersJump(strength, movementInput); } else { this.setChargeTimeout(30); - double d = this.getJumpVelocity(strength); - Vec3d vec3d = this.getVelocity().multiply(4); - this.setVelocity(vec3d.x, d, vec3d.z); + double d = this.getJumpPower(strength); + Vec3 vec3d = this.getDeltaMovement().scale(4); + this.setDeltaMovement(vec3d.x, d, vec3d.z); this.setOnGround(false); - this.velocityDirty = true; + this.hasImpulse = true; if (movementInput.z > 0.0) { - float f = MathHelper.sin(this.getYaw() * ((float)Math.PI / 180)); - float g = MathHelper.cos(this.getYaw() * ((float)Math.PI / 180)); - this.setVelocity(this.getVelocity().add(-0.4f * f * strength, 0.0, 0.4f * g * strength)); + float f = Mth.sin(this.getYRot() * ((float)Math.PI / 180)); + float g = Mth.cos(this.getYRot() * ((float)Math.PI / 180)); + this.setDeltaMovement(this.getDeltaMovement().add(-0.4f * f * strength, 0.0, 0.4f * g * strength)); } } } @Override - public void startJumping(int height) { + public void handleStartJump(int height) { if(this.hasControllingPassenger() && !this.getControllingPassenger().isSprinting()) { if(!this.isSitting()) { - this.jumping = true; + this.allowStandSliding = true; this.playJumpSound(); } else { @@ -388,7 +407,7 @@ public void startJumping(int height) { } } else { - super.startJumping(height); + super.handleStartJump(height); } } @@ -403,8 +422,8 @@ public int chargeDuration() { } @Override - public void tickMovement() { - super.tickMovement(); + public void aiStep() { + super.aiStep(); if(this.isSitting()) { this.getNavigation().stop(); @@ -417,23 +436,23 @@ public boolean dropHorn() { if (!bl && !bl2) { return false; } - TrackedData trackedData = !bl ? RIGHT_HORN : (!bl2 ? LEFT_HORN : (this.random.nextBoolean() ? LEFT_HORN : RIGHT_HORN)); - this.dataTracker.set(trackedData, false); - Vec3d vec3d = this.getPos(); + EntityDataAccessor trackedData = !bl ? RIGHT_HORN : (!bl2 ? LEFT_HORN : (this.random.nextBoolean() ? LEFT_HORN : RIGHT_HORN)); + this.entityData.set(trackedData, false); + Vec3 vec3d = this.position(); ItemStack itemStack = this.getGoatHornStack(); - double d = MathHelper.nextBetween(this.random, -0.2f, 0.2f); - double e = MathHelper.nextBetween(this.random, 0.3f, 0.7f); - double f = MathHelper.nextBetween(this.random, -0.2f, 0.2f); - ItemEntity itemEntity = new ItemEntity(this.getWorld(), vec3d.getX(), vec3d.getY(), vec3d.getZ(), itemStack, d, e, f); - this.getWorld().spawnEntity(itemEntity); + double d = Mth.randomBetween(this.random, -0.2f, 0.2f); + double e = Mth.randomBetween(this.random, 0.3f, 0.7f); + double f = Mth.randomBetween(this.random, -0.2f, 0.2f); + ItemEntity itemEntity = new ItemEntity(this.level(), vec3d.x(), vec3d.y(), vec3d.z(), itemStack, d, e, f); + this.level().addFreshEntity(itemEntity); return true; } public ItemStack getGoatHornStack() { - Random random = Random.create((long)this.getUuid().hashCode()); + RandomSource random = RandomSource.create((long)this.getUUID().hashCode()); TagKey tagKey = this.random.nextBoolean() ? InstrumentTags.SCREAMING_GOAT_HORNS : InstrumentTags.REGULAR_GOAT_HORNS; - return (ItemStack)this.getWorld().getRegistryManager().getOrThrow(RegistryKeys.INSTRUMENT).getRandomEntry(tagKey, random).map((registryEntry) -> { - return GoatHornItem.getStackForInstrument(Items.GOAT_HORN, registryEntry); + return this.level().registryAccess().registryOrThrow(Registries.INSTRUMENT).getRandomElementOf(tagKey, random).map((registryEntry) -> { + return InstrumentItem.create(Items.GOAT_HORN, registryEntry); }).orElseGet(() -> { return new ItemStack(Items.GOAT_HORN); }); @@ -441,15 +460,15 @@ public ItemStack getGoatHornStack() { protected void setupAnimationStates() { if(this.isSitting()) { - this.startSittingAnimationState.startIfNotRunning(this.age); + this.startSittingAnimationState.startIfStopped(this.tickCount); } - if(!this.isSitting() && this.startSittingAnimationState.isRunning()) { + if(!this.isSitting() && this.startSittingAnimationState.isStarted()) { this.startSittingAnimationState.stop(); - this.stopSittingAnimationState.start(this.age); + this.stopSittingAnimationState.start(this.tickCount); } - if(!this.isOnGround() && this.hasControllingPassenger()) { - this.jumpAnimationState.startIfNotRunning(this.age); + if(!this.onGround() && this.hasControllingPassenger()) { + this.jumpAnimationState.startIfStopped(this.tickCount); } else { this.jumpAnimationState.stop(); @@ -463,7 +482,7 @@ public boolean usesTameness() { @Override public boolean isCommandItem(ItemStack stack) { - return stack.isOf(Items.STICK); + return stack.is(Items.STICK); } @Override @@ -472,35 +491,35 @@ public boolean isFoodItem(ItemStack itemStack) { } @Override - protected float getSaddledSpeed(PlayerEntity controllingPlayer) { + protected float getRiddenSpeed(Player controllingPlayer) { if(!this.isSitting()) { - return controllingPlayer.isSprinting() ? ((float)this.getAttributeValue(EntityAttributes.MOVEMENT_SPEED)) : ((float)this.getAttributeValue(EntityAttributes.MOVEMENT_SPEED) * 0.5f); + return controllingPlayer.isSprinting() ? ((float)this.getAttributeValue(Attributes.MOVEMENT_SPEED)) : ((float)this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 0.5f); } - return super.getSaddledSpeed(controllingPlayer); + return super.getRiddenSpeed(controllingPlayer); } @Override protected float getNpcSaddledSpeed(NpcEntity controllingNpc) { if(!this.isSitting()) { - return controllingNpc.isSprinting() ? ((float)this.getAttributeValue(EntityAttributes.MOVEMENT_SPEED) * 2f) : ((float)this.getAttributeValue(EntityAttributes.MOVEMENT_SPEED) * 0.75f); + return controllingNpc.isSprinting() ? ((float)this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 2f) : ((float)this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 0.75f); } return super.getNpcSaddledSpeed(controllingNpc); } @Override - public boolean canSprintAsVehicle() { + public boolean canSprint() { return true; } @Override public boolean isBondingItem(ItemStack itemStack) { - return itemStack.isIn(ItemTags.GOAT_FOOD); + return itemStack.is(ItemTags.GOAT_FOOD); } /* VARIANTS */ - public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData) { + public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData) { BroadhoofGoatColor color = Util.getRandom(BroadhoofGoatColor.values(), this.random); BroadhoofGoatPattern pattern = BroadhoofGoatPattern.PATTERN_COMBINATIONS.get(color).getRandom().getItem(); BroadhoofGoatHorns horns = Util.getRandom(BroadhoofGoatHorns.values(), this.random); @@ -509,22 +528,22 @@ public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty this.setHair(this.random.nextBoolean()); - if(!this.getWorld().isClient()) { - this.dataTracker.set(MOUNTABLE, ModServerConfigs.ENABLE_MOUNT_BROADHOOF_GOAT); + if(!this.level().isClientSide()) { + this.entityData.set(MOUNTABLE, ModServerConfigs.ENABLE_MOUNT_BROADHOOF_GOAT); } - return super.initialize(world, difficulty, spawnReason, entityData); + return super.finalizeSpawn(world, difficulty, spawnReason, entityData); } // VARIANTS private void setGoatVariant(int variant) { - this.dataTracker.set(VARIANT, variant); + this.entityData.set(VARIANT, variant); } private int getGoatVariant() { - return this.dataTracker.get(VARIANT); + return this.entityData.get(VARIANT); } private void setGoatVariant(BroadhoofGoatColor color, BroadhoofGoatPattern pattern, BroadhoofGoatHorns horns) { @@ -547,34 +566,12 @@ public BroadhoofGoatHorns getHorns() { return BroadhoofGoatHorns.byId(this.getGoatVariant() & 0xFF0000); } - @Nullable - @Override - public T get(ComponentType type) { - return type == DataComponentTypesME.GOAT_VARIANT ? castComponentValue((ComponentType)type, this.getGoatColor()) : super.get(type); - } - - @Override - protected void copyComponentsFrom(ComponentsAccess from) { - this.copyComponentFrom(from, DataComponentTypesME.GOAT_VARIANT); - super.copyComponentsFrom(from); - } - - @Override - protected boolean setApplicableComponent(ComponentType type, T value) { - if (type == DataComponentTypesME.GOAT_VARIANT) { - this.setGoatColor(castComponentValue(DataComponentTypesME.GOAT_VARIANT, value)); - return true; - } else { - return super.setApplicableComponent(type, value); - } - } - public void setGoatBeads(BroadhoofGoatBeads beads) { - this.dataTracker.set(BEADS, beads.getIndex() & 0xFF); + this.entityData.set(BEADS, beads.getIndex() & 0xFF); } public int getGoatBeadsIndex() { - return this.dataTracker.get(BEADS); + return this.entityData.get(BEADS); } public BroadhoofGoatBeads getGoatBeads() { @@ -582,38 +579,38 @@ public BroadhoofGoatBeads getGoatBeads() { } public boolean hasHair() { - return this.dataTracker.get(HAIR); + return this.entityData.get(HAIR); } public void setHair(boolean hair) { - this.dataTracker.set(HAIR, hair); + this.entityData.set(HAIR, hair); } public boolean hasRightHorn() { - return this.dataTracker.get(RIGHT_HORN); + return this.entityData.get(RIGHT_HORN); } public boolean hasLeftHorn() { - return this.dataTracker.get(LEFT_HORN); + return this.entityData.get(LEFT_HORN); } public void setBrushedBeard(boolean brushedBeard) { - this.dataTracker.set(BRUSHED_BEARD, brushedBeard); + this.entityData.set(BRUSHED_BEARD, brushedBeard); } public boolean hasBrushedBeard() { - return this.dataTracker.get(BRUSHED_BEARD); + return this.entityData.get(BRUSHED_BEARD); } @Nullable @Override protected SoundEvent getDeathSound() { - return SoundEvents.ENTITY_GOAT_DEATH; + return SoundEvents.GOAT_DEATH; } @Nullable @Override protected SoundEvent getHurtSound(DamageSource source) { - return SoundEvents.ENTITY_GOAT_HURT; + return SoundEvents.GOAT_HURT; } @Override protected void playHurtSound(DamageSource damageSource) { @@ -623,7 +620,7 @@ protected void playHurtSound(DamageSource damageSource) { @Nullable @Override protected SoundEvent getAmbientSound() { - return SoundEvents.ENTITY_GOAT_AMBIENT; + return SoundEvents.GOAT_AMBIENT; } @Override @@ -634,32 +631,32 @@ public void playAmbientSound() { @Nullable @Override public SoundEvent getAmbientStandSound() { - return SoundEvents.ENTITY_GOAT_SCREAMING_AMBIENT; + return SoundEvents.GOAT_SCREAMING_AMBIENT; } @Nullable @Override protected SoundEvent getAngrySound() { - return SoundEvents.ENTITY_GOAT_PREPARE_RAM; + return SoundEvents.GOAT_PREPARE_RAM; } @Override - public void playAngrySound() { + public void makeMad() { this.playSound(this.getAngrySound(), 1.0f, 0.7f); } @Override protected void playStepSound(BlockPos pos, BlockState state) { - this.playSound(SoundEvents.ENTITY_GOAT_STEP, 0.15f, 0.7f); + this.playSound(SoundEvents.GOAT_STEP, 0.15f, 0.7f); } @Override - protected void playWalkSound(BlockSoundGroup group) { - this.playSound(SoundEvents.ENTITY_GOAT_STEP, 1.0f, 0.7f); + protected void playGallopSound(SoundType group) { + this.playSound(SoundEvents.GOAT_STEP, 1.0f, 0.7f); } @Override protected void playJumpSound() { - this.playSound(SoundEvents.ENTITY_GOAT_LONG_JUMP, 1.0f, 0.7f); + this.playSound(SoundEvents.GOAT_LONG_JUMP, 1.0f, 0.7f); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatEntityRenderState.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatEntityRenderState.java deleted file mode 100644 index 0fe6e19795..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatEntityRenderState.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.sevenstars.middleearth.entity.beasts.broadhoof; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.entity.state.LivingEntityRenderState; -import net.minecraft.entity.AnimationState; -import net.minecraft.entity.passive.HorseColor; -import net.minecraft.entity.passive.HorseMarking; -import net.minecraft.item.ItemStack; -import net.sevenstars.middleearth.entity.beasts.BeastEntityRenderState; - -@Environment(EnvType.CLIENT) -public class BroadhoofGoatEntityRenderState extends BeastEntityRenderState { - - public BroadhoofGoatColor color = BroadhoofGoatColor.WHITE; - public BroadhoofGoatPattern pattern = BroadhoofGoatPattern.NONE; - public BroadhoofGoatHorns horns = BroadhoofGoatHorns.TINY; - public BroadhoofGoatBeads beads = BroadhoofGoatBeads.NONE; - public boolean hair = false; - public boolean hasLeftHorn = false; - public boolean hasRightHorn = false; - public ItemStack armor = ItemStack.EMPTY; - public ItemStack saddle = ItemStack.EMPTY; - boolean beardBrushed; - - public AnimationState idleAnimationState = new AnimationState(); - public AnimationState attackAnimationState = new AnimationState(); - public AnimationState sittingAnimationState = new AnimationState(); - public AnimationState jumpAnimationState = new AnimationState(); - - -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatModel.java index 430b1aaf2a..ac5d45809d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatModel.java @@ -1,11 +1,16 @@ package net.sevenstars.middleearth.entity.beasts.broadhoof; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.animation.Animation; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.render.entity.model.EntityModelPartNames; - -public class BroadhoofGoatModel extends EntityModel { +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; + +public class BroadhoofGoatModel extends HierarchicalModel { private final ModelPart broadhoofGoat; private final ModelPart head; private final ModelPart hair; @@ -15,21 +20,9 @@ public class BroadhoofGoatModel extends EntityModel(Stream.of(GENERIC_SET, BROWN_SET, PALE_SET)) ); - private static final IntFunction INDEX_MAPPER = ValueLists.createIndexToValueFunction( - BroadhoofGoatPattern::getIndex, values(), ValueLists.OutOfBoundsHandling.WRAP + private static final IntFunction INDEX_MAPPER = ByIdMap.continuous( + BroadhoofGoatPattern::getIndex, values(), ByIdMap.OutOfBoundsStrategy.WRAP ); private final int index; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatRenderer.java index 2e07fd8389..6f9b566299 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/BroadhoofGoatRenderer.java @@ -1,64 +1,46 @@ package net.sevenstars.middleearth.entity.beasts.broadhoof; import com.google.common.collect.Maps; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.MobEntityRenderer; -import net.minecraft.client.render.entity.equipment.EquipmentModel; -import net.minecraft.client.render.entity.feature.HorseMarkingFeatureRenderer; -import net.minecraft.client.render.entity.feature.SaddleFeatureRenderer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.passive.HorseColor; -import net.minecraft.util.Identifier; -import net.minecraft.util.Util; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.MobRenderer; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntityModelLayersME; import net.sevenstars.middleearth.entity.beasts.broadhoof.features.BroadhoofGoatBeadsFeatureRenderer; +import net.sevenstars.middleearth.entity.beasts.broadhoof.features.BroadhoofGoatArmorFeatureRenderer; import net.sevenstars.middleearth.entity.beasts.broadhoof.features.BroadhoofGoatPatternFeatureRenderer; import net.sevenstars.middleearth.entity.beasts.broadhoof.features.BroadhoofGoatSaddleFeatureRenderer; import java.util.Map; -public class BroadhoofGoatRenderer extends MobEntityRenderer { +public class BroadhoofGoatRenderer extends MobRenderer { private static final String PATH = "textures/entities/broadhoof_goat/"; private static final float SIZE = 1f; - public BroadhoofGoatRenderer(EntityRendererFactory.Context context) { - super(context, new BroadhoofGoatModel(context.getPart(EntityModelLayersME.BROADHOOF_GOAT)), 0.8f); - this.addFeature(new BroadhoofGoatPatternFeatureRenderer(this)); - this.addFeature(new BroadhoofGoatBeadsFeatureRenderer(this)); - this.addFeature( - new SaddleFeatureRenderer<>( - this, - context.getEquipmentRenderer(), - new BroadhoofGoatModel(context.getPart(EntityModelLayersME.BROADHOOF_GOAT_ARMOR)), - EquipmentModel.LayerType.HORSE_BODY, - broadhoofGoatEntityRenderState -> broadhoofGoatEntityRenderState.armor - - ) - ); - this.addFeature(new BroadhoofGoatSaddleFeatureRenderer(this, context.getEntityModels(), context.getEquipmentRenderer())); + public BroadhoofGoatRenderer(EntityRendererProvider.Context context) { + super(context, new BroadhoofGoatModel(context.bakeLayer(EntityModelLayersME.BROADHOOF_GOAT)), 0.8f); + this.addLayer(new BroadhoofGoatPatternFeatureRenderer(this)); + this.addLayer(new BroadhoofGoatBeadsFeatureRenderer(this)); + this.addLayer(new BroadhoofGoatArmorFeatureRenderer(this, context.getModelSet())); + this.addLayer(new BroadhoofGoatSaddleFeatureRenderer(this, context.getModelSet())); } @Override - public void render(BroadhoofGoatEntityRenderState state, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) { - if(state.baby) { + public void render(BroadhoofGoatEntity entity, float entityYaw, float partialTick, PoseStack matrixStack, + MultiBufferSource vertexConsumerProvider, int light) { + if(entity.isBaby()) { matrixStack.scale(SIZE/2, SIZE/2, SIZE/2); } else { matrixStack.scale(SIZE, SIZE, SIZE); } - super.render(state, matrixStack, vertexConsumerProvider, i); - } - - @Override - public BroadhoofGoatEntityRenderState createRenderState() { - return new BroadhoofGoatEntityRenderState(); + super.render(entity, entityYaw, partialTick, matrixStack, vertexConsumerProvider, light); } - private static final Map TEXTURES = Maps.newEnumMap( + private static final Map TEXTURES = Maps.newEnumMap( Map.of( BroadhoofGoatColor.WHITE, MiddleEarth.of(PATH + "broadhoof_goat_white.png"), @@ -78,39 +60,7 @@ public BroadhoofGoatEntityRenderState createRenderState() { ); @Override - public void updateRenderState(BroadhoofGoatEntity goat, BroadhoofGoatEntityRenderState state, float f) { - super.updateRenderState(goat, state, f); - - state.color = goat.getGoatColor(); - state.pattern = goat.getPattern(); - state.armor = goat.getBodyArmor().copy(); - - state.beads = goat.getGoatBeads(); - state.horns = goat.getHorns(); - state.hair = goat.hasHair(); - state.hasLeftHorn = goat.hasLeftHorn(); - state.hasRightHorn = goat.hasRightHorn(); - state.beardBrushed = goat.hasBrushedBeard(); - - state.isSprinting = goat.isSprinting(); - state.isCharging = goat.isCharging(); - state.isTame = goat.isTame(); - state.conrollingPassenger = goat.getControllingPassenger(); - state.saddle = goat.getEquippedStack(EquipmentSlot.SADDLE); - state.armor = goat.getBodyArmor(); - - state.chargeAnimationState = goat.chargeAnimationState; - state.startSittingAnimationState = goat.startSittingAnimationState; - state.stopSittingAnimationState = goat.stopSittingAnimationState; - state.sittingAnimationState = goat.sittingAnimationState; - state.attackAnimationState = goat.attackAnimationState; - state.idleAnimationState = goat.idleAnimationState; - state.jumpAnimationState = goat.jumpAnimationState; - - } - - @Override - public Identifier getTexture(BroadhoofGoatEntityRenderState state) { - return TEXTURES.get(state.color); + public ResourceLocation getTextureLocation(BroadhoofGoatEntity entity) { + return TEXTURES.get(entity.getGoatColor()); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/WeightedBroadhoofGoatPattern.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/WeightedBroadhoofGoatPattern.java index 426d0acfa3..630bd117ee 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/WeightedBroadhoofGoatPattern.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/WeightedBroadhoofGoatPattern.java @@ -1,6 +1,5 @@ package net.sevenstars.middleearth.entity.beasts.broadhoof; -import net.minecraft.util.Util; import net.sevenstars.api.dtos.WeightedItem; import java.util.*; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatArmorFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatArmorFeatureRenderer.java index 5472090cde..950edd4b02 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatArmorFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatArmorFeatureRenderer.java @@ -1,38 +1,55 @@ package net.sevenstars.middleearth.entity.beasts.broadhoof.features; -import net.minecraft.client.render.entity.equipment.EquipmentModel; -import net.minecraft.client.render.entity.equipment.EquipmentRenderer; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.EquippableComponent; -import net.minecraft.registry.RegistryKey; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.DyedItemColor; +import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatEntityRenderState; +import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatEntity; import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatModel; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.item.ItemStack; - -public class BroadhoofGoatArmorFeatureRenderer extends FeatureRenderer { +import net.sevenstars.middleearth.item.items.armor.MountArmorItem; +public class BroadhoofGoatArmorFeatureRenderer extends RenderLayer { + private static final String TEXTURE_PATH = "textures/entity/equipment/horse_body/beast_armor/"; private final BroadhoofGoatArmorModel model; - private final EquipmentRenderer equipmentRenderer; - public BroadhoofGoatArmorFeatureRenderer(FeatureRendererContext context, LoadedEntityModels loader, EquipmentRenderer equipmentRenderer) { - super(context); - this.equipmentRenderer = equipmentRenderer; - this.model = new BroadhoofGoatArmorModel(loader.getModelPart(EntityModelLayersME.BROADHOOF_GOAT_ARMOR)); + public BroadhoofGoatArmorFeatureRenderer( + RenderLayerParent parent, EntityModelSet modelSet) { + super(parent); + this.model = new BroadhoofGoatArmorModel(modelSet.bakeLayer(EntityModelLayersME.BROADHOOF_GOAT_ARMOR)); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, BroadhoofGoatEntityRenderState state, float limbAngle, float limbDistance) { - ItemStack itemStack = state.armor; - EquippableComponent equippableComponent = (EquippableComponent)itemStack.get(DataComponentTypes.EQUIPPABLE); - if (equippableComponent != null && !equippableComponent.assetId().isEmpty()) { - model.setAngles(state); - this.equipmentRenderer.render(EquipmentModel.LayerType.HORSE_BODY, (RegistryKey)equippableComponent.assetId().get(), model, itemStack, matrices, vertexConsumers, light); + public void render(PoseStack matrices, MultiBufferSource buffers, int light, BroadhoofGoatEntity entity, + float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, + float netHeadYaw, float headPitch) { + ItemStack stack = entity.getBodyArmorItem(); + if (!(stack.getItem() instanceof MountArmorItem)) { + return; + } + + String name = BuiltInRegistries.ITEM.getKey(stack.getItem()).getPath(); + ResourceLocation texture = MiddleEarth.of(TEXTURE_PATH + name + ".png"); + int color = stack.has(DataComponents.DYED_COLOR) + ? DyedItemColor.getOrDefault(stack, DyedItemColor.LEATHER_COLOR) + : -1; + this.model.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); + this.model.renderToBuffer(matrices, buffers.getBuffer(RenderType.entityCutoutNoCull(texture)), + light, OverlayTexture.NO_OVERLAY, color); + + if (stack.has(DataComponents.DYED_COLOR)) { + ResourceLocation overlay = MiddleEarth.of(TEXTURE_PATH + name + "_overlay.png"); + this.model.renderToBuffer(matrices, buffers.getBuffer(RenderType.entityCutoutNoCull(overlay)), + light, OverlayTexture.NO_OVERLAY); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatArmorModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatArmorModel.java index 60fe6a2da7..aac7132094 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatArmorModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatArmorModel.java @@ -1,9 +1,14 @@ package net.sevenstars.middleearth.entity.beasts.broadhoof.features; -import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; -import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatEntityRenderState; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatModel; public class BroadhoofGoatArmorModel extends BroadhoofGoatModel { @@ -15,33 +20,28 @@ public BroadhoofGoatArmorModel(ModelPart root) { super(root); this.broadhoofGoat = root.getChild("broadhoof_goat"); - this.head = broadhoofGoat.getChild(EntityModelPartNames.BODY).getChild(EntityModelPartNames.HEAD); + this.head = broadhoofGoat.getChild(PartNames.BODY).getChild(PartNames.HEAD); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData root = modelData.getRoot().getChild("broadhoof_goat").getChild(EntityModelPartNames.BODY); - ModelPartData head = root.getChild(EntityModelPartNames.HEAD); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition root = modelData.getRoot().getChild("broadhoof_goat").getChild(PartNames.BODY); + PartDefinition head = root.getChild(PartNames.HEAD); - ModelPartData head_armor = head.addChild("head_armor", ModelPartBuilder.create().uv(0, 1).cuboid(0.9F, -11.0F, 2.0F, 3.0F, 2.0F, 1.0F, new Dilation(0.1F)) - .uv(0, 1).mirrored().cuboid(-7.9F, -11.0F, 2.0F, 3.0F, 2.0F, 1.0F, new Dilation(0.1F)).mirrored(false), ModelTransform.origin(2.0F, 0.0F, -8.0F)); + PartDefinition head_armor = head.addOrReplaceChild("head_armor", CubeListBuilder.create().texOffs(0, 1).addBox(0.9F, -11.0F, 2.0F, 3.0F, 2.0F, 1.0F, new CubeDeformation(0.1F)) + .texOffs(0, 1).mirror().addBox(-7.9F, -11.0F, 2.0F, 3.0F, 2.0F, 1.0F, new CubeDeformation(0.1F)).mirror(false), PartPose.offset(2.0F, 0.0F, -8.0F)); - ModelPartData neck_plate_r1 = head_armor.addChild("neck_plate_r1", ModelPartBuilder.create().uv(85, 5).cuboid(-5.0F, -7.0F, 4.0F, 6.0F, 14.0F, 6.0F, new Dilation(0.1F)) - .uv(44, 0).cuboid(-5.0F, -7.0F, -1.0F, 6.0F, 6.0F, 11.0F, new Dilation(0.1F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 0.7854F, 0.0F, 0.0F)); + PartDefinition neck_plate_r1 = head_armor.addOrReplaceChild("neck_plate_r1", CubeListBuilder.create().texOffs(85, 5).addBox(-5.0F, -7.0F, 4.0F, 6.0F, 14.0F, 6.0F, new CubeDeformation(0.1F)) + .texOffs(44, 0).addBox(-5.0F, -7.0F, -1.0F, 6.0F, 6.0F, 11.0F, new CubeDeformation(0.1F)), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.7854F, 0.0F, 0.0F)); - ModelPartData side_hanging_plate_r1 = head_armor.addChild("side_hanging_plate_r1", ModelPartBuilder.create().uv(77, 53).cuboid(-5.0F, -4.0F, -1.0F, 6.0F, 5.0F, 11.0F, new Dilation(0.1F)), ModelTransform.of(0.0F, 2.0F, 2.0F, 0.7854F, 0.0F, 0.0F)); + PartDefinition side_hanging_plate_r1 = head_armor.addOrReplaceChild("side_hanging_plate_r1", CubeListBuilder.create().texOffs(77, 53).addBox(-5.0F, -4.0F, -1.0F, 6.0F, 5.0F, 11.0F, new CubeDeformation(0.1F)), PartPose.offsetAndRotation(0.0F, 2.0F, 2.0F, 0.7854F, 0.0F, 0.0F)); - ModelPartData body_armor = root.addChild("body_armor", ModelPartBuilder.create().uv(0, 0).cuboid(-6.0F, -3.0F, -20.0F, 12.0F, 11.0F, 20.0F, new Dilation(0.2F)) - .uv(0, 89).cuboid(-6.0F, 2.0F, -20.0F, 12.0F, 6.0F, 20.0F, new Dilation(0.1F)) - .uv(0, 31).cuboid(-7.0F, -5.0F, -21.0F, 14.0F, 16.0F, 13.0F, new Dilation(0.2F)) - .uv(0, 60).cuboid(-7.0F, -5.0F, -21.0F, 14.0F, 16.0F, 13.0F, new Dilation(0.1F)) - .uv(108, 113).cuboid(6.0F, -2.0F, -7.0F, 3.0F, 8.0F, 7.0F, new Dilation(0.0F)) - .uv(108, 98).cuboid(-9.0F, -2.0F, -7.0F, 3.0F, 8.0F, 7.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, -6.0F, 9.0F)); - return TexturedModelData.of(modelData, 128, 128); - } - - @Override - public void setAngles(BroadhoofGoatEntityRenderState state) { - super.setAngles(state); + PartDefinition body_armor = root.addOrReplaceChild("body_armor", CubeListBuilder.create().texOffs(0, 0).addBox(-6.0F, -3.0F, -20.0F, 12.0F, 11.0F, 20.0F, new CubeDeformation(0.2F)) + .texOffs(0, 89).addBox(-6.0F, 2.0F, -20.0F, 12.0F, 6.0F, 20.0F, new CubeDeformation(0.1F)) + .texOffs(0, 31).addBox(-7.0F, -5.0F, -21.0F, 14.0F, 16.0F, 13.0F, new CubeDeformation(0.2F)) + .texOffs(0, 60).addBox(-7.0F, -5.0F, -21.0F, 14.0F, 16.0F, 13.0F, new CubeDeformation(0.1F)) + .texOffs(108, 113).addBox(6.0F, -2.0F, -7.0F, 3.0F, 8.0F, 7.0F, new CubeDeformation(0.0F)) + .texOffs(108, 98).addBox(-9.0F, -2.0F, -7.0F, 3.0F, 8.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -6.0F, 9.0F)); + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatBeadsFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatBeadsFeatureRenderer.java index 4e4d473b2c..e1682f1db2 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatBeadsFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatBeadsFeatureRenderer.java @@ -1,27 +1,27 @@ package net.sevenstars.middleearth.entity.beasts.broadhoof.features; import com.google.common.collect.Maps; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.LivingEntityRenderer; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.LivingEntityRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatBeads; -import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatEntityRenderState; +import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatEntity; import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatModel; import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatPattern; import java.util.Map; -public class BroadhoofGoatBeadsFeatureRenderer extends FeatureRenderer { +public class BroadhoofGoatBeadsFeatureRenderer extends RenderLayer { private static final String PATH = "textures/entities/broadhoof_goat/beads/"; - private static final Identifier INVISIBLE_ID = Identifier.ofVanilla("invisible"); + private static final ResourceLocation INVISIBLE_ID = ResourceLocation.withDefaultNamespace("invisible"); - private static final Map TEXTURES = Maps.newEnumMap( + private static final Map TEXTURES = Maps.newEnumMap( Map.of( BroadhoofGoatBeads.NONE, INVISIBLE_ID, @@ -38,17 +38,18 @@ public class BroadhoofGoatBeadsFeatureRenderer extends FeatureRenderer featureRendererContext) { + public BroadhoofGoatBeadsFeatureRenderer(RenderLayerParent featureRendererContext) { super(featureRendererContext); } public void render( - MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, BroadhoofGoatEntityRenderState state, float f, float g + PoseStack matrixStack, MultiBufferSource vertexConsumerProvider, int light, BroadhoofGoatEntity entity, + float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, float netHeadYaw, float headPitch ) { - Identifier identifier = (Identifier)TEXTURES.get(state.beads); - if (identifier != INVISIBLE_ID && !state.invisible) { - VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderLayer.getEntityTranslucent(identifier)); - this.getContextModel().render(matrixStack, vertexConsumer, i, LivingEntityRenderer.getOverlay(state, 0.0F)); + ResourceLocation identifier = TEXTURES.get(entity.getGoatBeads()); + if (identifier != INVISIBLE_ID && !entity.isInvisible()) { + VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderType.entityTranslucent(identifier)); + this.getParentModel().renderToBuffer(matrixStack, vertexConsumer, light, LivingEntityRenderer.getOverlayCoords(entity, 0.0F)); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatPatternFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatPatternFeatureRenderer.java index d349dd2315..76af3130dd 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatPatternFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatPatternFeatureRenderer.java @@ -1,32 +1,26 @@ package net.sevenstars.middleearth.entity.beasts.broadhoof.features; import com.google.common.collect.Maps; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.LivingEntityRenderer; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.entity.model.HorseEntityModel; -import net.minecraft.client.render.entity.state.HorseEntityRenderState; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.passive.HorseMarking; -import net.minecraft.util.Identifier; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.LivingEntityRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; -import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatEntityRenderState; +import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatEntity; import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatModel; import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatPattern; import java.util.Map; -@Environment(EnvType.CLIENT) -public class BroadhoofGoatPatternFeatureRenderer extends FeatureRenderer { +public class BroadhoofGoatPatternFeatureRenderer extends RenderLayer { private static final String PATH = "textures/entities/broadhoof_goat/patterns/"; - private static final Identifier INVISIBLE_ID = Identifier.ofVanilla("invisible"); + private static final ResourceLocation INVISIBLE_ID = ResourceLocation.withDefaultNamespace("invisible"); - private static final Map TEXTURES = Maps.newEnumMap( + private static final Map TEXTURES = Maps.newEnumMap( Map.ofEntries( Map.entry(BroadhoofGoatPattern.NONE, INVISIBLE_ID), @@ -70,17 +64,18 @@ public class BroadhoofGoatPatternFeatureRenderer extends FeatureRenderer featureRendererContext) { + public BroadhoofGoatPatternFeatureRenderer(RenderLayerParent featureRendererContext) { super(featureRendererContext); } public void render( - MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, BroadhoofGoatEntityRenderState state, float f, float g + PoseStack matrixStack, MultiBufferSource vertexConsumerProvider, int light, BroadhoofGoatEntity entity, + float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, float netHeadYaw, float headPitch ) { - Identifier identifier = (Identifier)TEXTURES.get(state.pattern); - if (identifier != INVISIBLE_ID && !state.invisible) { - VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderLayer.getEntityTranslucent(identifier)); - this.getContextModel().render(matrixStack, vertexConsumer, i, LivingEntityRenderer.getOverlay(state, 0.0F)); + ResourceLocation identifier = TEXTURES.get(entity.getPattern()); + if (identifier != INVISIBLE_ID && !entity.isInvisible()) { + VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderType.entityTranslucent(identifier)); + this.getParentModel().renderToBuffer(matrixStack, vertexConsumer, light, LivingEntityRenderer.getOverlayCoords(entity, 0.0F)); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatSaddleFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatSaddleFeatureRenderer.java index 9a0d5ad22a..9ed454beac 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatSaddleFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatSaddleFeatureRenderer.java @@ -1,39 +1,41 @@ package net.sevenstars.middleearth.entity.beasts.broadhoof.features; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.entity.equipment.EquipmentRenderer; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Identifier; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.entity.animal.horse.AbstractHorse; import net.sevenstars.middleearth.MiddleEarth; -import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatEntityRenderState; +import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatEntity; import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatModel; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.util.math.MatrixStack; -public class BroadhoofGoatSaddleFeatureRenderer extends FeatureRenderer { +public class BroadhoofGoatSaddleFeatureRenderer extends RenderLayer { private final BroadhoofGoatSaddleModel model; - public BroadhoofGoatSaddleFeatureRenderer(FeatureRendererContext context, LoadedEntityModels loader, EquipmentRenderer equipmentRenderer) { + public BroadhoofGoatSaddleFeatureRenderer(RenderLayerParent context, EntityModelSet loader) { super(context); - this.model = new BroadhoofGoatSaddleModel(loader.getModelPart(EntityModelLayersME.BROADHOOF_GOAT_SADDLE)); + this.model = new BroadhoofGoatSaddleModel(loader.bakeLayer(EntityModelLayersME.BROADHOOF_GOAT_SADDLE)); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, BroadhoofGoatEntityRenderState state, float limbAngle, float limbDistance) { - ItemStack itemStack = state.saddle; + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, BroadhoofGoatEntity entity, + float limbAngle, float limbDistance, float tickDelta, float animationProgress, + float headYaw, float headPitch) { + ItemStack itemStack = entity.getInventory().getItem(AbstractHorse.INV_SLOT_SADDLE); if(!itemStack.isEmpty()) { - VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumers, RenderLayer.getArmorCutoutNoCull(Identifier.of(MiddleEarth.MOD_ID, "textures/entities/broadhoof_goat/feature/broadhoof_goat_saddle.png")), itemStack.hasGlint()); + VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer(vertexConsumers, RenderType.armorCutoutNoCull(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "textures/entities/broadhoof_goat/feature/broadhoof_goat_saddle.png")), itemStack.hasFoil()); - model.setAngles(state); - model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV); + model.setupAnim(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch); + model.renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatSaddleModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatSaddleModel.java index 15d372d823..73515f354c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatSaddleModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/broadhoof/features/BroadhoofGoatSaddleModel.java @@ -1,9 +1,15 @@ package net.sevenstars.middleearth.entity.beasts.broadhoof.features; -import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; -import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatEntityRenderState; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatEntity; import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatModel; public class BroadhoofGoatSaddleModel extends BroadhoofGoatModel { @@ -11,32 +17,33 @@ public class BroadhoofGoatSaddleModel extends BroadhoofGoatModel { public BroadhoofGoatSaddleModel(ModelPart root) { super(root); - this.reins = root.getChild("broadhoof_goat").getChild(EntityModelPartNames.BODY).getChild(EntityModelPartNames.HEAD).getChild("saddle_things").getChild("reins"); + this.reins = root.getChild("broadhoof_goat").getChild(PartNames.BODY).getChild(PartNames.HEAD).getChild("saddle_things").getChild("reins"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData root = modelData.getRoot().getChild("broadhoof_goat").getChild(EntityModelPartNames.BODY); - ModelPartData head = root.getChild(EntityModelPartNames.HEAD); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition root = modelData.getRoot().getChild("broadhoof_goat").getChild(PartNames.BODY); + PartDefinition head = root.getChild(PartNames.HEAD); - ModelPartData saddle = root.addChild("saddle", ModelPartBuilder.create().uv(74, 19).cuboid(-7.0F, -23.0F, 13.0F, 14.0F, 14.0F, 13.0F, new Dilation(0.3F)) - .uv(92, 72).cuboid(-7.0F, -25.0F, 25.0F, 14.0F, 4.0F, 4.0F, new Dilation(0.5F)), ModelTransform.origin(0.0F, 12.0F, -21.0F)); + PartDefinition saddle = root.addOrReplaceChild("saddle", CubeListBuilder.create().texOffs(74, 19).addBox(-7.0F, -23.0F, 13.0F, 14.0F, 14.0F, 13.0F, new CubeDeformation(0.3F)) + .texOffs(92, 72).addBox(-7.0F, -25.0F, 25.0F, 14.0F, 4.0F, 4.0F, new CubeDeformation(0.5F)), PartPose.offset(0.0F, 12.0F, -21.0F)); - ModelPartData saddle_things = head.addChild("saddle_things", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition saddle_things = head.addOrReplaceChild("saddle_things", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData reins = saddle_things.addChild("reins", ModelPartBuilder.create().uv(81, -3).mirrored().cuboid(-4.1F, -7.0F, -8.0F, 0.0F, 3.0F, 15.0F, new Dilation(0.0F)).mirrored(false) - .uv(81, -3).cuboid(4.1F, -7.0F, -8.0F, 0.0F, 3.0F, 15.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, -2.0F, 1.0F, 0.48F, 0.0F, 0.0F)); + PartDefinition reins = saddle_things.addOrReplaceChild("reins", CubeListBuilder.create().texOffs(81, -3).mirror().addBox(-4.1F, -7.0F, -8.0F, 0.0F, 3.0F, 15.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(81, -3).addBox(4.1F, -7.0F, -8.0F, 0.0F, 3.0F, 15.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -2.0F, 1.0F, 0.48F, 0.0F, 0.0F)); - ModelPartData mouth_things = saddle_things.addChild("mouth_things", ModelPartBuilder.create().uv(62, 50).mirrored().cuboid(-2.0F, -3.0F, 1.0F, 1.0F, 2.0F, 2.0F, new Dilation(0.0F)).mirrored(false) - .uv(62, 50).cuboid(5.0F, -3.0F, 1.0F, 1.0F, 2.0F, 2.0F, new Dilation(0.0F)) - .uv(66, 47).cuboid(-1.0F, -7.0F, -1.0F, 6.0F, 7.0F, 11.0F, new Dilation(0.2F)), ModelTransform.of(-2.0F, 0.0F, -8.0F, 0.7854F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 128, 128); + PartDefinition mouth_things = saddle_things.addOrReplaceChild("mouth_things", CubeListBuilder.create().texOffs(62, 50).mirror().addBox(-2.0F, -3.0F, 1.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(62, 50).addBox(5.0F, -3.0F, 1.0F, 1.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(66, 47).addBox(-1.0F, -7.0F, -1.0F, 6.0F, 7.0F, 11.0F, new CubeDeformation(0.2F)), PartPose.offsetAndRotation(-2.0F, 0.0F, -8.0F, 0.7854F, 0.0F, 0.0F)); + return LayerDefinition.create(modelData, 128, 128); } @Override - public void setAngles(BroadhoofGoatEntityRenderState state) { - super.setAngles(state); + public void setupAnim(BroadhoofGoatEntity entity, float limbSwing, float limbSwingAmount, + float ageInTicks, float netHeadYaw, float headPitch) { + super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - this.reins.visible = state.conrollingPassenger != null; + this.reins.visible = entity.getControllingPassenger() != null; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollAnimations.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollAnimations.java index 02d472762d..3b541e33ff 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollAnimations.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollAnimations.java @@ -1,1767 +1,1770 @@ package net.sevenstars.middleearth.entity.beasts.cave_troll; -import net.minecraft.client.render.entity.animation.*; +import net.minecraft.client.animation.AnimationChannel; +import net.minecraft.client.animation.AnimationDefinition; +import net.minecraft.client.animation.Keyframe; +import net.minecraft.client.animation.KeyframeAnimations; public class CaveTrollAnimations { - public static final AnimationDefinition IDLE = AnimationDefinition.Builder.create(3.5f).looping() - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.875f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.625f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.875f, AnimationHelper.createRotationalVector(0f, 0f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.625f, AnimationHelper.createRotationalVector(0f, 0f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.875f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.625f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.875f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.625f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -1f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createRotationalVector(0f, 0f, -1f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandRight_FingerBase_1", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 7.5f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandRight_FingerBase_3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -2.5f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, -10f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createRotationalVector(0f, 0f, -2.5f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandRight_Thumb", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -2.5f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 5f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createRotationalVector(0f, 0f, -2.5f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandLeft_FingerBase_1", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, -7.5f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandLeft_FingerBase_3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 2.5f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 10f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createRotationalVector(0f, 0f, 2.5f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandLeft_Thumb", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 2.5f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, -5f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createRotationalVector(0f, 0f, 2.5f), - Transformation.Interpolations.CUBIC))).build(); - public static final AnimationDefinition SCREAM = AnimationDefinition.Builder.create(1.75f).looping() -.addBoneAnimation("Head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.33333f, AnimationHelper.createRotationalVector(-22.5f, 0f, -5f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.54167f, AnimationHelper.createRotationalVector(-5f, 0f, 5f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.79167f, AnimationHelper.createRotationalVector(-5f, 0f, -5f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(-5f, 0f, 5f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.375f, AnimationHelper.createRotationalVector(-5f, 0f, -5f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.375f, AnimationHelper.createTranslationalVector(0f, -2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.16667f, AnimationHelper.createRotationalVector(-1f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.375f, AnimationHelper.createRotationalVector(22.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(22.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.29167f, AnimationHelper.createRotationalVector(-13.91f, -4.9f, 8.83f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(27.62f, -12.2f, 21.99f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(27.62f, -12.2f, 21.99f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.29167f, AnimationHelper.createRotationalVector(-13.91f, 4.9f, -8.83f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(27.62f, 12.2f, -21.99f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(27.62f, 12.2f, -21.99f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.29167f, AnimationHelper.createRotationalVector(-6.8f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(12.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Loincloth_Front", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.375f, AnimationHelper.createRotationalVector(7.3f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandRight_FingerBase_1", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.79167f, AnimationHelper.createRotationalVector(0f, 0f, 40f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandRight_FingerBase_3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.79167f, AnimationHelper.createRotationalVector(0f, 0f, 27.5f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandLeft_FingerBase_1", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.79167f, AnimationHelper.createRotationalVector(0f, 0f, -40f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandLeft_FingerBase_3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.79167f, AnimationHelper.createRotationalVector(0f, 0f, -27.5f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))).build(); - public static final AnimationDefinition PASSIVE_WALK = AnimationDefinition.Builder.create(1.75f).looping() - .addBoneAnimation("root", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.29167f, AnimationHelper.createRotationalVector(0f, 0f, -1f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(0f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.29167f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(20f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(20f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 2f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.79167f, AnimationHelper.createTranslationalVector(0f, 0f, -1f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.79167f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, -1f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.29167f, AnimationHelper.createTranslationalVector(0f, 2f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, 0f, -1f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.29167f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-10f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.79167f, AnimationHelper.createRotationalVector(10f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(-10f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(-10f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Loincloth_Back", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 2.5f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Loincloth_Front", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.79167f, AnimationHelper.createTranslationalVector(0f, 0.3f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Loincloth_Front", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-5f, 2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(5.8f, 2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.79167f, AnimationHelper.createRotationalVector(-10.12f, -2.42f, 0.88f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.29167f, AnimationHelper.createRotationalVector(3.87f, 1.18f, 0.24f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(-5f, 2.5f, 0f), - Transformation.Interpolations.CUBIC))).build(); + public static final AnimationDefinition IDLE = AnimationDefinition.Builder.withLength(3.5f).looping() + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.875f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.625f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.875f, KeyframeAnimations.degreeVec(0f, 0f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.625f, KeyframeAnimations.degreeVec(0f, 0f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.875f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.625f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, 0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, 0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.875f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.625f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.degreeVec(0f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandRight_FingerBase_1", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 7.5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandRight_FingerBase_3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -2.5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, -10f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.degreeVec(0f, 0f, -2.5f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandRight_Thumb", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -2.5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.degreeVec(0f, 0f, -2.5f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandLeft_FingerBase_1", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, -7.5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandLeft_FingerBase_3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 2.5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 10f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.degreeVec(0f, 0f, 2.5f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandLeft_Thumb", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 2.5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, -5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.degreeVec(0f, 0f, 2.5f), + AnimationChannel.Interpolations.CATMULLROM))).build(); + public static final AnimationDefinition SCREAM = AnimationDefinition.Builder.withLength(1.75f).looping() +.addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.33333f, KeyframeAnimations.degreeVec(-22.5f, 0f, -5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.54167f, KeyframeAnimations.degreeVec(-5f, 0f, 5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.79167f, KeyframeAnimations.degreeVec(-5f, 0f, -5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(-5f, 0f, 5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.375f, KeyframeAnimations.degreeVec(-5f, 0f, -5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375f, KeyframeAnimations.posVec(0f, -2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, -1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.16667f, KeyframeAnimations.degreeVec(-1f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375f, KeyframeAnimations.degreeVec(22.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(22.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.29167f, KeyframeAnimations.degreeVec(-13.91f, -4.9f, 8.83f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(27.62f, -12.2f, 21.99f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(27.62f, -12.2f, 21.99f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.29167f, KeyframeAnimations.degreeVec(-13.91f, 4.9f, -8.83f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(27.62f, 12.2f, -21.99f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(27.62f, 12.2f, -21.99f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.29167f, KeyframeAnimations.degreeVec(-6.8f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(12.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Loincloth_Front", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375f, KeyframeAnimations.degreeVec(7.3f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(-7.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandRight_FingerBase_1", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.79167f, KeyframeAnimations.degreeVec(0f, 0f, 40f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandRight_FingerBase_3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.79167f, KeyframeAnimations.degreeVec(0f, 0f, 27.5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandLeft_FingerBase_1", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.79167f, KeyframeAnimations.degreeVec(0f, 0f, -40f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandLeft_FingerBase_3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.79167f, KeyframeAnimations.degreeVec(0f, 0f, -27.5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); + public static final AnimationDefinition PASSIVE_WALK = AnimationDefinition.Builder.withLength(1.75f).looping() + .addAnimation("root", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.29167f, KeyframeAnimations.degreeVec(0f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(0f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.29167f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(20f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(20f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 3f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 2f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.79167f, KeyframeAnimations.posVec(0f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, 0f, 3f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.79167f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, 0f, 3f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.29167f, KeyframeAnimations.posVec(0f, 2f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.29167f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-10f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.79167f, KeyframeAnimations.degreeVec(10f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(-10f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(-10f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Loincloth_Back", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Loincloth_Front", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.79167f, KeyframeAnimations.posVec(0f, 0.3f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Loincloth_Front", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-5f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(5.8f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.79167f, KeyframeAnimations.degreeVec(-10.12f, -2.42f, 0.88f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.29167f, KeyframeAnimations.degreeVec(3.87f, 1.18f, 0.24f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(-5f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); - public static final AnimationDefinition INSPECT = AnimationDefinition.Builder.create(5.5f).looping() -.addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(12.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(4.95833f, AnimationHelper.createRotationalVector(12.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(5.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(20.58f, -14.29f, -4.61f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(20.18f, 9.19f, 4.05f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.95833f, AnimationHelper.createRotationalVector(20.58f, -14.29f, -4.61f), - Transformation.Interpolations.CUBIC), - new Keyframe(4.95833f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(5.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(15f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(4.95833f, AnimationHelper.createRotationalVector(15f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(5.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(26.94f, -5.74f, 11.13f), - Transformation.Interpolations.CUBIC), - new Keyframe(4.95833f, AnimationHelper.createRotationalVector(26.94f, -5.74f, 11.13f), - Transformation.Interpolations.CUBIC), - new Keyframe(5.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(26.94f, 5.74f, -11.13f), - Transformation.Interpolations.CUBIC), - new Keyframe(4.95833f, AnimationHelper.createRotationalVector(26.94f, 5.74f, -11.13f), - Transformation.Interpolations.CUBIC), - new Keyframe(5.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))).build(); + public static final AnimationDefinition INSPECT = AnimationDefinition.Builder.withLength(5.5f).looping() +.addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(12.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.95833f, KeyframeAnimations.degreeVec(12.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(5.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(20.58f, -14.29f, -4.61f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(20.18f, 9.19f, 4.05f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.95833f, KeyframeAnimations.degreeVec(20.58f, -14.29f, -4.61f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.95833f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(5.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(15f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.95833f, KeyframeAnimations.degreeVec(15f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(5.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(26.94f, -5.74f, 11.13f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.95833f, KeyframeAnimations.degreeVec(26.94f, -5.74f, 11.13f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(5.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(26.94f, 5.74f, -11.13f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.95833f, KeyframeAnimations.degreeVec(26.94f, 5.74f, -11.13f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(5.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); - public static final AnimationDefinition SCREAM_RUN = AnimationDefinition.Builder.create(2f).looping() -.addBoneAnimation("Head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.08333f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.25f, AnimationHelper.createRotationalVector(-22.5f, 0f, -5f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.375f, AnimationHelper.createRotationalVector(-5f, 0f, 5f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.54167f, AnimationHelper.createRotationalVector(-5f, 0f, -5f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(-5f, 0f, 5f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.95833f, AnimationHelper.createRotationalVector(-5f, 0f, -5f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.08333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.25f, AnimationHelper.createTranslationalVector(0f, -2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.08333f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.125f, AnimationHelper.createRotationalVector(-1f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.25f, AnimationHelper.createRotationalVector(22.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.08333f, AnimationHelper.createRotationalVector(22.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(-13.91f, -4.9f, 8.83f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(27.62f, -12.2f, 21.99f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.08333f, AnimationHelper.createRotationalVector(27.62f, -12.2f, 21.99f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(-13.91f, 4.9f, -8.83f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(27.62f, 12.2f, -21.99f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.08333f, AnimationHelper.createRotationalVector(27.62f, 12.2f, -21.99f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(-6.8f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(12.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Loincloth_Front", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.25f, AnimationHelper.createRotationalVector(7.3f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandRight_FingerBase_1", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.54167f, AnimationHelper.createRotationalVector(0f, 0f, 40f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandRight_FingerBase_3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.54167f, AnimationHelper.createRotationalVector(0f, 0f, 27.5f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandLeft_FingerBase_1", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.54167f, AnimationHelper.createRotationalVector(0f, 0f, -40f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandLeft_FingerBase_3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.54167f, AnimationHelper.createRotationalVector(0f, 0f, -27.5f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))).build(); - public static final AnimationDefinition RUN = AnimationDefinition.Builder.create(1.25f).looping() - .addBoneAnimation("root", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.33333f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.95833f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("root", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.33333f, AnimationHelper.createRotationalVector(0f, 0f, 3.5f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, -5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.95833f, AnimationHelper.createRotationalVector(0f, 0f, -3.5f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 5f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.33333f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.95833f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(7.49f, 0.33f, -2.48f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(7.49f, -0.33f, 2.48f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(7.49f, 0.33f, -2.48f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(0f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.33333f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.95833f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-10.08f, -7.39f, 1.31f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(-10.04f, 4.92f, -0.87f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(-10.08f, -7.39f, 1.31f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.29167f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, -2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.91667f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, -2f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 4f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.33333f, AnimationHelper.createTranslationalVector(0f, 2f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.58333f, AnimationHelper.createTranslationalVector(0f, 0f, -4f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 4f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.33333f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(-10f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, -4f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.58333f, AnimationHelper.createTranslationalVector(0f, 0f, 4f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.95833f, AnimationHelper.createTranslationalVector(0f, 2f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, -4f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-10f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.16667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.95833f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(-10f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.58333f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-54.71f, 1.21f, 6.96f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(39.74f, -7.04f, 0.63f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(-54.71f, 1.21f, 6.96f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.58333f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(37.77f, -0.91f, -7.01f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(-55.14f, -1.24f, -6.96f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(37.77f, -0.91f, -7.01f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Loincloth_Back", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.29167f, AnimationHelper.createRotationalVector(-15f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.875f, AnimationHelper.createRotationalVector(-15f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.16667f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Loincloth_Front", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.58333f, AnimationHelper.createTranslationalVector(0f, 0.3f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Loincloth_Front", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-42.5f, 2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.29167f, AnimationHelper.createRotationalVector(0.8f, 2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(-42.5f, 2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.91667f, AnimationHelper.createRotationalVector(0.8f, 2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(-42.5f, 2.5f, 0f), - Transformation.Interpolations.CUBIC))).build(); - public static final AnimationDefinition SPRINT = AnimationDefinition.Builder.create(1f).looping() - .addBoneAnimation("root", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 3f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 3f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.79167f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 3f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("root", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.25f, AnimationHelper.createRotationalVector(0f, 0f, 3.5f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, -5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.79167f, AnimationHelper.createRotationalVector(0f, 0f, -3.5f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 5f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.25f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.79167f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(7.49f, 0.33f, -2.48f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(7.49f, -0.33f, 2.48f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(7.49f, 0.33f, -2.48f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(0f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.25f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.79167f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-10.08f, -7.39f, 1.31f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-10.04f, 4.92f, -0.87f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(-10.08f, -7.39f, 1.31f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.45833f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, -2f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 4f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.25f, AnimationHelper.createTranslationalVector(0f, 2f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.45833f, AnimationHelper.createTranslationalVector(0f, 0f, -4f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 4f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.25f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.45833f, AnimationHelper.createRotationalVector(-10f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, -4f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.45833f, AnimationHelper.createTranslationalVector(0f, 0f, 4f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.79167f, AnimationHelper.createTranslationalVector(0f, 2f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, -4f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-10f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.125f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.45833f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.79167f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(-10f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.45833f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-74.28f, -13.25f, 2.94f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.45833f, AnimationHelper.createRotationalVector(24.74f, -7.04f, 0.63f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(-74.28f, -13.25f, 2.94f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.45833f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(22.77f, -0.91f, -7.01f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.45833f, AnimationHelper.createRotationalVector(-74.73f, 13.25f, -3.05f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(22.77f, -0.91f, -7.01f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Loincloth_Back", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.25f, AnimationHelper.createRotationalVector(-15f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.45833f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(-15f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.95833f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Loincloth_Front", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.45833f, AnimationHelper.createTranslationalVector(0f, 0.3f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Loincloth_Front", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-42.5f, 2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.25f, AnimationHelper.createRotationalVector(0.8f, 2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.45833f, AnimationHelper.createRotationalVector(-42.5f, 2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(0.8f, 2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(-42.5f, 2.5f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body_no_limbs", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, -1f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.54167f, AnimationHelper.createTranslationalVector(0f, 0f, -1f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.79167f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, -1f), - Transformation.Interpolations.CUBIC))).build(); - public static final AnimationDefinition SMASH_NO_MACE = AnimationDefinition.Builder.create(2f).looping() - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-102.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(32.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition OVERHAND_SMASH = AnimationDefinition.Builder.create(2f) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(25f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(42.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(37.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(37.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, -1f, -1f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-67.2f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(-116.18f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(-150.35f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(-162.85f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-76.78f, -14.78f, -9.48f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, -1f, -1f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-68.18f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(-116.05f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(-152.16f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(-164.66f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-78.19f, 15f, 9.12f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandRight_FingerBase_1", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, -35f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandRight_FingerBase_3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, -32.5f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandLeft_FingerBase_1", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 35f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandLeft_FingerBase_3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 35f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))).build(); - public static final AnimationDefinition SITTING_SLEEP = AnimationDefinition.Builder.create(3.5f).looping() -.addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.20833f, AnimationHelper.createRotationalVector(10f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -3f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, -2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createTranslationalVector(0f, -3f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-32.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createRotationalVector(-32.5f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-25f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createRotationalVector(-25f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("root", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -9f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, -9f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, 35f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createRotationalVector(-90f, 35f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, -35f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createRotationalVector(-90f, -35f, 0f), - Transformation.Interpolations.CUBIC))).build(); - public static final AnimationDefinition STANDING_FROM_SITTING = AnimationDefinition.Builder.create(3f) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(35.39f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.41667f, AnimationHelper.createRotationalVector(28.17f, 5.58f, -9.74f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.125f, AnimationHelper.createRotationalVector(31.47f, -3.93f, 6.39f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(3f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -3f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, -2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-32.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-57.41f, -12.89f, -0.92f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.70833f, AnimationHelper.createRotationalVector(-44.88f, -9.34f, -2.52f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-25f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-62.18f, 9.24f, -5.51f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.70833f, AnimationHelper.createRotationalVector(-48.35f, 6.48f, -1.7f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("root", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -9f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, -9f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("root", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("Loincloth_Front", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("Loincloth_Front", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("Loincloth_Back", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("LegRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.41667f, AnimationHelper.createTranslationalVector(0f, 5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("LegRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, 35f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-85f, 35f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.41667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("LegLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.91667f, AnimationHelper.createTranslationalVector(0f, 6f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.125f, AnimationHelper.createTranslationalVector(0f, 2.43f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("LegLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, -35f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-85f, -35f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.91667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition STANDING_TO_SITTING = AnimationDefinition.Builder.create(2.5f) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(28.17f, 5.58f, -9.74f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.08333f, AnimationHelper.createRotationalVector(35.39f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(36.47f, -3.93f, 6.39f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(0f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.125f, AnimationHelper.createTranslationalVector(0f, -2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.5f, AnimationHelper.createTranslationalVector(0f, -3f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.08333f, AnimationHelper.createRotationalVector(-44.88f, -9.34f, -2.52f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.125f, AnimationHelper.createRotationalVector(-57.41f, -12.89f, -0.92f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(-32.5f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.08333f, AnimationHelper.createRotationalVector(-48.35f, 6.48f, -1.7f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.125f, AnimationHelper.createRotationalVector(-62.18f, 9.24f, -5.51f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(-25f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("root", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.125f, AnimationHelper.createTranslationalVector(0f, -9f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.5f, AnimationHelper.createTranslationalVector(0f, -9f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("root", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.125f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Loincloth_Front", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("Loincloth_Front", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("Loincloth_Back", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.125f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, 5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.125f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.125f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.125f, AnimationHelper.createRotationalVector(-85f, 35f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(-90f, 35f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.29167f, AnimationHelper.createTranslationalVector(0f, 6f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.45833f, AnimationHelper.createTranslationalVector(0f, 2.43f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.125f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.29167f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.125f, AnimationHelper.createRotationalVector(-85f, -35f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(-90f, -35f, 0f), - Transformation.Interpolations.CUBIC))).build(); - public static final AnimationDefinition SITTING_TO_SLEEPING = AnimationDefinition.Builder.create(2f).looping() - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(12.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(-90f, 0f, -1f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -3f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createTranslationalVector(0f, -3f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(12.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-32.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(-32.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(4.66f, -2.25f, 17.36f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-25f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(-25f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(4.09f, 4.43f, -24.64f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("root", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -9f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createTranslationalVector(0f, -9f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, -8f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Loincloth_Front", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(2f, AnimationHelper.createRotationalVector(20f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 1f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, 35f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(-90f, 35f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(-85.27f, 30.02f, -0.5f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, -35f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(-90f, -35f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(-85.27f, -30.02f, 0.5f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(2f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.CUBIC))).build(); - public static final AnimationDefinition SLEEP_LAYING_DOWN = AnimationDefinition.Builder.create(7f).looping() - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(5.25f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(7f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, 0f, -1f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.75f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(5.25f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(7f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(12.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(7f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(4.66f, -2.25f, 17.36f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(7f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(4.09f, 4.43f, -24.64f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("root", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -8f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createTranslationalVector(0f, 0f, -1f), - Transformation.Interpolations.CUBIC), - new Keyframe(7f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(7f, AnimationHelper.createRotationalVector(0f, 0f, 1f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-85.27f, 30.02f, -0.5f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("LegLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-85.27f, -30.02f, 0.5f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createTranslationalVector(0f, 0f, -1f), - Transformation.Interpolations.CUBIC), - new Keyframe(7f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(0f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.5f, AnimationHelper.createScalingVector(1f, 1f, 1.05f), - Transformation.Interpolations.CUBIC), - new Keyframe(7f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("Loincloth_Front", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(20f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.41667f, AnimationHelper.createRotationalVector(27.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(4.45833f, AnimationHelper.createRotationalVector(27.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(7f, AnimationHelper.createRotationalVector(20f, 0f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("HandRight_FingerBase_1", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -20f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("HandRight_FingerBase_3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -20f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("HandLeft_FingerBase_1", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 22.5f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("HandLeft_FingerBase_3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 20f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition SLEEP_LAYING_DOWN_STANDING_UP = AnimationDefinition.Builder.create(4f) -.addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(35.39f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2f, AnimationHelper.createRotationalVector(35.39f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.41667f, AnimationHelper.createRotationalVector(28.17f, 5.58f, -9.74f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.125f, AnimationHelper.createRotationalVector(31.47f, -3.93f, 6.39f), - Transformation.Interpolations.CUBIC), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body_no_legs", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(4f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -4f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, -2f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(22.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("ArmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(4.38f, 9.63f, 25.79f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-57.41f, -12.89f, -0.92f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.70833f, AnimationHelper.createRotationalVector(-44.88f, -9.34f, -2.52f), - Transformation.Interpolations.CUBIC), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("ArmLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(3.49f, -7.56f, -32.91f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-62.18f, 9.24f, -5.51f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.70833f, AnimationHelper.createRotationalVector(-48.35f, 6.48f, -1.7f), - Transformation.Interpolations.CUBIC), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("root", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -9f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, -9f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("root", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("Loincloth_Front", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("Loincloth_Front", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("Loincloth_Back", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("Head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-17.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("LegRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.41667f, AnimationHelper.createTranslationalVector(0f, 5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("LegRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-85f, 35f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-85f, 35f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.41667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("LegLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.91667f, AnimationHelper.createTranslationalVector(0f, 6f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(3.125f, AnimationHelper.createTranslationalVector(0f, 2.43f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("LegLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-85f, -35f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-85f, -35f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); + public static final AnimationDefinition SCREAM_RUN = AnimationDefinition.Builder.withLength(2f).looping() +.addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.08333f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25f, KeyframeAnimations.degreeVec(-22.5f, 0f, -5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375f, KeyframeAnimations.degreeVec(-5f, 0f, 5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.54167f, KeyframeAnimations.degreeVec(-5f, 0f, -5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(-5f, 0f, 5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.95833f, KeyframeAnimations.degreeVec(-5f, 0f, -5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.08333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25f, KeyframeAnimations.posVec(0f, -2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.08333f, KeyframeAnimations.posVec(0f, -1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.125f, KeyframeAnimations.degreeVec(-1f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25f, KeyframeAnimations.degreeVec(22.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.08333f, KeyframeAnimations.degreeVec(22.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(-13.91f, -4.9f, 8.83f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(27.62f, -12.2f, 21.99f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.08333f, KeyframeAnimations.degreeVec(27.62f, -12.2f, 21.99f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(-13.91f, 4.9f, -8.83f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(27.62f, 12.2f, -21.99f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.08333f, KeyframeAnimations.degreeVec(27.62f, 12.2f, -21.99f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(-6.8f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(12.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Loincloth_Front", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25f, KeyframeAnimations.degreeVec(7.3f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(-7.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandRight_FingerBase_1", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.54167f, KeyframeAnimations.degreeVec(0f, 0f, 40f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandRight_FingerBase_3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.54167f, KeyframeAnimations.degreeVec(0f, 0f, 27.5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandLeft_FingerBase_1", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.54167f, KeyframeAnimations.degreeVec(0f, 0f, -40f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandLeft_FingerBase_3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.54167f, KeyframeAnimations.degreeVec(0f, 0f, -27.5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); + public static final AnimationDefinition RUN = AnimationDefinition.Builder.withLength(1.25f).looping() + .addAnimation("root", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.33333f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.95833f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("root", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.33333f, KeyframeAnimations.degreeVec(0f, 0f, 3.5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, -5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.95833f, KeyframeAnimations.degreeVec(0f, 0f, -3.5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.33333f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.95833f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(7.49f, 0.33f, -2.48f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(7.49f, -0.33f, 2.48f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(7.49f, 0.33f, -2.48f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(0f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.33333f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.95833f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-10.08f, -7.39f, 1.31f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(-10.04f, 4.92f, -0.87f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(-10.08f, -7.39f, 1.31f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.29167f, KeyframeAnimations.posVec(0f, -1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, -2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.91667f, KeyframeAnimations.posVec(0f, -1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, -2f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 4f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.33333f, KeyframeAnimations.posVec(0f, 2f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.58333f, KeyframeAnimations.posVec(0f, 0f, -4f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 4f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.33333f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(-10f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, -4f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.58333f, KeyframeAnimations.posVec(0f, 0f, 4f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.95833f, KeyframeAnimations.posVec(0f, 2f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, -4f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-10f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.16667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.95833f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(-10f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.58333f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-54.71f, 1.21f, 6.96f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(39.74f, -7.04f, 0.63f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(-54.71f, 1.21f, 6.96f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.58333f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, -1f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(37.77f, -0.91f, -7.01f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(-55.14f, -1.24f, -6.96f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(37.77f, -0.91f, -7.01f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Loincloth_Back", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.29167f, KeyframeAnimations.degreeVec(-15f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.875f, KeyframeAnimations.degreeVec(-15f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.16667f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Loincloth_Front", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.58333f, KeyframeAnimations.posVec(0f, 0.3f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Loincloth_Front", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-42.5f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.29167f, KeyframeAnimations.degreeVec(0.8f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(-42.5f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.91667f, KeyframeAnimations.degreeVec(0.8f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(-42.5f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); + public static final AnimationDefinition SPRINT = AnimationDefinition.Builder.withLength(1f).looping() + .addAnimation("root", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 3f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 3f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.79167f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 3f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("root", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25f, KeyframeAnimations.degreeVec(0f, 0f, 3.5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, -5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.79167f, KeyframeAnimations.degreeVec(0f, 0f, -3.5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.79167f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(7.49f, 0.33f, -2.48f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(7.49f, -0.33f, 2.48f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(7.49f, 0.33f, -2.48f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(0f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.79167f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-10.08f, -7.39f, 1.31f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-10.04f, 4.92f, -0.87f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(-10.08f, -7.39f, 1.31f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.45833f, KeyframeAnimations.posVec(0f, -1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.posVec(0f, -2f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 4f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25f, KeyframeAnimations.posVec(0f, 2f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.45833f, KeyframeAnimations.posVec(0f, 0f, -4f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 4f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.45833f, KeyframeAnimations.degreeVec(-10f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, -4f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.45833f, KeyframeAnimations.posVec(0f, 0f, 4f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.79167f, KeyframeAnimations.posVec(0f, 2f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, -4f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-10f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.125f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.45833f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.79167f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(-10f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.45833f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-74.28f, -13.25f, 2.94f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.45833f, KeyframeAnimations.degreeVec(24.74f, -7.04f, 0.63f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(-74.28f, -13.25f, 2.94f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.45833f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.posVec(0f, -1f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(22.77f, -0.91f, -7.01f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.45833f, KeyframeAnimations.degreeVec(-74.73f, 13.25f, -3.05f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(22.77f, -0.91f, -7.01f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Loincloth_Back", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25f, KeyframeAnimations.degreeVec(-15f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.45833f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(-15f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.95833f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Loincloth_Front", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.45833f, KeyframeAnimations.posVec(0f, 0.3f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Loincloth_Front", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-42.5f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25f, KeyframeAnimations.degreeVec(0.8f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.45833f, KeyframeAnimations.degreeVec(-42.5f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(0.8f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(-42.5f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body_no_limbs", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.54167f, KeyframeAnimations.posVec(0f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.79167f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM))).build(); + public static final AnimationDefinition SMASH_NO_MACE = AnimationDefinition.Builder.withLength(2f).looping() + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-102.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(32.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition OVERHAND_SMASH = AnimationDefinition.Builder.withLength(2f) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(25f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(42.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(37.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(37.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, -1f, -1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-67.2f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(-116.18f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(-150.35f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(-162.85f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-76.78f, -14.78f, -9.48f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, -1f, -1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-68.18f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(-116.05f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(-152.16f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(-164.66f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-78.19f, 15f, 9.12f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandRight_FingerBase_1", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, -35f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandRight_FingerBase_3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, -32.5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandLeft_FingerBase_1", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 35f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandLeft_FingerBase_3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 35f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); + public static final AnimationDefinition SITTING_SLEEP = AnimationDefinition.Builder.withLength(3.5f).looping() +.addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.20833f, KeyframeAnimations.degreeVec(10f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -3f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, -2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.posVec(0f, -3f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-32.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.degreeVec(-32.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-25f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.degreeVec(-25f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("root", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -9f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.posVec(0f, -9f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, -1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, 35f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.degreeVec(-90f, 35f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, -35f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.degreeVec(-90f, -35f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); + public static final AnimationDefinition STANDING_FROM_SITTING = AnimationDefinition.Builder.withLength(3f) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(35.39f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.41667f, KeyframeAnimations.degreeVec(28.17f, 5.58f, -9.74f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.125f, KeyframeAnimations.degreeVec(31.47f, -3.93f, 6.39f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(3f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -3f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, -2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-32.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-57.41f, -12.89f, -0.92f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.70833f, KeyframeAnimations.degreeVec(-44.88f, -9.34f, -2.52f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-25f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-62.18f, 9.24f, -5.51f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.70833f, KeyframeAnimations.degreeVec(-48.35f, 6.48f, -1.7f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("root", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -9f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, -9f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("root", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("Loincloth_Front", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(3f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("Loincloth_Front", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("Loincloth_Back", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, -1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("LegRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.41667f, KeyframeAnimations.posVec(0f, 5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("LegRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, 35f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-85f, 35f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.41667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("LegLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.91667f, KeyframeAnimations.posVec(0f, 6f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.125f, KeyframeAnimations.posVec(0f, 2.43f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("LegLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, -35f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-85f, -35f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.91667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition STANDING_TO_SITTING = AnimationDefinition.Builder.withLength(2.5f) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(28.17f, 5.58f, -9.74f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.08333f, KeyframeAnimations.degreeVec(35.39f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(36.47f, -3.93f, 6.39f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(0f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.125f, KeyframeAnimations.posVec(0f, -2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5f, KeyframeAnimations.posVec(0f, -3f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.08333f, KeyframeAnimations.degreeVec(-44.88f, -9.34f, -2.52f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.125f, KeyframeAnimations.degreeVec(-57.41f, -12.89f, -0.92f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(-32.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.08333f, KeyframeAnimations.degreeVec(-48.35f, 6.48f, -1.7f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.125f, KeyframeAnimations.degreeVec(-62.18f, 9.24f, -5.51f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(-25f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("root", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.125f, KeyframeAnimations.posVec(0f, -9f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5f, KeyframeAnimations.posVec(0f, -9f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("root", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.125f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Loincloth_Front", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("Loincloth_Front", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("Loincloth_Back", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.125f, KeyframeAnimations.posVec(0f, -1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, 5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.125f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.125f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.125f, KeyframeAnimations.degreeVec(-85f, 35f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(-90f, 35f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.29167f, KeyframeAnimations.posVec(0f, 6f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.45833f, KeyframeAnimations.posVec(0f, 2.43f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.125f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.29167f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.125f, KeyframeAnimations.degreeVec(-85f, -35f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(-90f, -35f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); + public static final AnimationDefinition SITTING_TO_SLEEPING = AnimationDefinition.Builder.withLength(2f).looping() + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(12.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(-90f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -3f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.posVec(0f, -3f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(12.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(2f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-32.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(-32.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(4.66f, -2.25f, 17.36f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(2f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-25f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(-25f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(4.09f, 4.43f, -24.64f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("root", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -9f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.posVec(0f, -9f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.posVec(0f, -8f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Loincloth_Front", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(2f, KeyframeAnimations.degreeVec(20f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 1f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, 35f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(-90f, 35f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(-85.27f, 30.02f, -0.5f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, -35f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(-90f, -35f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(-85.27f, -30.02f, 0.5f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(2f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.CATMULLROM))).build(); + public static final AnimationDefinition SLEEP_LAYING_DOWN = AnimationDefinition.Builder.withLength(7f).looping() + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(5.25f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(7f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(5.25f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(7f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(12.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.posVec(0f, 0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(7f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(4.66f, -2.25f, 17.36f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.posVec(0f, 0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(7f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(4.09f, 4.43f, -24.64f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("root", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -8f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.posVec(0f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(7f, KeyframeAnimations.posVec(0f, -0.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(7f, KeyframeAnimations.degreeVec(0f, 0f, 1f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-85.27f, 30.02f, -0.5f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("LegLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-85.27f, -30.02f, 0.5f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.posVec(0f, 0f, -1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(7f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(0f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.5f, KeyframeAnimations.scaleVec(1f, 1f, 1.05f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(7f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("Loincloth_Front", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(20f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.41667f, KeyframeAnimations.degreeVec(27.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.45833f, KeyframeAnimations.degreeVec(27.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(7f, KeyframeAnimations.degreeVec(20f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("HandRight_FingerBase_1", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -20f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("HandRight_FingerBase_3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -20f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("HandLeft_FingerBase_1", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 22.5f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("HandLeft_FingerBase_3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 20f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition SLEEP_LAYING_DOWN_STANDING_UP = AnimationDefinition.Builder.withLength(4f) +.addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(35.39f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2f, KeyframeAnimations.degreeVec(35.39f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.41667f, KeyframeAnimations.degreeVec(28.17f, 5.58f, -9.74f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.125f, KeyframeAnimations.degreeVec(31.47f, -3.93f, 6.39f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body_no_legs", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(4f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -4f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, -2f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(22.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("ArmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(4.38f, 9.63f, 25.79f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-57.41f, -12.89f, -0.92f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.70833f, KeyframeAnimations.degreeVec(-44.88f, -9.34f, -2.52f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("ArmLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(3.49f, -7.56f, -32.91f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-62.18f, 9.24f, -5.51f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.70833f, KeyframeAnimations.degreeVec(-48.35f, 6.48f, -1.7f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("root", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -9f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, -9f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("root", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("Loincloth_Front", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("Loincloth_Front", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("Loincloth_Back", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, -1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("Head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-17.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("LegRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.41667f, KeyframeAnimations.posVec(0f, 5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("LegRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-85f, 35f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-85f, 35f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.41667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("LegLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.91667f, KeyframeAnimations.posVec(0f, 6f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.125f, KeyframeAnimations.posVec(0f, 2.43f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("LegLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-85f, -35f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-85f, -35f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollBrain.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollBrain.java index a52a0f6328..e491c62eb4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollBrain.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollBrain.java @@ -5,15 +5,23 @@ import com.google.common.collect.ImmutableSet; import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Dynamic; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.brain.Activity; -import net.minecraft.entity.ai.brain.Brain; -import net.minecraft.entity.ai.brain.MemoryModuleState; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.sensor.Sensor; -import net.minecraft.entity.ai.brain.sensor.SensorType; -import net.minecraft.entity.ai.brain.task.*; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.Brain; +import net.minecraft.world.entity.ai.behavior.CountDownCooldownTicks; +import net.minecraft.world.entity.ai.behavior.GateBehavior; +import net.minecraft.world.entity.ai.behavior.LookAtTargetSink; +import net.minecraft.world.entity.ai.behavior.MeleeAttack; +import net.minecraft.world.entity.ai.behavior.MoveToTargetSink; +import net.minecraft.world.entity.ai.behavior.RandomStroll; +import net.minecraft.world.entity.ai.behavior.RunOne; +import net.minecraft.world.entity.ai.behavior.SetWalkTargetFromAttackTargetIfTargetOutOfReach; +import net.minecraft.world.entity.ai.behavior.StartAttacking; +import net.minecraft.world.entity.ai.behavior.StopAttackingIfTargetInvalid; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.MemoryStatus; +import net.minecraft.world.entity.ai.sensing.Sensor; +import net.minecraft.world.entity.ai.sensing.SensorType; +import net.minecraft.world.entity.schedule.Activity; import net.sevenstars.middleearth.entity.ai.brain.ActivitiesME; import net.sevenstars.middleearth.entity.ai.brain.MemoryModulesME; import net.sevenstars.middleearth.entity.ai.brain.SensorsME; @@ -26,8 +34,8 @@ public class CaveTrollBrain { protected static final ImmutableList> MEMORY_MODULES; protected static Brain create(CaveTrollEntity troll, Dynamic dynamic) { - Brain.Profile profile = Brain.createProfile(MEMORY_MODULES, SENSORS); - Brain brain = profile.deserialize(dynamic); + Brain.Provider profile = Brain.provider(MEMORY_MODULES, SENSORS); + Brain brain = profile.makeBrain(dynamic); addCoreActivities(brain); addIdleActivities(brain); @@ -36,31 +44,31 @@ protected static Brain create(CaveTrollEntity troll, Dynamic dynamic) { brain.setCoreActivities(ImmutableSet.of(Activity.CORE)); brain.setDefaultActivity(Activity.FIGHT); - brain.resetPossibleActivities(); + brain.useDefaultActivity(); return brain; } private static void addCoreActivities(Brain brain) { - brain.forget(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE); - brain.setTaskList(Activity.CORE, 0, ImmutableList.of( - new MoveToTargetTask(), - new UpdateLookControlTask(45, 90), - new TickCooldownTask(MemoryModulesME.DIG_FOR_FOOD_COOLDOWN), - new TickCooldownTask(MemoryModulesME.ROAR_COOLDOWN), - new TickCooldownTask(MemoryModulesME.SMASH_COOLDOWN), - new TickCooldownTask(MemoryModulesME.ACTION_TIMEOUT) + brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE); + brain.addActivity(Activity.CORE, 0, ImmutableList.of( + new MoveToTargetSink(), + new LookAtTargetSink(45, 90), + new CountDownCooldownTicks(MemoryModulesME.DIG_FOR_FOOD_COOLDOWN), + new CountDownCooldownTicks(MemoryModulesME.ROAR_COOLDOWN), + new CountDownCooldownTicks(MemoryModulesME.SMASH_COOLDOWN), + new CountDownCooldownTicks(MemoryModulesME.ACTION_TIMEOUT) )); } private static void addIdleActivities(Brain brain) { - brain.setTaskList(Activity.IDLE, ImmutableList.of( - Pair.of(0, UpdateAttackTargetTask.create(CaveTrollBrain::getAttackTarget)), - Pair.of(0, UpdateAttackTargetTask.create(CaveTrollBrain::getHurtBy)), - Pair.of(1, new RandomTask<>(ImmutableList.of( - Pair.of(StrollTask.create(1.0F), 5), - Pair.of(new CompositeTask<>(ImmutableMap.of(MemoryModulesME.ACTION_TIMEOUT, MemoryModuleState.VALUE_ABSENT), ImmutableSet.of(), - CompositeTask.Order.ORDERED, - CompositeTask.RunMode.TRY_ALL, + brain.addActivityWithConditions(Activity.IDLE, ImmutableList.of( + Pair.of(0, StartAttacking.create(CaveTrollBrain::getAttackTarget)), + Pair.of(0, StartAttacking.create(CaveTrollBrain::getHurtBy)), + Pair.of(1, new RunOne<>(ImmutableList.of( + Pair.of(RandomStroll.stroll(1.0F), 5), + Pair.of(new GateBehavior<>(ImmutableMap.of(MemoryModulesME.ACTION_TIMEOUT, MemoryStatus.VALUE_ABSENT), ImmutableSet.of(), + GateBehavior.OrderPolicy.ORDERED, + GateBehavior.RunningPolicy.TRY_ALL, ImmutableList.of( Pair.of(new CaveTrollDigForFoodTask(), 1), Pair.of(new CaveTrollEatFoodTask(), 1), @@ -69,54 +77,54 @@ private static void addIdleActivities(Brain brain) { ))) ), ImmutableSet.of( - Pair.of(MemoryModulesME.TAME, MemoryModuleState.VALUE_ABSENT) + Pair.of(MemoryModulesME.TAME, MemoryStatus.VALUE_ABSENT) )); } private static void addTamedActivities(Brain brain) { - brain.setTaskList(ActivitiesME.TAMED, ImmutableList.of( - Pair.of(0, UpdateAttackTargetTask.create(CaveTrollBrain::getAttackTarget)), - Pair.of(1, new CompositeTask<>(ImmutableMap.of(MemoryModulesME.SITTING, MemoryModuleState.VALUE_ABSENT), ImmutableSet.of(), - CompositeTask.Order.SHUFFLED, - CompositeTask.RunMode.RUN_ONE, + brain.addActivityWithConditions(ActivitiesME.TAMED, ImmutableList.of( + Pair.of(0, StartAttacking.create(CaveTrollBrain::getAttackTarget)), + Pair.of(1, new GateBehavior<>(ImmutableMap.of(MemoryModulesME.SITTING, MemoryStatus.VALUE_ABSENT), ImmutableSet.of(), + GateBehavior.OrderPolicy.SHUFFLED, + GateBehavior.RunningPolicy.RUN_ONE, ImmutableList.of( - Pair.of(StrollTask.create(1.0f), 1) + Pair.of(RandomStroll.stroll(1.0f), 1) ))) ), ImmutableSet.of( - Pair.of(MemoryModulesME.TAME, MemoryModuleState.VALUE_PRESENT) + Pair.of(MemoryModulesME.TAME, MemoryStatus.VALUE_PRESENT) ) ); } private static void addFightActivities(Brain brain, CaveTrollEntity troll) { - brain.setTaskList(Activity.FIGHT, ImmutableList.of( - Pair.of(0, ForgetAttackTargetTask.create()), - Pair.of(2, new RandomTask<>(ImmutableList.of( - Pair.of(MeleeAttackTask.create(30), 4), - Pair.of(RangedApproachTask.create(2.5F), 3), + brain.addActivityWithConditions(Activity.FIGHT, ImmutableList.of( + Pair.of(0, StopAttackingIfTargetInvalid.create()), + Pair.of(2, new RunOne<>(ImmutableList.of( + Pair.of(MeleeAttack.create(30), 4), + Pair.of(SetWalkTargetFromAttackTargetIfTargetOutOfReach.create(2.5F), 3), Pair.of(new BeastChargeTask(troll.chargeDuration(), troll.maxChargeCooldown()), 1), Pair.of(new CaveTrollRoarTask(), 2), Pair.of(new CaveTrollSmashTask(), 2) ))) ), ImmutableSet.of( - Pair.of(MemoryModuleType.ATTACK_TARGET, MemoryModuleState.VALUE_PRESENT) + Pair.of(MemoryModuleType.ATTACK_TARGET, MemoryStatus.VALUE_PRESENT) ) ); } - private static Optional getAttackTarget(ServerWorld world, CaveTrollEntity troll) { - return (troll.isSleeping() || troll.isSitting()) ? troll.getBrain().getOptionalRegisteredMemory(MemoryModuleType.HURT_BY_ENTITY) : troll.getBrain().getOptionalRegisteredMemory(MemoryModuleType.NEAREST_ATTACKABLE); + private static Optional getAttackTarget(CaveTrollEntity troll) { + return (troll.isSleeping() || troll.isSitting()) ? troll.getBrain().getMemory(MemoryModuleType.HURT_BY_ENTITY) : troll.getBrain().getMemory(MemoryModuleType.NEAREST_ATTACKABLE); } - private static Optional getHurtBy (ServerWorld world, CaveTrollEntity troll) { - return troll.getBrain().getOptionalRegisteredMemory(MemoryModuleType.HURT_BY_ENTITY); + private static Optional getHurtBy(CaveTrollEntity troll) { + return troll.getBrain().getMemory(MemoryModuleType.HURT_BY_ENTITY); } public static void updateActivities(CaveTrollEntity troll) { - troll.getBrain().resetPossibleActivities(ImmutableList.of(Activity.FIGHT, ActivitiesME.TAMED, Activity.IDLE)); - troll.getBrain().refreshActivities(troll.getWorld().getTimeOfDay(), troll.getWorld().getTime()); + troll.getBrain().setActiveActivityToFirstValid(ImmutableList.of(Activity.FIGHT, ActivitiesME.TAMED, Activity.IDLE)); + troll.getBrain().updateActivityFromSchedule(troll.level().getDayTime(), troll.level().getGameTime()); } static { @@ -135,7 +143,7 @@ public static void updateActivities(CaveTrollEntity troll) { MemoryModuleType.LAST_WOKEN, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, - MemoryModuleType.VISIBLE_MOBS, + MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.LOOK_TARGET, diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollEntity.java index 558f45ac6d..c4d3bdbdc4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollEntity.java @@ -2,55 +2,61 @@ import com.google.common.collect.ImmutableList; import com.mojang.serialization.Dynamic; -import net.minecraft.advancement.criterion.Criteria; -import net.minecraft.block.BlockState; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.AttributeModifiersComponent; -import net.minecraft.entity.*; -import net.minecraft.entity.ai.brain.Brain; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.attribute.DefaultAttributeContainer; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.data.TrackedData; -import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.entity.passive.AnimalEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.loot.LootTable; -import net.minecraft.loot.context.LootContextParameters; -import net.minecraft.loot.context.LootContextTypes; -import net.minecraft.loot.context.LootWorldContext; -import net.minecraft.particle.BlockStateParticleEffect; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.tag.BlockTags; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundEvent; -import net.minecraft.sound.SoundEvents; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.Identifier; -import net.minecraft.util.Util; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Box; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.profiler.Profiler; -import net.minecraft.util.profiler.Profilers; -import net.minecraft.world.LocalDifficulty; -import net.minecraft.world.ServerWorldAccess; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; +import net.minecraft.Util; +import net.minecraft.advancements.CriteriaTriggers; +import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.particles.BlockParticleOption; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.tags.TagKey; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; +import net.minecraft.util.profiling.ProfilerFiller; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.AnimationState; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntityEvent; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.SpawnGroupData; +import net.minecraft.world.entity.ai.Brain; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.animal.Animal; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.ItemAttributeModifiers; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.ServerLevelAccessor; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.storage.loot.LootParams; +import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; +import net.minecraft.world.level.storage.loot.parameters.LootContextParams; +import net.minecraft.world.phys.AABB; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.ai.brain.MemoryModulesME; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; @@ -68,16 +74,16 @@ // TODO Add sounds public class CaveTrollEntity extends AbstractBeastEntity { public LootTable scavengeLootTable; - public LootWorldContext lootWorldContext; + public LootParams lootWorldContext; private float smashingStrength; // Used in server-side only private float smashingTime; // Used in server-side only private float enragedTime; // Used in server-side only - public static final TrackedData SCAVENGING = DataTracker.registerData(CaveTrollEntity.class, TrackedDataHandlerRegistry.BOOLEAN); - public static final TrackedData ROARING = DataTracker.registerData(CaveTrollEntity.class, TrackedDataHandlerRegistry.BOOLEAN); - public static final TrackedData SLEEPING = DataTracker.registerData(CaveTrollEntity.class, TrackedDataHandlerRegistry.BOOLEAN); - public static final TrackedData SMASHING = DataTracker.registerData(CaveTrollEntity.class, TrackedDataHandlerRegistry.BOOLEAN); - public static final TrackedData ENRAGED = DataTracker.registerData(CaveTrollEntity.class, TrackedDataHandlerRegistry.BOOLEAN); - private static final TrackedData VARIANT = DataTracker.registerData(CaveTrollEntity.class, TrackedDataHandlerRegistry.INTEGER); + public static final EntityDataAccessor SCAVENGING = SynchedEntityData.defineId(CaveTrollEntity.class, EntityDataSerializers.BOOLEAN); + public static final EntityDataAccessor ROARING = SynchedEntityData.defineId(CaveTrollEntity.class, EntityDataSerializers.BOOLEAN); + public static final EntityDataAccessor SLEEPING = SynchedEntityData.defineId(CaveTrollEntity.class, EntityDataSerializers.BOOLEAN); + public static final EntityDataAccessor SMASHING = SynchedEntityData.defineId(CaveTrollEntity.class, EntityDataSerializers.BOOLEAN); + public static final EntityDataAccessor ENRAGED = SynchedEntityData.defineId(CaveTrollEntity.class, EntityDataSerializers.BOOLEAN); + private static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(CaveTrollEntity.class, EntityDataSerializers.INT); public final AnimationState chaseAnimationState = new AnimationState(); public final AnimationState scavengingAnimationState = new AnimationState(); public final AnimationState startSleepingAnimationState = new AnimationState(); @@ -86,68 +92,68 @@ public class CaveTrollEntity extends AbstractBeastEntity { public final AnimationState roaringAnimationState = new AnimationState(); public final AnimationState smashingAnimationState = new AnimationState(); - public CaveTrollEntity(EntityType entityType, World world) { + public CaveTrollEntity(EntityType entityType, Level world) { super(entityType, world); - if(scavengeLootTable == null && !world.isClient()) { - if(world instanceof ServerWorld serverWorld) { + if(scavengeLootTable == null && !world.isClientSide()) { + if(world instanceof ServerLevel serverWorld) { - LootTable lootTable = serverWorld.getServer().getReloadableRegistries().getLootTable(RegistryKey.of(RegistryKeys.LOOT_TABLE, Identifier.of(MiddleEarth.MOD_ID, "gameplay/cave_troll_scavenging"))); + LootTable lootTable = serverWorld.getServer().reloadableRegistries().getLootTable(ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "gameplay/cave_troll_scavenging"))); if(lootTable != null) { scavengeLootTable = lootTable; - lootWorldContext = new LootWorldContext.Builder(serverWorld) - .add(LootContextParameters.THIS_ENTITY, this) - .add(LootContextParameters.ORIGIN, this.getPos()) - .build(LootContextTypes.CHEST); + lootWorldContext = new LootParams.Builder(serverWorld) + .withParameter(LootContextParams.THIS_ENTITY, this) + .withParameter(LootContextParams.ORIGIN, this.position()) + .create(LootContextParamSets.CHEST); } } } } - public static DefaultAttributeContainer.Builder setAttributes() { - return AnimalEntity.createAnimalAttributes() - .add(EntityAttributes.MOVEMENT_SPEED, 0.1f) - .add(EntityAttributes.MAX_HEALTH, 120.0) - .add(EntityAttributes.KNOCKBACK_RESISTANCE, 0.8) - .add(EntityAttributes.ATTACK_SPEED, 0.65) - .add(EntityAttributes.FOLLOW_RANGE, 28.0) - .add(EntityAttributes.ATTACK_DAMAGE, 10.0) - .add(EntityAttributes.STEP_HEIGHT, 1.25) - .add(EntityAttributes.FOLLOW_RANGE, 15.0); + public static AttributeSupplier.Builder setAttributes() { + return Mob.createMobAttributes() + .add(Attributes.MOVEMENT_SPEED, 0.1f) + .add(Attributes.MAX_HEALTH, 120.0) + .add(Attributes.KNOCKBACK_RESISTANCE, 0.8) + .add(Attributes.ATTACK_SPEED, 0.65) + .add(Attributes.FOLLOW_RANGE, 28.0) + .add(Attributes.ATTACK_DAMAGE, 10.0) + .add(Attributes.STEP_HEIGHT, 1.25) + .add(Attributes.FOLLOW_RANGE, 15.0); } @Override - protected void initDataTracker(DataTracker.Builder builder) { - super.initDataTracker(builder); - builder.add(SCAVENGING, false); - builder.add(ROARING, false); - builder.add(SLEEPING, false); - builder.add(SMASHING, false); - builder.add(ENRAGED, false); - builder.add(VARIANT, 0); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(SCAVENGING, false); + builder.define(ROARING, false); + builder.define(SLEEPING, false); + builder.define(SMASHING, false); + builder.define(ENRAGED, false); + builder.define(VARIANT, 0); } @Override - public void writeData(WriteView view) { - super.writeData(view); + public void addAdditionalSaveData(CompoundTag view) { + super.addAdditionalSaveData(view); view.putInt("Variant", this.getTypeVariant()); } @Override - protected void readCustomData(ReadView view) { - super.readCustomData(view); - this.dataTracker.set(VARIANT, view.getInt("Variant", 0)); + public void readAdditionalSaveData(CompoundTag view) { + super.readAdditionalSaveData(view); + this.entityData.set(VARIANT, view.getInt("Variant")); } @Nullable @Override - public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData) { + public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData) { CaveTrollVariant variant = Util.getRandom(CaveTrollVariant.values(), this.random); setVariant(variant); - return super.initialize(world, difficulty, spawnReason, entityData); + return super.finalizeSpawn(world, difficulty, spawnReason, entityData); } public CaveTrollVariant getVariant() { @@ -155,82 +161,86 @@ public CaveTrollVariant getVariant() { } private int getTypeVariant() { - return this.dataTracker.get(VARIANT); + return this.entityData.get(VARIANT); } private void setVariant(CaveTrollVariant variant) { - this.dataTracker.set(VARIANT, variant.getId() & 255); + this.entityData.set(VARIANT, variant.getId() & 255); } @Override - protected void mobTick(ServerWorld world) { - Profiler profiler = Profilers.get(); + protected void customServerAiStep() { + ServerLevel world = (ServerLevel)this.level(); + ProfilerFiller profiler = this.level().getProfiler(); profiler.push("caveTrollBrain"); this.getBrain().tick(world, this); - profiler.swap("caveTrollActivityUpdate"); + profiler.popPush("caveTrollActivityUpdate"); CaveTrollBrain.updateActivities(this); profiler.pop(); - if(!this.isClientWorld() && this.isAffectedByDaylight()) { - this.addStatusEffect(new StatusEffectInstance(StatusEffects.WEAKNESS, 100)); + if(!this.isClientWorld() && this.isSunBurnTick()) { + this.addEffect(new MobEffectInstance(MobEffects.WEAKNESS, 100)); } - super.mobTick(world); + super.customServerAiStep(); } @Override - public void tryBonding(PlayerEntity player) { + public void tryBonding(Player player) { double rand = this.random.nextDouble(); - if(rand < 0.15 || (rand < 0.3 && this.getTameness() <= 0) || player.isInCreativeMode()) { // Tame success, chance is twice as high if the troll is feral + if(rand < 0.15 || (rand < 0.3 && this.getTameness() <= 0) || player.hasInfiniteMaterials()) { // Tame success, chance is twice as high if the troll is feral this.tameBeast(player); - this.getWorld().sendEntityStatus(this, EntityStatuses.ADD_POSITIVE_PLAYER_REACTION_PARTICLES); + this.level().broadcastEntityEvent(this, EntityEvent.TAMING_SUCCEEDED); this.chargeTimeout = 0; } else if(rand > 0.7) { // Tame failure (wake up, become enraged) - this.enragedTime = this.age; + this.enragedTime = this.tickCount; this.setEnraged(true); - this.getBrain().remember(MemoryModuleType.ATTACK_TARGET, player); - this.addStatusEffect(new StatusEffectInstance(StatusEffects.STRENGTH, 1200)); - this.getWorld().sendEntityStatus(this, EntityStatuses.ADD_NEGATIVE_PLAYER_REACTION_PARTICLES); + this.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, player); + this.addEffect(new MobEffectInstance(MobEffects.DAMAGE_BOOST, 1200)); + this.level().broadcastEntityEvent(this, EntityEvent.TAMING_FAILED); } } @Override - public ActionResult interactMob(PlayerEntity player, Hand hand) { - ItemStack itemStack = player.getStackInHand(hand); + public InteractionResult mobInteract(Player player, InteractionHand hand) { + ItemStack itemStack = player.getItemInHand(hand); - if(!this.getWorld().isClient()) { // Server side + if(!this.level().isClientSide()) { // Server side for(RaceType race : this.getCompatibleRaces()) { // Check for race if(PlayerUtil.isOfRace(player, race) || player.isCreative()) { - if(isTrollWeapon(itemStack) && isOwner(player) && this.getMainHandStack().isEmpty()) { // Give the troll a weapon - this.equipStack(EquipmentSlot.MAINHAND, itemStack.copyAndEmpty()); - itemStack.decrementUnlessCreative(1, player); - return ActionResult.SUCCESS_SERVER; + if(isTrollWeapon(itemStack) && isOwner(player) && this.getMainHandItem().isEmpty()) { // Give the troll a weapon + this.setItemSlot(EquipmentSlot.MAINHAND, itemStack.copyAndClear()); + itemStack.consume(1, player); + return InteractionResult.SUCCESS; } - else if(player.isSneaking() && itemStack.isEmpty() && isOwner(player) && !this.getMainHandStack().isEmpty()) { // Take weapon away from troll - player.giveOrDropStack(this.getMainHandStack().copyAndEmpty()); - return ActionResult.SUCCESS_SERVER; + else if(player.isShiftKeyDown() && itemStack.isEmpty() && isOwner(player) && !this.getMainHandItem().isEmpty()) { // Take weapon away from troll + ItemStack returnedWeapon = this.getMainHandItem().copyAndClear(); + if (!player.addItem(returnedWeapon)) { + player.drop(returnedWeapon, false); + } + return InteractionResult.SUCCESS; } - else if(canAddPassenger(player) && isTame() && itemStack.isEmpty()) { // Ride if player is compatible and hand is empty - putPlayerOnBack(player); - return ActionResult.SUCCESS_SERVER; + else if(canAddPassenger(player) && isTamed() && itemStack.isEmpty()) { // Ride if player is compatible and hand is empty + doPlayerRide(player); + return InteractionResult.SUCCESS; } else if(!itemStack.isEmpty()) { - return super.interactMob(player, hand); + return super.mobInteract(player, hand); } } } } else { // Client side if(!itemStack.isEmpty()) { - return super.interactMob(player, hand); + return super.mobInteract(player, hand); } } - return ActionResult.PASS; // Player is of incompatible race - don't interact + return InteractionResult.PASS; // Player is of incompatible race - don't interact } @Override @@ -244,11 +254,11 @@ public boolean usesTameness() { } public boolean isTrollWeapon(ItemStack itemStack) { - return itemStack.isIn(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "troll_weapons"))); + return itemStack.is(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "troll_weapons"))); } @Override - protected boolean isTamable(PlayerEntity player) { + protected boolean isTamable(Player player) { return this.isSleeping() || player.isCreative(); } @@ -258,54 +268,54 @@ public boolean isMountable() { // This method only determines whether the entity } @Override - public void tameBeast(PlayerEntity player) { - if (player instanceof ServerPlayerEntity) { + public void tameBeast(Player player) { + if (player instanceof ServerPlayer) { this.tameBeast((LivingEntity) player); - Criteria.TAME_ANIMAL.trigger((ServerPlayerEntity)player, this); + CriteriaTriggers.TAME_ANIMAL.trigger((ServerPlayer)player, this); } } @Override public void tameBeast(LivingEntity livingEntity) { - if(!this.getWorld().isClient()) { - this.setTame(true); + if(!this.level().isClientSide()) { + this.setTamed(true); this.setTameness(75); this.stopSleeping(); - this.getBrain().remember(MemoryModulesME.TAME, true); - this.getBrain().forget(MemoryModulesME.DIG_FOR_FOOD_COOLDOWN); - this.getBrain().forget(MemoryModulesME.FOOD_EATEN_COUNT); - this.getBrain().forget(MemoryModuleType.NEAREST_ATTACKABLE); - this.getBrain().forget(MemoryModuleType.ATTACK_TARGET); + this.getBrain().setMemory(MemoryModulesME.TAME, true); + this.getBrain().eraseMemory(MemoryModulesME.DIG_FOR_FOOD_COOLDOWN); + this.getBrain().eraseMemory(MemoryModulesME.FOOD_EATEN_COUNT); + this.getBrain().eraseMemory(MemoryModuleType.NEAREST_ATTACKABLE); + this.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET); this.setOwner(livingEntity); } } @Override - public void tickMovement() { - if(this.getWorld().isClient) { + public void aiStep() { + if(this.level().isClientSide) { setupAnimationStates(); } else { - if(this.getTargetInBrain() != null && !this.isSprinting()) { + if(this.getTargetFromBrain() != null && !this.isSprinting()) { this.setSprinting(true); } - else if(this.getTargetInBrain() == null && this.isSprinting()) { + else if(this.getTargetFromBrain() == null && this.isSprinting()) { this.setSprinting(false); } if(this.isSmashing() && this.hasControllingPassenger()) { - if(this.age - this.smashingTime > 30) { + if(this.tickCount - this.smashingTime > 30) { smashAttack(smashingStrength); } } - if(this.isEnraged() && this.age - this.enragedTime > 1200) { + if(this.isEnraged() && this.tickCount - this.enragedTime > 1200) { this.setEnraged(false); } } - super.tickMovement(); + super.aiStep(); } @Override @@ -313,50 +323,50 @@ protected boolean canAddPassenger(Entity passenger) { // Allow 3 people to rid if(this.isSitting()) { return false; } - return this.hasSaddleEquipped() ? getPassengerList().size() < 3 : getPassengerList().isEmpty(); + return this.isSaddled() ? getPassengers().size() < 3 : getPassengers().isEmpty(); } @Override - protected float getSaddledSpeed(PlayerEntity controllingPlayer) { + protected float getRiddenSpeed(Player controllingPlayer) { if(!this.isSitting()) { - return controllingPlayer.isSprinting() ? ((float)this.getAttributeValue(EntityAttributes.MOVEMENT_SPEED) * 1.25f) : ((float)this.getAttributeValue(EntityAttributes.MOVEMENT_SPEED) * 0.2f); + return controllingPlayer.isSprinting() ? ((float)this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.25f) : ((float)this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 0.2f); } - return super.getSaddledSpeed(controllingPlayer); + return super.getRiddenSpeed(controllingPlayer); } @Override protected float getNpcSaddledSpeed(NpcEntity controllingNpc) { if(!this.isSitting()) { - return controllingNpc.isSprinting() ? ((float)this.getAttributeValue(EntityAttributes.MOVEMENT_SPEED) * 1.25f) : ((float)this.getAttributeValue(EntityAttributes.MOVEMENT_SPEED) * 0.2f); + return controllingNpc.isSprinting() ? ((float)this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.25f) : ((float)this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 0.2f); } return super.getNpcSaddledSpeed(controllingNpc); } @Override - protected Vec3d getPassengerAttachmentPos(Entity passenger, EntityDimensions dimensions, float scaleFactor) { - List passengerList = this.getPassengerList(); - boolean saddled = this.hasSaddleEquipped(); + protected Vec3 getPassengerAttachmentPoint(Entity passenger, EntityDimensions dimensions, float scaleFactor) { + List passengerList = this.getPassengers(); + boolean saddled = this.isSaddled(); boolean sprinting = this.isCharging(); if(this.getControllingPassenger() != null) { sprinting = this.getControllingPassenger().isSprinting() || this.isCharging(); } - float animationSpeed = this.limbAnimator.getSpeed(); - float animationProgress = this.limbAnimator.getAnimationProgress() * (MathHelper.PI / 180) * 18; + float animationSpeed = this.walkAnimation.speed(); + float animationProgress = this.walkAnimation.position() * (Mth.PI / 180) * 18; // frequency is calculated by dividing the speed of the animation by the duration of the animation. float frequency = sprinting ? (2f/1.25f) : (10f/1.75f); if(passenger.equals(this.getControllingPassenger()) || !saddled) { // Passenger 1 - Controlling ============================================================================ double y = sprinting ? - -MathHelper.cos(2 * frequency * animationProgress) * 0.06 * animationSpeed + 0.1 : // height when sprinting - MathHelper.sin(2 * frequency * animationProgress) * 0.02; // height when walking + -Mth.cos(2 * frequency * animationProgress) * 0.06 * animationSpeed + 0.1 : // height when sprinting + Mth.sin(2 * frequency * animationProgress) * 0.02; // height when walking double side = sprinting ? - MathHelper.sin(frequency * animationProgress - (4f/15f)*MathHelper.PI) * 0.225 : // side-to-side movement when sprinting - MathHelper.sin(frequency * animationProgress) * 0.04; // side-to-side movement when walking + Mth.sin(frequency * animationProgress - (4f/15f)*Mth.PI) * 0.225 : // side-to-side movement when sprinting + Mth.sin(frequency * animationProgress) * 0.04; // side-to-side movement when walking double front = sprinting ? 0.35 : // front-back movement when sprinting @@ -367,31 +377,31 @@ protected Vec3d getPassengerAttachmentPos(Entity passenger, EntityDimensions dim front += 0.5; } - if(this.getWorld().isClient() && this.smashingAnimationState.isRunning()) { - float time = (this.smashingAnimationState.getTimeInMilliseconds(this.age) / 2000.0F) * 2 * MathHelper.PI; // Goes from 0 to 2Pi over the duration of the animation - if(this.smashingAnimationState.getTimeInMilliseconds(this.age) < 1000) { - front -= MathHelper.sin(time) * 0.3; + if(this.level().isClientSide() && this.smashingAnimationState.isStarted()) { + float time = (this.smashingAnimationState.getAccumulatedTime() / 2000.0F) * 2 * Mth.PI; // Goes from 0 to 2Pi over the duration of the animation + if(this.smashingAnimationState.getAccumulatedTime() < 1000) { + front -= Mth.sin(time) * 0.3; } else { - front -= MathHelper.sin(time) * 2f; - y += MathHelper.sin(time) * 0.3f; + front -= Mth.sin(time) * 2f; + y += Mth.sin(time) * 0.3f; } } - double x = MathHelper.cos((float)Math.toRadians(this.getBodyYaw())) * side - MathHelper.sin((float)Math.toRadians(this.getBodyYaw())) * front; - double z = MathHelper.sin((float)Math.toRadians(this.getBodyYaw())) * side + MathHelper.cos((float)Math.toRadians(this.getBodyYaw())) * front; + double x = Mth.cos((float)Math.toRadians(this.getVisualRotationYInDegrees())) * side - Mth.sin((float)Math.toRadians(this.getVisualRotationYInDegrees())) * front; + double z = Mth.sin((float)Math.toRadians(this.getVisualRotationYInDegrees())) * side + Mth.cos((float)Math.toRadians(this.getVisualRotationYInDegrees())) * front; - return super.getPassengerAttachmentPos(passenger, dimensions, scaleFactor).add(x, y, z); + return super.getPassengerAttachmentPoint(passenger, dimensions, scaleFactor).add(x, y, z); } else { // Passenger 2 or 3 - Side ============================================================================== double y = sprinting ? - -MathHelper.cos(frequency * animationProgress) * 0.06 * animationSpeed : // height when sprinting - MathHelper.sin(frequency * animationProgress) * 0.02; // height when walking + -Mth.cos(frequency * animationProgress) * 0.06 * animationSpeed : // height when sprinting + Mth.sin(frequency * animationProgress) * 0.02; // height when walking double side = sprinting ? - MathHelper.sin(frequency * animationProgress - (4f/15f)*MathHelper.PI) * 0.15 : // side-to-side movement when sprinting - MathHelper.sin(frequency * animationProgress) * 0.04; // side-to-side movement when walking + Mth.sin(frequency * animationProgress - (4f/15f)*Mth.PI) * 0.15 : // side-to-side movement when sprinting + Mth.sin(frequency * animationProgress) * 0.04; // side-to-side movement when walking double front = sprinting ? 0.35 : // front-back movement when sprinting @@ -403,79 +413,79 @@ protected Vec3d getPassengerAttachmentPos(Entity passenger, EntityDimensions dim y = sprinting ? y + 0.15 : y; // Add offset if sprinting - if(this.getWorld().isClient()) { - float time = (this.smashingAnimationState.getTimeInMilliseconds(this.age) / 2000.0F) * 2 * MathHelper.PI; // Goes from 0 to 2Pi over the duration of the animation - if(this.smashingAnimationState.getTimeInMilliseconds(this.age) < 1000) { - front -= MathHelper.sin(time) * 0.3; + if(this.level().isClientSide()) { + float time = (this.smashingAnimationState.getAccumulatedTime() / 2000.0F) * 2 * Mth.PI; // Goes from 0 to 2Pi over the duration of the animation + if(this.smashingAnimationState.getAccumulatedTime() < 1000) { + front -= Mth.sin(time) * 0.3; } else { - front -= MathHelper.sin(time) * 1.8f; - y += MathHelper.sin(time) * 0.3f; + front -= Mth.sin(time) * 1.8f; + y += Mth.sin(time) * 0.3f; } } - double x = MathHelper.cos((float)Math.toRadians(this.getBodyYaw())) * side - MathHelper.sin((float)Math.toRadians(this.getBodyYaw())) * front; - double z = MathHelper.sin((float)Math.toRadians(this.getBodyYaw())) * side + MathHelper.cos((float)Math.toRadians(this.getBodyYaw())) * front; + double x = Mth.cos((float)Math.toRadians(this.getVisualRotationYInDegrees())) * side - Mth.sin((float)Math.toRadians(this.getVisualRotationYInDegrees())) * front; + double z = Mth.sin((float)Math.toRadians(this.getVisualRotationYInDegrees())) * side + Mth.cos((float)Math.toRadians(this.getVisualRotationYInDegrees())) * front; - return super.getPassengerAttachmentPos(passenger, dimensions, scaleFactor).add(x, y, z); + return super.getPassengerAttachmentPoint(passenger, dimensions, scaleFactor).add(x, y, z); } } @Override - public boolean canSprintAsVehicle() { + public boolean canSprint() { return true; } @Override protected void setupAnimationStates() { if(this.isScavenging()) { // Looking for food - this.scavengingAnimationState.startIfNotRunning(this.age); + this.scavengingAnimationState.startIfStopped(this.tickCount); } else { this.scavengingAnimationState.stop(); } if(this.isSitting()) { // Sitting - this.startSittingAnimationState.startIfNotRunning(this.age); + this.startSittingAnimationState.startIfStopped(this.tickCount); } - else if(this.startSittingAnimationState.isRunning()) { + else if(this.startSittingAnimationState.isStarted()) { this.startSittingAnimationState.stop(); - this.stopSittingAnimationState.startIfNotRunning(this.age); + this.stopSittingAnimationState.startIfStopped(this.tickCount); } - if(this.stopSittingAnimationState.getTimeInMilliseconds(this.age) > 3000) { + if(this.stopSittingAnimationState.getAccumulatedTime() > 3000) { this.stopSittingAnimationState.stop(); } if(this.isSleeping()) { // Sleeping - if(!this.startSleepingAnimationState.isRunning() && !this.sleepingAnimationState.isRunning()) { - this.startSleepingAnimationState.startIfNotRunning(this.age); + if(!this.startSleepingAnimationState.isStarted() && !this.sleepingAnimationState.isStarted()) { + this.startSleepingAnimationState.startIfStopped(this.tickCount); } - if (this.startSleepingAnimationState.getTimeInMilliseconds(this.age) > 5000) { - this.sleepingAnimationState.startIfNotRunning(this.age); + if (this.startSleepingAnimationState.getAccumulatedTime() > 5000) { + this.sleepingAnimationState.startIfStopped(this.tickCount); this.startSleepingAnimationState.stop(); } } - else if(this.startSleepingAnimationState.isRunning() || this.sleepingAnimationState.isRunning()) { + else if(this.startSleepingAnimationState.isStarted() || this.sleepingAnimationState.isStarted()) { this.startSleepingAnimationState.stop(); this.sleepingAnimationState.stop(); - this.stopSleepingAnimationState.startIfNotRunning(this.age); + this.stopSleepingAnimationState.startIfStopped(this.tickCount); } - if(this.stopSleepingAnimationState.getTimeInMilliseconds(this.age) > 5000) { + if(this.stopSleepingAnimationState.getAccumulatedTime() > 5000) { this.stopSleepingAnimationState.stop(); } if(this.isRoaring()) { - this.roaringAnimationState.startIfNotRunning(this.age); + this.roaringAnimationState.startIfStopped(this.tickCount); } else { this.roaringAnimationState.stop(); } if(this.isSmashing()) { - this.smashingAnimationState.startIfNotRunning(this.age); + this.smashingAnimationState.startIfStopped(this.tickCount); } - else if(smashingAnimationState.getTimeInMilliseconds(this.age) >= 2000) { + else if(smashingAnimationState.getAccumulatedTime() >= 2000) { smashingAnimationState.stop(); } } @@ -493,87 +503,86 @@ public int maxChargeCooldown() { @Nullable @Override public LivingEntity getTarget() { - return getTargetInBrain(); + return getTargetFromBrain(); } @Override public void chargeAttack() { - List entities = this.getWorld().getOtherEntities(this, this.getBoundingBox().expand(0.2f, 0.0, 0.2f)); - Vec3d direction = Vec3d.ZERO; + Vec3 direction = Vec3.ZERO; LivingEntity target = this.getTarget(); - int difficulty = this.hasControllingPassenger() ? this.getWorld().getDifficulty().getId() : 0; + int difficulty = this.hasControllingPassenger() ? this.level().getDifficulty().getId() : 0; - if(!this.isTame() && !this.getWorld().isClient) { // Charge Attack for wild Troll + if(!this.isTamed() && !this.level().isClientSide) { // Charge Attack for wild Troll if(target != null) { // Has attack target memory - direction = this.getPos().relativize(target.getPos()); // Vector from Troll to target entity + direction = this.position().vectorTo(target.position()); // Vector from Troll to target entity } - this.setYaw((float) Math.toDegrees(Math.atan2(-direction.x, direction.z))); // Turning the troll into the right direction + this.setYRot((float) Math.toDegrees(Math.atan2(-direction.x, direction.z))); // Turning the troll into the right direction this.setChargeVelocity(direction); } - else if (this.getWorld().isClient && this.hasControllingPassenger()) { // Charge Attack for tamed Troll - this.setChargeVelocity(this.getRotationVector()); + else if (this.level().isClientSide && this.hasControllingPassenger()) { // Charge Attack for tamed Troll + this.setChargeVelocity(this.getLookAngle()); } - for(Entity entity : entities) { // Check through all nearby entities - if(entity != this.getOwner() && !this.getPassengerList().contains(entity)) { // Exclude passengers and owner - if(getWorld() instanceof ServerWorld serverWorld) { - entity.damage(serverWorld, entity.getDamageSources().mobAttack(this), 10.0f + difficulty * 2); - } - + if (this.level() instanceof ServerLevel serverLevel) { + Entity owner = this.getOwner(); + List entities = serverLevel.getEntities( + this, + this.getBoundingBox().inflate(0.2f, 0.0, 0.2f), + entity -> entity != owner && !this.getPassengers().contains(entity) + ); + for(Entity entity : entities) { + entity.hurt(entity.damageSources().mobAttack(this), 10.0f + difficulty * 2); } } - this.getWorld().addParticleClient(ParticleTypes.EXPLOSION, this.getX(), this.getY(), this.getZ(), 1, 0.1, 1); + this.level().addParticle(ParticleTypes.EXPLOSION, this.getX(), this.getY(), this.getZ(), 1, 0.1, 1); } public void smashAttack(float strength) { // Strength goes from 0 to 100 setSmashing(false); - Box box = new Box(this.getPos().subtract(5,0,5), this.getPos().add(5,1,5)); + AABB box = new AABB(this.position().subtract(5,0,5), this.position().add(5,1,5)); double weaponDamage = 0; - AttributeModifiersComponent component = this.getWeaponStack().get(DataComponentTypes.ATTRIBUTE_MODIFIERS); + ItemAttributeModifiers component = this.getWeaponItem().get(DataComponents.ATTRIBUTE_MODIFIERS); if(component != null) { - for(AttributeModifiersComponent.Entry modifier : component.modifiers()) { - if(modifier.matches(EntityAttributes.ATTACK_DAMAGE, Identifier.ofVanilla("base_attack_damage"))) { - weaponDamage = modifier.modifier().value(); + for(ItemAttributeModifiers.Entry modifier : component.modifiers()) { + if(modifier.matches(Attributes.ATTACK_DAMAGE, ResourceLocation.withDefaultNamespace("base_attack_damage"))) { + weaponDamage = modifier.modifier().amount(); } } } - List entities = this.getWorld().getOtherEntities(this, box); - World world = this.getWorld(); + Level world = this.level(); int difficulty = this.hasControllingPassenger() ? world.getDifficulty().getId() : 0; - if(world instanceof ServerWorld serverWorld) { + if(world instanceof ServerLevel serverWorld) { + List entities = serverWorld.getEntities(this, box, this::isValidTarget); for(Entity entity : entities) { - if(this.isValidTarget(entity)) { - entity.damage(serverWorld, this.getDamageSources().mobAttack(this), (float)weaponDamage + (strength / 12.5f) + (difficulty * 2)); - } + entity.hurt(this.damageSources().mobAttack(this), (float)weaponDamage + (strength / 12.5f) + (difficulty * 2)); } for(int x = -5; x <= 5; x++) { // Spawn particles on affected blocks for(int z = -5; z <= 5; z++) { - BlockStateParticleEffect particles = new BlockStateParticleEffect(ParticleTypes.BLOCK, world.getBlockState(new BlockPos(this.getBlockX() + x, this.getBlockY() - 1, this.getBlockZ() + z))); - serverWorld.spawnParticles(particles, this.getBlockX() + x, this.getBlockY(), this.getBlockZ() + z, 7, 0.5, 0.3, 0.5, 0.2); + BlockParticleOption particles = new BlockParticleOption(ParticleTypes.BLOCK, world.getBlockState(new BlockPos(this.getBlockX() + x, this.getBlockY() - 1, this.getBlockZ() + z))); + serverWorld.sendParticles(particles, this.getBlockX() + x, this.getBlockY(), this.getBlockZ() + z, 7, 0.5, 0.3, 0.5, 0.2); } } - this.playSound(SoundEvents.BLOCK_STONE_BREAK, 1, 0.4f); + this.playSound(SoundEvents.STONE_BREAK, 1, 0.4f); if(weaponDamage > 0) { - this.playSound(SoundEvents.BLOCK_ANVIL_LAND, 1, 0.1f); + this.playSound(SoundEvents.ANVIL_LAND, 1, 0.1f); } } } - @Override - public float getWeaponDisableBlockingForSeconds() { + public float getSecondsToDisableBlocking() { return this.isCharging() || this.isSmashing() ? 10.0f : 0f; } @Override - protected void jump(float strength, Vec3d movementInput) { + protected void executeRidersJump(float strength, Vec3 movementInput) { if(this.hasControllingPassenger() && this.getControllingPassenger().isSprinting()) { - super.jump(strength, movementInput); + super.executeRidersJump(strength, movementInput); } else if(this.hasControllingPassenger() && !this.getControllingPassenger().isSprinting()) { setChargeTimeout(300); @@ -581,12 +590,12 @@ else if(this.hasControllingPassenger() && !this.getControllingPassenger().isSpri } @Override - public void startJumping(int height) { + public void handleStartJump(int height) { if(this.hasControllingPassenger() && !this.getControllingPassenger().isSprinting()) { if(!this.isSitting()) { this.playJumpSound(); this.setSmashing(true); - this.smashingTime = this.age; + this.smashingTime = this.tickCount; this.smashingStrength = height; } else { @@ -594,21 +603,21 @@ public void startJumping(int height) { } } else { - super.startJumping(height); + super.handleStartJump(height); } } public void startSleeping() { - if (this.hasVehicle()) { + if (this.isPassenger()) { this.stopRiding(); } this.setSleeping(true); - this.setVelocity(Vec3d.ZERO); - this.velocityDirty = true; + this.setDeltaMovement(Vec3.ZERO); + this.hasImpulse = true; - this.brain.forget(MemoryModuleType.WALK_TARGET); - this.brain.forget(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE); + this.brain.eraseMemory(MemoryModuleType.WALK_TARGET); + this.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE); } public void stopSleeping() { @@ -616,62 +625,62 @@ public void stopSleeping() { } public boolean isSleeping() { - return this.dataTracker.get(SLEEPING); + return this.entityData.get(SLEEPING); } public void setSleeping(boolean isSleeping) { - this.dataTracker.set(SLEEPING, isSleeping); + this.entityData.set(SLEEPING, isSleeping); } public boolean isEnraged() { - return this.dataTracker.get(ENRAGED); + return this.entityData.get(ENRAGED); } public void setEnraged(boolean isEnraged) { - this.dataTracker.set(ENRAGED, isEnraged); + this.entityData.set(ENRAGED, isEnraged); } public boolean isSmashing() { - return this.dataTracker.get(SMASHING); + return this.entityData.get(SMASHING); } public void setSmashing(boolean isSmashing) { - this.dataTracker.set(SMASHING, isSmashing); + this.entityData.set(SMASHING, isSmashing); } @Override public void setSitting(boolean sitting) { - if(!this.getWorld().isClient()) { + if(!this.level().isClientSide()) { if(sitting) { - this.getBrain().remember(MemoryModulesME.SITTING, true); - this.getBrain().forget(MemoryModuleType.WALK_TARGET); + this.getBrain().setMemory(MemoryModulesME.SITTING, true); + this.getBrain().eraseMemory(MemoryModuleType.WALK_TARGET); } else { - this.getBrain().forget(MemoryModulesME.SITTING); + this.getBrain().eraseMemory(MemoryModulesME.SITTING); } - this.removeAllPassengers(); + this.ejectPassengers(); } super.setSitting(sitting); } public boolean isScavenging() { - return this.dataTracker.get(SCAVENGING); + return this.entityData.get(SCAVENGING); } public void setScavenging(boolean isDigging) { - this.dataTracker.set(SCAVENGING, isDigging); + this.entityData.set(SCAVENGING, isDigging); } public boolean isRoaring() { - return this.dataTracker.get(ROARING); + return this.entityData.get(ROARING); } public void setRoaring(boolean isRoaring) { - this.dataTracker.set(ROARING, isRoaring); + this.entityData.set(ROARING, isRoaring); } - protected Brain deserializeBrain(Dynamic dynamic) { + protected Brain makeBrain(Dynamic dynamic) { return CaveTrollBrain.create(this, dynamic); } @@ -691,29 +700,29 @@ public List getCompatibleRaces() { @Override public boolean isCommandItem(ItemStack stack) { - return stack.isIn(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))); + return stack.is(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))); } @Override public boolean isFoodItem(ItemStack itemStack) { - return itemStack.isIn(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "troll_food"))); + return itemStack.is(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "troll_food"))); } @Override public boolean isBondingItem(ItemStack itemStack) { - return itemStack.isIn(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "chains"))); + return itemStack.is(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "chains"))); } public static boolean shouldTarget(LivingEntity target) { - return target instanceof NpcEntity || target instanceof PlayerEntity || target instanceof Pouncer; + return target instanceof NpcEntity || target instanceof Player || target instanceof Pouncer; } @Override - protected float calculateNextStepSoundDistance() { + protected float nextStep() { if(this.hasControllingPassenger() && this.getControllingPassenger().isSprinting()) { - return this.distanceTraveled + 1.0f; + return this.moveDist + 1.0f; } - return this.distanceTraveled + 0.25f; + return this.moveDist + 0.25f; } @Nullable @@ -730,8 +739,8 @@ protected SoundEvent getHurtSound(DamageSource source) { @Nullable @Override - protected SoundEvent getEatSound() { - return super.getEatSound(); + protected SoundEvent getEatingSound() { + return super.getEatingSound(); } @Nullable @@ -756,15 +765,15 @@ protected SoundEvent getRoarSound() { } public void playRoarSound() { - this.playSound(this.getRoarSound()); + this.makeSound(this.getRoarSound()); } - public static boolean canSpawn(EntityType type, ServerWorldAccess serverWorldAccess, SpawnReason spawnReason, BlockPos blockPos, Random random) { + public static boolean canSpawn(EntityType type, ServerLevelAccessor serverWorldAccess, MobSpawnType spawnReason, BlockPos blockPos, RandomSource random) { return SpawnUtil.canSpawn(blockPos, serverWorldAccess, spawnReason); } @Override - public boolean canSpawn(WorldAccess world, SpawnReason spawnReason) { + public boolean checkSpawnRules(LevelAccessor world, MobSpawnType spawnReason) { return true; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollEntityModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollEntityModel.java index fa0c2aaab3..5f269077f3 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollEntityModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollEntityModel.java @@ -1,157 +1,146 @@ package net.sevenstars.middleearth.entity.beasts.cave_troll; +import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.animation.Animation; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.util.math.MatrixStack; - -public class CaveTrollEntityModel extends EntityModel { - private final Animation walkingAnimation; - private final Animation chaseAnimation; - private final Animation scavengingAnimation; - private final Animation startSittingAnimation; - private final Animation stopSittingAnimation; - private final Animation startSleepingAnimation; - private final Animation sleepingAnimation; - private final Animation stopSleepingAnimation; - private final Animation roaringAnimation; - private final Animation smashingAnimation; - +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; + +public class CaveTrollEntityModel extends HierarchicalModel { private final ModelPart rightArm; private final ModelPart upperBody; private final ModelPart rootChild; private final ModelPart chain; protected CaveTrollEntityModel(ModelPart root) { - super(root); - rootChild = root.getChild("root"); upperBody = rootChild.getChild("body_no_legs"); rightArm = upperBody.getChild("ArmRight"); chain = upperBody.getChild("body_no_limbs").getChild("Head").getChild("chain"); - - walkingAnimation = CaveTrollAnimations.PASSIVE_WALK.createAnimation(root); - chaseAnimation = CaveTrollAnimations.RUN.createAnimation(root); - scavengingAnimation = CaveTrollAnimations.INSPECT.createAnimation(root); - startSittingAnimation = CaveTrollAnimations.STANDING_TO_SITTING.createAnimation(root); - stopSittingAnimation = CaveTrollAnimations.STANDING_FROM_SITTING.createAnimation(root); - startSleepingAnimation = CaveTrollAnimations.SLEEP_LAYING_DOWN.createAnimation(root); - sleepingAnimation = CaveTrollAnimations.SLEEP_LAYING_DOWN.createAnimation(root); - stopSleepingAnimation = CaveTrollAnimations.SLEEP_LAYING_DOWN_STANDING_UP.createAnimation(root); - roaringAnimation = CaveTrollAnimations.SCREAM.createAnimation(root); - smashingAnimation = CaveTrollAnimations.OVERHAND_SMASH.createAnimation(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); - return TexturedModelData.of(modelData, 256, 256); + return LayerDefinition.create(modelData, 256, 256); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData root = modelPartData.addChild("root", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 24.0F, 0.0F)); + PartDefinition root = modelPartData.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 24.0F, 0.0F)); - ModelPartData body_no_legs = root.addChild("body_no_legs", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -15.3333F, -0.5F)); + PartDefinition body_no_legs = root.addOrReplaceChild("body_no_legs", CubeListBuilder.create(), PartPose.offset(0.0F, -15.3333F, -0.5F)); - ModelPartData body_no_limbs = body_no_legs.addChild("body_no_limbs", ModelPartBuilder.create(), ModelTransform.origin(-0.5F, 0.3333F, 0.5F)); + PartDefinition body_no_limbs = body_no_legs.addOrReplaceChild("body_no_limbs", CubeListBuilder.create(), PartPose.offset(-0.5F, 0.3333F, 0.5F)); - ModelPartData body = body_no_limbs.addChild("body", ModelPartBuilder.create().uv(156, 199).cuboid(-16.0F, -40.0F, -9.0F, 33.0F, 40.0F, 17.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition body = body_no_limbs.addOrReplaceChild("body", CubeListBuilder.create().texOffs(156, 199).addBox(-16.0F, -40.0F, -9.0F, 33.0F, 40.0F, 17.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData Loincloth_Front = body.addChild("Loincloth_Front", ModelPartBuilder.create().uv(190, 122).cuboid(-17.0F, 0.0F, 0.0F, 33.0F, 7.0F, 0.0F, new Dilation(0.0F)), ModelTransform.origin(1.0F, 0.0F, -9.0F)); + PartDefinition Loincloth_Front = body.addOrReplaceChild("Loincloth_Front", CubeListBuilder.create().texOffs(190, 122).addBox(-17.0F, 0.0F, 0.0F, 33.0F, 7.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(1.0F, 0.0F, -9.0F)); - ModelPartData Loincloth_Back = body_no_limbs.addChild("Loincloth_Back", ModelPartBuilder.create().uv(190, 134).cuboid(-17.0F, 0.0F, 0.0F, 33.0F, 7.0F, 0.0F, new Dilation(0.0F)), ModelTransform.origin(1.0F, 0.0F, 8.0F)); + PartDefinition Loincloth_Back = body_no_limbs.addOrReplaceChild("Loincloth_Back", CubeListBuilder.create().texOffs(190, 134).addBox(-17.0F, 0.0F, 0.0F, 33.0F, 7.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(1.0F, 0.0F, 8.0F)); - ModelPartData Head = body_no_limbs.addChild("Head", ModelPartBuilder.create().uv(172, 161).cuboid(-8.5F, -8.5F, -8.5F, 17.0F, 17.0F, 17.0F, new Dilation(0.0F)), ModelTransform.origin(0.5F, -34.5F, -8.5F)); + PartDefinition Head = body_no_limbs.addOrReplaceChild("Head", CubeListBuilder.create().texOffs(172, 161).addBox(-8.5F, -8.5F, -8.5F, 17.0F, 17.0F, 17.0F, new CubeDeformation(0.0F)), PartPose.offset(0.5F, -34.5F, -8.5F)); - ModelPartData chain = Head.addChild("chain", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - ModelPartData head_chain = chain.addChild("head_chain", ModelPartBuilder.create().uv(0, 21).cuboid(0.0F, -14.0F, -2.0F, 18.0F, 17.0F, 3.0F, new Dilation(0.01F)), ModelTransform.origin(-9.0F, 5.5F, -1.5F)); + PartDefinition chain = Head.addOrReplaceChild("chain", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition head_chain = chain.addOrReplaceChild("head_chain", CubeListBuilder.create().texOffs(0, 21).addBox(0.0F, -14.0F, -2.0F, 18.0F, 17.0F, 3.0F, new CubeDeformation(0.01F)), PartPose.offset(-9.0F, 5.5F, -1.5F)); - ModelPartData chain_hanging = chain.addChild("chain_hanging", ModelPartBuilder.create().uv(45, 30).cuboid(-1.5F, -0.5F, 0.0F, 3.0F, 11.0F, 0.0F, new Dilation(0.01F)), ModelTransform.origin(0.0F, 9.0F, -2.0F)); + PartDefinition chain_hanging = chain.addOrReplaceChild("chain_hanging", CubeListBuilder.create().texOffs(45, 30).addBox(-1.5F, -0.5F, 0.0F, 3.0F, 11.0F, 0.0F, new CubeDeformation(0.01F)), PartPose.offset(0.0F, 9.0F, -2.0F)); - ModelPartData jaw = Head.addChild("jaw", ModelPartBuilder.create().uv(143, 144).cuboid(-8.5F, -1.5F, -5.5F, 17.0F, 4.0F, 6.0F, new Dilation(0.01F)) - .uv(201, 150).cuboid(-4.5F, -4.5F, -5.5F, 9.0F, 3.0F, 1.0F, new Dilation(0.01F)) - .uv(166, 162).cuboid(4.5F, -5.5F, -5.5F, 2.0F, 4.0F, 2.0F, new Dilation(0.01F)) - .uv(166, 162).mirrored().cuboid(-6.5F, -5.5F, -5.5F, 2.0F, 4.0F, 2.0F, new Dilation(0.01F)).mirrored(false), ModelTransform.of(0.0F, 6.0F, -4.0F, 0.0436F, 0.0F, 0.0F)); + PartDefinition jaw = Head.addOrReplaceChild("jaw", CubeListBuilder.create().texOffs(143, 144).addBox(-8.5F, -1.5F, -5.5F, 17.0F, 4.0F, 6.0F, new CubeDeformation(0.01F)) + .texOffs(201, 150).addBox(-4.5F, -4.5F, -5.5F, 9.0F, 3.0F, 1.0F, new CubeDeformation(0.01F)) + .texOffs(166, 162).addBox(4.5F, -5.5F, -5.5F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.01F)) + .texOffs(166, 162).mirror().addBox(-6.5F, -5.5F, -5.5F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.01F)).mirror(false), PartPose.offsetAndRotation(0.0F, 6.0F, -4.0F, 0.0436F, 0.0F, 0.0F)); - ModelPartData ArmRight = body_no_legs.addChild("ArmRight", ModelPartBuilder.create().uv(62, 171).cuboid(-10.0F, -3.5F, -5.0F, 10.0F, 41.0F, 10.0F, new Dilation(0.0F)), ModelTransform.origin(-16.5F, -34.1667F, 0.5F)); + PartDefinition ArmRight = body_no_legs.addOrReplaceChild("ArmRight", CubeListBuilder.create().texOffs(62, 171).addBox(-10.0F, -3.5F, -5.0F, 10.0F, 41.0F, 10.0F, new CubeDeformation(0.0F)), PartPose.offset(-16.5F, -34.1667F, 0.5F)); - ModelPartData HandRight = ArmRight.addChild("HandRight", ModelPartBuilder.create(), ModelTransform.origin(-9.0F, 39.5F, -3.0F)); + PartDefinition HandRight = ArmRight.addOrReplaceChild("HandRight", CubeListBuilder.create(), PartPose.offset(-9.0F, 39.5F, -3.0F)); - ModelPartData HandRight_FingerBase_1 = HandRight.addChild("HandRight_FingerBase_1", ModelPartBuilder.create().uv(117, 154).cuboid(-2.5F, 3.0F, -1.5F, 5.0F, 2.0F, 3.0F, new Dilation(0.0F)), ModelTransform.origin(1.5F, -1.0F, -0.5F)); + PartDefinition HandRight_FingerBase_1 = HandRight.addOrReplaceChild("HandRight_FingerBase_1", CubeListBuilder.create().texOffs(117, 154).addBox(-2.5F, 3.0F, -1.5F, 5.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(1.5F, -1.0F, -0.5F)); - ModelPartData HandRight_Finger_1 = HandRight_FingerBase_1.addChild("HandRight_Finger_1", ModelPartBuilder.create().uv(119, 162).cuboid(-4.0F, -5.9F, -2.0F, 3.0F, 4.0F, 3.0F, new Dilation(0.0F)) - .uv(122, 149).cuboid(1.0F, -1.6F, -1.5F, 1.0F, 1.0F, 2.0F, new Dilation(0.0F)), ModelTransform.origin(1.5F, 4.9F, 0.5F)); + PartDefinition HandRight_Finger_1 = HandRight_FingerBase_1.addOrReplaceChild("HandRight_Finger_1", CubeListBuilder.create().texOffs(119, 162).addBox(-4.0F, -5.9F, -2.0F, 3.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(122, 149).addBox(1.0F, -1.6F, -1.5F, 1.0F, 1.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(1.5F, 4.9F, 0.5F)); - ModelPartData HandRight_FingerBase_2 = HandRight.addChild("HandRight_FingerBase_2", ModelPartBuilder.create(), ModelTransform.origin(48.9F, 0.5F, 8.1F)); + PartDefinition HandRight_FingerBase_2 = HandRight.addOrReplaceChild("HandRight_FingerBase_2", CubeListBuilder.create(), PartPose.offset(48.9F, 0.5F, 8.1F)); - ModelPartData HandRight_Finger_2 = HandRight_FingerBase_2.addChild("HandRight_Finger_2", ModelPartBuilder.create(), ModelTransform.origin(-45.9F, 3.4F, -4.1F)); + PartDefinition HandRight_Finger_2 = HandRight_FingerBase_2.addOrReplaceChild("HandRight_Finger_2", CubeListBuilder.create(), PartPose.offset(-45.9F, 3.4F, -4.1F)); - ModelPartData HandRight_FingerBase_3 = HandRight.addChild("HandRight_FingerBase_3", ModelPartBuilder.create().uv(117, 154).cuboid(-2.5F, 3.0F, -1.5F, 5.0F, 2.0F, 3.0F, new Dilation(0.0F)), ModelTransform.origin(1.5F, -1.0F, 6.5F)); + PartDefinition HandRight_FingerBase_3 = HandRight.addOrReplaceChild("HandRight_FingerBase_3", CubeListBuilder.create().texOffs(117, 154).addBox(-2.5F, 3.0F, -1.5F, 5.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(1.5F, -1.0F, 6.5F)); - ModelPartData HandRight_Finger_3 = HandRight_FingerBase_3.addChild("HandRight_Finger_3", ModelPartBuilder.create().uv(119, 162).cuboid(-4.0F, -5.9F, -2.0F, 3.0F, 4.0F, 3.0F, new Dilation(0.0F)) - .uv(122, 149).cuboid(1.0F, -1.6F, -1.5F, 1.0F, 1.0F, 2.0F, new Dilation(0.0F)), ModelTransform.origin(1.5F, 4.9F, 0.5F)); + PartDefinition HandRight_Finger_3 = HandRight_FingerBase_3.addOrReplaceChild("HandRight_Finger_3", CubeListBuilder.create().texOffs(119, 162).addBox(-4.0F, -5.9F, -2.0F, 3.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(122, 149).addBox(1.0F, -1.6F, -1.5F, 1.0F, 1.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(1.5F, 4.9F, 0.5F)); - ModelPartData HandRight_Thumb = HandRight.addChild("HandRight_Thumb", ModelPartBuilder.create().uv(95, 163).cuboid(-1.75F, -1.5F, -1.5F, 3.0F, 3.0F, 3.0F, new Dilation(0.0F)) - .uv(97, 157).cuboid(-0.75F, 1.5F, -1.0F, 2.0F, 1.0F, 2.0F, new Dilation(-0.02F)), ModelTransform.origin(7.15F, -1.0F, 0.6F)); + PartDefinition HandRight_Thumb = HandRight.addOrReplaceChild("HandRight_Thumb", CubeListBuilder.create().texOffs(95, 163).addBox(-1.75F, -1.5F, -1.5F, 3.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(97, 157).addBox(-0.75F, 1.5F, -1.0F, 2.0F, 1.0F, 2.0F, new CubeDeformation(-0.02F)), PartPose.offset(7.15F, -1.0F, 0.6F)); - ModelPartData ArmLeft = body_no_legs.addChild("ArmLeft", ModelPartBuilder.create().uv(105, 171).cuboid(0.0F, -3.5F, -5.0F, 10.0F, 41.0F, 10.0F, new Dilation(0.0F)), ModelTransform.origin(16.5F, -34.1667F, 0.5F)); + PartDefinition ArmLeft = body_no_legs.addOrReplaceChild("ArmLeft", CubeListBuilder.create().texOffs(105, 171).addBox(0.0F, -3.5F, -5.0F, 10.0F, 41.0F, 10.0F, new CubeDeformation(0.0F)), PartPose.offset(16.5F, -34.1667F, 0.5F)); - ModelPartData HandLeft = ArmLeft.addChild("HandLeft", ModelPartBuilder.create(), ModelTransform.origin(-42.0F, 39.5F, -4.0F)); + PartDefinition HandLeft = ArmLeft.addOrReplaceChild("HandLeft", CubeListBuilder.create(), PartPose.offset(-42.0F, 39.5F, -4.0F)); - ModelPartData HandLeft_FingerBase_1 = HandLeft.addChild("HandLeft_FingerBase_1", ModelPartBuilder.create().uv(119, 162).cuboid(-1.5F, 0.0F, -1.5F, 3.0F, 4.0F, 3.0F, new Dilation(0.0F)), ModelTransform.origin(50.5F, -2.0F, 0.5F)); + PartDefinition HandLeft_FingerBase_1 = HandLeft.addOrReplaceChild("HandLeft_FingerBase_1", CubeListBuilder.create().texOffs(119, 162).addBox(-1.5F, 0.0F, -1.5F, 3.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(50.5F, -2.0F, 0.5F)); - ModelPartData HandLeft_Finger_1 = HandLeft_FingerBase_1.addChild("HandLeft_Finger_1", ModelPartBuilder.create().uv(117, 154).cuboid(44.0F, -1.9F, -1.0F, 5.0F, 2.0F, 3.0F, new Dilation(0.0F)) - .uv(122, 149).cuboid(43.0F, -1.6F, -0.5F, 1.0F, 1.0F, 2.0F, new Dilation(0.0F)), ModelTransform.origin(-47.5F, 5.9F, -0.5F)); + PartDefinition HandLeft_Finger_1 = HandLeft_FingerBase_1.addOrReplaceChild("HandLeft_Finger_1", CubeListBuilder.create().texOffs(117, 154).addBox(44.0F, -1.9F, -1.0F, 5.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(122, 149).addBox(43.0F, -1.6F, -0.5F, 1.0F, 1.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(-47.5F, 5.9F, -0.5F)); - ModelPartData HandLeft_FingerBase_2 = HandLeft.addChild("HandLeft_FingerBase_2", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 3.5F)); + PartDefinition HandLeft_FingerBase_2 = HandLeft.addOrReplaceChild("HandLeft_FingerBase_2", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 3.5F)); - ModelPartData HandLeft_Finger_2 = HandLeft_FingerBase_2.addChild("HandLeft_Finger_2", ModelPartBuilder.create(), ModelTransform.origin(3.0F, 3.9F, 0.0F)); + PartDefinition HandLeft_Finger_2 = HandLeft_FingerBase_2.addOrReplaceChild("HandLeft_Finger_2", CubeListBuilder.create(), PartPose.offset(3.0F, 3.9F, 0.0F)); - ModelPartData HandLeft_FingerBase_3 = HandLeft.addChild("HandLeft_FingerBase_3", ModelPartBuilder.create().uv(119, 162).cuboid(-1.5F, 0.0F, -1.5F, 3.0F, 4.0F, 3.0F, new Dilation(0.0F)), ModelTransform.origin(50.5F, -2.0F, 7.5F)); + PartDefinition HandLeft_FingerBase_3 = HandLeft.addOrReplaceChild("HandLeft_FingerBase_3", CubeListBuilder.create().texOffs(119, 162).addBox(-1.5F, 0.0F, -1.5F, 3.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(50.5F, -2.0F, 7.5F)); - ModelPartData HandLeft_Finger_3 = HandLeft_FingerBase_3.addChild("HandLeft_Finger_3", ModelPartBuilder.create().uv(117, 154).cuboid(44.0F, -1.9F, -1.0F, 5.0F, 2.0F, 3.0F, new Dilation(0.0F)) - .uv(122, 149).cuboid(43.0F, -1.6F, -0.5F, 1.0F, 1.0F, 2.0F, new Dilation(0.0F)), ModelTransform.origin(-47.5F, 5.9F, -0.5F)); + PartDefinition HandLeft_Finger_3 = HandLeft_FingerBase_3.addOrReplaceChild("HandLeft_Finger_3", CubeListBuilder.create().texOffs(117, 154).addBox(44.0F, -1.9F, -1.0F, 5.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(122, 149).addBox(43.0F, -1.6F, -0.5F, 1.0F, 1.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(-47.5F, 5.9F, -0.5F)); - ModelPartData HandLeft_Thumb = HandLeft.addChild("HandLeft_Thumb", ModelPartBuilder.create().uv(95, 163).cuboid(-1.25F, -0.5F, -1.5F, 3.0F, 3.0F, 3.0F, new Dilation(0.0F)) - .uv(97, 157).cuboid(-1.25F, 2.5F, -1.0F, 2.0F, 1.0F, 2.0F, new Dilation(-0.02F)), ModelTransform.origin(43.65F, -2.0F, 1.6F)); + PartDefinition HandLeft_Thumb = HandLeft.addOrReplaceChild("HandLeft_Thumb", CubeListBuilder.create().texOffs(95, 163).addBox(-1.25F, -0.5F, -1.5F, 3.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(97, 157).addBox(-1.25F, 2.5F, -1.0F, 2.0F, 1.0F, 2.0F, new CubeDeformation(-0.02F)), PartPose.offset(43.65F, -2.0F, 1.6F)); - ModelPartData LegRight = root.addChild("LegRight", ModelPartBuilder.create().uv(44, 228).cuboid(-6.5F, -0.5F, -6.5F, 13.0F, 15.0F, 13.0F, new Dilation(0.0F)), ModelTransform.origin(-9.0F, -14.5F, -1.5F)); + PartDefinition LegRight = root.addOrReplaceChild("LegRight", CubeListBuilder.create().texOffs(44, 228).addBox(-6.5F, -0.5F, -6.5F, 13.0F, 15.0F, 13.0F, new CubeDeformation(0.0F)), PartPose.offset(-9.0F, -14.5F, -1.5F)); - ModelPartData LegLeft = root.addChild("LegLeft", ModelPartBuilder.create().uv(100, 228).cuboid(-6.5F, -0.5F, -6.5F, 13.0F, 15.0F, 13.0F, new Dilation(0.0F)), ModelTransform.origin(9.0F, -14.5F, -1.5F)); + PartDefinition LegLeft = root.addOrReplaceChild("LegLeft", CubeListBuilder.create().texOffs(100, 228).addBox(-6.5F, -0.5F, -6.5F, 13.0F, 15.0F, 13.0F, new CubeDeformation(0.0F)), PartPose.offset(9.0F, -14.5F, -1.5F)); return modelData; } @Override - public void setAngles(CaveTrollEntityRenderState state) { - super.setAngles(state); + public void setupAnim(CaveTrollEntity entity, float limbSwing, float limbSwingAmount, + float ageInTicks, float netHeadYaw, float headPitch) { + this.root().getAllParts().forEach(ModelPart::resetPose); - chain.visible = state.isTame; + chain.visible = entity.isTamed(); - if(!state.isSprinting && !(state.conrollingPassenger != null && state.conrollingPassenger.isSprinting()) && !state.isCharging) { - this.walkingAnimation.applyWalking(state.limbSwingAnimationProgress, state.limbSwingAmplitude, 10.0f, 10.0f); + if(!entity.isSprinting() + && !(entity.getControllingPassenger() != null && entity.getControllingPassenger().isSprinting()) + && !entity.isCharging()) { + this.animateWalk(CaveTrollAnimations.PASSIVE_WALK, limbSwing, limbSwingAmount, 10.0F, 10.0F); } else { - this.chaseAnimation.applyWalking(state.limbSwingAnimationProgress, state.limbSwingAmplitude, 2.0f, 2.0f); + this.animateWalk(CaveTrollAnimations.RUN, limbSwing, limbSwingAmount, 2.0F, 2.0F); } - this.scavengingAnimation.apply(state.scavengingAnimationState, state.age); - this.startSittingAnimation.apply(state.startSittingAnimationState, state.age); - this.stopSittingAnimation.apply(state.stopSittingAnimationState, state.age); - this.startSleepingAnimation.apply(state.startSleepingAnimationState, state.age); - this.sleepingAnimation.apply(state.sleepingAnimationState, state.age); - this.stopSleepingAnimation.apply(state.stopSleepingAnimationState, state.age); - this.roaringAnimation.apply(state.roaringAnimationState, state.age); - this.smashingAnimation.apply(state.smashingAnimationState, state.age); + this.animate(entity.scavengingAnimationState, CaveTrollAnimations.INSPECT, ageInTicks); + this.animate(entity.startSittingAnimationState, CaveTrollAnimations.STANDING_TO_SITTING, ageInTicks); + this.animate(entity.stopSittingAnimationState, CaveTrollAnimations.STANDING_FROM_SITTING, ageInTicks); + this.animate(entity.startSleepingAnimationState, CaveTrollAnimations.SLEEP_LAYING_DOWN, ageInTicks); + this.animate(entity.sleepingAnimationState, CaveTrollAnimations.SLEEP_LAYING_DOWN, ageInTicks); + this.animate(entity.stopSleepingAnimationState, CaveTrollAnimations.SLEEP_LAYING_DOWN_STANDING_UP, ageInTicks); + this.animate(entity.roaringAnimationState, CaveTrollAnimations.SCREAM, ageInTicks); + this.animate(entity.smashingAnimationState, CaveTrollAnimations.OVERHAND_SMASH, ageInTicks); } - public void setArmAngle(MatrixStack matrices) { - this.getRootPart().applyTransform(matrices); - this.rootChild.applyTransform(matrices); - this.upperBody.applyTransform(matrices); - this.rightArm.applyTransform(matrices); + public void setArmAngle(PoseStack matrices) { + this.root().translateAndRotate(matrices); + this.rootChild.translateAndRotate(matrices); + this.upperBody.translateAndRotate(matrices); + this.rightArm.translateAndRotate(matrices); + } + + @Override + public ModelPart root() { + return this.rootChild; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollEntityRenderState.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollEntityRenderState.java deleted file mode 100644 index 99a45edb5c..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollEntityRenderState.java +++ /dev/null @@ -1,30 +0,0 @@ -package net.sevenstars.middleearth.entity.beasts.cave_troll; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.item.ItemModelManager; -import net.minecraft.client.render.item.ItemRenderState; -import net.minecraft.entity.AnimationState; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemDisplayContext; -import net.minecraft.util.Arm; -import net.sevenstars.middleearth.entity.beasts.BeastEntityRenderState; - -@Environment(EnvType.CLIENT) -public class CaveTrollEntityRenderState extends BeastEntityRenderState { - public final ItemRenderState handItemState = new ItemRenderState(); - - public CaveTrollVariant variant = CaveTrollVariant.GREEN; - public boolean isEnraged = false; - public AnimationState chaseAnimationState = new AnimationState(); - public AnimationState scavengingAnimationState = new AnimationState(); - public AnimationState startSleepingAnimationState = new AnimationState(); - public AnimationState sleepingAnimationState = new AnimationState(); - public AnimationState stopSleepingAnimationState = new AnimationState(); - public AnimationState roaringAnimationState = new AnimationState(); - public AnimationState smashingAnimationState = new AnimationState(); - - public static void updateRenderState(LivingEntity entity, CaveTrollEntityRenderState state, ItemModelManager itemModelManager) { - itemModelManager.updateForLivingEntity(state.handItemState, entity.getStackInArm(Arm.RIGHT), ItemDisplayContext.THIRD_PERSON_RIGHT_HAND, entity); - } -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollRenderer.java index a990bd9948..73979cee37 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/CaveTrollRenderer.java @@ -1,11 +1,10 @@ package net.sevenstars.middleearth.entity.beasts.cave_troll; import com.google.common.collect.Maps; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.MobEntityRenderer; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.util.Identifier; -import net.minecraft.util.Util; +import net.minecraft.Util; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.MobRenderer; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntityModelLayersME; import net.sevenstars.middleearth.entity.beasts.cave_troll.feature.CaveTrollDroolFeatureRenderer; @@ -14,28 +13,28 @@ import java.util.Map; -public class CaveTrollRenderer extends MobEntityRenderer { +public class CaveTrollRenderer extends MobRenderer { private static final String PATH = "textures/entities/trolls/cave/cave_troll_"; private static final String TEXTURE_ANG = "textures/entities/trolls/cave/cave_troll_ang.png"; private static final String TEXTURE_ANGRY_ANG = "textures/entities/trolls/cave/cave_troll_angry_ang.png"; - public CaveTrollRenderer(EntityRendererFactory.Context context) { - super(context, new CaveTrollEntityModel(context.getPart(EntityModelLayersME.CAVE_TROLL)), 1.1f); - this.addFeature(new CaveTrollDroolFeatureRenderer(this)); - this.addFeature(new CaveTrollSaddleFeatureRenderer(this, context.getEntityModels(), context.getEquipmentRenderer())); - this.addFeature(new CaveTrollHeldItemFeatureRenderer(this)); + public CaveTrollRenderer(EntityRendererProvider.Context context) { + super(context, new CaveTrollEntityModel(context.bakeLayer(EntityModelLayersME.CAVE_TROLL)), 1.1f); + this.addLayer(new CaveTrollDroolFeatureRenderer(this)); + this.addLayer(new CaveTrollSaddleFeatureRenderer(this, context.getModelSet())); + this.addLayer(new CaveTrollHeldItemFeatureRenderer(this, context.getItemRenderer())); } @Override - public Identifier getTexture(CaveTrollEntityRenderState state) { - boolean isCalm = (state.tameness > 25 || !state.isTame) && !state.isEnraged; - if(state.customName != null && state.customName.getString().equals("Angmarzku")) { + public ResourceLocation getTextureLocation(CaveTrollEntity entity) { + boolean isCalm = (entity.getTameness() > 25 || !entity.isTamed()) && !entity.isEnraged(); + if(entity.hasCustomName() && entity.getName().getString().equals("Angmarzku")) { return isCalm ? MiddleEarth.of(TEXTURE_ANG) : MiddleEarth.of(TEXTURE_ANGRY_ANG); } return isCalm ? - MiddleEarth.of(PATH + LOCATION_BY_VARIANT.get(state.variant) + ".png") : - MiddleEarth.of(PATH + LOCATION_BY_VARIANT.get(state.variant) + "_angry.png"); + MiddleEarth.of(PATH + LOCATION_BY_VARIANT.get(entity.getVariant()) + ".png") : + MiddleEarth.of(PATH + LOCATION_BY_VARIANT.get(entity.getVariant()) + "_angry.png"); } public static final Map LOCATION_BY_VARIANT = @@ -49,32 +48,4 @@ public Identifier getTexture(CaveTrollEntityRenderState state) { map.put(CaveTrollVariant.GREY_BLUE, "grey_blue"); }); - @Override - public CaveTrollEntityRenderState createRenderState() { - return new CaveTrollEntityRenderState(); - } - - @Override - public void updateRenderState(CaveTrollEntity troll, CaveTrollEntityRenderState state, float f) { - super.updateRenderState(troll, state, f); - CaveTrollEntityRenderState.updateRenderState(troll, state, this.itemModelResolver); - - state.chaseAnimationState = troll.chaseAnimationState; - state.scavengingAnimationState = troll.scavengingAnimationState; - state.startSittingAnimationState = troll.startSittingAnimationState; - state.stopSittingAnimationState = troll.stopSittingAnimationState; - state.startSleepingAnimationState = troll.startSleepingAnimationState; - state.sleepingAnimationState = troll.sleepingAnimationState; - state.stopSleepingAnimationState = troll.stopSleepingAnimationState; - state.roaringAnimationState = troll.roaringAnimationState; - state.smashingAnimationState = troll.smashingAnimationState; - state.isSprinting = troll.isSprinting(); - state.isCharging = troll.isCharging(); - state.isEnraged = troll.isEnraged(); - state.variant = troll.getVariant(); - state.isTame = troll.isTame(); - state.conrollingPassenger = troll.getControllingPassenger(); - state.saddle = troll.getEquippedStack(EquipmentSlot.SADDLE); - state.tameness = troll.getTameness(); - } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/feature/CaveTrollDroolFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/feature/CaveTrollDroolFeatureRenderer.java index 6d4f61ef8f..25b25ee634 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/feature/CaveTrollDroolFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/feature/CaveTrollDroolFeatureRenderer.java @@ -1,29 +1,30 @@ package net.sevenstars.middleearth.entity.beasts.cave_troll.feature; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.feature.EyesFeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntityModel; -import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntityRenderState; +import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntity; -public class CaveTrollDroolFeatureRenderer extends FeatureRenderer { - private static final Identifier TEXTURE = Identifier.of(MiddleEarth.MOD_ID, "textures/entities/trolls/cave/cave_troll_green_drooling.png"); - public CaveTrollDroolFeatureRenderer(FeatureRendererContext featureRendererContext) { +public class CaveTrollDroolFeatureRenderer extends RenderLayer { + private static final ResourceLocation TEXTURE = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "textures/entities/trolls/cave/cave_troll_green_drooling.png"); + public CaveTrollDroolFeatureRenderer(RenderLayerParent featureRendererContext) { super(featureRendererContext); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CaveTrollEntityRenderState state, float limbAngle, float limbDistance) { - if(state.tameness < 50 && state.isTame) { - VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(TEXTURE)); - this.getContextModel().render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV); + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, CaveTrollEntity entity, + float limbAngle, float limbDistance, float tickDelta, float animationProgress, + float headYaw, float headPitch) { + if(entity.getTameness() < 50 && entity.isTamed()) { + VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderType.entityCutoutNoCull(TEXTURE)); + this.getParentModel().renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/feature/CaveTrollHeldItemFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/feature/CaveTrollHeldItemFeatureRenderer.java index d425123456..ad83acfc22 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/feature/CaveTrollHeldItemFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/feature/CaveTrollHeldItemFeatureRenderer.java @@ -1,31 +1,42 @@ package net.sevenstars.middleearth.entity.beasts.cave_troll.feature; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.item.ItemRenderState; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Arm; -import net.minecraft.util.math.RotationAxis; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Axis; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.world.item.ItemDisplayContext; import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntityModel; -import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntityRenderState; +import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntity; -public class CaveTrollHeldItemFeatureRenderer extends FeatureRenderer { - public CaveTrollHeldItemFeatureRenderer(FeatureRendererContext context) { +public class CaveTrollHeldItemFeatureRenderer extends RenderLayer { + private final ItemRenderer itemRenderer; + + public CaveTrollHeldItemFeatureRenderer( + RenderLayerParent context, ItemRenderer itemRenderer) { super(context); + this.itemRenderer = itemRenderer; } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CaveTrollEntityRenderState state, float limbAngle, float limbDistance) { - this.getContextModel().setArmAngle(matrices); - matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-90.0F)); - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180.0F)); + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, CaveTrollEntity entity, + float limbAngle, float limbDistance, float tickDelta, float animationProgress, + float headYaw, float headPitch) { + if (entity.getMainHandItem().isEmpty()) { + return; + } + matrices.pushPose(); + this.getParentModel().setArmAngle(matrices); + matrices.mulPose(Axis.XP.rotationDegrees(-90.0F)); + matrices.mulPose(Axis.YP.rotationDegrees(180.0F)); matrices.translate(0.3f, 0, -2.6); matrices.scale(1.5f,1.5f,1.5f); - state.handItemState.render(matrices, vertexConsumers, light, OverlayTexture.DEFAULT_UV); + this.itemRenderer.renderStatic(entity.getMainHandItem(), ItemDisplayContext.THIRD_PERSON_RIGHT_HAND, + light, OverlayTexture.NO_OVERLAY, matrices, vertexConsumers, entity.level(), entity.getId()); + matrices.popPose(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/feature/CaveTrollSaddleFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/feature/CaveTrollSaddleFeatureRenderer.java index 0e826f87d3..a9becdb861 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/feature/CaveTrollSaddleFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/feature/CaveTrollSaddleFeatureRenderer.java @@ -1,39 +1,41 @@ package net.sevenstars.middleearth.entity.beasts.cave_troll.feature; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.equipment.EquipmentRenderer; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Identifier; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.entity.animal.horse.AbstractHorse; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntityModelLayersME; import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntityModel; -import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntityRenderState; +import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntity; -public class CaveTrollSaddleFeatureRenderer extends FeatureRenderer { +public class CaveTrollSaddleFeatureRenderer extends RenderLayer { private final CaveTrollSaddleModel model; - public CaveTrollSaddleFeatureRenderer(FeatureRendererContext context, LoadedEntityModels loader, EquipmentRenderer equipmentRenderer) { + public CaveTrollSaddleFeatureRenderer(RenderLayerParent context, EntityModelSet loader) { super(context); - model = new CaveTrollSaddleModel(loader.getModelPart(EntityModelLayersME.CAVE_TROLL_SADDLE)); + model = new CaveTrollSaddleModel(loader.bakeLayer(EntityModelLayersME.CAVE_TROLL_SADDLE)); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CaveTrollEntityRenderState state, float limbAngle, float limbDistance) { - ItemStack itemStack = state.saddle; + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, CaveTrollEntity entity, + float limbAngle, float limbDistance, float tickDelta, float animationProgress, + float headYaw, float headPitch) { + ItemStack itemStack = entity.getInventory().getItem(AbstractHorse.INV_SLOT_SADDLE); if(!itemStack.isEmpty()) { - VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumers, RenderLayer.getArmorCutoutNoCull(Identifier.of(MiddleEarth.MOD_ID, "textures/entities/trolls/cave/cave_troll_platform.png")), itemStack.hasGlint()); + VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer(vertexConsumers, RenderType.armorCutoutNoCull(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "textures/entities/trolls/cave/cave_troll_platform.png")), itemStack.hasFoil()); - model.setAngles(state); - model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV); + model.setupAnim(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch); + model.renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/feature/CaveTrollSaddleModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/feature/CaveTrollSaddleModel.java index f13abe86eb..b66e4bca25 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/feature/CaveTrollSaddleModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/cave_troll/feature/CaveTrollSaddleModel.java @@ -1,9 +1,15 @@ package net.sevenstars.middleearth.entity.beasts.cave_troll.feature; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.ModelTransformer; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntityModel; -import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntityRenderState; +import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntity; public class CaveTrollSaddleModel extends CaveTrollEntityModel { private final ModelPart reins; @@ -14,44 +20,45 @@ protected CaveTrollSaddleModel(ModelPart root) { reins = root.getChild("root").getChild("body_no_legs").getChild("body_no_limbs").getChild("Head").getChild("Saddle_Reigns"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getModelData(); - ModelPartData modelPartData = modelData.getRoot().getChild("root").getChild("body_no_legs").getChild("body_no_limbs"); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getModelData(); + PartDefinition modelPartData = modelData.getRoot().getChild("root").getChild("body_no_legs").getChild("body_no_limbs"); - ModelPartData body = modelPartData.addChild("body", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition body = modelPartData.addOrReplaceChild("body", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData armor = body.addChild("armor", ModelPartBuilder.create().uv(91, 51) - .cuboid(-16.0F, -40.0F, -9.0F, 33.0F, 40.0F, 17.0F, new Dilation(0.2F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition armor = body.addOrReplaceChild("armor", CubeListBuilder.create().texOffs(91, 51) + .addBox(-16.0F, -40.0F, -9.0F, 33.0F, 40.0F, 17.0F, new CubeDeformation(0.2F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData saddle_platform = modelPartData.addChild("saddle_platform", ModelPartBuilder.create().uv(0, 0).cuboid(-7.5F, 1.0F, -7.5F, 15.0F, 2.0F, 16.0F, new Dilation(0.0F)) - .uv(0, 77).cuboid(-7.5F, -17.0F, -7.5F, 15.0F, 18.0F, 16.0F, - new Dilation(0.0F)), ModelTransform.origin(0.5F, -47.0F, 6.5F)); + PartDefinition saddle_platform = modelPartData.addOrReplaceChild("saddle_platform", CubeListBuilder.create().texOffs(0, 0).addBox(-7.5F, 1.0F, -7.5F, 15.0F, 2.0F, 16.0F, new CubeDeformation(0.0F)) + .texOffs(0, 77).addBox(-7.5F, -17.0F, -7.5F, 15.0F, 18.0F, 16.0F, + new CubeDeformation(0.0F)), PartPose.offset(0.5F, -47.0F, 6.5F)); - ModelPartData log2_r1 = saddle_platform.addChild("log2_r1", ModelPartBuilder.create().uv(67, 25).cuboid(-1.5F, -1.5F, 3.0F, 4.0F, 4.0F, 6.0F, new Dilation(0.0F)), ModelTransform.of(0.4F, 4.5F, 9.0F, 3.1416F, 0.0F, 3.1416F)); + PartDefinition log2_r1 = saddle_platform.addOrReplaceChild("log2_r1", CubeListBuilder.create().texOffs(67, 25).addBox(-1.5F, -1.5F, 3.0F, 4.0F, 4.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.4F, 4.5F, 9.0F, 3.1416F, 0.0F, 3.1416F)); - ModelPartData log1_r1 = saddle_platform.addChild("log1_r1", ModelPartBuilder.create().uv(53, 0).cuboid(-1.5F, -1.5F, -10.0F, 4.0F, 4.0F, 20.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 4.5F, -2.5F, 0.0F, -1.5708F, 0.0F)); + PartDefinition log1_r1 = saddle_platform.addOrReplaceChild("log1_r1", CubeListBuilder.create().texOffs(53, 0).addBox(-1.5F, -1.5F, -10.0F, 4.0F, 4.0F, 20.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 4.5F, -2.5F, 0.0F, -1.5708F, 0.0F)); - ModelPartData platform = modelPartData.addChild("platform", ModelPartBuilder.create().uv(106, 15).cuboid(-15.5F, 12.0F, 1.5F, 31.0F, 4.0F, 4.0F, new Dilation(0.0F)) - .uv(89, 28).cuboid(-19.0F, 10.0F, 1.6F, 38.0F, 2.0F, 16.0F, new Dilation(0.0F)) - .uv(77, 114).cuboid(-19.0F, 1.0F, 1.6F, 38.0F, 9.0F, 16.0F, new Dilation(0.0F)), ModelTransform.origin(0.5F, -48.0F, 6.5F)); + PartDefinition platform = modelPartData.addOrReplaceChild("platform", CubeListBuilder.create().texOffs(106, 15).addBox(-15.5F, 12.0F, 1.5F, 31.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)) + .texOffs(89, 28).addBox(-19.0F, 10.0F, 1.6F, 38.0F, 2.0F, 16.0F, new CubeDeformation(0.0F)) + .texOffs(77, 114).addBox(-19.0F, 1.0F, 1.6F, 38.0F, 9.0F, 16.0F, new CubeDeformation(0.0F)), PartPose.offset(0.5F, -48.0F, 6.5F)); - ModelPartData log2_r2 = platform.addChild("log2_r2", ModelPartBuilder.create().uv(111, 0).cuboid(-1.5F, -1.5F, -1.0F, 4.0F, 4.0F, 10.0F, new Dilation(0.0F)), ModelTransform.of(-7.5F, 13.5F, 14.5F, 3.1416F, 0.0F, 3.1416F)); + PartDefinition log2_r2 = platform.addOrReplaceChild("log2_r2", CubeListBuilder.create().texOffs(111, 0).addBox(-1.5F, -1.5F, -1.0F, 4.0F, 4.0F, 10.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-7.5F, 13.5F, 14.5F, 3.1416F, 0.0F, 3.1416F)); - ModelPartData log1_r2 = platform.addChild("log1_r2", ModelPartBuilder.create().uv(142, 0).cuboid(-1.5F, -1.5F, -1.0F, 4.0F, 4.0F, 10.0F, new Dilation(0.0F)), ModelTransform.of(8.5F, 13.5F, 14.5F, 3.1416F, 0.0F, 3.1416F)); + PartDefinition log1_r2 = platform.addOrReplaceChild("log1_r2", CubeListBuilder.create().texOffs(142, 0).addBox(-1.5F, -1.5F, -1.0F, 4.0F, 4.0F, 10.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(8.5F, 13.5F, 14.5F, 3.1416F, 0.0F, 3.1416F)); - ModelPartData Head = modelPartData.addChild("Head", ModelPartBuilder.create(), ModelTransform.origin(0.5F, -34.5F, -8.5F)); + PartDefinition Head = modelPartData.addOrReplaceChild("Head", CubeListBuilder.create(), PartPose.offset(0.5F, -34.5F, -8.5F)); - ModelPartData Saddle_Reigns = Head.addChild("Saddle_Reigns", ModelPartBuilder.create(), ModelTransform.of(0.0F, 0.0F, 0.0F, -0.0873F, 0.0F, 0.0F)); + PartDefinition Saddle_Reigns = Head.addOrReplaceChild("Saddle_Reigns", CubeListBuilder.create(), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -0.0873F, 0.0F, 0.0F)); - ModelPartData cube_r1 = Saddle_Reigns.addChild("cube_r1", ModelPartBuilder.create().uv(0, 43).cuboid(-5.0F, -22.0F, -2.0F, 10.0F, 22.0F, 7.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, -5.0F, -4.0F, -0.6981F, 0.0F, 0.0F)); + PartDefinition cube_r1 = Saddle_Reigns.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 43).addBox(-5.0F, -22.0F, -2.0F, 10.0F, 22.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -5.0F, -4.0F, -0.6981F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 256, 256).transform(ModelTransformer.NO_OP); + return LayerDefinition.create(modelData, 256, 256); } @Override - public void setAngles(CaveTrollEntityRenderState state) { - super.setAngles(state); + public void setupAnim(CaveTrollEntity entity, float limbSwing, float limbSwingAmount, + float ageInTicks, float netHeadYaw, float headPitch) { + super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - reins.visible = state.conrollingPassenger != null; + reins.visible = entity.getControllingPassenger() != null; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornAnimations.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornAnimations.java index d8f61fd949..4cf3a31718 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornAnimations.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornAnimations.java @@ -1,372 +1,372 @@ package net.sevenstars.middleearth.entity.beasts.great_horn; -import net.minecraft.client.render.entity.animation.AnimationDefinition; -import net.minecraft.client.render.entity.animation.AnimationHelper; -import net.minecraft.client.render.entity.animation.Keyframe; -import net.minecraft.client.render.entity.animation.Transformation; +import net.minecraft.client.animation.AnimationChannel; +import net.minecraft.client.animation.AnimationDefinition; +import net.minecraft.client.animation.Keyframe; +import net.minecraft.client.animation.KeyframeAnimations; public class GreatHornAnimations { //region WALK - public static final AnimationDefinition WALK = AnimationDefinition.Builder.create(2.0F).looping() - .addBoneAnimation("body", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -2.5F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2.5F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -2.5F), Transformation.Interpolations.CUBIC) + public static final AnimationDefinition WALK = AnimationDefinition.Builder.withLength(2.0F).looping() + .addAnimation("body", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -2.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 2.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -2.5F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("body", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, -0.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5417F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, -0.5F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5417F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, -0.5F), Transformation.Interpolations.CUBIC) + .addAnimation("body", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, -0.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5417F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, -0.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5417F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.0F, -0.5F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("back_left_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4167F, AnimationHelper.createRotationalVector(15.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(-15.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.3333F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) + .addAnimation("back_left_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4167F, KeyframeAnimations.degreeVec(15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(-15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.3333F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("back_left_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4167F, AnimationHelper.createTranslationalVector(0.0F, 2.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.73F, -2.94F), Transformation.Interpolations.CUBIC), - new Keyframe(1.3333F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, -2.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.625F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.5F), Transformation.Interpolations.CUBIC) + .addAnimation("back_left_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4167F, KeyframeAnimations.posVec(0.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.73F, -2.94F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.3333F, KeyframeAnimations.posVec(0.0F, 0.0F, -2.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.625F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.5F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("back_right_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(-15.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.3333F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.4583F, AnimationHelper.createRotationalVector(15.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(-15.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) + .addAnimation("back_right_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.3333F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.4583F, KeyframeAnimations.degreeVec(15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(-15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("back_right_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.73F, -2.94F), Transformation.Interpolations.CUBIC), - new Keyframe(0.3333F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, -2.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.625F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.5F), Transformation.Interpolations.CUBIC), - new Keyframe(1.4583F, AnimationHelper.createTranslationalVector(0.0F, 2.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.73F, -2.94F), Transformation.Interpolations.CUBIC) + .addAnimation("back_right_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.73F, -2.94F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.3333F, KeyframeAnimations.posVec(0.0F, 0.0F, -2.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.4583F, KeyframeAnimations.posVec(0.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.73F, -2.94F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("front_left_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2.5F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -2.5F), Transformation.Interpolations.CUBIC), - new Keyframe(1.375F, AnimationHelper.createRotationalVector(15.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.7083F, AnimationHelper.createRotationalVector(-15.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2.5F), Transformation.Interpolations.CUBIC) + .addAnimation("front_left_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 2.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -2.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.375F, KeyframeAnimations.degreeVec(15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.7083F, KeyframeAnimations.degreeVec(-15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 2.5F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("front_left_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, -1.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5417F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 2.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 3.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.375F, AnimationHelper.createTranslationalVector(0.0F, 3.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, -1.0F), Transformation.Interpolations.CUBIC) + .addAnimation("front_left_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, -1.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5417F, KeyframeAnimations.posVec(0.0F, 0.0F, 2.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 3.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.375F, KeyframeAnimations.posVec(0.0F, 3.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.0F, -1.0F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("front_right_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.3333F, AnimationHelper.createRotationalVector(15.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.6667F, AnimationHelper.createRotationalVector(-15.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -2.5F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2.5F), Transformation.Interpolations.CUBIC) + .addAnimation("front_right_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 2.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.3333F, KeyframeAnimations.degreeVec(15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.6667F, KeyframeAnimations.degreeVec(-15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -2.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 2.5F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("front_right_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 3.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.3333F, AnimationHelper.createTranslationalVector(0.0F, 3.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, -1.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5417F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 2.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 3.0F), Transformation.Interpolations.CUBIC) + .addAnimation("front_right_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 3.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.3333F, KeyframeAnimations.posVec(0.0F, 3.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, -1.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5417F, KeyframeAnimations.posVec(0.0F, 0.0F, 2.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 3.0F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("head_neck", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -2.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2.0F), Transformation.Interpolations.CUBIC) + .addAnimation("head_neck", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 2.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -2.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 2.0F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("head_neck", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5417F, AnimationHelper.createTranslationalVector(0.0F, -0.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5417F, AnimationHelper.createTranslationalVector(0.0F, -0.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) + .addAnimation("head_neck", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5417F, KeyframeAnimations.posVec(0.0F, -0.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5417F, KeyframeAnimations.posVec(0.0F, -0.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("beard", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -1.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5417F, AnimationHelper.createRotationalVector(-2.0F, 0.0F, 0.0714F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 1.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5417F, AnimationHelper.createRotationalVector(-2.0F, 0.0F, 0.0714F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -1.0F), Transformation.Interpolations.CUBIC) + .addAnimation("beard", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -1.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5417F, KeyframeAnimations.degreeVec(-2.0F, 0.0F, 0.0714F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5417F, KeyframeAnimations.degreeVec(-2.0F, 0.0F, 0.0714F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -1.0F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("tail", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(10.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR) + .addAnimation("tail", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(10.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) - .addBoneAnimation("ear_left", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(-5.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(-5.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) + .addAnimation("ear_left", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(-5.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(-5.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("ear_left", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) + .addAnimation("ear_left", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("ear_right", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(-5.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(-5.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) + .addAnimation("ear_right", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(-5.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(-5.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("ear_right", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) + .addAnimation("ear_right", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) )) .build(); // endregion // region IDLE - public static final AnimationDefinition EAR_WIGGLE = AnimationDefinition.Builder.create(3.0F) - .addBoneAnimation("ear_left", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.9583F, AnimationHelper.createRotationalVector(10.1692F, 25.5711F, 13.9439F), Transformation.Interpolations.CUBIC), - new Keyframe(1.125F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.2917F, AnimationHelper.createRotationalVector(10.1692F, 25.5711F, 13.9439F), Transformation.Interpolations.CUBIC), - new Keyframe(1.4583F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(3.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) + public static final AnimationDefinition EAR_WIGGLE = AnimationDefinition.Builder.withLength(3.0F) + .addAnimation("ear_left", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.9583F, KeyframeAnimations.degreeVec(10.1692F, 25.5711F, 13.9439F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.125F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.2917F, KeyframeAnimations.degreeVec(10.1692F, 25.5711F, 13.9439F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.4583F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("ear_right", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.9583F, AnimationHelper.createRotationalVector(10.1692F, -25.5711F, -13.9439F), Transformation.Interpolations.CUBIC), - new Keyframe(1.125F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.2917F, AnimationHelper.createRotationalVector(10.1692F, -25.5711F, -13.9439F), Transformation.Interpolations.CUBIC), - new Keyframe(1.4583F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(3.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) + .addAnimation("ear_right", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.9583F, KeyframeAnimations.degreeVec(10.1692F, -25.5711F, -13.9439F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.125F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.2917F, KeyframeAnimations.degreeVec(10.1692F, -25.5711F, -13.9439F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.4583F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) )) .build(); - public static final AnimationDefinition IDLE = AnimationDefinition.Builder.create(3.0F).looping() - .addBoneAnimation("head_neck", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(-2.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(3.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) + public static final AnimationDefinition IDLE = AnimationDefinition.Builder.withLength(3.0F).looping() + .addAnimation("head_neck", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(-2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("front_body", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(3.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) + .addAnimation("front_body", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) )) - .addBoneAnimation("front_body", new Transformation(Transformation.Targets.SCALE, - new Keyframe(0.0F, AnimationHelper.createScalingVector(1.0F, 1.0F, 1.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createScalingVector(1.0F, 1.0F, 1.05F), Transformation.Interpolations.CUBIC), - new Keyframe(3.0F, AnimationHelper.createScalingVector(1.0F, 1.0F, 1.0F), Transformation.Interpolations.CUBIC) + .addAnimation("front_body", new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0F, 1.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.scaleVec(1.0F, 1.0F, 1.05F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(3.0F, KeyframeAnimations.scaleVec(1.0F, 1.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM) )) .build(); // endregion // region GALLOP - public static final AnimationDefinition GALLOP = AnimationDefinition.Builder.create(0.75F).looping() - .addBoneAnimation("root", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(-2.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.3333F, AnimationHelper.createRotationalVector(12.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(-2.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("root", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 4.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.3333F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, 4.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("body", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(-2.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4583F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(-2.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("back_left_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(62.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4583F, AnimationHelper.createRotationalVector(-35.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(62.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("back_left_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 2.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4583F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, -1.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("back_right_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(62.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4583F, AnimationHelper.createRotationalVector(-35.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(62.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("back_right_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 2.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4583F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, -1.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("front_left_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(-62.4474F, -0.0884F, 0.5044F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4583F, AnimationHelper.createRotationalVector(35.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(-62.4474F, -0.0884F, 0.5044F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("front_left_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, -1.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.2083F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 1.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4583F, AnimationHelper.createTranslationalVector(0.0F, 3.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, -1.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("front_right_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(-62.4474F, -0.0884F, 0.5044F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4583F, AnimationHelper.createRotationalVector(35.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(-62.4474F, -0.0884F, 0.5044F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("front_right_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, -1.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.2083F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 1.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4583F, AnimationHelper.createTranslationalVector(0.0F, 3.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, -1.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("head_neck", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(5.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.3333F, AnimationHelper.createRotationalVector(-2.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(5.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("head_neck", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4583F, AnimationHelper.createTranslationalVector(0.0F, -0.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("tail", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(-30.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4167F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(-30.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("beard", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4583F, AnimationHelper.createRotationalVector(-5.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("ear_left", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(-15.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4583F, AnimationHelper.createRotationalVector(20.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(-15.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("ear_right", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(-15.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4583F, AnimationHelper.createRotationalVector(20.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(-15.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) + public static final AnimationDefinition GALLOP = AnimationDefinition.Builder.withLength(0.75F).looping() + .addAnimation("root", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.3333F, KeyframeAnimations.degreeVec(12.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(-2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("root", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 4.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.3333F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 4.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("body", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(-2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("back_left_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(62.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583F, KeyframeAnimations.degreeVec(-35.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(62.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("back_left_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583F, KeyframeAnimations.posVec(0.0F, 0.0F, -1.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("back_right_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(62.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583F, KeyframeAnimations.degreeVec(-35.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(62.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("back_right_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583F, KeyframeAnimations.posVec(0.0F, 0.0F, -1.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("front_left_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-62.4474F, -0.0884F, 0.5044F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583F, KeyframeAnimations.degreeVec(35.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(-62.4474F, -0.0884F, 0.5044F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("front_left_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 1.0F, -1.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2083F, KeyframeAnimations.posVec(0.0F, 0.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583F, KeyframeAnimations.posVec(0.0F, 3.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 1.0F, -1.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("front_right_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-62.4474F, -0.0884F, 0.5044F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583F, KeyframeAnimations.degreeVec(35.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(-62.4474F, -0.0884F, 0.5044F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("front_right_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 1.0F, -1.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2083F, KeyframeAnimations.posVec(0.0F, 0.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583F, KeyframeAnimations.posVec(0.0F, 3.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 1.0F, -1.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("head_neck", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(5.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.3333F, KeyframeAnimations.degreeVec(-2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(5.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("head_neck", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583F, KeyframeAnimations.posVec(0.0F, -0.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("tail", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-30.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4167F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(-30.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("beard", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583F, KeyframeAnimations.degreeVec(-5.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("ear_left", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583F, KeyframeAnimations.degreeVec(20.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(-15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("ear_right", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583F, KeyframeAnimations.degreeVec(20.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(-15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) )) .build(); // endregion // region BOW - public static final AnimationDefinition BOW = AnimationDefinition.Builder.create(4.0F) - .addBoneAnimation("back_left_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(12.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(4.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("back_left_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, 2.5F, 0.5F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 1.0F), Transformation.Interpolations.CUBIC), - new Keyframe(4.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("back_right_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(-15.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(4.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("back_right_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, -2.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, -4.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, -4.0F), Transformation.Interpolations.CUBIC), - new Keyframe(4.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("front_left_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(-67.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.5F, AnimationHelper.createRotationalVector(-67.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(4.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("front_left_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, 4.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(4.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("front_right_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(-22.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.5F, AnimationHelper.createRotationalVector(-22.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(4.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("front_right_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 6.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.5F, AnimationHelper.createTranslationalVector(0.0F, 6.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(4.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("head_neck", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(47.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.5F, AnimationHelper.createRotationalVector(47.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(4.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("beard", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(-2.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(4.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("front_half", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(22.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.5F, AnimationHelper.createRotationalVector(22.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(4.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("front_half", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, -6.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.5F, AnimationHelper.createTranslationalVector(0.0F, -6.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(4.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("ear_left", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(36.6611F, 8.8837F, 33.0832F), Transformation.Interpolations.CUBIC), - new Keyframe(4.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("ear_right", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(36.6611F, -8.8837F, -33.0832F), Transformation.Interpolations.CUBIC), - new Keyframe(4.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) + public static final AnimationDefinition BOW = AnimationDefinition.Builder.withLength(4.0F) + .addAnimation("back_left_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(12.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("back_left_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 2.5F, 0.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("back_right_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(-15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("back_right_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 1.0F, -2.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 0.0F, -4.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5F, KeyframeAnimations.posVec(0.0F, 0.0F, -4.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("front_left_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(-67.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5F, KeyframeAnimations.degreeVec(-67.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("front_left_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 4.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("front_right_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(-22.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5F, KeyframeAnimations.degreeVec(-22.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("front_right_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 6.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5F, KeyframeAnimations.posVec(0.0F, 6.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("head_neck", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(47.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5F, KeyframeAnimations.degreeVec(47.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("beard", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(-2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("front_half", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(22.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5F, KeyframeAnimations.degreeVec(22.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("front_half", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, -6.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.5F, KeyframeAnimations.posVec(0.0F, -6.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("ear_left", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(36.6611F, 8.8837F, 33.0832F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("ear_right", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(36.6611F, -8.8837F, -33.0832F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(4.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) )) .build(); // endregion - + // region ATTACK - public static final AnimationDefinition ATTACK = AnimationDefinition.Builder.create(0.8333F) - .addBoneAnimation("head_neck", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.0833F, AnimationHelper.createRotationalVector(54.06F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.2083F, AnimationHelper.createRotationalVector(95.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.3333F, AnimationHelper.createRotationalVector(28.33F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.4167F, AnimationHelper.createRotationalVector(-5.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(-12.16F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.6667F, AnimationHelper.createRotationalVector(-13.52F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.8333F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR) + public static final AnimationDefinition ATTACK = AnimationDefinition.Builder.withLength(0.8333F) + .addAnimation("head_neck", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.0833F, KeyframeAnimations.degreeVec(54.06F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.2083F, KeyframeAnimations.degreeVec(95.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3333F, KeyframeAnimations.degreeVec(28.33F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.4167F, KeyframeAnimations.degreeVec(-5.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(-12.16F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6667F, KeyframeAnimations.degreeVec(-13.52F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8333F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) .build(); // endregion -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornEntity.java index c4adf370ed..1921718243 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornEntity.java @@ -1,44 +1,62 @@ package net.sevenstars.middleearth.entity.beasts.great_horn; -import net.minecraft.block.BlockState; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.FoodComponent; -import net.minecraft.entity.*; -import net.minecraft.entity.ai.goal.*; -import net.minecraft.entity.attribute.DefaultAttributeContainer; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.data.TrackedData; -import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.entity.passive.*; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.spawn.SpawnContext; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.tag.BiomeTags; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.BlockSoundGroup; -import net.minecraft.sound.SoundEvent; -import net.minecraft.sound.SoundEvents; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec2f; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.LocalDifficulty; -import net.minecraft.world.ServerWorldAccess; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.Registries; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.tags.BiomeTags; +import net.minecraft.tags.TagKey; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.AgeableMob; +import net.minecraft.world.entity.AnimationState; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.Pose; +import net.minecraft.world.entity.SpawnGroupData; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.goal.BreedGoal; +import net.minecraft.world.entity.ai.goal.FloatGoal; +import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; +import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; +import net.minecraft.world.entity.ai.goal.TemptGoal; +import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; +import net.minecraft.world.entity.animal.Animal; +import net.minecraft.world.entity.animal.horse.AbstractHorse; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.ServerLevelAccessor; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec2; +import net.minecraft.world.phys.Vec3; +import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.config.ModServerConfigs; import net.sevenstars.middleearth.entity.EntitiesME; import net.sevenstars.middleearth.entity.TrackedDataHandlerRegistryME; +import net.sevenstars.middleearth.entity.VariantHolderUtils; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; import net.sevenstars.middleearth.entity.beasts.trolls.stone.StoneTrollEntity; import net.sevenstars.middleearth.entity.beasts.warg.WargEntity; @@ -58,111 +76,116 @@ import org.joml.Vector3f; import java.util.List; -import java.util.Optional; import java.util.function.DoubleSupplier; import java.util.function.IntUnaryOperator; public class GreatHornEntity extends AbstractBeastEntity implements Evader { + private static final TagKey WARM_VARIANT_BIOMES = + TagKey.create(Registries.BIOME, MiddleEarth.of("spawns_warm_variant_great_horn")); + private static final TagKey COLD_VARIANT_BIOMES = + TagKey.create(Registries.BIOME, MiddleEarth.of("spawns_cold_variant_great_horn")); private static final int HORNS_ATTACK_COOLDOWN = 50; - private static final float MIN_MOVEMENT_SPEED_BONUS = (float) GreatHornEntity.getChildMovementSpeedBonus(() -> 0.0); - private static final float MAX_MOVEMENT_SPEED_BONUS = (float) GreatHornEntity.getChildMovementSpeedBonus(() -> 1.0); - private static final float MIN_HEALTH_BONUS = GreatHornEntity.getChildHealthBonus(max -> 0); - private static final float MAX_HEALTH_BONUS = GreatHornEntity.getChildHealthBonus(max -> max - 1); - private static final TrackedData> VARIANT = DataTracker.registerData(GreatHornEntity.class, TrackedDataHandlerRegistryME.GREAT_HORN_VARIANT);; - private static final TrackedData BOW = DataTracker.registerData(GreatHornEntity.class, TrackedDataHandlerRegistry.INTEGER); - private static final TrackedData ATTACK = DataTracker.registerData(GreatHornEntity.class, TrackedDataHandlerRegistry.INTEGER); - private static final TrackedData BLUE_SADDLE = DataTracker.registerData(GreatHornEntity.class, TrackedDataHandlerRegistry.BOOLEAN); - private static final TrackedData MOUNTABLE = DataTracker.registerData(GreatHornEntity.class, TrackedDataHandlerRegistry.BOOLEAN); - private static final TrackedData EVADING = DataTracker.registerData(GreatHornEntity.class, TrackedDataHandlerRegistry.BOOLEAN); + private static final float MIN_MOVEMENT_SPEED_BONUS = (float) GreatHornEntity.generateSpeed(() -> 0.0); + private static final float MAX_MOVEMENT_SPEED_BONUS = (float) GreatHornEntity.generateSpeed(() -> 1.0); + private static final float MIN_HEALTH_BONUS = GreatHornEntity.generateMaxHealth(max -> 0); + private static final float MAX_HEALTH_BONUS = GreatHornEntity.generateMaxHealth(max -> max - 1); + private static final EntityDataAccessor> VARIANT = SynchedEntityData.defineId(GreatHornEntity.class, TrackedDataHandlerRegistryME.GREAT_HORN_VARIANT);; + private static final EntityDataAccessor BOW = SynchedEntityData.defineId(GreatHornEntity.class, EntityDataSerializers.INT); + private static final EntityDataAccessor ATTACK = SynchedEntityData.defineId(GreatHornEntity.class, EntityDataSerializers.INT); + private static final EntityDataAccessor BLUE_SADDLE = SynchedEntityData.defineId(GreatHornEntity.class, EntityDataSerializers.BOOLEAN); + private static final EntityDataAccessor MOUNTABLE = SynchedEntityData.defineId(GreatHornEntity.class, EntityDataSerializers.BOOLEAN); + private static final EntityDataAccessor EVADING = SynchedEntityData.defineId(GreatHornEntity.class, EntityDataSerializers.BOOLEAN); public final AnimationState earWigglingAnimationState = new AnimationState(); public final AnimationState gallopAnimationState = new AnimationState(); public final AnimationState bowAnimationState = new AnimationState(); public final AnimationState attackAnimationState = new AnimationState(); - private static final EntityDimensions BABY_BASE_DIMENSIONS = EntitiesME.GREAT_HORN.getDimensions().scaled(0.5f); + private static final EntityDimensions BABY_BASE_DIMENSIONS = EntitiesME.GREAT_HORN.getDimensions().scale(0.5f); protected int attackAnimationCooldown = 0; protected int bowAnimationTimeout = 0; - public GreatHornEntity(EntityType entityType, World world) { + public GreatHornEntity(EntityType entityType, Level world) { super(entityType, world); idleAnimationTimeout = 200; } - public static DefaultAttributeContainer.Builder setAttributes() { - return AnimalEntity.createAnimalAttributes() - .add(EntityAttributes.MOVEMENT_SPEED, 0.3) - .add(EntityAttributes.MAX_HEALTH, 50.0d) - .add(EntityAttributes.KNOCKBACK_RESISTANCE, 0.3d) - .add(EntityAttributes.ATTACK_SPEED, 1.0d) - .add(EntityAttributes.FOLLOW_RANGE, 38.0d) - .add(EntityAttributes.ATTACK_DAMAGE, 4.0d) - .add(EntityAttributes.WATER_MOVEMENT_EFFICIENCY, 0.5f) - .add(EntityAttributes.STEP_HEIGHT, 1.15d) - .add(EntityAttributes.SAFE_FALL_DISTANCE, 7.0d) - .add(EntityAttributes.JUMP_STRENGTH, 0.75d); + public static AttributeSupplier.Builder setAttributes() { + return Mob.createMobAttributes() + .add(Attributes.MOVEMENT_SPEED, 0.3) + .add(Attributes.MAX_HEALTH, 50.0d) + .add(Attributes.KNOCKBACK_RESISTANCE, 0.3d) + .add(Attributes.ATTACK_SPEED, 1.0d) + .add(Attributes.FOLLOW_RANGE, 38.0d) + .add(Attributes.ATTACK_DAMAGE, 4.0d) + .add(Attributes.WATER_MOVEMENT_EFFICIENCY, 0.5f) + .add(Attributes.STEP_HEIGHT, 1.15d) + .add(Attributes.SAFE_FALL_DISTANCE, 7.0d) + .add(Attributes.JUMP_STRENGTH, 0.75d); } @Override - protected void initAttributes(Random random) { - this.getAttributeInstance(EntityAttributes.MAX_HEALTH).setBaseValue(this.getChildHealthBonus(random::nextInt)); - this.getAttributeInstance(EntityAttributes.MOVEMENT_SPEED).setBaseValue(this.getChildMovementSpeedBonus(random::nextDouble)); - this.getAttributeInstance(EntityAttributes.JUMP_STRENGTH).setBaseValue(this.getChildJumpStrengthBonus(random::nextDouble)); + protected void randomizeAttributes(RandomSource random) { + this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.generateMaxHealth(random::nextInt)); + this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.generateSpeed(random::nextDouble)); + this.getAttribute(Attributes.JUMP_STRENGTH).setBaseValue(this.generateJumpStrength(random::nextDouble)); } @Override - protected void initGoals() { - this.goalSelector.add(1, new SwimGoal(this)); - this.goalSelector.add(2, new BowAtEntityGoal(this, PlayerEntity.class, 16, (livingEntity -> { - return this.shouldBow((PlayerEntity) livingEntity); + protected void registerGoals() { + this.goalSelector.addGoal(1, new FloatGoal(this)); + this.goalSelector.addGoal(2, new BowAtEntityGoal(this, Player.class, 16, (livingEntity -> { + return this.shouldBow((Player) livingEntity); }) )); - this.goalSelector.add(3, new SmartFleeEntityGoal<>(this, (Evader) this, - PlayerEntity.class, 20.0F, 1.6, 1.9, (entity) -> { - return !this.canTrust((PlayerEntity)entity); + this.goalSelector.addGoal(3, new SmartFleeEntityGoal<>(this, (Evader) this, + Player.class, 20.0F, 1.6, 1.9, (entity) -> { + return !this.canTrust((Player)entity); })); - this.goalSelector.add(4, new SmartFleeEntityGoal<>(this, (Evader) this, + this.goalSelector.addGoal(4, new SmartFleeEntityGoal<>(this, (Evader) this, WargEntity.class, 20.0F, 1.7, 2.0, (entity) -> true)); - this.goalSelector.add(4, new ChargeAttackGoal(this, null, maxChargeCooldown())); - this.goalSelector.add(5, new AnimalMateGoal(this, 1.5)); - this.goalSelector.add(6, new TemptGoal(this, 1.0, (stack) -> stack.isIn(ItemTagsME.ELK_FOOD), false)); - this.goalSelector.add(7, new WanderAroundFarGoal(this, 1.0)); - this.goalSelector.add(8, new LookAtEntityGoal(this, PlayerEntity.class, 6.0f)); - this.goalSelector.add(9, new LookAroundGoal(this)); + this.goalSelector.addGoal(4, new ChargeAttackGoal(this, null, maxChargeCooldown())); + this.goalSelector.addGoal(5, new BreedGoal(this, 1.5)); + this.goalSelector.addGoal(6, new TemptGoal(this, 1.0, (stack) -> stack.is(ItemTagsME.ELK_FOOD), false)); + this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0)); + this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 6.0f)); + this.goalSelector.addGoal(9, new RandomLookAroundGoal(this)); } @Override - protected void initDataTracker(DataTracker.Builder builder) { - super.initDataTracker(builder); - RegistryEntry greatHornVariantRegistryEntry = Variants.getOrDefaultOrThrow(this.getRegistryManager(), GreatHornVariantRegistry.DEFAULT); - builder.add(BOW, 0); - builder.add(BLUE_SADDLE, false); - builder.add(MOUNTABLE, true); - builder.add(EVADING, false); - builder.add(ATTACK, 0); - builder.add(VARIANT, greatHornVariantRegistryEntry); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + Holder greatHornVariantRegistryEntry = + VariantHolderUtils.getDefaultOrAny(this.registryAccess(), GreatHornVariantRegistry.DEFAULT); + builder.define(BOW, 0); + builder.define(BLUE_SADDLE, false); + builder.define(MOUNTABLE, true); + builder.define(EVADING, false); + builder.define(ATTACK, 0); + builder.define(VARIANT, greatHornVariantRegistryEntry); } @Override - protected void writeCustomData(WriteView view) { - super.writeCustomData(view); - Variants.writeVariantToNbt(view, this.getRegistryVariant()); + public void addAdditionalSaveData(CompoundTag view) { + super.addAdditionalSaveData(view); + VariantHolderUtils.writeVariant(view, this.getRegistryVariant()); } @Override - protected void readCustomData(ReadView view) { - super.readCustomData(view); - Variants.readVariantFromNbt(view, DynamicRegistriesME.GREAT_HORN_VARIANTS).ifPresent(this::setVariant); - this.dataTracker.set(MOUNTABLE, ModServerConfigs.ENABLE_MOUNT_BROADHOOF_GOAT); + public void readAdditionalSaveData(CompoundTag view) { + super.readAdditionalSaveData(view); + VariantHolderUtils.readVariant(view, this.registryAccess(), DynamicRegistriesME.GREAT_HORN_VARIANTS) + .ifPresent(this::setVariant); + this.entityData.set(MOUNTABLE, ModServerConfigs.ENABLE_MOUNT_BROADHOOF_GOAT); } - protected static float getChildHealthBonus(IntUnaryOperator randomIntGetter) { + protected static float generateMaxHealth(IntUnaryOperator randomIntGetter) { return 20.0f + (float)randomIntGetter.applyAsInt(8) + (float)randomIntGetter.applyAsInt(8); } - protected static double getChildJumpStrengthBonus(DoubleSupplier randomDoubleGetter) { + protected static double generateJumpStrength(DoubleSupplier randomDoubleGetter) { return 0; } - protected static double getChildMovementSpeedBonus(DoubleSupplier randomDoubleGetter) { + protected static double generateSpeed(DoubleSupplier randomDoubleGetter) { return ((double)0.4f + randomDoubleGetter.getAsDouble() * 0.25 + randomDoubleGetter.getAsDouble() * 0.25 + randomDoubleGetter.getAsDouble() * 0.2) * 0.27; } @@ -182,45 +205,45 @@ public boolean usesTameness() { } public boolean hasBlueSaddle() { - return this.dataTracker.get(BLUE_SADDLE); + return this.entityData.get(BLUE_SADDLE); } @Override - public ActionResult interactMob(PlayerEntity player, Hand hand) { - ItemStack itemStack = player.getStackInHand(hand); + public InteractionResult mobInteract(Player player, InteractionHand hand) { + ItemStack itemStack = player.getItemInHand(hand); - if(!this.getWorld().isClient() && !player.isCreative()) { + if(!this.level().isClientSide() && !player.isCreative()) { RaceType playerRace = RaceUtil.getRaceType(player); if(playerRace == null || playerRace == RaceType.NONE || (this.getCompatibleRaces() != null && !this.getCompatibleRaces().contains(playerRace))) { - return ActionResult.FAIL; + return InteractionResult.FAIL; } } - if(this.isTame() && this.isTamable(player)) { - if (this.isBreedingItem(itemStack)) { + if(this.isTamed() && this.isTamable(player)) { + if (this.isFood(itemStack)) { if(this.getHealth() < this.getMaxHealth()) { - itemStack.decrementUnlessCreative(1, player); - FoodComponent foodComponent = itemStack.get(DataComponentTypes.FOOD); + itemStack.consume(1, player); + FoodProperties foodComponent = itemStack.get(DataComponents.FOOD); float f = foodComponent != null ? (float)foodComponent.nutrition() : 1.0f; this.heal(2.0f * f); - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } - else if (!this.getWorld().isClient && this.getBreedingAge() == 0 && this.canEat()) { - this.eat(player, hand, itemStack); - this.lovePlayer(player); - return ActionResult.SUCCESS; + else if (!this.level().isClientSide && this.getAge() == 0 && this.canFallInLove()) { + this.usePlayerItem(player, hand, itemStack); + this.setInLove(player); + return InteractionResult.SUCCESS; } } } - if(itemStack.getItem().equals(Items.BLUE_DYE) && !this.dataTracker.get(BLUE_SADDLE)) { - this.dataTracker.set(BLUE_SADDLE, true); - } else if(itemStack.getItem().equals(Items.RED_DYE) && this.dataTracker.get(BLUE_SADDLE)) { - this.dataTracker.set(BLUE_SADDLE, false); + if(itemStack.getItem().equals(Items.BLUE_DYE) && !this.entityData.get(BLUE_SADDLE)) { + this.entityData.set(BLUE_SADDLE, true); + } else if(itemStack.getItem().equals(Items.RED_DYE) && this.entityData.get(BLUE_SADDLE)) { + this.entityData.set(BLUE_SADDLE, false); } - return super.interactMob(player, hand); + return super.mobInteract(player, hand); } @Override @@ -229,26 +252,26 @@ public boolean canCarryChest() { } @Override - protected Vec3d getPassengerAttachmentPos(Entity passenger, EntityDimensions dimensions, float scaleFactor) { - float f = this.limbAnimator.getAnimationProgress() / 20; - float g = this.limbAnimator.getAnimationProgress() * (MathHelper.PI / 180) * 18; // TODO : Fix,was using limbAnimator.getPos() + protected Vec3 getPassengerAttachmentPoint(Entity passenger, EntityDimensions dimensions, float scaleFactor) { + float f = this.walkAnimation.position() / 20; + float g = this.walkAnimation.position() * (Mth.PI / 180) * 18; // TODO : Fix,was using limbAnimator.getPos() double y = 0.45; - if(gallopAnimationState.isRunning()) { - y += -0.025 + MathHelper.cos((f/0.75f) * (MathHelper.PI*2)) * 0.15; + if(gallopAnimationState.isStarted()) { + y += -0.025 + Mth.cos((f/0.75f) * (Mth.PI*2)) * 0.15; } else { - y += MathHelper.cos(g - MathHelper.PI) * 0.02 - 0.2; + y += Mth.cos(g - Mth.PI) * 0.02 - 0.2; } - return super.getPassengerAttachmentPos(passenger, dimensions, scaleFactor).add(0, y,0); + return super.getPassengerAttachmentPoint(passenger, dimensions, scaleFactor).add(0, y,0); } @Override @Nullable - public PassiveEntity createChild(ServerWorld world, PassiveEntity entity) { - GreatHornEntity greatHornEntity2 = EntitiesME.GREAT_HORN.create(world, SpawnReason.BREEDING); + public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) { + GreatHornEntity greatHornEntity2 = EntitiesME.GREAT_HORN.create(world); if (greatHornEntity2 != null) { - this.setChildAttributes(entity, greatHornEntity2); + this.setOffspringAttributes(entity, greatHornEntity2); if (this.random.nextBoolean()) { greatHornEntity2.setVariant(this.getRegistryVariant()); } else { @@ -259,72 +282,73 @@ public PassiveEntity createChild(ServerWorld world, PassiveEntity entity) { } @Override - protected void setChildAttributes(PassiveEntity other, AbstractHorseEntity child) { - this.setChildAttribute(other, child, EntityAttributes.MAX_HEALTH, MIN_HEALTH_BONUS, MAX_HEALTH_BONUS); - this.setChildAttribute(other, child, EntityAttributes.MOVEMENT_SPEED, MIN_MOVEMENT_SPEED_BONUS, MAX_MOVEMENT_SPEED_BONUS); + protected void setOffspringAttributes(AgeableMob other, AbstractHorse child) { + this.setOffspringAttribute(other, child, Attributes.MAX_HEALTH, MIN_HEALTH_BONUS, MAX_HEALTH_BONUS); + this.setOffspringAttribute(other, child, Attributes.MOVEMENT_SPEED, MIN_MOVEMENT_SPEED_BONUS, MAX_MOVEMENT_SPEED_BONUS); } @Override - public EntityDimensions getBaseDimensions(EntityPose pose) { - return this.isBaby() ? BABY_BASE_DIMENSIONS : super.getBaseDimensions(pose); + public EntityDimensions getDefaultDimensions(Pose pose) { + return this.isBaby() ? BABY_BASE_DIMENSIONS : super.getDefaultDimensions(pose); } @Override - protected boolean isTamable(PlayerEntity player) { + protected boolean isTamable(Player player) { return this.isMountable(); } @Override - public boolean canBreedWith(AnimalEntity other) { + public boolean canMate(Animal other) { return other instanceof GreatHornEntity; } @Override - public boolean isBreedingItem(ItemStack stack) { - return stack.isIn(ItemTagsME.ELK_FOOD); + public boolean isFood(ItemStack stack) { + return stack.is(ItemTagsME.ELK_FOOD); } @Override - protected void jump(float strength, Vec3d movementInput) { + protected void executeRidersJump(float strength, Vec3 movementInput) { if(this.chargeTimeout <= 0 && this.hasControllingPassenger() && this.getControllingPassenger().isSprinting()) { this.setCharging(true); this.chargeTimeout = maxChargeCooldown(); - float entitySpeed = (float) this.getAttributeInstance(EntityAttributes.MOVEMENT_SPEED).getValue(); - if(!this.getWorld().isClient) { - Vec2f vec2f = this.getControlledRotation(this.getControllingPassenger()); - this.setVelocity(new Vec3d(vec2f.x,0,vec2f.y).normalize().add(0,0.4,0).multiply(strength * (1.4f + entitySpeed))); + float entitySpeed = (float) this.getAttribute(Attributes.MOVEMENT_SPEED).getValue(); + if(!this.level().isClientSide) { + Vec2 vec2f = this.getRiddenRotation(this.getControllingPassenger()); + this.setDeltaMovement(new Vec3(vec2f.x,0,vec2f.y).normalize().add(0,0.4,0).scale(strength * (1.4f + entitySpeed))); } - else if (this.getWorld().isClient) { - this.setVelocity(this.getRotationVector().multiply(1,0,1).normalize().add(0,0.4,0).multiply(strength * (1.4f + entitySpeed))); + else if (this.level().isClientSide) { + this.setDeltaMovement(this.getLookAngle().multiply(1,0,1).normalize().add(0,0.4,0).scale(strength * (1.4f + entitySpeed))); } - this.chargeAnimationState.startIfNotRunning(this.age); + this.chargeAnimationState.startIfStopped(this.tickCount); } } @Override - public void startJumping(int height) { + public void handleStartJump(int height) { if(this.hasControllingPassenger()) { - this.jumping = true; + this.allowStandSliding = true; this.playJumpSound(); float jumpPercentage = (float)height/100; if(!this.getControllingPassenger().isSprinting()) { this.setChargeTimeout(HORNS_ATTACK_COOLDOWN); - dataTracker.set(ATTACK, HORNS_ATTACK_COOLDOWN); + entityData.set(ATTACK, HORNS_ATTACK_COOLDOWN); attackAnimationCooldown = HORNS_ATTACK_COOLDOWN; - List entities = this.getWorld().getOtherEntities(this, this.getBoundingBox().expand(2.5,2,2.5)); - - for(Entity entity : entities) { - if(!this.getPassengerList().contains(entity)) { - if(!this.getWorld().isClient()) { - entity.damage((ServerWorld) this.getWorld(), entity.getDamageSources().mobAttack(this), jumpPercentage * getAttackDamage()); - } + if (this.level() instanceof ServerLevel serverLevel) { + List entities = serverLevel.getEntities( + this, + this.getBoundingBox().inflate(2.5, 2, 2.5), + entity -> !this.getPassengers().contains(entity) + ); + for(Entity entity : entities) { + entity.hurt(entity.damageSources().mobAttack(this), jumpPercentage * getAttackDamage()); double dx = entity.getX() - this.getX(); double dz = entity.getZ() - this.getZ(); - Vec3d velocity = new Vec3d(dx, 1.25f + getRandom().nextFloat() * 0.5f, dz).normalize(); - velocity.multiply(jumpPercentage); - entity.addVelocity(velocity); + Vec3 velocity = new Vec3(dx, 1.25f + getRandom().nextFloat() * 0.5f, dz).normalize(); + velocity = velocity.scale(jumpPercentage); + entity.push(velocity); this.setCharging(false); } @@ -334,7 +358,7 @@ public void startJumping(int height) { } } else { - super.startJumping(height); + super.handleStartJump(height); } } @@ -345,7 +369,7 @@ public boolean canUseSlot(EquipmentSlot slot) { @Override public int getJumpCooldown() { - return Math.max(super.getJumpCooldown(), this.dataTracker.get(ATTACK)); + return Math.max(super.getJumpCooldown(), this.entityData.get(ATTACK)); } @Override @@ -363,7 +387,7 @@ public void tick() { super.tick(); if(this.isCharging()) { - if(this.chargeTimeout <= maxChargeCooldown() - 10 && this.isOnGround()) { + if(this.chargeTimeout <= maxChargeCooldown() - 10 && this.onGround()) { this.setCharging(false); this.setHasCharged(false); } @@ -372,62 +396,62 @@ public void tick() { if(bowAnimationTimeout > 0) { bowAnimationTimeout = Math.max(bowAnimationTimeout - 1, 0); if(bowAnimationTimeout == 0) { - dataTracker.set(BOW, -1); + entityData.set(BOW, -1); } } if(attackAnimationCooldown > 0) { attackAnimationCooldown = Math.max(attackAnimationCooldown - 1, 0); - dataTracker.set(ATTACK, attackAnimationCooldown); + entityData.set(ATTACK, attackAnimationCooldown); } - if (this.getWorld().isClient && bowAnimationState.isRunning()) { + if (this.level().isClientSide && bowAnimationState.isStarted()) { if(random.nextInt(2) == 0) { Vector3f randPos = new Vector3f(this.random.nextFloat()*6 - 3f, this.random.nextFloat()*1.25f, this.random.nextFloat()*6 - 3f); - this.getWorld().addParticleClient(ParticleTypes.INSTANT_EFFECT, this.getX() + randPos.x, this.getY() + randPos.y, this.getZ() + randPos.z, + this.level().addParticle(ParticleTypes.INSTANT_EFFECT, this.getX() + randPos.x, this.getY() + randPos.y, this.getZ() + randPos.z, 0.0, 0.75f + this.random.nextFloat(), 0.0); } } } - public void slowMovement(BlockState state, Vec3d multiplier) { + public void makeStuckInBlock(BlockState state, Vec3 multiplier) { float pow = 0.1f; - Vec3d lessPenalty = new Vec3d(Math.pow(multiplier.x, pow), Math.pow(multiplier.y, pow), Math.pow(multiplier.z, pow)); - super.slowMovement(state, lessPenalty); + Vec3 lessPenalty = new Vec3(Math.pow(multiplier.x, pow), Math.pow(multiplier.y, pow), Math.pow(multiplier.z, pow)); + super.makeStuckInBlock(state, lessPenalty); } protected void setupAnimationStates() { - this.idleAnimationState.startIfNotRunning(this.age); + this.idleAnimationState.startIfStopped(this.tickCount); if (this.idleAnimationTimeout <= 0) { this.idleAnimationTimeout = this.random.nextInt(40) + 80; - this.earWigglingAnimationState.start(this.age); + this.earWigglingAnimationState.start(this.tickCount); } else { --this.idleAnimationTimeout; } - int bowState = dataTracker.get(BOW); + int bowState = entityData.get(BOW); if(bowState == 1) { - this.bowAnimationState.startIfNotRunning(this.age); - dataTracker.set(BOW, 0); + this.bowAnimationState.startIfStopped(this.tickCount); + entityData.set(BOW, 0); } else if(bowState == -1) { this.bowAnimationState.stop(); - dataTracker.set(BOW, 0); + entityData.set(BOW, 0); } - int attack = dataTracker.get(ATTACK); + int attack = entityData.get(ATTACK); if(attack == HORNS_ATTACK_COOLDOWN) { - this.attackAnimationState.start(this.age); + this.attackAnimationState.start(this.tickCount); } else if(attack == 0) { this.attackAnimationState.stop(); } if(hasControllingPassenger()) { if((getControllingPassenger().isSprinting())) { - this.gallopAnimationState.startIfNotRunning(this.age); + this.gallopAnimationState.startIfStopped(this.tickCount); } else { this.gallopAnimationState.stop(); } - } else if(this.dataTracker.get(EVADING)) { - this.gallopAnimationState.startIfNotRunning(this.age); + } else if(this.entityData.get(EVADING)) { + this.gallopAnimationState.startIfStopped(this.tickCount); } else { this.gallopAnimationState.stop(); } @@ -435,23 +459,23 @@ protected void setupAnimationStates() { @Override public void startFlee() { - this.dataTracker.set(EVADING, true); + this.entityData.set(EVADING, true); } @Override public void stopFlee() { - this.dataTracker.set(EVADING, false); + this.entityData.set(EVADING, false); } @Override public boolean isCommandItem(ItemStack stack) { - return stack.isOf(Items.STICK); + return stack.is(Items.STICK); } @Override - protected float getSaddledSpeed(PlayerEntity controllingPlayer) { - float speed = ((float)this.getAttributeValue(EntityAttributes.MOVEMENT_SPEED)); - if(this.getWorld().getBiome(this.getBlockPos()).isIn(BiomeTags.IS_FOREST)) { + protected float getRiddenSpeed(Player controllingPlayer) { + float speed = ((float)this.getAttributeValue(Attributes.MOVEMENT_SPEED)); + if(this.level().getBiome(this.blockPosition()).is(BiomeTags.IS_FOREST)) { speed *= 1.1f; } if (controllingPlayer.isSprinting()) { @@ -462,27 +486,27 @@ protected float getSaddledSpeed(PlayerEntity controllingPlayer) { } @Override - public boolean canSprintAsVehicle() { + public boolean canSprint() { return true; } - public boolean canTrust(PlayerEntity playerEntity) { + public boolean canTrust(Player playerEntity) { RaceType playerRace = RaceUtil.getRaceType(playerEntity); return (playerRace != null && playerRace != RaceType.NONE) && (this.getCompatibleRaces() != null && this.getCompatibleRaces().contains(playerRace)); } - public boolean shouldBow(PlayerEntity playerEntity) { + public boolean shouldBow(Player playerEntity) { return isOwner(playerEntity) && bowAnimationTimeout > 0; } - public boolean isOwner(PlayerEntity playerEntity) { - PlayerEntity owner = this.getOwner(); - return (owner != null && owner.getUuid().equals(playerEntity.getUuid())); + public boolean isOwner(Player playerEntity) { + Player owner = this.getOwner(); + return (owner != null && owner.getUUID().equals(playerEntity.getUUID())); } @Override public boolean isBondingItem(ItemStack itemStack) { - return itemStack.isIn(ItemTagsME.ELK_FOOD); + return itemStack.is(ItemTagsME.ELK_FOOD); } @Override @@ -493,35 +517,43 @@ public boolean isFoodItem(ItemStack itemStack) { @Override public void setOwner(@Nullable LivingEntity entity) { super.setOwner(entity); - this.dataTracker.set(BOW, 1); + this.entityData.set(BOW, 1); bowAnimationTimeout = 80; } /* VARIANTS */ - public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, - @Nullable EntityData entityData) { + public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, + @Nullable SpawnGroupData entityData) { if (entityData instanceof GreatHornData greatHornData) { this.setVariant(greatHornData.variant); } else { - Optional> optional = Variants.select(SpawnContext.of(world, this.getBlockPos()), DynamicRegistriesME.GREAT_HORN_VARIANTS); - if (optional.isPresent()) { - this.setVariant(optional.get()); - entityData = new GreatHornData(optional.get()); - } + var biome = world.getBiome(this.blockPosition()); + var variantKey = biome.is(COLD_VARIANT_BIOMES) + ? GreatHornVariantRegistry.COLD + : biome.is(WARM_VARIANT_BIOMES) + ? GreatHornVariantRegistry.WARM + : this.random.nextBoolean() + ? GreatHornVariantRegistry.BROWN + : GreatHornVariantRegistry.TEMPERATE; + Holder variant = world.registryAccess() + .registryOrThrow(DynamicRegistriesME.GREAT_HORN_VARIANTS) + .getHolderOrThrow(variantKey); + this.setVariant(variant); + entityData = new GreatHornData(variant); } - return super.initialize(world, difficulty, spawnReason, entityData); + return super.finalizeSpawn(world, difficulty, spawnReason, entityData); } - private void setVariant(RegistryEntry variant) { - this.dataTracker.set(VARIANT, variant); + private void setVariant(Holder variant) { + this.entityData.set(VARIANT, variant); } public GreatHornVariant getVariant() { return getRegistryVariant().value(); } - private RegistryEntry getRegistryVariant() { - return this.dataTracker.get(VARIANT); + private Holder getRegistryVariant() { + return this.entityData.get(VARIANT); } @Nullable @@ -549,34 +581,34 @@ public void playAmbientSound() { @Override protected void playStepSound(BlockPos pos, BlockState state) { - this.playSound(SoundEvents.ENTITY_GOAT_STEP, 0.15f, 0.7f); + this.playSound(SoundEvents.GOAT_STEP, 0.15f, 0.7f); } @Override - protected void playWalkSound(BlockSoundGroup group) { - this.playSound(SoundEvents.ENTITY_GOAT_STEP, 1.0f, 0.7f); + protected void playGallopSound(SoundType group) { + this.playSound(SoundEvents.GOAT_STEP, 1.0f, 0.7f); } @Override protected void playJumpSound() { - this.playSound(SoundEvents.ENTITY_GOAT_LONG_JUMP, 1.0f, 0.7f); + this.playSound(SoundEvents.GOAT_LONG_JUMP, 1.0f, 0.7f); } - public static class GreatHornData extends PassiveEntity.PassiveData { - public final RegistryEntry variant; + public static class GreatHornData extends AgeableMob.AgeableMobGroupData { + public final Holder variant; - public GreatHornData(RegistryEntry variant) { + public GreatHornData(Holder variant) { super(0.075f); this.variant = variant; } } - public static boolean canSpawn(EntityType type, ServerWorldAccess serverWorldAccess, SpawnReason spawnReason, BlockPos blockPos, Random random) { + public static boolean canSpawn(EntityType type, ServerLevelAccessor serverWorldAccess, MobSpawnType spawnReason, BlockPos blockPos, RandomSource random) { return SpawnUtil.canSpawn(blockPos, serverWorldAccess, spawnReason); } @Override - public boolean canSpawn(WorldAccess world, SpawnReason spawnReason) { + public boolean checkSpawnRules(LevelAccessor world, MobSpawnType spawnReason) { return true; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornEntityRenderState.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornEntityRenderState.java deleted file mode 100644 index 395072f8ca..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornEntityRenderState.java +++ /dev/null @@ -1,43 +0,0 @@ -package net.sevenstars.middleearth.entity.beasts.great_horn; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.entity.state.LivingEntityRenderState; -import net.minecraft.entity.AnimationState; -import net.minecraft.item.ItemStack; - -@Environment(EnvType.CLIENT) -public class GreatHornEntityRenderState extends LivingEntityRenderState { - public GreatHornVariantDep variant; - public ItemStack saddle; - public ItemStack armor; - public boolean blueSaddle; - public boolean hasRider; - - public final AnimationState idleAnimationState = new AnimationState(); - public final AnimationState earWiggleAnimationState = new AnimationState(); - public final AnimationState gallopAnimationState = new AnimationState(); - public final AnimationState bowAnimationState = new AnimationState(); - public final AnimationState attackAnimationState = new AnimationState(); - - public GreatHornVariant greatHornVariant; - - public GreatHornEntityRenderState() { - saddle = ItemStack.EMPTY; - armor = ItemStack.EMPTY; - blueSaddle = false; - hasRider = false; - } - - public boolean hasRedNose() { - if(this.customName != null) { - String name = this.customName.getString(); - return ("rudolph".equalsIgnoreCase(name) || "rudolf".equalsIgnoreCase(name)); - } - return false; - } - - public boolean isElkebies() { - return (this.customName != null && "elkebies".equalsIgnoreCase(this.customName.getString())); - } -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornModel.java index 9c1ed15bfc..7e5d29cf7e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornModel.java @@ -1,16 +1,15 @@ package net.sevenstars.middleearth.entity.beasts.great_horn; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.animation.Animation; -import net.minecraft.client.render.entity.model.BabyModelTransformer; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.render.entity.model.ModelTransformer; -import net.minecraft.item.ItemStack; - -import java.util.Set; - -public class GreatHornModel extends EntityModel { - public static final ModelTransformer BABY_TRANSFORMER = new BabyModelTransformer(true, 10.0F, 4.0F, Set.of("head")); +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; + +public class GreatHornModel extends HierarchicalModel { private final ModelPart root; private final ModelPart body; private final ModelPart frontHalf; @@ -20,15 +19,7 @@ public class GreatHornModel extends EntityModel { private final ModelPart leftAntler; private final ModelPart beard; - private final Animation idleAnimation; - private final Animation earWiggleAnimation; - private final Animation walkingAnimation; - private final Animation gallopAnimation; - private final Animation bowAnimation; - private final Animation attackAnimation; - public GreatHornModel(ModelPart root) { - super(root); this.root = root.getChild("root"); this.body = this.root.getChild("body"); this.frontHalf = this.body.getChild("front_half"); @@ -38,133 +29,134 @@ public GreatHornModel(ModelPart root) { this.leftAntler = this.topHead.getChild("left_antler"); this.beard = this.topHead.getChild("beard"); - this.idleAnimation = GreatHornAnimations.IDLE.createAnimation(root); - this.earWiggleAnimation = GreatHornAnimations.EAR_WIGGLE.createAnimation(root); - this.walkingAnimation = GreatHornAnimations.WALK.createAnimation(root); - this.gallopAnimation = GreatHornAnimations.GALLOP.createAnimation(root); - this.bowAnimation = GreatHornAnimations.BOW.createAnimation(root); - this.attackAnimation = GreatHornAnimations.ATTACK.createAnimation(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData root = modelPartData.addChild("root", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 8.0F, -10.0F)); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition root = modelPartData.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 8.0F, -10.0F)); - ModelPartData body = root.addChild("body", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -8.5F, 12.0F)); + PartDefinition body = root.addOrReplaceChild("body", CubeListBuilder.create(), PartPose.offset(0.0F, -8.5F, 12.0F)); - ModelPartData front_half = body.addChild("front_half", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, -13.0F)); + PartDefinition front_half = body.addOrReplaceChild("front_half", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, -13.0F)); - ModelPartData front_body = front_half.addChild("front_body", ModelPartBuilder.create().uv(0, 15).cuboid(-6.5F, -8.0F, -6.5F, 13.0F, 16.0F, 13.0F, new Dilation(0.0F)) - .uv(0, 15).cuboid(-6.5F, -8.0F, -6.5F, 13.0F, 16.0F, 13.0F, new Dilation(0.2F)) - .uv(37, 133).cuboid(-6.5F, 8.4F, -6.5F, 13.0F, 4.0F, 13.0F, new Dilation(0.2F)), ModelTransform.origin(0.0F, 0.5F, 2.5F)); + PartDefinition front_body = front_half.addOrReplaceChild("front_body", CubeListBuilder.create().texOffs(0, 15).addBox(-6.5F, -8.0F, -6.5F, 13.0F, 16.0F, 13.0F, new CubeDeformation(0.0F)) + .texOffs(0, 15).addBox(-6.5F, -8.0F, -6.5F, 13.0F, 16.0F, 13.0F, new CubeDeformation(0.2F)) + .texOffs(37, 133).addBox(-6.5F, 8.4F, -6.5F, 13.0F, 4.0F, 13.0F, new CubeDeformation(0.2F)), PartPose.offset(0.0F, 0.5F, 2.5F)); - ModelPartData saddle = front_body.addChild("saddle", ModelPartBuilder.create().uv(88, 50).cuboid(-7.0F, -1.0F, 2.0F, 14.0F, 22.0F, 6.0F, new Dilation(0.3F)) - .uv(84, 18).cuboid(-7.0F, -2.0F, -6.6F, 14.0F, 23.0F, 8.0F, new Dilation(0.3F)), ModelTransform.origin(0.0F, -6.5F, 6.5F)); + PartDefinition saddle = front_body.addOrReplaceChild("saddle", CubeListBuilder.create().texOffs(88, 50).addBox(-7.0F, -1.0F, 2.0F, 14.0F, 22.0F, 6.0F, new CubeDeformation(0.3F)) + .texOffs(84, 18).addBox(-7.0F, -2.0F, -6.6F, 14.0F, 23.0F, 8.0F, new CubeDeformation(0.3F)), PartPose.offset(0.0F, -6.5F, 6.5F)); - ModelPartData seat_back_r1 = saddle.addChild("seat_back_r1", ModelPartBuilder.create().uv(49, 78).cuboid(-4.5F, -4.5F, -1.0F, 9.0F, 5.0F, 2.0F, new Dilation(0.3F)), ModelTransform.of(0.0F, 1.0F, 8.4F, -0.2182F, 0.0F, 0.0F)); + PartDefinition seat_back_r1 = saddle.addOrReplaceChild("seat_back_r1", CubeListBuilder.create().texOffs(49, 78).addBox(-4.5F, -4.5F, -1.0F, 9.0F, 5.0F, 2.0F, new CubeDeformation(0.3F)), PartPose.offsetAndRotation(0.0F, 1.0F, 8.4F, -0.2182F, 0.0F, 0.0F)); - ModelPartData frontLeftLeg = front_half.addChild("front_left_leg", ModelPartBuilder.create().uv(0, 108).cuboid(-2.0F, 0.0F, -2.0F, 4.0F, 16.0F, 4.0F, new Dilation(0.0F)) - .uv(0, 108).cuboid(-2.0F, 0.0F, -2.0F, 4.0F, 16.0F, 4.0F, new Dilation(0.2F)), ModelTransform.origin(4.5F, 8.5F, -1.0F)); + PartDefinition frontLeftLeg = front_half.addOrReplaceChild("front_left_leg", CubeListBuilder.create().texOffs(0, 108).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 16.0F, 4.0F, new CubeDeformation(0.0F)) + .texOffs(0, 108).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 16.0F, 4.0F, new CubeDeformation(0.2F)), PartPose.offset(4.5F, 8.5F, -1.0F)); - ModelPartData frontRightLeg = front_half.addChild("front_right_leg", ModelPartBuilder.create().uv(16, 108).cuboid(-2.0F, 0.0F, -2.0F, 4.0F, 16.0F, 4.0F, new Dilation(0.0F)) - .uv(16, 108).cuboid(-2.0F, 0.0F, -2.0F, 4.0F, 16.0F, 4.0F, new Dilation(0.2F)), ModelTransform.origin(-4.5F, 8.5F, -1.0F)); + PartDefinition frontRightLeg = front_half.addOrReplaceChild("front_right_leg", CubeListBuilder.create().texOffs(16, 108).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 16.0F, 4.0F, new CubeDeformation(0.0F)) + .texOffs(16, 108).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 16.0F, 4.0F, new CubeDeformation(0.2F)), PartPose.offset(-4.5F, 8.5F, -1.0F)); - ModelPartData head_neck = front_half.addChild("head_neck", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -6.0F, -3.0F)); + PartDefinition head_neck = front_half.addOrReplaceChild("head_neck", CubeListBuilder.create(), PartPose.offset(0.0F, -6.0F, -3.0F)); - ModelPartData neck = head_neck.addChild("neck", ModelPartBuilder.create().uv(40, 0).cuboid(-3.5F, -6.0F, -2.0F, 7.0F, 18.0F, 7.0F, new Dilation(0.0F)) - .uv(40, 0).cuboid(-3.5F, -6.0F, -2.0F, 7.0F, 18.0F, 7.0F, new Dilation(0.0F)) - .uv(53, 53).cuboid(-3.5F, -6.0F, -2.0F, 7.0F, 18.0F, 7.0F, new Dilation(0.3F)), ModelTransform.origin(0.0F, -1.5F, -2.0F)); + PartDefinition neck = head_neck.addOrReplaceChild("neck", CubeListBuilder.create().texOffs(40, 0).addBox(-3.5F, -6.0F, -2.0F, 7.0F, 18.0F, 7.0F, new CubeDeformation(0.0F)) + .texOffs(40, 0).addBox(-3.5F, -6.0F, -2.0F, 7.0F, 18.0F, 7.0F, new CubeDeformation(0.0F)) + .texOffs(53, 53).addBox(-3.5F, -6.0F, -2.0F, 7.0F, 18.0F, 7.0F, new CubeDeformation(0.3F)), PartPose.offset(0.0F, -1.5F, -2.0F)); - ModelPartData top_head = head_neck.addChild("top_head", ModelPartBuilder.create().uv(96, 0).cuboid(-3.5F, -7.0F, -6.0F, 7.0F, 7.0F, 9.0F, new Dilation(0.0F)) - .uv(96, 0).cuboid(-3.5F, -7.0F, -6.0F, 7.0F, 7.0F, 9.0F, new Dilation(0.2F)) - .uv(51, 35).cuboid(-3.5F, -7.0F, -6.0F, 7.0F, 7.0F, 9.0F, new Dilation(0.3F)) - .uv(69, 0).cuboid(-2.5F, -4.0F, -11.0F, 5.0F, 4.0F, 5.0F, new Dilation(0.0F)) - .uv(69, 0).cuboid(-2.5F, -4.0F, -11.0F, 5.0F, 4.0F, 5.0F, new Dilation(0.2F)) - .uv(52, 26).cuboid(-2.5F, -4.0F, -11.0F, 5.0F, 4.0F, 5.0F, new Dilation(0.3F)) - .uv(86, 99).cuboid(3.9F, -2.0F, -7.0F, 0.0F, 7.0F, 21.0F, new Dilation(0.0F)) - .uv(86, 91).cuboid(-3.9F, -2.0F, -7.0F, 0.0F, 7.0F, 21.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, -7.5F, 0.0F)); + PartDefinition top_head = head_neck.addOrReplaceChild("top_head", CubeListBuilder.create().texOffs(96, 0).addBox(-3.5F, -7.0F, -6.0F, 7.0F, 7.0F, 9.0F, new CubeDeformation(0.0F)) + .texOffs(96, 0).addBox(-3.5F, -7.0F, -6.0F, 7.0F, 7.0F, 9.0F, new CubeDeformation(0.2F)) + .texOffs(51, 35).addBox(-3.5F, -7.0F, -6.0F, 7.0F, 7.0F, 9.0F, new CubeDeformation(0.3F)) + .texOffs(69, 0).addBox(-2.5F, -4.0F, -11.0F, 5.0F, 4.0F, 5.0F, new CubeDeformation(0.0F)) + .texOffs(69, 0).addBox(-2.5F, -4.0F, -11.0F, 5.0F, 4.0F, 5.0F, new CubeDeformation(0.2F)) + .texOffs(52, 26).addBox(-2.5F, -4.0F, -11.0F, 5.0F, 4.0F, 5.0F, new CubeDeformation(0.3F)) + .texOffs(86, 99).addBox(3.9F, -2.0F, -7.0F, 0.0F, 7.0F, 21.0F, new CubeDeformation(0.0F)) + .texOffs(86, 91).addBox(-3.9F, -2.0F, -7.0F, 0.0F, 7.0F, 21.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -7.5F, 0.0F)); - ModelPartData earLeft = top_head.addChild("ear_left", ModelPartBuilder.create().uv(0, 0).cuboid(0.0F, -4.0F, -1.0F, 1.0F, 5.0F, 3.0F, new Dilation(0.0F)) - .uv(0, 0).cuboid(0.0F, -4.0F, -1.0F, 1.0F, 5.0F, 3.0F, new Dilation(0.2F)), ModelTransform.of(2.5F, -6.0F, 1.0F, -0.7854F, 0.4363F, 0.0F)); + PartDefinition earLeft = top_head.addOrReplaceChild("ear_left", CubeListBuilder.create().texOffs(0, 0).addBox(0.0F, -4.0F, -1.0F, 1.0F, 5.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(0, 0).addBox(0.0F, -4.0F, -1.0F, 1.0F, 5.0F, 3.0F, new CubeDeformation(0.2F)), PartPose.offsetAndRotation(2.5F, -6.0F, 1.0F, -0.7854F, 0.4363F, 0.0F)); - ModelPartData earRight = top_head.addChild("ear_right", ModelPartBuilder.create().uv(9, 0).cuboid(-0.5F, -4.0F, -1.0F, 1.0F, 5.0F, 3.0F, new Dilation(0.0F)) - .uv(9, 0).cuboid(-0.5F, -4.0F, -1.0F, 1.0F, 5.0F, 3.0F, new Dilation(0.2F)), ModelTransform.of(-3.0F, -6.0F, 1.0F, -0.7854F, -0.4363F, 0.0F)); + PartDefinition earRight = top_head.addOrReplaceChild("ear_right", CubeListBuilder.create().texOffs(9, 0).addBox(-0.5F, -4.0F, -1.0F, 1.0F, 5.0F, 3.0F, new CubeDeformation(0.0F)) + .texOffs(9, 0).addBox(-0.5F, -4.0F, -1.0F, 1.0F, 5.0F, 3.0F, new CubeDeformation(0.2F)), PartPose.offsetAndRotation(-3.0F, -6.0F, 1.0F, -0.7854F, -0.4363F, 0.0F)); - ModelPartData right_antler = top_head.addChild("right_antler", ModelPartBuilder.create().uv(34, 120).mirrored().cuboid(-8.0F, 0.0F, -2.0F, 8.0F, 2.0F, 2.0F, new Dilation(0.0F)).mirrored(false) - .uv(34, 120).mirrored().cuboid(-8.0F, 0.0F, -2.0F, 8.0F, 2.0F, 2.0F, new Dilation(0.2F)).mirrored(false), ModelTransform.of(-3.0F, -7.0F, 0.0F, 0.1812F, -0.3808F, 0.4252F)); + PartDefinition right_antler = top_head.addOrReplaceChild("right_antler", CubeListBuilder.create().texOffs(34, 120).mirror().addBox(-8.0F, 0.0F, -2.0F, 8.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(34, 120).mirror().addBox(-8.0F, 0.0F, -2.0F, 8.0F, 2.0F, 2.0F, new CubeDeformation(0.2F)).mirror(false), PartPose.offsetAndRotation(-3.0F, -7.0F, 0.0F, 0.1812F, -0.3808F, 0.4252F)); - ModelPartData tip_r_armor_r1 = right_antler.addChild("tip_r_armor_r1", ModelPartBuilder.create().uv(34, 124).mirrored().cuboid(-8.0F, -1.0F, -1.0F, 8.0F, 2.0F, 2.0F, new Dilation(0.2F)).mirrored(false), ModelTransform.of(-7.0F, 1.0F, 0.425F, 0.0F, 1.5708F, 0.0F)); + PartDefinition tip_r_armor_r1 = right_antler.addOrReplaceChild("tip_r_armor_r1", CubeListBuilder.create().texOffs(34, 124).mirror().addBox(-8.0F, -1.0F, -1.0F, 8.0F, 2.0F, 2.0F, new CubeDeformation(0.2F)).mirror(false), PartPose.offsetAndRotation(-7.0F, 1.0F, 0.425F, 0.0F, 1.5708F, 0.0F)); - ModelPartData tip_r_r1 = right_antler.addChild("tip_r_r1", ModelPartBuilder.create().uv(34, 124).mirrored().cuboid(-8.0F, -1.0F, -1.0F, 8.0F, 2.0F, 2.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.of(-7.0F, 1.0F, 0.0F, 0.0F, 1.5708F, 0.0F)); + PartDefinition tip_r_r1 = right_antler.addOrReplaceChild("tip_r_r1", CubeListBuilder.create().texOffs(34, 124).mirror().addBox(-8.0F, -1.0F, -1.0F, 8.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-7.0F, 1.0F, 0.0F, 0.0F, 1.5708F, 0.0F)); - ModelPartData tip_r_horn_r1 = right_antler.addChild("tip_r_horn_r1", ModelPartBuilder.create().uv(27, 87).mirrored().cuboid(-16.0F, 0.0F, -12.0F, 16.0F, 0.0F, 23.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.of(-8.0F, 0.0F, 7.0F, 0.0F, 0.0F, 0.6109F)); + PartDefinition tip_r_horn_r1 = right_antler.addOrReplaceChild("tip_r_horn_r1", CubeListBuilder.create().texOffs(27, 87).mirror().addBox(-16.0F, 0.0F, -12.0F, 16.0F, 0.0F, 23.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-8.0F, 0.0F, 7.0F, 0.0F, 0.0F, 0.6109F)); - ModelPartData base_r_horn_r1 = right_antler.addChild("base_r_horn_r1", ModelPartBuilder.create().uv(27, 112).cuboid(-5.0F, 0.0F, -7.0F, 11.0F, 0.0F, 7.0F, new Dilation(0.0F)), ModelTransform.of(-7.0F, 0.0F, -2.0F, -1.1781F, 0.0F, 0.0F)); + PartDefinition base_r_horn_r1 = right_antler.addOrReplaceChild("base_r_horn_r1", CubeListBuilder.create().texOffs(27, 112).addBox(-5.0F, 0.0F, -7.0F, 11.0F, 0.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-7.0F, 0.0F, -2.0F, -1.1781F, 0.0F, 0.0F)); - ModelPartData left_antler = top_head.addChild("left_antler", ModelPartBuilder.create().uv(54, 120).cuboid(0.0F, 0.0F, -2.0F, 8.0F, 2.0F, 2.0F, new Dilation(0.0F)) - .uv(54, 120).cuboid(0.0F, 0.0F, -2.0F, 8.0F, 2.0F, 2.0F, new Dilation(0.2F)), ModelTransform.of(3.0F, -7.0F, 0.0F, 0.1812F, 0.3808F, -0.4252F)); + PartDefinition left_antler = top_head.addOrReplaceChild("left_antler", CubeListBuilder.create().texOffs(54, 120).addBox(0.0F, 0.0F, -2.0F, 8.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(54, 120).addBox(0.0F, 0.0F, -2.0F, 8.0F, 2.0F, 2.0F, new CubeDeformation(0.2F)), PartPose.offsetAndRotation(3.0F, -7.0F, 0.0F, 0.1812F, 0.3808F, -0.4252F)); - ModelPartData base_l_horn_r1 = left_antler.addChild("base_l_horn_r1", ModelPartBuilder.create().uv(50, 112).cuboid(-6.0F, 0.0F, -7.0F, 11.0F, 0.0F, 7.0F, new Dilation(0.0F)), ModelTransform.of(7.0F, 0.0F, -2.0F, -1.1781F, 0.0F, 0.0F)); + PartDefinition base_l_horn_r1 = left_antler.addOrReplaceChild("base_l_horn_r1", CubeListBuilder.create().texOffs(50, 112).addBox(-6.0F, 0.0F, -7.0F, 11.0F, 0.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(7.0F, 0.0F, -2.0F, -1.1781F, 0.0F, 0.0F)); - ModelPartData tip_l_horn_r1 = left_antler.addChild("tip_l_horn_r1", ModelPartBuilder.create().uv(62, 87).cuboid(0.0F, 0.0F, -12.0F, 16.0F, 0.0F, 23.0F, new Dilation(0.0F)), ModelTransform.of(8.0F, 0.0F, 7.0F, 0.0F, 0.0F, -0.6109F)); + PartDefinition tip_l_horn_r1 = left_antler.addOrReplaceChild("tip_l_horn_r1", CubeListBuilder.create().texOffs(62, 87).addBox(0.0F, 0.0F, -12.0F, 16.0F, 0.0F, 23.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(8.0F, 0.0F, 7.0F, 0.0F, 0.0F, -0.6109F)); - ModelPartData tip_l_armor_r1 = left_antler.addChild("tip_l_armor_r1", ModelPartBuilder.create().uv(54, 124).cuboid(0.0F, -1.0F, -1.0F, 8.0F, 2.0F, 2.0F, new Dilation(0.2F)), ModelTransform.of(7.0F, 1.0F, 0.375F, 0.0F, -1.5708F, 0.0F)); + PartDefinition tip_l_armor_r1 = left_antler.addOrReplaceChild("tip_l_armor_r1", CubeListBuilder.create().texOffs(54, 124).addBox(0.0F, -1.0F, -1.0F, 8.0F, 2.0F, 2.0F, new CubeDeformation(0.2F)), PartPose.offsetAndRotation(7.0F, 1.0F, 0.375F, 0.0F, -1.5708F, 0.0F)); - ModelPartData tip_l_r1 = left_antler.addChild("tip_l_r1", ModelPartBuilder.create().uv(54, 124).cuboid(0.0F, -1.0F, -1.0F, 8.0F, 2.0F, 2.0F, new Dilation(0.0F)), ModelTransform.of(7.0F, 1.0F, 0.0F, 0.0F, -1.5708F, 0.0F)); + PartDefinition tip_l_r1 = left_antler.addOrReplaceChild("tip_l_r1", CubeListBuilder.create().texOffs(54, 124).addBox(0.0F, -1.0F, -1.0F, 8.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(7.0F, 1.0F, 0.0F, 0.0F, -1.5708F, 0.0F)); - ModelPartData beard = top_head.addChild("beard", ModelPartBuilder.create().uv(69, 3).cuboid(0.0F, -1.0F, -6.0F, 0.0F, 18.0F, 7.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, 0.5F, -5.0F)); + PartDefinition beard = top_head.addOrReplaceChild("beard", CubeListBuilder.create().texOffs(69, 3).addBox(0.0F, -1.0F, -6.0F, 0.0F, 18.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.5F, -5.0F)); - ModelPartData back_body = front_half.addChild("back_body", ModelPartBuilder.create().uv(0, 44).cuboid(-5.5F, -4.55F, -3.6F, 11.0F, 13.0F, 14.0F, new Dilation(0.2F)) - .uv(0, 44).cuboid(-5.5F, -4.5F, -4.0F, 11.0F, 13.0F, 14.0F, new Dilation(0.0F)) - .uv(0, 128).cuboid(-5.5F, 8.825F, -3.6F, 11.0F, 4.0F, 14.0F, new Dilation(0.2F)), ModelTransform.origin(0.0F, 0.0F, 13.0F)); + PartDefinition back_body = front_half.addOrReplaceChild("back_body", CubeListBuilder.create().texOffs(0, 44).addBox(-5.5F, -4.55F, -3.6F, 11.0F, 13.0F, 14.0F, new CubeDeformation(0.2F)) + .texOffs(0, 44).addBox(-5.5F, -4.5F, -4.0F, 11.0F, 13.0F, 14.0F, new CubeDeformation(0.0F)) + .texOffs(0, 128).addBox(-5.5F, 8.825F, -3.6F, 11.0F, 4.0F, 14.0F, new CubeDeformation(0.2F)), PartPose.offset(0.0F, 0.0F, 13.0F)); - ModelPartData tail = back_body.addChild("tail", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -4.5F, 10.0F)); + PartDefinition tail = back_body.addOrReplaceChild("tail", CubeListBuilder.create(), PartPose.offset(0.0F, -4.5F, 10.0F)); - ModelPartData tail_armor_r1 = tail.addChild("tail_armor_r1", ModelPartBuilder.create().uv(39, 47).cuboid(-1.5F, -2.0F, 0.0F, 3.0F, 2.0F, 4.0F, new Dilation(0.2F)) - .uv(39, 47).cuboid(-1.5F, -2.0F, 0.0F, 3.0F, 2.0F, 4.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 2.0F, 0.0F, 0.5236F, 0.0F, 0.0F)); + PartDefinition tail_armor_r1 = tail.addOrReplaceChild("tail_armor_r1", CubeListBuilder.create().texOffs(39, 47).addBox(-1.5F, -2.0F, 0.0F, 3.0F, 2.0F, 4.0F, new CubeDeformation(0.2F)) + .texOffs(39, 47).addBox(-1.5F, -2.0F, 0.0F, 3.0F, 2.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 2.0F, 0.0F, 0.5236F, 0.0F, 0.0F)); - ModelPartData backLeftLeg = root.addChild("back_left_leg", ModelPartBuilder.create().uv(0, 72).cuboid(-2.25F, -4.25F, -3.75F, 5.0F, 10.0F, 7.0F, new Dilation(0.0F)) - .uv(0, 72).cuboid(-2.25F, -4.25F, -3.75F, 5.0F, 10.0F, 7.0F, new Dilation(0.2F)) - .uv(4, 89).cuboid(-2.25F, 5.75F, 0.25F, 4.0F, 15.0F, 4.0F, new Dilation(0.0F)) - .uv(4, 89).cuboid(-2.25F, 5.75F, 0.25F, 4.0F, 15.0F, 4.0F, new Dilation(0.2F)), ModelTransform.origin(4.75F, -4.75F, 19.75F)); + PartDefinition backLeftLeg = root.addOrReplaceChild("back_left_leg", CubeListBuilder.create().texOffs(0, 72).addBox(-2.25F, -4.25F, -3.75F, 5.0F, 10.0F, 7.0F, new CubeDeformation(0.0F)) + .texOffs(0, 72).addBox(-2.25F, -4.25F, -3.75F, 5.0F, 10.0F, 7.0F, new CubeDeformation(0.2F)) + .texOffs(4, 89).addBox(-2.25F, 5.75F, 0.25F, 4.0F, 15.0F, 4.0F, new CubeDeformation(0.0F)) + .texOffs(4, 89).addBox(-2.25F, 5.75F, 0.25F, 4.0F, 15.0F, 4.0F, new CubeDeformation(0.2F)), PartPose.offset(4.75F, -4.75F, 19.75F)); - ModelPartData backRightLeg = root.addChild("back_right_leg", ModelPartBuilder.create().uv(24, 72).cuboid(-2.75F, -4.25F, -3.75F, 5.0F, 10.0F, 7.0F, new Dilation(0.0F)) - .uv(24, 72).cuboid(-2.75F, -4.25F, -3.75F, 5.0F, 10.0F, 7.0F, new Dilation(0.2F)) - .uv(28, 89).cuboid(-1.75F, 5.75F, 0.25F, 4.0F, 15.0F, 4.0F, new Dilation(0.0F)) - .uv(28, 89).cuboid(-1.75F, 5.75F, 0.25F, 4.0F, 15.0F, 4.0F, new Dilation(0.2F)), ModelTransform.origin(-4.75F, -4.75F, 19.75F)); - return TexturedModelData.of(modelData, 128, 160); + PartDefinition backRightLeg = root.addOrReplaceChild("back_right_leg", CubeListBuilder.create().texOffs(24, 72).addBox(-2.75F, -4.25F, -3.75F, 5.0F, 10.0F, 7.0F, new CubeDeformation(0.0F)) + .texOffs(24, 72).addBox(-2.75F, -4.25F, -3.75F, 5.0F, 10.0F, 7.0F, new CubeDeformation(0.2F)) + .texOffs(28, 89).addBox(-1.75F, 5.75F, 0.25F, 4.0F, 15.0F, 4.0F, new CubeDeformation(0.0F)) + .texOffs(28, 89).addBox(-1.75F, 5.75F, 0.25F, 4.0F, 15.0F, 4.0F, new CubeDeformation(0.2F)), PartPose.offset(-4.75F, -4.75F, 19.75F)); + return LayerDefinition.create(modelData, 128, 160); } @Override - public void setAngles(GreatHornEntityRenderState state) { - super.setAngles(state); + public void setupAnim(GreatHornEntity entity, float limbSwing, float limbSwingAmount, + float ageInTicks, float netHeadYaw, float headPitch) { + this.root().getAllParts().forEach(ModelPart::resetPose); - this.idleAnimation.apply(state.idleAnimationState, state.age); - this.earWiggleAnimation.apply(state.earWiggleAnimationState, state.age); + this.animate(entity.idleAnimationState, GreatHornAnimations.IDLE, ageInTicks); + this.animate(entity.earWigglingAnimationState, GreatHornAnimations.EAR_WIGGLE, ageInTicks); - if(state.attackAnimationState.isRunning()) { - this.attackAnimation.apply(state.attackAnimationState, state.age); + if(entity.attackAnimationState.isStarted()) { + this.animate(entity.attackAnimationState, GreatHornAnimations.ATTACK, ageInTicks); } - if(state.bowAnimationState.isRunning()) { - this.bowAnimation.apply(state.bowAnimationState, state.age); + if(entity.bowAnimationState.isStarted()) { + this.animate(entity.bowAnimationState, GreatHornAnimations.BOW, ageInTicks); } else { - if(state.gallopAnimationState.isRunning()) { - this.gallopAnimation.applyWalking(state.limbSwingAnimationProgress, state.limbSwingAmplitude, 1.0F, 2.5F); + if(entity.gallopAnimationState.isStarted()) { + this.animateWalk(GreatHornAnimations.GALLOP, limbSwing, limbSwingAmount, 1.0F, 2.5F); } else { - this.walkingAnimation.applyWalking(state.limbSwingAnimationProgress, state.limbSwingAmplitude, 2.75F, 2.5F); + this.animateWalk(GreatHornAnimations.WALK, limbSwing, limbSwingAmount, 2.75F, 2.5F); } } leftAntler.visible = true; rightAntler.visible = true; - if(state.baby) { + beard.skipDraw = false; + if(entity.isBaby()) { leftAntler.visible = false; rightAntler.visible = false; - beard.hidden = true; - } else if(state.isElkebies()) { + beard.skipDraw = true; + } else if(entity.hasCustomName() && "elkebies".equalsIgnoreCase(entity.getName().getString())) { leftAntler.visible = false; rightAntler.visible = false; } } -} \ No newline at end of file + + @Override + public ModelPart root() { + return this.root; + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornRenderer.java index 34be170253..22e8614a4f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornRenderer.java @@ -1,11 +1,12 @@ package net.sevenstars.middleearth.entity.beasts.great_horn; import com.google.common.collect.Maps; -import net.minecraft.client.render.entity.AgeableMobEntityRenderer; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.util.Identifier; -import net.minecraft.util.Util; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.Util; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.MobRenderer; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntityModelLayersME; import net.sevenstars.middleearth.entity.beasts.great_horn.features.GreatHornArmorFeatureRenderer; @@ -14,62 +15,46 @@ import java.util.Map; -public class GreatHornRenderer extends AgeableMobEntityRenderer { +public class GreatHornRenderer extends MobRenderer { private static final String PATH = "textures/entities/great_horn/"; private static final float SIZE = 1f; - public GreatHornRenderer(EntityRendererFactory.Context context) { - super(context, new GreatHornModel(context.getPart(EntityModelLayersME.GREAT_HORN)), - new GreatHornModel(context.getPart(EntityModelLayersME.GREAT_HORN_BABY)), 0.95f); - this.addFeature(new GreatHornSaddleFeatureRenderer(this, context.getEntityModels(), context.getEquipmentRenderer())); - this.addFeature(new GreatHornArmorFeatureRenderer(this, context.getEntityModels(), context.getEquipmentRenderer())); - this.addFeature(new GreatHornNoseFeatureRenderer(this, context.getEntityModels())); - } - - protected float getShadowRadius(GreatHornEntityRenderState greatHornEntityRenderState) { - float f = super.getShadowRadius(greatHornEntityRenderState); - return greatHornEntityRenderState.baby ? f * 0.8F : f; + public GreatHornRenderer(EntityRendererProvider.Context context) { + super(context, new GreatHornModel(context.bakeLayer(EntityModelLayersME.GREAT_HORN)), 0.95f); + this.addLayer(new GreatHornSaddleFeatureRenderer(this, context.getModelSet())); + this.addLayer(new GreatHornArmorFeatureRenderer(this, context.getModelSet())); + this.addLayer(new GreatHornNoseFeatureRenderer(this, context.getModelSet())); } @Override - public GreatHornEntityRenderState createRenderState() { - return new GreatHornEntityRenderState(); + public void render(GreatHornEntity entity, float entityYaw, float partialTick, PoseStack poseStack, + MultiBufferSource bufferSource, int packedLight) { + poseStack.pushPose(); + if (entity.isBaby()) { + poseStack.scale(0.5F, 0.5F, 0.5F); + } + super.render(entity, entityYaw, partialTick, poseStack, bufferSource, packedLight); + poseStack.popPose(); } - public static final Map LOCATION_BY_VARIANT = + public static final Map LOCATION_BY_VARIANT = Util.make(Maps.newEnumMap(GreatHornVariantDep.class), (map) -> { map.put(GreatHornVariantDep.BROWN, - Identifier.of(MiddleEarth.MOD_ID, PATH + "brown_great_horn.png")); + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "brown_great_horn.png")); map.put(GreatHornVariantDep.TEMPERATE, - Identifier.of(MiddleEarth.MOD_ID, PATH + "temperate_great_horn.png")); + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "temperate_great_horn.png")); map.put(GreatHornVariantDep.COLD, - Identifier.of(MiddleEarth.MOD_ID, PATH + "cold_great_horn.png")); + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "cold_great_horn.png")); map.put(GreatHornVariantDep.WARM, - Identifier.of(MiddleEarth.MOD_ID, PATH + "warm_great_horn.png")); + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "warm_great_horn.png")); map.put(GreatHornVariantDep.WHITE, - Identifier.of(MiddleEarth.MOD_ID, PATH + "white_great_horn.png")); + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "white_great_horn.png")); }); @Override - public Identifier getTexture(GreatHornEntityRenderState state) { - return state.greatHornVariant.assetInfo().id().texturePath(); - } - - @Override - public void updateRenderState(GreatHornEntity greatHornEntity, GreatHornEntityRenderState state, float f) { - super.updateRenderState(greatHornEntity, state, f); - - state.idleAnimationState.copyFrom(greatHornEntity.idleAnimationState); - state.earWiggleAnimationState.copyFrom(greatHornEntity.earWigglingAnimationState); - state.gallopAnimationState.copyFrom(greatHornEntity.gallopAnimationState); - state.bowAnimationState.copyFrom(greatHornEntity.bowAnimationState); - state.attackAnimationState.copyFrom(greatHornEntity.attackAnimationState); - state.saddle = greatHornEntity.getEquippedStack(EquipmentSlot.SADDLE); - state.armor = greatHornEntity.getEquippedStack(EquipmentSlot.BODY); - state.blueSaddle = greatHornEntity.hasBlueSaddle(); - state.hasRider = greatHornEntity.hasPlayerRider(); - state.greatHornVariant = greatHornEntity.getVariant(); + public ResourceLocation getTextureLocation(GreatHornEntity entity) { + return GreatHornVariant.texture(entity.getVariant().assetInfo().id()); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornVariant.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornVariant.java index 73c3b03569..f592b4ed77 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornVariant.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/GreatHornVariant.java @@ -2,45 +2,34 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.entity.VariantSelectorProvider; -import net.minecraft.entity.spawn.SpawnCondition; -import net.minecraft.entity.spawn.SpawnConditionSelectors; -import net.minecraft.entity.spawn.SpawnContext; -import net.minecraft.network.RegistryByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.entry.RegistryFixedCodec; -import net.minecraft.util.AssetInfo; +import net.minecraft.core.Holder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.RegistryFixedCodec; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.registries.DynamicRegistriesME; -import java.util.List; - -public record GreatHornVariant(GreatHornAssetInfo assetInfo, SpawnConditionSelectors spawnConditions) implements VariantSelectorProvider { +public record GreatHornVariant(GreatHornAssetInfo assetInfo) { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( - GreatHornAssetInfo.CODEC.fieldOf("assets").forGetter(GreatHornVariant::assetInfo), - SpawnConditionSelectors.CODEC.fieldOf("spawn_conditions").forGetter(GreatHornVariant::spawnConditions) + GreatHornAssetInfo.CODEC.fieldOf("assets").forGetter(GreatHornVariant::assetInfo) ) .apply(instance, GreatHornVariant::new) ); - public static final Codec> ENTRY_CODEC = RegistryFixedCodec.of(DynamicRegistriesME.GREAT_HORN_VARIANTS); - - public static final PacketCodec> PACKET_CODEC = PacketCodecs.registryEntry(DynamicRegistriesME.GREAT_HORN_VARIANTS); + public static final Codec> ENTRY_CODEC = RegistryFixedCodec.create(DynamicRegistriesME.GREAT_HORN_VARIANTS); - private GreatHornVariant(GreatHornAssetInfo assetInfo) { - this(assetInfo, SpawnConditionSelectors.EMPTY); - } + public static final StreamCodec> PACKET_CODEC = ByteBufCodecs.holderRegistry(DynamicRegistriesME.GREAT_HORN_VARIANTS); - @Override - public List> getSelectors() { - return this.spawnConditions.selectors(); + public static ResourceLocation texture(ResourceLocation assetId) { + return ResourceLocation.fromNamespaceAndPath( + assetId.getNamespace(), "textures/" + assetId.getPath() + ".png"); } - public record GreatHornAssetInfo(AssetInfo id) { + public record GreatHornAssetInfo(ResourceLocation id) { public static final Codec CODEC = RecordCodecBuilder.create( - instance -> instance.group(AssetInfo.CODEC.fieldOf("id").forGetter(GreatHornAssetInfo::id)).apply(instance, GreatHornAssetInfo::new) + instance -> instance.group(ResourceLocation.CODEC.fieldOf("id").forGetter(GreatHornAssetInfo::id)).apply(instance, GreatHornAssetInfo::new) ); } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornArmorFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornArmorFeatureRenderer.java index 5cf72025a8..0b80a36ef8 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornArmorFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornArmorFeatureRenderer.java @@ -1,62 +1,55 @@ package net.sevenstars.middleearth.entity.beasts.great_horn.features; -import net.fabricmc.fabric.api.client.rendering.v1.ArmorRenderer; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.equipment.EquipmentRenderer; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.DyedColorComponent; -import net.minecraft.component.type.EquippableComponent; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.util.Identifier; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.DyedItemColor; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import net.sevenstars.middleearth.entity.beasts.great_horn.GreatHornEntityRenderState; +import net.sevenstars.middleearth.entity.beasts.great_horn.GreatHornEntity; import net.sevenstars.middleearth.entity.beasts.great_horn.GreatHornModel; -import net.sevenstars.middleearth.item.utils.armor.DyeablePiecesME; +import net.sevenstars.middleearth.item.items.armor.MountArmorItem; -public class GreatHornArmorFeatureRenderer extends FeatureRenderer { +public class GreatHornArmorFeatureRenderer extends RenderLayer { + private static final String TEXTURE_PATH = "textures/entities/great_horn/feature/"; private final GreatHornArmorModel model; - private final EquipmentRenderer equipmentRenderer; - public GreatHornArmorFeatureRenderer(FeatureRendererContext context, LoadedEntityModels loader, EquipmentRenderer equipmentRenderer) { - super(context); - this.model = new GreatHornArmorModel(loader.getModelPart(EntityModelLayersME.GREAT_HORN_ARMOR)); - this.equipmentRenderer = equipmentRenderer; + public GreatHornArmorFeatureRenderer( + RenderLayerParent parent, EntityModelSet modelSet) { + super(parent); + this.model = new GreatHornArmorModel(modelSet.bakeLayer(EntityModelLayersME.GREAT_HORN_ARMOR)); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, GreatHornEntityRenderState state, float limbAngle, float limbDistance) { - ItemStack itemStack = state.armor; - EquippableComponent equippableComponent = (EquippableComponent)itemStack.get(DataComponentTypes.EQUIPPABLE); - if (equippableComponent != null && !equippableComponent.assetId().isEmpty()) { - model.setAngles(state); - String path = "textures/entities/great_horn/feature/" + equippableComponent.assetId().get().getValue().getPath() + ".png"; - boolean dyeable = false; - if (itemStack.isIn(ItemTags.DYEABLE)) { - dyeable = true; - } - VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumers, - RenderLayer.getArmorCutoutNoCull(Identifier.of(MiddleEarth.MOD_ID, path)), itemStack.hasGlint()); + public void render(PoseStack matrices, MultiBufferSource buffers, int light, GreatHornEntity entity, + float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, + float netHeadYaw, float headPitch) { + ItemStack stack = entity.getBodyArmorItem(); + if (!(stack.getItem() instanceof MountArmorItem)) { + return; + } + + String name = BuiltInRegistries.ITEM.getKey(stack.getItem()).getPath(); + ResourceLocation texture = MiddleEarth.of(TEXTURE_PATH + name + ".png"); + int color = stack.has(DataComponents.DYED_COLOR) + ? DyedItemColor.getOrDefault(stack, DyedItemColor.LEATHER_COLOR) + : -1; + this.model.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); + this.model.renderToBuffer(matrices, buffers.getBuffer(RenderType.entityCutoutNoCull(texture)), + light, OverlayTexture.NO_OVERLAY, color); - if(dyeable){ - int color = DyedColorComponent.getColor(itemStack, DyedColorComponent.DEFAULT_COLOR); - model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, color); - if(DyeablePiecesME.dyeablePieces.get(itemStack.getItem())) { - ArmorRenderer.renderPart(matrices, vertexConsumers, light, itemStack, model, - Identifier.of(MiddleEarth.MOD_ID, path.replaceAll(".png", "_overlay.png"))); - } - } else { - model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV); - } + if (stack.has(DataComponents.DYED_COLOR)) { + ResourceLocation overlay = MiddleEarth.of(TEXTURE_PATH + name + "_overlay.png"); + this.model.renderToBuffer(matrices, buffers.getBuffer(RenderType.entityCutoutNoCull(overlay)), + light, OverlayTexture.NO_OVERLAY); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornArmorModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornArmorModel.java index 4418eb5016..1c7fab8d50 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornArmorModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornArmorModel.java @@ -1,8 +1,14 @@ package net.sevenstars.middleearth.entity.beasts.great_horn.features; import net.minecraft.client.model.*; -import net.minecraft.item.ItemStack; -import net.sevenstars.middleearth.entity.beasts.great_horn.GreatHornEntityRenderState; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.sevenstars.middleearth.entity.beasts.great_horn.GreatHornEntity; import net.sevenstars.middleearth.entity.beasts.great_horn.GreatHornModel; public class GreatHornArmorModel extends GreatHornModel { @@ -29,110 +35,111 @@ public GreatHornArmorModel(ModelPart root) { this.reins = this.topHead.getChild("reins"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData root = modelPartData.addChild("root", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 8.0F, -10.0F)); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition root = modelPartData.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 8.0F, -10.0F)); - ModelPartData body = root.addChild("body", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -8.5F, 12.0F)); + PartDefinition body = root.addOrReplaceChild("body", CubeListBuilder.create(), PartPose.offset(0.0F, -8.5F, 12.0F)); - ModelPartData front_half = body.addChild("front_half", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, -13.0F)); + PartDefinition front_half = body.addOrReplaceChild("front_half", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, -13.0F)); - ModelPartData front_body = front_half.addChild("front_body", ModelPartBuilder.create().uv(0, 15) - .cuboid(-6.5F, -8.0F, -6.5F, 13.0F, 16.0F, 13.0F, new Dilation(0.2F)) - .uv(37, 133).cuboid(-6.5F, 8.4F, -6.5F, 13.0F, 4.0F, 13.0F, - new Dilation(0.2F)), ModelTransform.origin(0.0F, 0.5F, 2.5F)); + PartDefinition front_body = front_half.addOrReplaceChild("front_body", CubeListBuilder.create().texOffs(0, 15) + .addBox(-6.5F, -8.0F, -6.5F, 13.0F, 16.0F, 13.0F, new CubeDeformation(0.2F)) + .texOffs(37, 133).addBox(-6.5F, 8.4F, -6.5F, 13.0F, 4.0F, 13.0F, + new CubeDeformation(0.2F)), PartPose.offset(0.0F, 0.5F, 2.5F)); - ModelPartData front_left_leg = front_half.addChild("front_left_leg", ModelPartBuilder.create().uv(0, 108) - .cuboid(-2.0F, 0.0F, -2.0F, 4.0F, 16.0F, 4.0F, new Dilation(0.2F)), ModelTransform.origin(4.5F, 8.5F, -1.0F)); + PartDefinition front_left_leg = front_half.addOrReplaceChild("front_left_leg", CubeListBuilder.create().texOffs(0, 108) + .addBox(-2.0F, 0.0F, -2.0F, 4.0F, 16.0F, 4.0F, new CubeDeformation(0.2F)), PartPose.offset(4.5F, 8.5F, -1.0F)); - ModelPartData front_right_leg = front_half.addChild("front_right_leg", ModelPartBuilder.create().uv(16, 108) - .cuboid(-2.0F, 0.0F, -2.0F, 4.0F, 16.0F, 4.0F, new Dilation(0.2F)), ModelTransform.origin(-4.5F, 8.5F, -1.0F)); + PartDefinition front_right_leg = front_half.addOrReplaceChild("front_right_leg", CubeListBuilder.create().texOffs(16, 108) + .addBox(-2.0F, 0.0F, -2.0F, 4.0F, 16.0F, 4.0F, new CubeDeformation(0.2F)), PartPose.offset(-4.5F, 8.5F, -1.0F)); - ModelPartData head_neck = front_half.addChild("head_neck", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -6.0F, -3.0F)); + PartDefinition head_neck = front_half.addOrReplaceChild("head_neck", CubeListBuilder.create(), PartPose.offset(0.0F, -6.0F, -3.0F)); - ModelPartData neck = head_neck.addChild("neck", ModelPartBuilder.create().uv(40, 0) - .cuboid(-3.5F, -6.0F, -2.0F, 7.0F, 18.0F, 7.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, -1.5F, -2.0F)); + PartDefinition neck = head_neck.addOrReplaceChild("neck", CubeListBuilder.create().texOffs(40, 0) + .addBox(-3.5F, -6.0F, -2.0F, 7.0F, 18.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -1.5F, -2.0F)); - ModelPartData top_head = head_neck.addChild("top_head", ModelPartBuilder.create().uv(96, 0) - .cuboid(-3.5F, -7.0F, -6.0F, 7.0F, 7.0F, 9.0F, new Dilation(0.2F)) - .uv(69, 0).cuboid(-2.5F, -4.0F, -11.0F, 5.0F, 4.0F, 5.0F, - new Dilation(0.2F)), ModelTransform.origin(0.0F, -7.5F, 0.0F)); + PartDefinition top_head = head_neck.addOrReplaceChild("top_head", CubeListBuilder.create().texOffs(96, 0) + .addBox(-3.5F, -7.0F, -6.0F, 7.0F, 7.0F, 9.0F, new CubeDeformation(0.2F)) + .texOffs(69, 0).addBox(-2.5F, -4.0F, -11.0F, 5.0F, 4.0F, 5.0F, + new CubeDeformation(0.2F)), PartPose.offset(0.0F, -7.5F, 0.0F)); - ModelPartData ear_left = top_head.addChild("ear_left", ModelPartBuilder.create().uv(0, 0) - .cuboid(0.0F, -4.0F, -1.0F, 1.0F, 5.0F, 3.0F, new Dilation(0.2F)), - ModelTransform.of(2.5F, -6.0F, 1.0F, -0.7854F, 0.4363F, 0.0F)); + PartDefinition ear_left = top_head.addOrReplaceChild("ear_left", CubeListBuilder.create().texOffs(0, 0) + .addBox(0.0F, -4.0F, -1.0F, 1.0F, 5.0F, 3.0F, new CubeDeformation(0.2F)), + PartPose.offsetAndRotation(2.5F, -6.0F, 1.0F, -0.7854F, 0.4363F, 0.0F)); - ModelPartData ear_right = top_head.addChild("ear_right", ModelPartBuilder.create().uv(9, 0) - .cuboid(-0.5F, -4.0F, -1.0F, 1.0F, 5.0F, 3.0F, new Dilation(0.2F)), - ModelTransform.of(-3.0F, -6.0F, 1.0F, -0.7854F, -0.4363F, 0.0F)); + PartDefinition ear_right = top_head.addOrReplaceChild("ear_right", CubeListBuilder.create().texOffs(9, 0) + .addBox(-0.5F, -4.0F, -1.0F, 1.0F, 5.0F, 3.0F, new CubeDeformation(0.2F)), + PartPose.offsetAndRotation(-3.0F, -6.0F, 1.0F, -0.7854F, -0.4363F, 0.0F)); - ModelPartData right_antler = top_head.addChild("right_antler", ModelPartBuilder.create().uv(34, 120) - .mirrored().cuboid(-8.0F, 0.0F, -2.0F, 8.0F, 2.0F, 2.0F, new Dilation(0.2F)) - .mirrored(false), ModelTransform.of(-3.0F, -7.0F, 0.0F, 0.1812F, -0.3808F, 0.4252F)); + PartDefinition right_antler = top_head.addOrReplaceChild("right_antler", CubeListBuilder.create().texOffs(34, 120) + .mirror().addBox(-8.0F, 0.0F, -2.0F, 8.0F, 2.0F, 2.0F, new CubeDeformation(0.2F)) + .mirror(false), PartPose.offsetAndRotation(-3.0F, -7.0F, 0.0F, 0.1812F, -0.3808F, 0.4252F)); - ModelPartData tip_r_armor_r1 = right_antler.addChild("tip_r_armor_r1", ModelPartBuilder.create().uv(34, 124) - .mirrored().cuboid(-8.0F, -1.0F, -1.0F, 8.0F, 2.0F, 2.0F, new Dilation(0.2F)).mirrored(false), - ModelTransform.of(-7.0F, 1.0F, 0.425F, 0.0F, 1.5708F, 0.0F)); + PartDefinition tip_r_armor_r1 = right_antler.addOrReplaceChild("tip_r_armor_r1", CubeListBuilder.create().texOffs(34, 124) + .mirror().addBox(-8.0F, -1.0F, -1.0F, 8.0F, 2.0F, 2.0F, new CubeDeformation(0.2F)).mirror(false), + PartPose.offsetAndRotation(-7.0F, 1.0F, 0.425F, 0.0F, 1.5708F, 0.0F)); - ModelPartData left_antler = top_head.addChild("left_antler", ModelPartBuilder.create().uv(54, 120) - .cuboid(0.0F, 0.0F, -2.0F, 8.0F, 2.0F, 2.0F, new Dilation(0.2F)), - ModelTransform.of(3.0F, -7.0F, 0.0F, 0.1812F, 0.3808F, -0.4252F)); + PartDefinition left_antler = top_head.addOrReplaceChild("left_antler", CubeListBuilder.create().texOffs(54, 120) + .addBox(0.0F, 0.0F, -2.0F, 8.0F, 2.0F, 2.0F, new CubeDeformation(0.2F)), + PartPose.offsetAndRotation(3.0F, -7.0F, 0.0F, 0.1812F, 0.3808F, -0.4252F)); - ModelPartData tip_l_armor_r1 = left_antler.addChild("tip_l_armor_r1", ModelPartBuilder.create().uv(54, 124) - .cuboid(0.0F, -1.0F, -1.0F, 8.0F, 2.0F, 2.0F, new Dilation(0.2F)), - ModelTransform.of(7.0F, 1.0F, 0.375F, 0.0F, -1.5708F, 0.0F)); + PartDefinition tip_l_armor_r1 = left_antler.addOrReplaceChild("tip_l_armor_r1", CubeListBuilder.create().texOffs(54, 124) + .addBox(0.0F, -1.0F, -1.0F, 8.0F, 2.0F, 2.0F, new CubeDeformation(0.2F)), + PartPose.offsetAndRotation(7.0F, 1.0F, 0.375F, 0.0F, -1.5708F, 0.0F)); - ModelPartData reins_head = top_head.addChild("reins_head", ModelPartBuilder.create().uv(51, 35) - .cuboid(-3.5F, -7.0F, -6.0F, 7.0F, 7.0F, 9.0F, new Dilation(0.3F)) - .uv(52, 26).cuboid(-2.5F, -4.0F, -11.0F, 5.0F, 4.0F, 5.0F, - new Dilation(0.3F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition reins_head = top_head.addOrReplaceChild("reins_head", CubeListBuilder.create().texOffs(51, 35) + .addBox(-3.5F, -7.0F, -6.0F, 7.0F, 7.0F, 9.0F, new CubeDeformation(0.3F)) + .texOffs(52, 26).addBox(-2.5F, -4.0F, -11.0F, 5.0F, 4.0F, 5.0F, + new CubeDeformation(0.3F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData reins = top_head.addChild("reins", ModelPartBuilder.create().uv(86, 99) - .cuboid(3.9F, 0.0F, 0.0F, 0.0F, 7.0F, 21.0F, new Dilation(0.0F)) - .uv(86, 91).cuboid(-3.9F, 0.0F, 0.0F, 0.0F, 7.0F, 21.0F, - new Dilation(0.0F)), ModelTransform.origin(0.0F, -2.0F, -7.0F)); + PartDefinition reins = top_head.addOrReplaceChild("reins", CubeListBuilder.create().texOffs(86, 99) + .addBox(3.9F, 0.0F, 0.0F, 0.0F, 7.0F, 21.0F, new CubeDeformation(0.0F)) + .texOffs(86, 91).addBox(-3.9F, 0.0F, 0.0F, 0.0F, 7.0F, 21.0F, + new CubeDeformation(0.0F)), PartPose.offset(0.0F, -2.0F, -7.0F)); - ModelPartData back_body = front_half.addChild("back_body", ModelPartBuilder.create().uv(0, 44) - .cuboid(-5.5F, -4.55F, -3.6F, 11.0F, 13.0F, 14.0F, new Dilation(0.2F)) - .uv(0, 128).cuboid(-5.5F, 8.825F, -3.6F, 11.0F, 4.0F, 14.0F, - new Dilation(0.2F)), ModelTransform.origin(0.0F, 0.0F, 13.0F)); + PartDefinition back_body = front_half.addOrReplaceChild("back_body", CubeListBuilder.create().texOffs(0, 44) + .addBox(-5.5F, -4.55F, -3.6F, 11.0F, 13.0F, 14.0F, new CubeDeformation(0.2F)) + .texOffs(0, 128).addBox(-5.5F, 8.825F, -3.6F, 11.0F, 4.0F, 14.0F, + new CubeDeformation(0.2F)), PartPose.offset(0.0F, 0.0F, 13.0F)); - ModelPartData tail = back_body.addChild("tail", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -4.5F, 10.0F)); + PartDefinition tail = back_body.addOrReplaceChild("tail", CubeListBuilder.create(), PartPose.offset(0.0F, -4.5F, 10.0F)); - ModelPartData tail_armor_r1 = tail.addChild("tail_armor_r1", ModelPartBuilder.create().uv(39, 47) - .cuboid(-1.5F, -2.0F, 0.0F, 3.0F, 2.0F, 4.0F, new Dilation(0.2F)), - ModelTransform.of(0.0F, 2.0F, 0.0F, 0.5236F, 0.0F, 0.0F)); + PartDefinition tail_armor_r1 = tail.addOrReplaceChild("tail_armor_r1", CubeListBuilder.create().texOffs(39, 47) + .addBox(-1.5F, -2.0F, 0.0F, 3.0F, 2.0F, 4.0F, new CubeDeformation(0.2F)), + PartPose.offsetAndRotation(0.0F, 2.0F, 0.0F, 0.5236F, 0.0F, 0.0F)); - ModelPartData back_left_leg = root.addChild("back_left_leg", ModelPartBuilder.create().uv(0, 72) - .cuboid(-2.25F, -4.25F, -3.75F, 5.0F, 10.0F, 7.0F, new Dilation(0.2F)) - .uv(4, 89).cuboid(-2.25F, 5.75F, 0.25F, 4.0F, 15.0F, 4.0F, - new Dilation(0.2F)), ModelTransform.origin(4.75F, -4.75F, 19.75F)); + PartDefinition back_left_leg = root.addOrReplaceChild("back_left_leg", CubeListBuilder.create().texOffs(0, 72) + .addBox(-2.25F, -4.25F, -3.75F, 5.0F, 10.0F, 7.0F, new CubeDeformation(0.2F)) + .texOffs(4, 89).addBox(-2.25F, 5.75F, 0.25F, 4.0F, 15.0F, 4.0F, + new CubeDeformation(0.2F)), PartPose.offset(4.75F, -4.75F, 19.75F)); - ModelPartData back_right_leg = root.addChild("back_right_leg", ModelPartBuilder.create().uv(24, 72) - .cuboid(-2.75F, -4.25F, -3.75F, 5.0F, 10.0F, 7.0F, new Dilation(0.2F)) - .uv(28, 89).cuboid(-1.75F, 5.75F, 0.25F, 4.0F, 15.0F, 4.0F, - new Dilation(0.2F)), ModelTransform.origin(-4.75F, -4.75F, 19.75F)); + PartDefinition back_right_leg = root.addOrReplaceChild("back_right_leg", CubeListBuilder.create().texOffs(24, 72) + .addBox(-2.75F, -4.25F, -3.75F, 5.0F, 10.0F, 7.0F, new CubeDeformation(0.2F)) + .texOffs(28, 89).addBox(-1.75F, 5.75F, 0.25F, 4.0F, 15.0F, 4.0F, + new CubeDeformation(0.2F)), PartPose.offset(-4.75F, -4.75F, 19.75F)); - top_head.addChild("beard", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - front_body.addChild("saddle", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + top_head.addOrReplaceChild("beard", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + front_body.addOrReplaceChild("saddle", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 128, 160); + return LayerDefinition.create(modelData, 128, 160); } @Override - public void setAngles(GreatHornEntityRenderState state) { - super.setAngles(state); + public void setupAnim(GreatHornEntity entity, float limbSwing, float limbSwingAmount, + float ageInTicks, float netHeadYaw, float headPitch) { + super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - boolean showSaddle = state.saddle != ItemStack.EMPTY; - saddle.hidden = !showSaddle; - reinsHead.hidden = !showSaddle; - reins.hidden = !showSaddle; + boolean showSaddle = !entity.getBodyArmorItem().isEmpty(); + saddle.skipDraw = !showSaddle; + reinsHead.skipDraw = !showSaddle; + reins.skipDraw = !showSaddle; - if(!state.hasRider) { - reins.pitch = -12.5f * 0.017453292F; + if(!entity.hasExactlyOnePlayerPassenger()) { + reins.xRot = -12.5f * 0.017453292F; } else { - reins.pitch = 0f; + reins.xRot = 0f; } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornNoseFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornNoseFeatureRenderer.java index c04a6b61f3..b97012d2df 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornNoseFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornNoseFeatureRenderer.java @@ -1,32 +1,28 @@ package net.sevenstars.middleearth.entity.beasts.great_horn.features; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import net.sevenstars.middleearth.entity.beasts.great_horn.GreatHornEntityRenderState; +import net.sevenstars.middleearth.entity.beasts.great_horn.GreatHornEntity; import net.sevenstars.middleearth.entity.beasts.great_horn.GreatHornModel; - +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; import java.time.LocalDate; import java.time.Month; -@Environment(EnvType.CLIENT) -public class GreatHornNoseFeatureRenderer extends FeatureRenderer { +public class GreatHornNoseFeatureRenderer extends RenderLayer { private final GreatHornModel model; - private final static Identifier TEXTURE = Identifier.of(MiddleEarth.MOD_ID, "textures/entities/great_horn/feature/great_horn_red_nose.png"); + private final static ResourceLocation TEXTURE = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "textures/entities/great_horn/feature/great_horn_red_nose.png"); - public GreatHornNoseFeatureRenderer(FeatureRendererContext context, LoadedEntityModels loader) { + public GreatHornNoseFeatureRenderer(RenderLayerParent context, EntityModelSet loader) { super(context); - this.model = new GreatHornModel(loader.getModelPart(EntityModelLayersME.GREAT_HORN)); + this.model = new GreatHornModel(loader.bakeLayer(EntityModelLayersME.GREAT_HORN)); } private boolean isChristmas() { @@ -35,10 +31,13 @@ private boolean isChristmas() { } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, GreatHornEntityRenderState state, float limbAngle, float limbDistance) { - if(state.hasRedNose() || isChristmas()) { - VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityTranslucent(TEXTURE)); - this.getContextModel().render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV); + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, GreatHornEntity entity, + float limbAngle, float limbDistance, float tickDelta, float animationProgress, + float headYaw, float headPitch) { + String name = entity.hasCustomName() ? entity.getName().getString() : ""; + if("rudolph".equalsIgnoreCase(name) || "rudolf".equalsIgnoreCase(name) || isChristmas()) { + VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderType.entityTranslucent(TEXTURE)); + this.getParentModel().renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornSaddleFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornSaddleFeatureRenderer.java index 92bdef4e73..af3d753f9d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornSaddleFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornSaddleFeatureRenderer.java @@ -1,43 +1,45 @@ package net.sevenstars.middleearth.entity.beasts.great_horn.features; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.equipment.EquipmentRenderer; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Identifier; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.entity.animal.horse.AbstractHorse; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import net.sevenstars.middleearth.entity.beasts.great_horn.GreatHornEntityRenderState; +import net.sevenstars.middleearth.entity.beasts.great_horn.GreatHornEntity; import net.sevenstars.middleearth.entity.beasts.great_horn.GreatHornModel; -public class GreatHornSaddleFeatureRenderer extends FeatureRenderer { +public class GreatHornSaddleFeatureRenderer extends RenderLayer { private final GreatHornSaddleModel model; private final static String PATH = "textures/entities/great_horn/feature/great_horn_saddle"; - public GreatHornSaddleFeatureRenderer(FeatureRendererContext context, LoadedEntityModels loader, EquipmentRenderer equipmentRenderer) { + public GreatHornSaddleFeatureRenderer(RenderLayerParent context, EntityModelSet loader) { super(context); - this.model = new GreatHornSaddleModel(loader.getModelPart(EntityModelLayersME.GREAT_HORN_SADDLE)); + this.model = new GreatHornSaddleModel(loader.bakeLayer(EntityModelLayersME.GREAT_HORN_SADDLE)); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, GreatHornEntityRenderState state, float limbAngle, float limbDistance) { - ItemStack itemStack = state.saddle; - boolean blueSaddle = state.blueSaddle; + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, GreatHornEntity entity, + float limbAngle, float limbDistance, float tickDelta, float animationProgress, + float headYaw, float headPitch) { + ItemStack itemStack = entity.getInventory().getItem(AbstractHorse.INV_SLOT_SADDLE); + boolean blueSaddle = entity.hasBlueSaddle(); String suffix = ""; if(blueSaddle) suffix = "_blue"; if(!itemStack.isEmpty()) { - VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumers, - RenderLayer.getArmorCutoutNoCull(Identifier.of(MiddleEarth.MOD_ID, PATH + suffix + ".png")), itemStack.hasGlint()); + VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer(vertexConsumers, + RenderType.armorCutoutNoCull(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + suffix + ".png")), itemStack.hasFoil()); - model.setAngles(state); - model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV); + model.setupAnim(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch); + model.renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornSaddleModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornSaddleModel.java index c59a5ac858..2a2f1eeab3 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornSaddleModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/great_horn/features/GreatHornSaddleModel.java @@ -1,8 +1,14 @@ package net.sevenstars.middleearth.entity.beasts.great_horn.features; import net.minecraft.client.model.*; -import net.minecraft.item.ItemStack; -import net.sevenstars.middleearth.entity.beasts.great_horn.GreatHornEntityRenderState; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.sevenstars.middleearth.entity.beasts.great_horn.GreatHornEntity; import net.sevenstars.middleearth.entity.beasts.great_horn.GreatHornModel; public class GreatHornSaddleModel extends GreatHornModel { @@ -29,70 +35,71 @@ public GreatHornSaddleModel(ModelPart root) { this.reins = this.topHead.getChild("reins"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData root = modelPartData.addChild("root", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 8.0F, -10.0F)); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition root = modelPartData.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 8.0F, -10.0F)); - ModelPartData body = root.addChild("body", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -8.5F, 12.0F)); + PartDefinition body = root.addOrReplaceChild("body", CubeListBuilder.create(), PartPose.offset(0.0F, -8.5F, 12.0F)); - ModelPartData front_half = body.addChild("front_half", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, -13.0F)); + PartDefinition front_half = body.addOrReplaceChild("front_half", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, -13.0F)); - ModelPartData front_body = front_half.addChild("front_body", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.5F, 2.5F)); + PartDefinition front_body = front_half.addOrReplaceChild("front_body", CubeListBuilder.create(), PartPose.offset(0.0F, 0.5F, 2.5F)); - ModelPartData saddle = front_body.addChild("saddle", ModelPartBuilder.create().uv(88, 50) - .cuboid(-7.0F, -1.0F, 2.0F, 14.0F, 22.0F, 6.0F, new Dilation(0.3F)) - .uv(84, 18).cuboid(-7.0F, -2.0F, -6.6F, 14.0F, 23.0F, 8.0F, - new Dilation(0.3F)), ModelTransform.origin(0.0F, -6.5F, 6.5F)); + PartDefinition saddle = front_body.addOrReplaceChild("saddle", CubeListBuilder.create().texOffs(88, 50) + .addBox(-7.0F, -1.0F, 2.0F, 14.0F, 22.0F, 6.0F, new CubeDeformation(0.3F)) + .texOffs(84, 18).addBox(-7.0F, -2.0F, -6.6F, 14.0F, 23.0F, 8.0F, + new CubeDeformation(0.3F)), PartPose.offset(0.0F, -6.5F, 6.5F)); - ModelPartData seat_back_r1 = saddle.addChild("seat_back_r1", ModelPartBuilder.create().uv(49, 78) - .cuboid(-4.5F, -4.5F, -1.0F, 9.0F, 5.0F, 2.0F, new Dilation(0.3F)), ModelTransform.of(0.0F, 1.0F, 8.4F, -0.2182F, 0.0F, 0.0F)); + PartDefinition seat_back_r1 = saddle.addOrReplaceChild("seat_back_r1", CubeListBuilder.create().texOffs(49, 78) + .addBox(-4.5F, -4.5F, -1.0F, 9.0F, 5.0F, 2.0F, new CubeDeformation(0.3F)), PartPose.offsetAndRotation(0.0F, 1.0F, 8.4F, -0.2182F, 0.0F, 0.0F)); - ModelPartData head_neck = front_half.addChild("head_neck", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -6.0F, -3.0F)); + PartDefinition head_neck = front_half.addOrReplaceChild("head_neck", CubeListBuilder.create(), PartPose.offset(0.0F, -6.0F, -3.0F)); - ModelPartData top_head = head_neck.addChild("top_head", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -7.5F, 0.0F)); + PartDefinition top_head = head_neck.addOrReplaceChild("top_head", CubeListBuilder.create(), PartPose.offset(0.0F, -7.5F, 0.0F)); - root.addChild("front_left_leg", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - root.addChild("front_right_leg", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - root.addChild("back_left_leg", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - root.addChild("back_right_leg", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + root.addOrReplaceChild("front_left_leg", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + root.addOrReplaceChild("front_right_leg", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + root.addOrReplaceChild("back_left_leg", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + root.addOrReplaceChild("back_right_leg", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData back_body = front_half.addChild("back_body", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - back_body.addChild("tail", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition back_body = front_half.addOrReplaceChild("back_body", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + back_body.addOrReplaceChild("tail", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - top_head.addChild("right_antler", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - top_head.addChild("left_antler", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - top_head.addChild("ear_left", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - top_head.addChild("ear_right", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - top_head.addChild("beard", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + top_head.addOrReplaceChild("right_antler", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + top_head.addOrReplaceChild("left_antler", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + top_head.addOrReplaceChild("ear_left", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + top_head.addOrReplaceChild("ear_right", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + top_head.addOrReplaceChild("beard", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData reins_head = top_head.addChild("reins_head", ModelPartBuilder.create().uv(51, 35) - .cuboid(-3.5F, -7.0F, -6.0F, 7.0F, 7.0F, 9.0F, new Dilation(0.3F)) - .uv(52, 26).cuboid(-2.5F, -4.0F, -11.0F, 5.0F, 4.0F, 5.0F, new Dilation(0.3F)) - .uv(53, 53).cuboid(-3.5F, 0.0F, -4.0F, 7.0F, 18.0F, 7.0F, - new Dilation(0.3F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition reins_head = top_head.addOrReplaceChild("reins_head", CubeListBuilder.create().texOffs(51, 35) + .addBox(-3.5F, -7.0F, -6.0F, 7.0F, 7.0F, 9.0F, new CubeDeformation(0.3F)) + .texOffs(52, 26).addBox(-2.5F, -4.0F, -11.0F, 5.0F, 4.0F, 5.0F, new CubeDeformation(0.3F)) + .texOffs(53, 53).addBox(-3.5F, 0.0F, -4.0F, 7.0F, 18.0F, 7.0F, + new CubeDeformation(0.3F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData reins = top_head.addChild("reins", ModelPartBuilder.create().uv(86, 99) - .cuboid(3.9F, 0.0F, 0.0F, 0.0F, 7.0F, 21.0F, new Dilation(0.0F)) - .uv(86, 91).cuboid(-3.9F, 0.0F, 0.0F, 0.0F, 7.0F, 21.0F, - new Dilation(0.0F)), ModelTransform.origin(0.0F, -2.0F, -7.0F)); + PartDefinition reins = top_head.addOrReplaceChild("reins", CubeListBuilder.create().texOffs(86, 99) + .addBox(3.9F, 0.0F, 0.0F, 0.0F, 7.0F, 21.0F, new CubeDeformation(0.0F)) + .texOffs(86, 91).addBox(-3.9F, 0.0F, 0.0F, 0.0F, 7.0F, 21.0F, + new CubeDeformation(0.0F)), PartPose.offset(0.0F, -2.0F, -7.0F)); - return TexturedModelData.of(modelData, 128, 160); + return LayerDefinition.create(modelData, 128, 160); } @Override - public void setAngles(GreatHornEntityRenderState state) { - super.setAngles(state); + public void setupAnim(GreatHornEntity entity, float limbSwing, float limbSwingAmount, + float ageInTicks, float netHeadYaw, float headPitch) { + super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); - boolean showSaddle = state.saddle != ItemStack.EMPTY; - saddle.hidden = !showSaddle; - reinsHead.hidden = !showSaddle; - reins.hidden = !showSaddle; + boolean showSaddle = entity.isSaddled(); + saddle.skipDraw = !showSaddle; + reinsHead.skipDraw = !showSaddle; + reins.skipDraw = !showSaddle; - if(!state.hasRider) { - reins.pitch = -12.5f * 0.017453292F; + if(!entity.hasExactlyOnePlayerPassenger()) { + reins.xRot = -12.5f * 0.017453292F; } else { - reins.pitch = 0f; + reins.xRot = 0f; } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/TrollAnimations.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/TrollAnimations.java index 6b47b149b8..5404ee0ba5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/TrollAnimations.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/TrollAnimations.java @@ -1,783 +1,786 @@ package net.sevenstars.middleearth.entity.beasts.trolls; -import net.minecraft.client.render.entity.animation.*; +import net.minecraft.client.animation.AnimationChannel; +import net.minecraft.client.animation.AnimationDefinition; +import net.minecraft.client.animation.Keyframe; +import net.minecraft.client.animation.KeyframeAnimations; public class TrollAnimations { - public static final AnimationDefinition GOSLEEPING = AnimationDefinition.Builder.create(0.68f) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.6f, AnimationHelper.createTranslationalVector(0f, -14f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.6f, AnimationHelper.createTranslationalVector(0f, -13f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.6f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.6f, AnimationHelper.createTranslationalVector(0f, -19f, 6f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.6f, AnimationHelper.createRotationalVector(-90f, -20f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.6f, AnimationHelper.createTranslationalVector(0f, -19f, 6f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.6f, AnimationHelper.createRotationalVector(-90f, 20f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.6f, AnimationHelper.createTranslationalVector(0f, -15f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.6f, AnimationHelper.createTranslationalVector(0f, -15f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition WAKEUP = AnimationDefinition.Builder.create(0.72f) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -14f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -13f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -18f, 6f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, -20f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -18f, 6f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-90f, 20f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -15f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -15f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition IDLE = AnimationDefinition.Builder.create(3f).looping() - .addBoneAnimation("boneJaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(1.4f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.8f, AnimationHelper.createRotationalVector(10f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition EATING = AnimationDefinition.Builder.create(1.92f) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.6f, AnimationHelper.createRotationalVector(22.85f, 12.07f, 3.28f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.76f, AnimationHelper.createRotationalVector(28.06f, 10.86f, 2.96f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.92f, AnimationHelper.createRotationalVector(18.06f, 10.86f, 2.96f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.08f, AnimationHelper.createRotationalVector(28.06f, 10.86f, 2.96f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createRotationalVector(31.55f, 9.31f, 2.53f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.32f, AnimationHelper.createRotationalVector(16.29f, 7.76f, 2.11f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createRotationalVector(25.54f, 6.21f, 1.69f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("boneJaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.6f, AnimationHelper.createRotationalVector(10f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.76f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.92f, AnimationHelper.createRotationalVector(10f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.08f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createRotationalVector(10f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.32f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createRotationalVector(10f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.56f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.64f, AnimationHelper.createRotationalVector(-59.1f, -16.73f, -4.29f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createRotationalVector(-59.1f, -16.73f, -4.29f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("forearmRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.64f, AnimationHelper.createTranslationalVector(-4f, 5f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createTranslationalVector(-4f, 5f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("forearmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.64f, AnimationHelper.createRotationalVector(0f, 0f, -20f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createRotationalVector(0f, 0f, -20f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition MOVING = AnimationDefinition.Builder.create(1.92f).looping() - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createTranslationalVector(1f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createTranslationalVector(-1f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(0f, 0f, 2.5f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createRotationalVector(0f, 0f, -2.5f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createTranslationalVector(2f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createTranslationalVector(-2f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(0f, 0f, 7.5f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createRotationalVector(0f, 0f, -7.5f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(-25f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createRotationalVector(25f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(25f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createRotationalVector(-25f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createTranslationalVector(1.95f, 0.7f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createTranslationalVector(-1.4f, -0.5f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(-25f, 0f, 2.08f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createRotationalVector(25f, 0f, -2.08f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(-0.05f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createTranslationalVector(1.92f, -0.5f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createTranslationalVector(-0.05f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createTranslationalVector(-2.17f, 0.73f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(25f, 0f, 2.5f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createRotationalVector(-25f, 0f, -2.08f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition ATTACK = AnimationDefinition.Builder.create(1.68f) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createTranslationalVector(0f, -2f, -5f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(-5.41f, -15.59f, 5.18f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createRotationalVector(7.5f, -20f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createTranslationalVector(3.2f, 0f, 0.2f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createTranslationalVector(4f, -2f, -6f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(0f, 0f, 7.5f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createRotationalVector(7.5f, 0f, 5f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("boneJaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createRotationalVector(15f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createTranslationalVector(0f, 1f, -6.4f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createTranslationalVector(0f, 0f, -8f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createTranslationalVector(0f, 2f, -4f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(-37.5f, 5f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createRotationalVector(0f, 10f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createTranslationalVector(1.8f, 1.4f, -5.2f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createTranslationalVector(2.25f, -4f, -14f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(11.07f, -15.94f, 5.2f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createRotationalVector(-10f, -20f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createTranslationalVector(-3f, -3.6f, 1.6f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createTranslationalVector(0f, -4f, -3f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(15.77f, -13.86f, -12.45f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createRotationalVector(-7.5f, -22.5f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("forearmRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createTranslationalVector(0f, 1f, 6f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("forearmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(-37.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("kneeRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createTranslationalVector(0f, 1f, -10f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createTranslationalVector(0f, 0f, -2f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("kneeRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(40f, 5f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createRotationalVector(0f, 10f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createRotationalVector(-7.5f, 5f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition THROWING = AnimationDefinition.Builder.create(1.68f) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createTranslationalVector(0f, -18f, -21f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(-60f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.12f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.68f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createTranslationalVector(0f, -13f, -21f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(-15f, -5f, -15f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(-177f, 0f, 15f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.12f, AnimationHelper.createRotationalVector(-87.5f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.68f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createTranslationalVector(0f, -13f, -21f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(-15f, 5f, 15f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(-177f, 0f, -15f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.12f, AnimationHelper.createRotationalVector(-90f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1.68f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(62.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition STARTCHARGING = AnimationDefinition.Builder.create(1.92f) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createTranslationalVector(0f, 0f, 2f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(15.12f, -7.24f, -1.95f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createTranslationalVector(0f, -3f, -3f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(0f, 0f, -2.5f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.72f, AnimationHelper.createRotationalVector(-15f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("kneeLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.72f, AnimationHelper.createTranslationalVector(0f, 4f, 6f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createTranslationalVector(0f, 4f, 5f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("kneeLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.72f, AnimationHelper.createRotationalVector(27.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createTranslationalVector(0f, -4f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createRotationalVector(-20f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createRotationalVector(12.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("kneeRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createTranslationalVector(0f, 2f, -6f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createTranslationalVector(0f, 3f, -1f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("kneeRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.68f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.92f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createTranslationalVector(-0.25f, 0f, -6f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createTranslationalVector(2.75f, -3f, -17f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(2.62f, -7.24f, -1.95f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createRotationalVector(-52.38f, -7.24f, -1.95f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("forearmRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createTranslationalVector(-12f, 5f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("forearmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createRotationalVector(0f, 0f, -50f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createTranslationalVector(-0.5f, 0f, -3f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createTranslationalVector(-2.5f, 0f, -10f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(15.12f, -7.24f, -1.95f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createRotationalVector(-72.38f, -7.24f, -1.95f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("forearmLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createTranslationalVector(2f, 3f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("forearmLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.44f, AnimationHelper.createRotationalVector(0f, 0f, 42.5f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition CHARGING = AnimationDefinition.Builder.create(0.96f).looping() - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 2f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(15.12f, -7.24f, -1.95f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -3f, -3f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -2.5f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.24f, AnimationHelper.createRotationalVector(-25f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.72f, AnimationHelper.createRotationalVector(25f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.24f, AnimationHelper.createRotationalVector(25f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.48f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.72f, AnimationHelper.createRotationalVector(-25f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.96f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("kneeRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("kneeRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(2.75f, -3f, -17f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-52.38f, -7.24f, -1.95f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("forearmRight", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(-12f, 5f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("forearmRight", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -50f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(-2.5f, 0f, -10f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("armLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-72.38f, -7.24f, -1.95f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("forearmLeft", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(2f, 3f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("forearmLeft", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 42.5f), - Transformation.Interpolations.LINEAR))).build(); + public static final AnimationDefinition GOSLEEPING = AnimationDefinition.Builder.withLength(0.68f) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6f, KeyframeAnimations.posVec(0f, -14f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6f, KeyframeAnimations.posVec(0f, -13f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6f, KeyframeAnimations.posVec(0f, -19f, 6f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6f, KeyframeAnimations.degreeVec(-90f, -20f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6f, KeyframeAnimations.posVec(0f, -19f, 6f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6f, KeyframeAnimations.degreeVec(-90f, 20f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6f, KeyframeAnimations.posVec(0f, -15f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6f, KeyframeAnimations.posVec(0f, -15f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition WAKEUP = AnimationDefinition.Builder.withLength(0.72f) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -14f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -13f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -18f, 6f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, -20f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -18f, 6f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-90f, 20f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -15f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -15f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition IDLE = AnimationDefinition.Builder.withLength(3f).looping() + .addAnimation("boneJaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(1.4f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8f, KeyframeAnimations.degreeVec(10f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition EATING = AnimationDefinition.Builder.withLength(1.92f) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6f, KeyframeAnimations.degreeVec(22.85f, 12.07f, 3.28f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.76f, KeyframeAnimations.degreeVec(28.06f, 10.86f, 2.96f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.92f, KeyframeAnimations.degreeVec(18.06f, 10.86f, 2.96f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.08f, KeyframeAnimations.degreeVec(28.06f, 10.86f, 2.96f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.degreeVec(31.55f, 9.31f, 2.53f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.32f, KeyframeAnimations.degreeVec(16.29f, 7.76f, 2.11f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.degreeVec(25.54f, 6.21f, 1.69f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("boneJaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6f, KeyframeAnimations.degreeVec(10f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.76f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.92f, KeyframeAnimations.degreeVec(10f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.08f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.degreeVec(10f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.32f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.degreeVec(10f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.56f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.64f, KeyframeAnimations.degreeVec(-59.1f, -16.73f, -4.29f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.degreeVec(-59.1f, -16.73f, -4.29f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("forearmRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.64f, KeyframeAnimations.posVec(-4f, 5f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.posVec(-4f, 5f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("forearmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.64f, KeyframeAnimations.degreeVec(0f, 0f, -20f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.degreeVec(0f, 0f, -20f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition MOVING = AnimationDefinition.Builder.withLength(1.92f).looping() + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.posVec(1f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.posVec(-1f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(0f, 0f, 2.5f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.degreeVec(0f, 0f, -2.5f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.posVec(2f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.posVec(-2f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(0f, 0f, 7.5f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.degreeVec(0f, 0f, -7.5f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(-25f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.degreeVec(25f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(25f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.degreeVec(-25f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.posVec(1.95f, 0.7f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.posVec(-1.4f, -0.5f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(-25f, 0f, 2.08f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.degreeVec(25f, 0f, -2.08f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(-0.05f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.posVec(1.92f, -0.5f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.posVec(-0.05f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.posVec(-2.17f, 0.73f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(25f, 0f, 2.5f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.degreeVec(-25f, 0f, -2.08f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition ATTACK = AnimationDefinition.Builder.withLength(1.68f) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.posVec(0f, -2f, -5f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(-5.41f, -15.59f, 5.18f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.degreeVec(7.5f, -20f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.posVec(3.2f, 0f, 0.2f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.posVec(4f, -2f, -6f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(0f, 0f, 7.5f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.degreeVec(7.5f, 0f, 5f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("boneJaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.degreeVec(15f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.posVec(0f, 1f, -6.4f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.posVec(0f, 0f, -8f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.posVec(0f, 2f, -4f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(-37.5f, 5f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.degreeVec(0f, 10f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.posVec(1.8f, 1.4f, -5.2f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.posVec(2.25f, -4f, -14f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(11.07f, -15.94f, 5.2f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.degreeVec(-10f, -20f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.posVec(-3f, -3.6f, 1.6f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.posVec(0f, -4f, -3f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(15.77f, -13.86f, -12.45f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.degreeVec(-7.5f, -22.5f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("forearmRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.posVec(0f, 1f, 6f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("forearmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(-37.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("kneeRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.posVec(0f, 1f, -10f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.posVec(0f, 0f, -2f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("kneeRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(40f, 5f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.degreeVec(0f, 10f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.degreeVec(-7.5f, 5f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition THROWING = AnimationDefinition.Builder.withLength(1.68f) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.posVec(0f, -18f, -21f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(-60f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.12f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.68f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.posVec(0f, -13f, -21f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(-15f, -5f, -15f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(-177f, 0f, 15f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.12f, KeyframeAnimations.degreeVec(-87.5f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.68f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.posVec(0f, -13f, -21f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(-15f, 5f, 15f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(-177f, 0f, -15f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.12f, KeyframeAnimations.degreeVec(-90f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.68f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(62.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition STARTCHARGING = AnimationDefinition.Builder.withLength(1.92f) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.posVec(0f, 0f, 2f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(15.12f, -7.24f, -1.95f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.posVec(0f, -3f, -3f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(0f, 0f, -2.5f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.posVec(0f, -1f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.72f, KeyframeAnimations.degreeVec(-15f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("kneeLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.72f, KeyframeAnimations.posVec(0f, 4f, 6f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.posVec(0f, 4f, 5f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("kneeLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.72f, KeyframeAnimations.degreeVec(27.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.posVec(0f, -4f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.degreeVec(-20f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.degreeVec(12.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("kneeRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.posVec(0f, 2f, -6f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.posVec(0f, 3f, -1f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("kneeRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.68f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.92f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.posVec(-0.25f, 0f, -6f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.posVec(2.75f, -3f, -17f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(2.62f, -7.24f, -1.95f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.degreeVec(-52.38f, -7.24f, -1.95f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("forearmRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.posVec(-12f, 5f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("forearmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.degreeVec(0f, 0f, -50f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.posVec(-0.5f, 0f, -3f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.posVec(-2.5f, 0f, -10f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(15.12f, -7.24f, -1.95f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.degreeVec(-72.38f, -7.24f, -1.95f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("forearmLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.posVec(2f, 3f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("forearmLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.44f, KeyframeAnimations.degreeVec(0f, 0f, 42.5f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition CHARGING = AnimationDefinition.Builder.withLength(0.96f).looping() + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 2f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(15.12f, -7.24f, -1.95f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -3f, -3f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -2.5f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.24f, KeyframeAnimations.degreeVec(-25f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.72f, KeyframeAnimations.degreeVec(25f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.24f, KeyframeAnimations.degreeVec(25f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.48f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.72f, KeyframeAnimations.degreeVec(-25f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.96f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("kneeRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("kneeRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(2.75f, -3f, -17f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-52.38f, -7.24f, -1.95f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("forearmRight", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(-12f, 5f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("forearmRight", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -50f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(-2.5f, 0f, -10f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("armLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-72.38f, -7.24f, -1.95f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("forearmLeft", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(2f, 3f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("forearmLeft", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 42.5f), + AnimationChannel.Interpolations.LINEAR))).build(); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/TrollEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/TrollEntity.java index 6a714508de..44e9d54b98 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/TrollEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/TrollEntity.java @@ -1,26 +1,35 @@ package net.sevenstars.middleearth.entity.beasts.trolls; -import net.minecraft.entity.*; -import net.minecraft.entity.ai.goal.*; -import net.minecraft.entity.attribute.DefaultAttributeContainer; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.data.TrackedData; -import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.entity.passive.AnimalEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.StackWithSlot; -import net.minecraft.item.ItemStack; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundEvents; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.tags.TagKey; +import net.minecraft.world.entity.AnimationState; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityEvent; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.goal.FloatGoal; +import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; +import net.minecraft.world.entity.ai.goal.MeleeAttackGoal; +import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; +import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; +import net.minecraft.world.entity.animal.Animal; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntitiesME; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; @@ -30,7 +39,6 @@ import net.sevenstars.middleearth.resources.datas.common.RaceType; import net.sevenstars.middleearth.resources.persistent_datas.PlayerDataService; -import java.util.Iterator; import java.util.List; public class TrollEntity extends AbstractBeastEntity { @@ -41,61 +49,61 @@ public class TrollEntity extends AbstractBeastEntity { private int bondingTries = 0; private int bondingTimeout = 0; - public static final TrackedData THROWING = DataTracker.registerData(TrollEntity.class, TrackedDataHandlerRegistry.BOOLEAN); + public static final EntityDataAccessor THROWING = SynchedEntityData.defineId(TrollEntity.class, EntityDataSerializers.BOOLEAN); - public TrollEntity(EntityType entityType, World world) { + public TrollEntity(EntityType entityType, Level world) { super(entityType, world); } - public static DefaultAttributeContainer.Builder setAttributes() { - return AnimalEntity.createAnimalAttributes() - .add(EntityAttributes.MOVEMENT_SPEED, 0.35f) - .add(EntityAttributes.MAX_HEALTH, 120.0) - .add(EntityAttributes.KNOCKBACK_RESISTANCE, 0.6) - .add(EntityAttributes.ATTACK_SPEED, 0.9) - .add(EntityAttributes.FOLLOW_RANGE, 28.0) - .add(EntityAttributes.ATTACK_DAMAGE, 10.0) - .add(EntityAttributes.STEP_HEIGHT, 1.25) - .add(EntityAttributes.JUMP_STRENGTH, 0.0); + public static AttributeSupplier.Builder setAttributes() { + return Mob.createMobAttributes() + .add(Attributes.MOVEMENT_SPEED, 0.35f) + .add(Attributes.MAX_HEALTH, 120.0) + .add(Attributes.KNOCKBACK_RESISTANCE, 0.6) + .add(Attributes.ATTACK_SPEED, 0.9) + .add(Attributes.FOLLOW_RANGE, 28.0) + .add(Attributes.ATTACK_DAMAGE, 10.0) + .add(Attributes.STEP_HEIGHT, 1.25) + .add(Attributes.JUMP_STRENGTH, 0.0); } @Override - protected void initGoals() { - this.goalSelector.add(1, new SwimGoal(this)); - this.goalSelector.add(2, new BeastSitGoal(this)); - this.goalSelector.add(3, new MeleeAttackGoal(this, 0.9f, false)); - this.goalSelector.add(4, new ChargeAttackGoal(this, this.getDisposition(), maxChargeCooldown())); - this.goalSelector.add(5, new WanderAroundFarGoal(this, 1.0)); - this.goalSelector.add(6, new LookAtEntityGoal(this, PlayerEntity.class, 6.0f)); - this.goalSelector.add(7, new LookAroundGoal(this)); - this.targetSelector.add(1, new BeastTrackOwnerAttackerGoal((AbstractBeastEntity) this)); - this.targetSelector.add(2, new BeastAttackWithOwnerGoal((AbstractBeastEntity)this)); - this.targetSelector.add(3, new BeastRevengeGoal(this, new Class[0])); + protected void registerGoals() { + this.goalSelector.addGoal(1, new FloatGoal(this)); + this.goalSelector.addGoal(2, new BeastSitGoal(this)); + this.goalSelector.addGoal(3, new MeleeAttackGoal(this, 0.9f, false)); + this.goalSelector.addGoal(4, new ChargeAttackGoal(this, this.getDisposition(), maxChargeCooldown())); + this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0)); + this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0f)); + this.goalSelector.addGoal(7, new RandomLookAroundGoal(this)); + this.targetSelector.addGoal(1, new BeastTrackOwnerAttackerGoal((AbstractBeastEntity) this)); + this.targetSelector.addGoal(2, new BeastAttackWithOwnerGoal((AbstractBeastEntity)this)); + this.targetSelector.addGoal(3, new BeastRevengeGoal(this, new Class[0])); } - protected void initDataTracker(DataTracker.Builder builder) { - super.initDataTracker(builder); - builder.add(THROWING, false); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(THROWING, false); } @Override - public void onTrackedDataSet(TrackedData data) { - if(!this.firstUpdate && THROWING.equals(data)) { + public void onSyncedDataUpdated(EntityDataAccessor data) { + if(!this.firstTick && THROWING.equals(data)) { this.throwCooldown = this.throwCooldown == 0 ? 200 : this.throwCooldown; } - super.onTrackedDataSet(data); + super.onSyncedDataUpdated(data); } @Override protected void setupAnimationStates() { if (this.idleAnimationTimeout <= 0) { this.idleAnimationTimeout = this.random.nextInt(40) + 80; - this.idleAnimationState.start(this.age); + this.idleAnimationState.start(this.tickCount); } else { --this.idleAnimationTimeout; } if(this.isSitting()) { - this.sittingAnimationState.startIfNotRunning(this.age); + this.sittingAnimationState.startIfStopped(this.tickCount); } else { this.sittingAnimationState.stop(); @@ -103,12 +111,12 @@ protected void setupAnimationStates() { if(this.isThrowing() && this.throwingAnimationTimeout <= 0) { this.throwingAnimationTimeout = 100; - this.throwingAnimationState.start(this.age); + this.throwingAnimationState.start(this.tickCount); }else { --this.throwingAnimationTimeout; } if(isThrowing()) { - this.setMovementSpeed(0); + this.setSpeed(0); } if(!this.isThrowing()) { @@ -121,24 +129,24 @@ public void tick() { super.tick(); if(this.getTarget() != null) { - this.getLookControl().lookAt(this.getTarget()); + this.getLookControl().setLookAt(this.getTarget()); } if(this.isCharging()) { chargeAttack(); - if(!chargeAnimationState.isRunning()) { - this.chargeAnimationState.start(this.age); + if(!chargeAnimationState.isStarted()) { + this.chargeAnimationState.start(this.tickCount); } } if(throwCooldown == 0 && this.getTarget() != null && !isCharging()) { - if(this.squaredDistanceTo(this.getTarget()) >= 25 && !this.hasPassengers() && canThrow()) { + if(this.distanceToSqr(this.getTarget()) >= 25 && !this.isVehicle() && canThrow()) { this.setThrowing(true); throwCooldown = 200; } } if(this.isThrowing() && canThrow()) { - this.setVelocity(Vec3d.ZERO); + this.setDeltaMovement(Vec3.ZERO); if(throwCooldown <= 180) { throwAttack(); } @@ -147,7 +155,7 @@ public void tick() { --this.throwCooldown; } - if (!this.getWorld().isClient) { + if (!this.level().isClientSide) { if(this.bondingTimeout > 0) { this.bondingTimeout--; } @@ -175,12 +183,12 @@ public boolean usesTameness() { } @Override - protected float getSaddledSpeed(PlayerEntity controllingPlayer) { - return (float)this.getAttributeValue(EntityAttributes.MOVEMENT_SPEED) * 0.5f; + protected float getRiddenSpeed(Player controllingPlayer) { + return (float)this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 0.5f; } public boolean isCommandItem(ItemStack stack) { - return stack.isIn(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))); + return stack.is(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))); } @Override @@ -189,65 +197,63 @@ public boolean isFoodItem(ItemStack itemStack) { } @Override - protected void writeCustomData(WriteView view) { - super.writeCustomData(view); + public void addAdditionalSaveData(CompoundTag view) { + super.addAdditionalSaveData(view); view.putBoolean("ChestedTroll", this.hasChest()); if (this.hasChest()) { - WriteView.ListAppender listAppender = view.getListAppender("Items", StackWithSlot.CODEC); - - for(int i = 0; i < this.items.size(); ++i) { - ItemStack itemStack = this.items.getStack(i); + ListTag items = new ListTag(); + for(int i = 0; i < this.inventory.getContainerSize(); ++i) { + ItemStack itemStack = this.inventory.getItem(i); if (!itemStack.isEmpty()) { - listAppender.add(new StackWithSlot(i, itemStack)); + CompoundTag itemTag = new CompoundTag(); + itemTag.putByte("Slot", (byte)i); + itemStack.save(this.registryAccess(), itemTag); + items.add(itemTag); } } + view.put("Items", items); } } @Override - protected void readCustomData(ReadView view) { - super.readCustomData(view); - this.setHasChest(view.getBoolean("ChestedTroll", false)); - this.onChestedStatusChanged(); + public void readAdditionalSaveData(CompoundTag view) { + super.readAdditionalSaveData(view); + this.setHasChest(view.getBoolean("ChestedTroll")); + this.createInventory(); if (this.hasChest()) { - Iterator list = view.getTypedListView("Items", StackWithSlot.CODEC).iterator(); - - while(list.hasNext()) { - StackWithSlot stackWithSlot = (StackWithSlot)list.next(); - if (stackWithSlot.isValidSlot(this.items.size())) { - this.items.setStack(stackWithSlot.slot(), stackWithSlot.stack()); + ListTag items = view.getList("Items", Tag.TAG_COMPOUND); + for (int i = 0; i < items.size(); i++) { + CompoundTag itemTag = items.getCompound(i); + int slot = itemTag.getByte("Slot") & 255; + if (slot < this.inventory.getContainerSize()) { + ItemStack.parse(this.registryAccess(), itemTag) + .ifPresent(itemStack -> this.inventory.setItem(slot, itemStack)); } } } - /*if (nbt.contains("SaddleItem")) { - ItemStack itemStack = (ItemStack)ItemStack.fromNbt(this.getRegistryManager(), nbt.getCompound("SaddleItem").get()).orElse(ItemStack.EMPTY); - if (itemStack.isOf(Items.SADDLE)) { - this.items.setStack(0, itemStack); - } - }*/ - //this.updateSaddledFlag(); // TODO } @Override - public boolean tryAttack(ServerWorld world, Entity target) { + public boolean doHurtTarget(Entity target) { + ServerLevel world = (ServerLevel)this.level(); this.attackTicksLeft = ATTACK_COOLDOWN; - this.getWorld().sendEntityStatus(this, EntityStatuses.PLAY_ATTACK_SOUND); + this.level().broadcastEntityEvent(this, EntityEvent.START_ATTACKING); float f = this.getAttackDamage(); float g = (int)f > 0 ? f / 2.0f + (float)this.random.nextInt((int)f) : f; - boolean bl = target.damage(world, this.getDamageSources().mobAttack(this), g); + boolean bl = target.hurt(this.damageSources().mobAttack(this), g); if (bl) { double d; if (target instanceof LivingEntity) { LivingEntity livingEntity = (LivingEntity)target; - d = livingEntity.getAttributeValue(EntityAttributes.KNOCKBACK_RESISTANCE); + d = livingEntity.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE); } else { d = 0.0; } double e = Math.max(0.0, 1.0 - d); - target.setVelocity(target.getVelocity().multiply(1f + (0.8f * e))); //.add(0.0, (double)0.1f * e, 0.0)); + target.setDeltaMovement(target.getDeltaMovement().scale(1f + (0.8f * e))); //.add(0.0, (double)0.1f * e, 0.0)); } - this.playSound(SoundEvents.ENTITY_HOGLIN_ATTACK, 1.5f, 0.8f); + this.playSound(SoundEvents.HOGLIN_ATTACK, 1.5f, 0.8f); return bl; } @@ -261,11 +267,11 @@ public boolean canThrow() { } public void setThrowing(boolean throwing) { - this.dataTracker.set(THROWING, throwing); + this.entityData.set(THROWING, throwing); } public boolean isThrowing() { - return this.dataTracker.get(THROWING); + return this.entityData.get(THROWING); } @Override @@ -286,11 +292,11 @@ public void setBondingTimeout(int bondingTimeout) { } @Override - public void tryBonding(PlayerEntity player) { + public void tryBonding(Player player) { if(player.isCreative()) { tameBeast(player); - this.getWorld().sendEntityStatus(this, EntityStatuses.ADD_POSITIVE_PLAYER_REACTION_PARTICLES); + this.level().broadcastEntityEvent(this, EntityEvent.TAMING_SUCCEEDED); this.setChargeTimeout(0); } else if(this.getBondingTimeout() <= 0) { @@ -298,11 +304,11 @@ else if(this.getBondingTimeout() <= 0) { this.bondingTries++; if(bondingTries == 3) { tameBeast(player); - this.getWorld().sendEntityStatus(this, EntityStatuses.ADD_POSITIVE_PLAYER_REACTION_PARTICLES); + this.level().broadcastEntityEvent(this, EntityEvent.TAMING_SUCCEEDED); this.setChargeTimeout(0); } } - player.getStackInHand(player.getActiveHand()).decrement(1); + player.getItemInHand(player.getUsedItemHand()).shrink(1); this.setBondingTimeout(40); } @@ -310,54 +316,57 @@ else if(this.getBondingTimeout() <= 0) { public void throwAttack() { Entity target = this.getTarget(); - if(target instanceof PlayerEntity player) { - if(PlayerDataService.getPlayerDisposition(player, getWorld()) == this.getDisposition()){ + if(target instanceof Player player) { + if(PlayerDataService.getPlayerDisposition(player, level()) == this.getDisposition()){ return; } } - if(target != null && !this.getWorld().isClient) { + if(target != null && !this.level().isClientSide) { this.setThrowing(false); - Vec3d rotationVec = this.getRotationVec(1.0f); - BoulderEntity boulder = new BoulderEntity(EntitiesME.BOULDER, this.getWorld()); + Vec3 rotationVec = this.getViewVector(1.0f); + BoulderEntity boulder = new BoulderEntity(EntitiesME.BOULDER, this.level()); double x = target.getX() - this.getX(); - double y = target.getBodyY(0.3333333333333333) - boulder.getY(); + double y = target.getY(0.3333333333333333) - boulder.getY(); double z = target.getZ() - this.getZ(); double c = Math.sqrt(x * x + z * z); - boulder.setPosition(this.getX() + rotationVec.x * 2.0f, this.getBodyY(0.75f), boulder.getZ() + rotationVec.z * 2.0f); - boulder.setVelocity(x * 0.8d, y + c * 0.3d , z * 0.8d, 1.0f, 8 - this.getWorld().getDifficulty().getId() * 4); + boulder.setPos(this.getX() + rotationVec.x * 2.0f, this.getY(0.75f), boulder.getZ() + rotationVec.z * 2.0f); + boulder.shoot(x * 0.8d, y + c * 0.3d , z * 0.8d, 1.0f, 8 - this.level().getDifficulty().getId() * 4); if(boulder != null) { - this.getWorld().spawnEntity(boulder); + this.level().addFreshEntity(boulder); } } } @Override public void chargeAttack() { - List entities = this.getWorld().getOtherEntities(this, this.getBoundingBox().expand(0.2f, 0.0, 0.2f)); - - if(!this.isTame() && !this.getWorld().isClient) { - if(targetDir == Vec3d.ZERO && this.getTarget() != null) { - targetDir = new Vec3d( this.getTarget().getBlockPos().getX() - this.getBlockPos().getX(), - this.getTarget().getBlockPos().getY() - this.getBlockPos().getY(), - this.getTarget().getBlockPos().getZ() - this.getBlockPos().getZ()); + if(!this.isTamed() && !this.level().isClientSide) { + if(targetDir == Vec3.ZERO && this.getTarget() != null) { + targetDir = new Vec3( this.getTarget().blockPosition().getX() - this.blockPosition().getX(), + this.getTarget().blockPosition().getY() - this.blockPosition().getY(), + this.getTarget().blockPosition().getZ() - this.blockPosition().getZ()); } - this.setYaw((float) Math.toDegrees(Math.atan2(-targetDir.x, targetDir.z))); - this.setVelocity(targetDir.multiply(1,0,1).normalize().multiply(1.0d - ((double)(this.chargeTimeout - (maxChargeCooldown() - chargeDuration())) / chargeDuration())).add(0, this.getVelocity().y, 0)); + this.setYRot((float) Math.toDegrees(Math.atan2(-targetDir.x, targetDir.z))); + this.setDeltaMovement(targetDir.multiply(1,0,1).normalize().scale(1.0d - ((double)(this.chargeTimeout - (maxChargeCooldown() - chargeDuration())) / chargeDuration())).add(0, this.getDeltaMovement().y, 0)); } - else if (this.getWorld().isClient) { - this.setVelocity(this.getRotationVector().multiply(1,0,1).normalize().multiply(1.0d - ((double)(this.chargeTimeout - (maxChargeCooldown() - chargeDuration())) / chargeDuration())).add(0, this.getVelocity().y, 0)); + else if (this.level().isClientSide) { + this.setDeltaMovement(this.getLookAngle().multiply(1,0,1).normalize().scale(1.0d - ((double)(this.chargeTimeout - (maxChargeCooldown() - chargeDuration())) / chargeDuration())).add(0, this.getDeltaMovement().y, 0)); } - for(Entity entity : entities) { - if(entity != this.getOwner() && entity != this && !this.getPassengerList().contains(entity)) { - if(getWorld() instanceof ServerWorld serverWorld) - entity.damage(serverWorld, entity.getDamageSources().mobAttack(this), 16.0f); + if (this.level() instanceof ServerLevel serverLevel) { + Entity owner = this.getOwner(); + List entities = serverLevel.getEntities( + this, + this.getBoundingBox().inflate(0.2f, 0.0, 0.2f), + entity -> entity != owner && !this.getPassengers().contains(entity) + ); + for(Entity entity : entities) { + entity.hurt(entity.damageSources().mobAttack(this), 16.0f); } } - this.getWorld().addParticleClient(ParticleTypes.EXPLOSION, this.getX(), this.getY(), this.getZ(), 0, 0, 0); - this.chargeAnimationState.startIfNotRunning(this.age); + this.level().addParticle(ParticleTypes.EXPLOSION, this.getX(), this.getY(), this.getZ(), 0, 0, 0); + this.chargeAnimationState.startIfStopped(this.tickCount); } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/TrollEntityRenderState.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/TrollEntityRenderState.java deleted file mode 100644 index 30d1dea72a..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/TrollEntityRenderState.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.sevenstars.middleearth.entity.beasts.trolls; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.entity.state.LivingEntityRenderState; -import net.minecraft.entity.AnimationState; - -@Environment(EnvType.CLIENT) -public class TrollEntityRenderState extends LivingEntityRenderState { - public AnimationState attackAnimationState = new AnimationState(); - public AnimationState chargeAnimationState = new AnimationState(); - public AnimationState throwingAnimationState = new AnimationState(); - - -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/petrified/PetrifiedTrollEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/petrified/PetrifiedTrollEntity.java index 48ee84f0cc..9bde6d440d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/petrified/PetrifiedTrollEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/petrified/PetrifiedTrollEntity.java @@ -1,41 +1,36 @@ package net.sevenstars.middleearth.entity.beasts.trolls.petrified; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.attribute.DefaultAttributeContainer; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.mob.MobEntity; -import net.minecraft.entity.passive.AnimalEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundEvent; -import net.minecraft.sound.SoundEvents; -import net.minecraft.util.Identifier; -import net.minecraft.world.World; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.item.items.CustomSpawnEggItem; import org.jetbrains.annotations.Nullable; -public class PetrifiedTrollEntity extends MobEntity { +public class PetrifiedTrollEntity extends Mob { - public PetrifiedTrollEntity(EntityType entityType, World world) { + public PetrifiedTrollEntity(EntityType entityType, Level world) { super(entityType, world); - this.setAiDisabled(true); + this.setNoAi(true); } - public static DefaultAttributeContainer.Builder setAttributes() { - return AnimalEntity.createAnimalAttributes() - .add(EntityAttributes.MAX_HEALTH, 30.0); + public static AttributeSupplier.Builder setAttributes() { + return Mob.createMobAttributes() + .add(Attributes.MAX_HEALTH, 30.0); } @Override public void tick() { super.tick(); - this.setBodyYaw(this.getYaw()); + this.setYBodyRot(this.getYRot()); } @Override @@ -44,32 +39,29 @@ public boolean canBeLeashed() { } @Override - public boolean damage(ServerWorld world, DamageSource source, float amount) { - if (this.getWorld().isClient) return false; - Entity entity = source.getAttacker(); - if(entity instanceof PlayerEntity playerEntity) { + public boolean hurt(DamageSource source, float amount) { + if (this.level().isClientSide) return false; + Entity entity = source.getEntity(); + if(entity instanceof Player playerEntity) { if(playerEntity.isCreative()) { super.setHealth(0); return true; } - ItemStack itemStack = playerEntity.getMainHandStack(); - if(itemStack.getComponents().contains(DataComponentTypes.TOOL) && !this.getWorld().isClient) { - TagKey tagKey = TagKey.of(RegistryKeys.ITEM, Identifier.of("pickaxes")); - if(itemStack.isIn(tagKey)) { - return super.damage(world, source, 10.0f); - } + ItemStack itemStack = playerEntity.getMainHandItem(); + if(itemStack.is(ItemTags.PICKAXES)) { + return super.hurt(source, 10.0f); } } return false; } @Override - public void onDamaged(DamageSource damageSource) { + public void handleDamageEvent(DamageSource damageSource) { } @Override @Nullable - public ItemStack getPickBlockStack() { + public ItemStack getPickResult() { CustomSpawnEggItem statue = CustomSpawnEggItem.forEntity(this.getType()); if (statue == null) { return null; @@ -80,12 +72,12 @@ public ItemStack getPickBlockStack() { @Nullable @Override protected SoundEvent getHurtSound(DamageSource source) { - return SoundEvents.BLOCK_STONE_BREAK; + return SoundEvents.STONE_BREAK; } @Nullable @Override protected SoundEvent getDeathSound() { - return SoundEvents.BLOCK_STONE_BREAK; + return SoundEvents.STONE_BREAK; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/petrified/PetrifiedTrollModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/petrified/PetrifiedTrollModel.java index 170895694b..7213bac308 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/petrified/PetrifiedTrollModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/petrified/PetrifiedTrollModel.java @@ -1,81 +1,89 @@ package net.sevenstars.middleearth.entity.beasts.trolls.petrified; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.render.entity.state.LivingEntityRenderState; -import net.minecraft.util.math.MathHelper; - -public class PetrifiedTrollModel extends EntityModel { +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.util.Mth; + +public class PetrifiedTrollModel extends HierarchicalModel { private final ModelPart r; private final ModelPart head; public PetrifiedTrollModel(ModelPart root) { - super(root); - this.r = root.getChild("r"); this.head = r.getChild("upperbody").getChild("upperbodynoarms").getChild("head"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData r = modelPartData.addChild("r", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 26.0F, 0.0F)); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition r = modelPartData.addOrReplaceChild("r", CubeListBuilder.create(), PartPose.offset(0.0F, 26.0F, 0.0F)); - ModelPartData upperBody = r.addChild("upperbody", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -20.0F, 1.0F)); + PartDefinition upperBody = r.addOrReplaceChild("upperbody", CubeListBuilder.create(), PartPose.offset(0.0F, -20.0F, 1.0F)); - ModelPartData arms = upperBody.addChild("arms", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 20.0F, -1.0F)); + PartDefinition arms = upperBody.addOrReplaceChild("arms", CubeListBuilder.create(), PartPose.offset(0.0F, 20.0F, -1.0F)); - ModelPartData rightarm = arms.addChild("rightarm", ModelPartBuilder.create().uv(28, 82).cuboid(-5.0F, -2.0F, -4.0F, 6.0F, 36.0F, 8.0F, new Dilation(0.2F)) - .uv(84, 96).cuboid(-5.0F, -2.0F, -4.0F, 6.0F, 36.0F, 8.0F, new Dilation(0.0F)), ModelTransform.origin(-14.0F, -46.0F, 2.0F)); + PartDefinition rightarm = arms.addOrReplaceChild("rightarm", CubeListBuilder.create().texOffs(28, 82).addBox(-5.0F, -2.0F, -4.0F, 6.0F, 36.0F, 8.0F, new CubeDeformation(0.2F)) + .texOffs(84, 96).addBox(-5.0F, -2.0F, -4.0F, 6.0F, 36.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(-14.0F, -46.0F, 2.0F)); - ModelPartData leftArm = arms.addChild("leftarm", ModelPartBuilder.create().uv(0, 82).mirrored().cuboid(-3.0F, -2.0F, -4.0F, 6.0F, 36.0F, 8.0F, new Dilation(0.2F)) - .uv(56, 96).mirrored().cuboid(-3.0F, -2.0F, -4.0F, 6.0F, 36.0F, 8.0F, new Dilation(0.0F)), ModelTransform.origin(15.0F, -46.0F, 2.0F)); + PartDefinition leftArm = arms.addOrReplaceChild("leftarm", CubeListBuilder.create().texOffs(0, 82).mirror().addBox(-3.0F, -2.0F, -4.0F, 6.0F, 36.0F, 8.0F, new CubeDeformation(0.2F)) + .texOffs(56, 96).mirror().addBox(-3.0F, -2.0F, -4.0F, 6.0F, 36.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(15.0F, -46.0F, 2.0F)); - ModelPartData upperBodyNoArms = upperBody.addChild("upperbodynoarms", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -2.0F, -1.0F)); + PartDefinition upperBodyNoArms = upperBody.addOrReplaceChild("upperbodynoarms", CubeListBuilder.create(), PartPose.offset(0.0F, -2.0F, -1.0F)); - ModelPartData head = upperBodyNoArms.addChild("head", ModelPartBuilder.create().uv(74, 0).cuboid(-6.5F, -9.6306F, -6.7491F, 13.0F, 14.0F, 12.0F, new Dilation(0.0F)) - .uv(62, 70).cuboid(-6.5F, -9.6306F, -6.7491F, 13.0F, 14.0F, 12.0F, new Dilation(0.2F)) - .uv(0, 0).mirrored().cuboid(6.4F, -5.6306F, -1.7491F, 4.0F, 4.0F, 1.0F, new Dilation(0.0F)).mirrored(false) - .uv(0, 5).cuboid(-10.4F, -5.6306F, -1.7491F, 4.0F, 4.0F, 1.0F, new Dilation(0.0F)), ModelTransform.origin(-0.5F, -27.3694F, -1.2509F)); + PartDefinition head = upperBodyNoArms.addOrReplaceChild("head", CubeListBuilder.create().texOffs(74, 0).addBox(-6.5F, -9.6306F, -6.7491F, 13.0F, 14.0F, 12.0F, new CubeDeformation(0.0F)) + .texOffs(62, 70).addBox(-6.5F, -9.6306F, -6.7491F, 13.0F, 14.0F, 12.0F, new CubeDeformation(0.2F)) + .texOffs(0, 0).mirror().addBox(6.4F, -5.6306F, -1.7491F, 4.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(0, 5).addBox(-10.4F, -5.6306F, -1.7491F, 4.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(-0.5F, -27.3694F, -1.2509F)); - ModelPartData nose = head.addChild("nose", ModelPartBuilder.create().uv(62, 0).cuboid(-2.5F, -1.5F, -3.0F, 5.0F, 5.0F, 4.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, -3.1306F, -4.7491F, -0.3054F, 0.0F, 0.0F)); + PartDefinition nose = head.addOrReplaceChild("nose", CubeListBuilder.create().texOffs(62, 0).addBox(-2.5F, -1.5F, -3.0F, 5.0F, 5.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -3.1306F, -4.7491F, -0.3054F, 0.0F, 0.0F)); - ModelPartData jaw = head.addChild("Jaw", ModelPartBuilder.create().uv(126, 29).cuboid(-4.5F, -2.0F, -4.0F, 9.0F, 4.0F, 4.0F, new Dilation(0.3F)), ModelTransform.origin(0.0F, 3.3694F, -2.7491F)); + PartDefinition jaw = head.addOrReplaceChild("Jaw", CubeListBuilder.create().texOffs(126, 29).addBox(-4.5F, -2.0F, -4.0F, 9.0F, 4.0F, 4.0F, new CubeDeformation(0.3F)), PartPose.offset(0.0F, 3.3694F, -2.7491F)); - ModelPartData hair = head.addChild("hair", ModelPartBuilder.create().uv(192, 158).cuboid(-33.0F, -55.2728F, -0.4462F, 13.0F, 19.0F, 12.0F, new Dilation(0.1F)), ModelTransform.origin(26.5F, 51.3694F, -5.7491F)); + PartDefinition hair = head.addOrReplaceChild("hair", CubeListBuilder.create().texOffs(192, 158).addBox(-33.0F, -55.2728F, -0.4462F, 13.0F, 19.0F, 12.0F, new CubeDeformation(0.1F)), PartPose.offset(26.5F, 51.3694F, -5.7491F)); - ModelPartData hair1 = hair.addChild("hair1", ModelPartBuilder.create().uv(204, 105).cuboid(-6.3F, -22.2272F, -5.9945F, 13.0F, 19.0F, 12.0F, new Dilation(0.1F)), ModelTransform.of(-26.7F, -37.5249F, 16.9945F, 0.5236F, 0.0F, 0.0F)); + PartDefinition hair1 = hair.addOrReplaceChild("hair1", CubeListBuilder.create().texOffs(204, 105).addBox(-6.3F, -22.2272F, -5.9945F, 13.0F, 19.0F, 12.0F, new CubeDeformation(0.1F)), PartPose.offsetAndRotation(-26.7F, -37.5249F, 16.9945F, 0.5236F, 0.0F, 0.0F)); - ModelPartData torso = upperBodyNoArms.addChild("torso", ModelPartBuilder.create().uv(0, 41).cuboid(-13.0F, -50.0F, -4.0F, 25.0F, 29.0F, 12.0F, new Dilation(0.0F)) - .uv(0, 0).cuboid(-13.0F, -50.0F, -4.0F, 25.0F, 29.0F, 12.0F, new Dilation(0.2F)), ModelTransform.origin(0.0F, 22.0F, 0.0F)); + PartDefinition torso = upperBodyNoArms.addOrReplaceChild("torso", CubeListBuilder.create().texOffs(0, 41).addBox(-13.0F, -50.0F, -4.0F, 25.0F, 29.0F, 12.0F, new CubeDeformation(0.0F)) + .texOffs(0, 0).addBox(-13.0F, -50.0F, -4.0F, 25.0F, 29.0F, 12.0F, new CubeDeformation(0.2F)), PartPose.offset(0.0F, 22.0F, 0.0F)); - ModelPartData frontloin = torso.addChild("frontloin", ModelPartBuilder.create().uv(74, 48).cuboid(-12.5F, -1.5F, -0.5F, 25.0F, 21.0F, 1.0F, new Dilation(0.3F)), ModelTransform.origin(-0.5F, -26.5F, -3.504F)); + PartDefinition frontloin = torso.addOrReplaceChild("frontloin", CubeListBuilder.create().texOffs(74, 48).addBox(-12.5F, -1.5F, -0.5F, 25.0F, 21.0F, 1.0F, new CubeDeformation(0.3F)), PartPose.offset(-0.5F, -26.5F, -3.504F)); - ModelPartData backloin = torso.addChild("backloin", ModelPartBuilder.create().uv(74, 26).cuboid(-12.5F, -1.5F, -0.5F, 25.0F, 21.0F, 1.0F, new Dilation(0.3F)), ModelTransform.origin(-0.5F, -26.5F, 7.85F)); + PartDefinition backloin = torso.addOrReplaceChild("backloin", CubeListBuilder.create().texOffs(74, 26).addBox(-12.5F, -1.5F, -0.5F, 25.0F, 21.0F, 1.0F, new CubeDeformation(0.3F)), PartPose.offset(-0.5F, -26.5F, 7.85F)); - ModelPartData bodyNoArms = upperBodyNoArms.addChild("bodynoarmswithlegs", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -11.0F, 0.0F)); + PartDefinition bodyNoArms = upperBodyNoArms.addOrReplaceChild("bodynoarmswithlegs", CubeListBuilder.create(), PartPose.offset(0.0F, -11.0F, 0.0F)); - ModelPartData legs = r.addChild("legs", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition legs = r.addOrReplaceChild("legs", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData rightleg = legs.addChild("rightleg", ModelPartBuilder.create().uv(126, 0).cuboid(-5.0F, 0.5F, -5.0F, 10.0F, 19.0F, 10.0F, new Dilation(0.0F)) - .uv(112, 99).cuboid(-5.0F, 0.5F, -5.0F, 10.0F, 19.0F, 10.0F, new Dilation(0.2F)), ModelTransform.origin(-7.0F, -21.5F, 2.0F)); + PartDefinition rightleg = legs.addOrReplaceChild("rightleg", CubeListBuilder.create().texOffs(126, 0).addBox(-5.0F, 0.5F, -5.0F, 10.0F, 19.0F, 10.0F, new CubeDeformation(0.0F)) + .texOffs(112, 99).addBox(-5.0F, 0.5F, -5.0F, 10.0F, 19.0F, 10.0F, new CubeDeformation(0.2F)), PartPose.offset(-7.0F, -21.5F, 2.0F)); - ModelPartData leftleg = legs.addChild("leftleg", ModelPartBuilder.create().uv(0, 126).cuboid(-5.0F, 0.5F, -5.0F, 10.0F, 19.0F, 10.0F, new Dilation(0.0F)) - .uv(112, 70).cuboid(-5.0F, 0.5F, -5.0F, 10.0F, 19.0F, 10.0F, new Dilation(0.2F)), ModelTransform.origin(6.0F, -21.5F, 2.0F)); + PartDefinition leftleg = legs.addOrReplaceChild("leftleg", CubeListBuilder.create().texOffs(0, 126).addBox(-5.0F, 0.5F, -5.0F, 10.0F, 19.0F, 10.0F, new CubeDeformation(0.0F)) + .texOffs(112, 70).addBox(-5.0F, 0.5F, -5.0F, 10.0F, 19.0F, 10.0F, new CubeDeformation(0.2F)), PartPose.offset(6.0F, -21.5F, 2.0F)); - return TexturedModelData.of(modelData, 256, 256); + return LayerDefinition.create(modelData, 256, 256); } @Override - public void setAngles(LivingEntityRenderState state) { - super.setAngles(state); - - this.setHeadAngles(state.relativeHeadYaw, state.pitch); + public void setupAnim(PetrifiedTrollEntity entity, float limbSwing, float limbSwingAmount, + float ageInTicks, float netHeadYaw, float headPitch) { + this.root().getAllParts().forEach(ModelPart::resetPose); + this.setHeadAngles(netHeadYaw, headPitch); } private void setHeadAngles(float headYaw, float headPitch) { - headYaw = MathHelper.clamp(headYaw, -30.0F, 30.0F); - headPitch = MathHelper.clamp(headPitch, -25.0F, 40.0F); + headYaw = Mth.clamp(headYaw, -30.0F, 30.0F); + headPitch = Mth.clamp(headPitch, -25.0F, 40.0F); - this.head.yaw = headYaw * 0.017453292F; - this.head.pitch = headPitch * 0.017453292F; + this.head.yRot = headYaw * 0.017453292F; + this.head.xRot = headPitch * 0.017453292F; + } + + @Override + public ModelPart root() { + return this.r; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/petrified/PetrifiedTrollRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/petrified/PetrifiedTrollRenderer.java index 9e97907f36..e3859aa5dc 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/petrified/PetrifiedTrollRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/petrified/PetrifiedTrollRenderer.java @@ -1,27 +1,20 @@ package net.sevenstars.middleearth.entity.beasts.trolls.petrified; -import net.minecraft.client.render.entity.state.LivingEntityRenderState; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.MobRenderer; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.MobEntityRenderer; -import net.minecraft.util.Identifier; -import net.sevenstars.middleearth.entity.beasts.trolls.TrollEntityRenderState; -public class PetrifiedTrollRenderer extends MobEntityRenderer { +public class PetrifiedTrollRenderer extends MobRenderer { private static final String PATH = "textures/entities/trolls/stone/"; - public PetrifiedTrollRenderer(EntityRendererFactory.Context ctx) { - super(ctx, new PetrifiedTrollModel(ctx.getPart(EntityModelLayersME.PETRIFIED_TROLL)), 0.0f); + public PetrifiedTrollRenderer(EntityRendererProvider.Context ctx) { + super(ctx, new PetrifiedTrollModel(ctx.bakeLayer(EntityModelLayersME.PETRIFIED_TROLL)), 0.0f); } @Override - public LivingEntityRenderState createRenderState() { - return new TrollEntityRenderState(); - } - - @Override - public Identifier getTexture(LivingEntityRenderState state) { - return Identifier.of(MiddleEarth.MOD_ID, PATH + "petrified_stone_troll.png"); + public ResourceLocation getTextureLocation(PetrifiedTrollEntity entity) { + return ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "petrified_stone_troll.png"); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/snow/SnowTrollAnimations.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/snow/SnowTrollAnimations.java index 9379c1b431..61e5fe8303 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/snow/SnowTrollAnimations.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/snow/SnowTrollAnimations.java @@ -1,403 +1,406 @@ package net.sevenstars.middleearth.entity.beasts.trolls.snow; -import net.minecraft.client.render.entity.animation.*; +import net.minecraft.client.animation.AnimationChannel; +import net.minecraft.client.animation.AnimationDefinition; +import net.minecraft.client.animation.Keyframe; +import net.minecraft.client.animation.KeyframeAnimations; public class SnowTrollAnimations { - public static final AnimationDefinition ROAR = AnimationDefinition.Builder.create(2.5f) - .addBoneAnimation("right_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(52.5f, -13.12f, 21.47f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(115f, -13.12f, 21.47f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createTranslationalVector(0f, 0f, -1f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(57.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(57.5f, -10f, -4.98f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.0416767f, AnimationHelper.createRotationalVector(57.5f, 10f, 5.02f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(57.5f, -10f, -4.98f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.625f, AnimationHelper.createRotationalVector(57.5f, 10f, 5.02f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.9167667f, AnimationHelper.createRotationalVector(57.5f, -10f, -4.98f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.0416767f, AnimationHelper.createRotationalVector(37.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(0f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("torso", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-67.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(-45.01f, -0.65f, 2.41f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.0416767f, AnimationHelper.createRotationalVector(-45.01f, 0.65f, -2.41f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(-45.01f, -0.65f, 2.41f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.625f, AnimationHelper.createRotationalVector(-45.01f, 0.65f, -2.41f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.9167667f, AnimationHelper.createRotationalVector(-45.01f, -0.65f, 2.41f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("roots", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(50.26f, 11.25f, -22.47f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(112.76f, 11.25f, -22.47f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition WALKING = AnimationDefinition.Builder.create(1f).looping() - .addBoneAnimation("right_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-15f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(25f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-15f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.25f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(25f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-15f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(25f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("torso", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -2.5f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 2.5f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -2.5f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("right_arm", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.375f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(37.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-12.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(37.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_arm", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.875f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-10f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(37.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-10f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.4167667f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition CHARGING = AnimationDefinition.Builder.create(1f).looping() - .addBoneAnimation("right_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.375f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(42.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.375f, AnimationHelper.createRotationalVector(-35f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(42.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_leg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(37.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(-35f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(37.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("torso", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.375f, AnimationHelper.createTranslationalVector(0f, -2f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("torso", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-2.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.375f, AnimationHelper.createRotationalVector(2.48f, 2.22f, -1.15f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0.45f, -3.02f, 1.77f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-2.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_arm", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.875f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-22.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.375f, AnimationHelper.createRotationalVector(40f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-22.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_arm", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.875f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-17.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(42.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-17.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(15f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.4167667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(15f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition THROWING = AnimationDefinition.Builder.create(3.5f) - .addBoneAnimation("torso", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.2916767f, AnimationHelper.createRotationalVector(-20f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(-60f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-75f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(-47.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(-72.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(-57.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(3.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(65f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(60f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(52.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(3.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(32.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(3.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(46.98f, 5.25f, -11.36f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(15.25f, -1.94f, -14.88f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(-118.47f, -9.58f, 11.6f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(-108.18f, -9.54f, 8.11f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.9583433f, AnimationHelper.createRotationalVector(-15.74f, -8.68f, 0.79f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.25f, AnimationHelper.createRotationalVector(112.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(75f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(3.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(51.94f, -5.74f, 11.13f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(15.33f, 2.58f, 14.78f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(-118.45f, 9.07f, -12f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(-108.19f, 9.18f, -8.52f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.9583433f, AnimationHelper.createRotationalVector(-11.58f, 8.35f, -0.94f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.25f, AnimationHelper.createRotationalVector(122.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(72.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(3.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition ATTACK = AnimationDefinition.Builder.create(1.25f) - .addBoneAnimation("torso", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(-45f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(33.7f, -4.86f, -8.75f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(50.01f, 0.43f, 2.46f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(-36.9f, 10.8f, 6.33f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(-36.9f, -10.8f, -6.33f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); + public static final AnimationDefinition ROAR = AnimationDefinition.Builder.withLength(2.5f) + .addAnimation("right_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(52.5f, -13.12f, 21.47f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(115f, -13.12f, 21.47f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.posVec(0f, 0f, -1f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(57.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(57.5f, -10f, -4.98f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.0416767f, KeyframeAnimations.degreeVec(57.5f, 10f, 5.02f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(57.5f, -10f, -4.98f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.625f, KeyframeAnimations.degreeVec(57.5f, 10f, 5.02f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9167667f, KeyframeAnimations.degreeVec(57.5f, -10f, -4.98f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.0416767f, KeyframeAnimations.degreeVec(37.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(0f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("torso", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-67.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(-45.01f, -0.65f, 2.41f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.0416767f, KeyframeAnimations.degreeVec(-45.01f, 0.65f, -2.41f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(-45.01f, -0.65f, 2.41f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.625f, KeyframeAnimations.degreeVec(-45.01f, 0.65f, -2.41f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9167667f, KeyframeAnimations.degreeVec(-45.01f, -0.65f, 2.41f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("roots", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(50.26f, 11.25f, -22.47f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(112.76f, 11.25f, -22.47f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition WALKING = AnimationDefinition.Builder.withLength(1f).looping() + .addAnimation("right_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-15f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(25f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-15f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(25f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-15f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(25f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("torso", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -2.5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 2.5f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -2.5f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("right_arm", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.375f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, -1f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(37.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-12.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(37.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_arm", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.875f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-10f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(37.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-10f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.4167667f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition CHARGING = AnimationDefinition.Builder.withLength(1f).looping() + .addAnimation("right_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.375f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(42.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.375f, KeyframeAnimations.degreeVec(-35f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(42.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_leg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(37.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(-35f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(37.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("torso", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.375f, KeyframeAnimations.posVec(0f, -2f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("torso", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-2.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.375f, KeyframeAnimations.degreeVec(2.48f, 2.22f, -1.15f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0.45f, -3.02f, 1.77f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-2.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_arm", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.875f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-22.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.375f, KeyframeAnimations.degreeVec(40f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-22.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_arm", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.875f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-17.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(42.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-17.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(15f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.4167667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(15f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition THROWING = AnimationDefinition.Builder.withLength(3.5f) + .addAnimation("torso", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.2916767f, KeyframeAnimations.degreeVec(-20f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(-60f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-75f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(-47.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(-72.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(-57.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(65f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(60f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(52.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(32.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(46.98f, 5.25f, -11.36f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(15.25f, -1.94f, -14.88f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(-118.47f, -9.58f, 11.6f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(-108.18f, -9.54f, 8.11f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9583433f, KeyframeAnimations.degreeVec(-15.74f, -8.68f, 0.79f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.25f, KeyframeAnimations.degreeVec(112.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(75f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(51.94f, -5.74f, 11.13f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(15.33f, 2.58f, 14.78f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(-118.45f, 9.07f, -12f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(-108.19f, 9.18f, -8.52f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9583433f, KeyframeAnimations.degreeVec(-11.58f, 8.35f, -0.94f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.25f, KeyframeAnimations.degreeVec(122.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(72.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition ATTACK = AnimationDefinition.Builder.withLength(1.25f) + .addAnimation("torso", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(-45f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(33.7f, -4.86f, -8.75f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(50.01f, 0.43f, 2.46f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(-36.9f, 10.8f, 6.33f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(-36.9f, -10.8f, -6.33f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/snow/SnowTrollEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/snow/SnowTrollEntity.java index d5ac09e925..f3a245e50b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/snow/SnowTrollEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/snow/SnowTrollEntity.java @@ -1,48 +1,55 @@ package net.sevenstars.middleearth.entity.beasts.trolls.snow; import net.sevenstars.middleearth.entity.beasts.trolls.TrollEntity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.ai.goal.*; -import net.minecraft.entity.attribute.DefaultAttributeContainer; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.entity.passive.AnimalEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.goal.FloatGoal; +import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; +import net.minecraft.world.entity.ai.goal.MeleeAttackGoal; +import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; +import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; +import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; +import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; +import net.minecraft.world.entity.animal.Animal; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.entity.goals.ChargeAttackGoal; import net.sevenstars.middleearth.entity.goals.TargetPlayerGoal; import net.sevenstars.middleearth.entity.npcs.NpcEntity; public class SnowTrollEntity extends TrollEntity { - public SnowTrollEntity(EntityType entityType, World world) { + public SnowTrollEntity(EntityType entityType, Level world) { super(entityType, world); } - public static DefaultAttributeContainer.Builder setAttributes() { - return AnimalEntity.createAnimalAttributes() - .add(EntityAttributes.MOVEMENT_SPEED, 0.35f) - .add(EntityAttributes.MAX_HEALTH, 180.0) - .add(EntityAttributes.KNOCKBACK_RESISTANCE, 0.8) - .add(EntityAttributes.ATTACK_SPEED, 0.65) - .add(EntityAttributes.FOLLOW_RANGE, 28.0) - .add(EntityAttributes.ATTACK_DAMAGE, 14.0) - .add(EntityAttributes.STEP_HEIGHT, 1.25) - .add(EntityAttributes.JUMP_STRENGTH, 0.0); + public static AttributeSupplier.Builder setAttributes() { + return Mob.createMobAttributes() + .add(Attributes.MOVEMENT_SPEED, 0.35f) + .add(Attributes.MAX_HEALTH, 180.0) + .add(Attributes.KNOCKBACK_RESISTANCE, 0.8) + .add(Attributes.ATTACK_SPEED, 0.65) + .add(Attributes.FOLLOW_RANGE, 28.0) + .add(Attributes.ATTACK_DAMAGE, 14.0) + .add(Attributes.STEP_HEIGHT, 1.25) + .add(Attributes.JUMP_STRENGTH, 0.0); } @Override - protected void initGoals() { - this.goalSelector.add(1, new SwimGoal(this)); - this.goalSelector.add(2, new MeleeAttackGoal(this, 0.9f, false)); - this.goalSelector.add(3, new ChargeAttackGoal(this, null, maxChargeCooldown())); - this.goalSelector.add(4, new WanderAroundFarGoal(this, 1.0)); - this.goalSelector.add(5, new LookAtEntityGoal(this, PlayerEntity.class, 6.0f)); - this.goalSelector.add(6, new LookAroundGoal(this)); - this.targetSelector.add(1, new RevengeGoal(this, new Class[0])); - this.targetSelector.add(2, new TargetPlayerGoal(this)); - this.targetSelector.add(3, new ActiveTargetGoal<>(this, PlayerEntity.class, true)); - this.targetSelector.add(4, new ActiveTargetGoal<>(this, NpcEntity.class, true)); - this.targetSelector.add(5, new ActiveTargetGoal<>(this, AnimalEntity.class, true)); + protected void registerGoals() { + this.goalSelector.addGoal(1, new FloatGoal(this)); + this.goalSelector.addGoal(2, new MeleeAttackGoal(this, 0.9f, false)); + this.goalSelector.addGoal(3, new ChargeAttackGoal(this, null, maxChargeCooldown())); + this.goalSelector.addGoal(4, new WaterAvoidingRandomStrollGoal(this, 1.0)); + this.goalSelector.addGoal(5, new LookAtPlayerGoal(this, Player.class, 6.0f)); + this.goalSelector.addGoal(6, new RandomLookAroundGoal(this)); + this.targetSelector.addGoal(1, new HurtByTargetGoal(this, new Class[0])); + this.targetSelector.addGoal(2, new TargetPlayerGoal(this)); + this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Player.class, true)); + this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, NpcEntity.class, true)); + this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Animal.class, true)); } @Override diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/snow/SnowTrollModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/snow/SnowTrollModel.java index 5c15bef40b..ce9f9eb171 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/snow/SnowTrollModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/snow/SnowTrollModel.java @@ -1,93 +1,85 @@ package net.sevenstars.middleearth.entity.beasts.trolls.snow; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.animation.Animation; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.util.math.MathHelper; -import net.sevenstars.middleearth.entity.beasts.trolls.TrollEntityRenderState; -import net.sevenstars.middleearth.entity.beasts.trolls.stone.StoneTrollAnimations; - -@Environment(value= EnvType.CLIENT) -public class SnowTrollModel extends EntityModel { +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.util.Mth; +public class SnowTrollModel extends HierarchicalModel { private final ModelPart troll; private final ModelPart head; - private final Animation walkingAnimation; - private final Animation attackinggAnimation; - private final Animation chargingAnimation; - private final Animation throwingAnimation; - public SnowTrollModel(ModelPart root) { - super(root); - this.troll = root.getChild("roots"); this.head = troll.getChild("torso").getChild("head"); - - this.walkingAnimation = SnowTrollAnimations.WALKING.createAnimation(root); - this.attackinggAnimation = SnowTrollAnimations.ATTACK.createAnimation(root); - this.chargingAnimation = SnowTrollAnimations.CHARGING.createAnimation(root); - this.throwingAnimation = SnowTrollAnimations.THROWING.createAnimation(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData roots = modelPartData.addChild("roots", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 26.0F, 0.0F)); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition roots = modelPartData.addOrReplaceChild("roots", CubeListBuilder.create(), PartPose.offset(0.0F, 26.0F, 0.0F)); - ModelPartData legs = roots.addChild("legs", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition legs = roots.addOrReplaceChild("legs", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData right_leg = legs.addChild("right_leg", ModelPartBuilder.create().uv(126, 98).mirrored().cuboid(-4.0F, 1.0F, -5.0F, 10.0F, 19.0F, 10.0F, new Dilation(0.0F)).mirrored(false) - .uv(118, 69).cuboid(-4.0F, 1.0F, -5.0F, 10.0F, 19.0F, 10.0F, new Dilation(0.2F)), ModelTransform.origin(-8.0F, -22.0F, 5.0F)); + PartDefinition right_leg = legs.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(126, 98).mirror().addBox(-4.0F, 1.0F, -5.0F, 10.0F, 19.0F, 10.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(118, 69).addBox(-4.0F, 1.0F, -5.0F, 10.0F, 19.0F, 10.0F, new CubeDeformation(0.2F)), PartPose.offset(-8.0F, -22.0F, 5.0F)); - ModelPartData left_leg = legs.addChild("left_leg", ModelPartBuilder.create().uv(122, 0).cuboid(-6.0F, 0.9848F, -4.8264F, 10.0F, 19.0F, 10.0F, new Dilation(0.0F)) - .uv(100, 40).cuboid(-6.0F, 0.9848F, -4.8264F, 10.0F, 19.0F, 10.0F, new Dilation(0.2F)), ModelTransform.origin(7.0F, -22.0F, 5.0F)); + PartDefinition left_leg = legs.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(122, 0).addBox(-6.0F, 0.9848F, -4.8264F, 10.0F, 19.0F, 10.0F, new CubeDeformation(0.0F)) + .texOffs(100, 40).addBox(-6.0F, 0.9848F, -4.8264F, 10.0F, 19.0F, 10.0F, new CubeDeformation(0.2F)), PartPose.offset(7.0F, -22.0F, 5.0F)); - ModelPartData torso = roots.addChild("torso", ModelPartBuilder.create().uv(0, 41).cuboid(-12.5F, -28.5F, -6.0865F, 25.0F, 29.0F, 12.0F, new Dilation(0.0F)) - .uv(0, 0).cuboid(-12.5F, -28.5F, -6.0865F, 25.0F, 29.0F, 12.0F, new Dilation(0.2F)) - .uv(74, 0).cuboid(-5.5F, -29.5F, -2.0905F, 11.0F, 27.0F, 13.0F, new Dilation(0.0F)), ModelTransform.of(-0.5F, -21.5F, 5.0865F, 1.0472F, 0.0F, 0.0F)); + PartDefinition torso = roots.addOrReplaceChild("torso", CubeListBuilder.create().texOffs(0, 41).addBox(-12.5F, -28.5F, -6.0865F, 25.0F, 29.0F, 12.0F, new CubeDeformation(0.0F)) + .texOffs(0, 0).addBox(-12.5F, -28.5F, -6.0865F, 25.0F, 29.0F, 12.0F, new CubeDeformation(0.2F)) + .texOffs(74, 0).addBox(-5.5F, -29.5F, -2.0905F, 11.0F, 27.0F, 13.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-0.5F, -21.5F, 5.0865F, 1.0472F, 0.0F, 0.0F)); - ModelPartData head = torso.addChild("head", ModelPartBuilder.create().uv(0, 82).cuboid(-7.0F, -11.0F, -12.0F, 13.0F, 14.0F, 12.0F, new Dilation(0.0F)) - .uv(56, 64).cuboid(-7.0F, -11.0F, -12.0F, 13.0F, 24.0F, 18.0F, new Dilation(0.2F)), ModelTransform.of(0.5F, -24.5F, -1.0865F, -1.0036F, 0.0F, 0.0F)); + PartDefinition head = torso.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 82).addBox(-7.0F, -11.0F, -12.0F, 13.0F, 14.0F, 12.0F, new CubeDeformation(0.0F)) + .texOffs(56, 64).addBox(-7.0F, -11.0F, -12.0F, 13.0F, 24.0F, 18.0F, new CubeDeformation(0.2F)), PartPose.offsetAndRotation(0.5F, -24.5F, -1.0865F, -1.0036F, 0.0F, 0.0F)); - ModelPartData right_ear = head.addChild("right_ear", ModelPartBuilder.create().uv(0, 5).mirrored().cuboid(-4.0F, -2.0F, -0.5F, 4.0F, 4.0F, 1.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.of(-7.0F, -5.0F, -6.5F, 0.0F, 0.829F, 0.0F)); + PartDefinition right_ear = head.addOrReplaceChild("right_ear", CubeListBuilder.create().texOffs(0, 5).mirror().addBox(-4.0F, -2.0F, -0.5F, 4.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-7.0F, -5.0F, -6.5F, 0.0F, 0.829F, 0.0F)); - ModelPartData left_ear = head.addChild("left_ear", ModelPartBuilder.create().uv(0, 0).cuboid(0.0F, -2.0F, -0.5F, 4.0F, 4.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(6.0F, -5.0F, -6.5F, 0.0F, -0.7854F, 0.0F)); + PartDefinition left_ear = head.addOrReplaceChild("left_ear", CubeListBuilder.create().texOffs(0, 0).addBox(0.0F, -2.0F, -0.5F, 4.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(6.0F, -5.0F, -6.5F, 0.0F, -0.7854F, 0.0F)); - ModelPartData nose = head.addChild("nose", ModelPartBuilder.create().uv(62, 0).cuboid(-2.5F, -1.5F, -3.0F, 5.0F, 5.0F, 4.0F, new Dilation(0.0F)), ModelTransform.of(-0.5F, -4.5F, -10.0F, -0.3054F, 0.0F, 0.0F)); + PartDefinition nose = head.addOrReplaceChild("nose", CubeListBuilder.create().texOffs(62, 0).addBox(-2.5F, -1.5F, -3.0F, 5.0F, 5.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-0.5F, -4.5F, -10.0F, -0.3054F, 0.0F, 0.0F)); - ModelPartData jaw = head.addChild("jaw", ModelPartBuilder.create().uv(66, 48).cuboid(-4.5F, -3.3653F, -4.8333F, 9.0F, 2.0F, 0.0F, new Dilation(0.3F)) - .uv(62, 41).cuboid(-4.5F, -0.7693F, -4.8333F, 9.0F, 2.0F, 4.0F, new Dilation(0.3F)) - .uv(126, 127).cuboid(-4.5F, -2.8653F, -4.8333F, 9.0F, 10.0F, 7.0F, new Dilation(0.5F)), ModelTransform.origin(-0.5F, 3.8653F, -7.1667F)); + PartDefinition jaw = head.addOrReplaceChild("jaw", CubeListBuilder.create().texOffs(66, 48).addBox(-4.5F, -3.3653F, -4.8333F, 9.0F, 2.0F, 0.0F, new CubeDeformation(0.3F)) + .texOffs(62, 41).addBox(-4.5F, -0.7693F, -4.8333F, 9.0F, 2.0F, 4.0F, new CubeDeformation(0.3F)) + .texOffs(126, 127).addBox(-4.5F, -2.8653F, -4.8333F, 9.0F, 10.0F, 7.0F, new CubeDeformation(0.5F)), PartPose.offset(-0.5F, 3.8653F, -7.1667F)); - ModelPartData arms = torso.addChild("arms", ModelPartBuilder.create(), ModelTransform.of(0.5F, 7.5F, -20.0865F, -1.0472F, 0.0F, 0.0F)); + PartDefinition arms = torso.addOrReplaceChild("arms", CubeListBuilder.create(), PartPose.offsetAndRotation(0.5F, 7.5F, -20.0865F, -1.0472F, 0.0F, 0.0F)); - ModelPartData right_arm = arms.addChild("right_arm", ModelPartBuilder.create().uv(70, 106).cuboid(-6.0F, -3.0F, -3.0F, 6.0F, 36.0F, 8.0F, new Dilation(0.2F)) - .uv(0, 108).mirrored().cuboid(-6.0F, -3.0F, -3.0F, 6.0F, 36.0F, 8.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.of(-13.0F, -32.0F, -18.0F, -0.3927F, 0.0F, 0.0F)); + PartDefinition right_arm = arms.addOrReplaceChild("right_arm", CubeListBuilder.create().texOffs(70, 106).addBox(-6.0F, -3.0F, -3.0F, 6.0F, 36.0F, 8.0F, new CubeDeformation(0.2F)) + .texOffs(0, 108).mirror().addBox(-6.0F, -3.0F, -3.0F, 6.0F, 36.0F, 8.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-13.0F, -32.0F, -18.0F, -0.3927F, 0.0F, 0.0F)); - ModelPartData left_arm = arms.addChild("left_arm", ModelPartBuilder.create().uv(42, 106).cuboid(-1.0F, -3.0F, -2.0F, 6.0F, 36.0F, 8.0F, new Dilation(0.2F)) - .uv(98, 106).cuboid(-1.0F, -3.0F, -2.0F, 6.0F, 36.0F, 8.0F, new Dilation(0.0F)), ModelTransform.of(13.0F, -32.0F, -17.0F, -0.4363F, 0.0F, 0.0F)); + PartDefinition left_arm = arms.addOrReplaceChild("left_arm", CubeListBuilder.create().texOffs(42, 106).addBox(-1.0F, -3.0F, -2.0F, 6.0F, 36.0F, 8.0F, new CubeDeformation(0.2F)) + .texOffs(98, 106).addBox(-1.0F, -3.0F, -2.0F, 6.0F, 36.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(13.0F, -32.0F, -17.0F, -0.4363F, 0.0F, 0.0F)); - ModelPartData bone = torso.addChild("bone", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 256, 256); + PartDefinition bone = torso.addOrReplaceChild("bone", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + return LayerDefinition.create(modelData, 256, 256); } @Override - public void setAngles(TrollEntityRenderState state) { - super.setAngles(state); - this.setHeadAngles(state.relativeHeadYaw, state.pitch); - - this.walkingAnimation.applyWalking(state.limbSwingAnimationProgress, state.limbSwingAmplitude, 1.0F, 2.5F); - this.attackinggAnimation.apply(state.attackAnimationState, state.age); - this.chargingAnimation.apply(state.chargeAnimationState, state.age); - this.throwingAnimation.apply(state.throwingAnimationState, state.age); + public void setupAnim(SnowTrollEntity entity, float limbSwing, float limbSwingAmount, + float ageInTicks, float netHeadYaw, float headPitch) { + this.root().getAllParts().forEach(ModelPart::resetPose); + this.setHeadAngles(netHeadYaw, headPitch); + this.animateWalk(SnowTrollAnimations.WALKING, limbSwing, limbSwingAmount, 1.0F, 2.5F); + this.animate(entity.attackAnimationState, SnowTrollAnimations.ATTACK, ageInTicks); + this.animate(entity.chargeAnimationState, SnowTrollAnimations.CHARGING, ageInTicks); + this.animate(entity.throwingAnimationState, SnowTrollAnimations.THROWING, ageInTicks); } private void setHeadAngles(float headYaw, float headPitch) { - headYaw = MathHelper.clamp(headYaw, -30.0F, 30.0F); - headPitch = MathHelper.clamp(headPitch, -25.0F, 40.0F) + -60.0F; + headYaw = Mth.clamp(headYaw, -30.0F, 30.0F); + headPitch = Mth.clamp(headPitch, -25.0F, 40.0F) + -60.0F; - this.head.yaw = headYaw * 0.017453292F; - this.head.pitch = headPitch * 0.017453292F; + this.head.yRot = headYaw * 0.017453292F; + this.head.xRot = headPitch * 0.017453292F; + } + + @Override + public ModelPart root() { + return this.troll; } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/snow/SnowTrollRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/snow/SnowTrollRenderer.java index 21e01cc39a..ded97dd873 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/snow/SnowTrollRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/snow/SnowTrollRenderer.java @@ -1,25 +1,20 @@ package net.sevenstars.middleearth.entity.beasts.trolls.snow; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.MobRenderer; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; -import net.sevenstars.middleearth.entity.beasts.trolls.TrollEntityRenderState; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.MobEntityRenderer; -import net.minecraft.util.Identifier; -public class SnowTrollRenderer extends MobEntityRenderer { +public class SnowTrollRenderer extends MobRenderer { private static final String PATH = "textures/entities/trolls/snow/snow_troll1.png"; - public SnowTrollRenderer(EntityRendererFactory.Context ctx) { - super(ctx, new SnowTrollModel(ctx.getPart(EntityModelLayersME.SNOW_TROLL)), 1.1f); + public SnowTrollRenderer(EntityRendererProvider.Context ctx) { + super(ctx, new SnowTrollModel(ctx.bakeLayer(EntityModelLayersME.SNOW_TROLL)), 1.1f); } @Override - public TrollEntityRenderState createRenderState() { - return new TrollEntityRenderState(); - } - @Override - public Identifier getTexture(TrollEntityRenderState state) { - return Identifier.of(MiddleEarth.MOD_ID, PATH); + public ResourceLocation getTextureLocation(SnowTrollEntity entity) { + return ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/stone/StoneTrollAnimations.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/stone/StoneTrollAnimations.java index 90eaac7170..cd552732d2 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/stone/StoneTrollAnimations.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/stone/StoneTrollAnimations.java @@ -1,472 +1,475 @@ package net.sevenstars.middleearth.entity.beasts.trolls.stone; -import net.minecraft.client.render.entity.animation.*; +import net.minecraft.client.animation.AnimationChannel; +import net.minecraft.client.animation.AnimationDefinition; +import net.minecraft.client.animation.Keyframe; +import net.minecraft.client.animation.KeyframeAnimations; public class StoneTrollAnimations { - public static final AnimationDefinition WALK = AnimationDefinition.Builder.create(1f).looping() - .addBoneAnimation("right_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(15f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-15f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(15f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-15f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(15f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-15f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-17.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-17.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-17.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("frontloin", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-10f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-10f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("backloin", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(7.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(5f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("upperbody", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 5f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, -5f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-0.09f, 0.33f, 4.98f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition EATING = AnimationDefinition.Builder.create(1.4583433f) - .addBoneAnimation("r", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.25f, AnimationHelper.createRotationalVector(-60f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(-56.94f, -23.57f, -14.59f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.25f, AnimationHelper.createRotationalVector(12.37f, 5.13f, -0.53f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.4583433f, AnimationHelper.createRotationalVector(11.49f, 13.5f, -3.91f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(13.65f, 11.31f, 6.08f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.875f, AnimationHelper.createRotationalVector(11.49f, 13.5f, -3.91f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.0834333f, AnimationHelper.createRotationalVector(13.65f, 11.31f, 6.08f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2916767f, AnimationHelper.createRotationalVector(11.49f, 13.5f, -3.91f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.25f, AnimationHelper.createRotationalVector(-3.33f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.4583433f, AnimationHelper.createRotationalVector(10f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.875f, AnimationHelper.createRotationalVector(10f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.0834333f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.2916767f, AnimationHelper.createRotationalVector(10f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.4583433f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition SITDOWN = AnimationDefinition.Builder.create(1.5f) - .addBoneAnimation("r", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, -4f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("r", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-55f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-57.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-50f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-20f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_arm", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(0f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createScalingVector(1f, 1.1f, 1f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-57.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-55f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-20f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_arm", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(0f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createScalingVector(1f, 1.1f, 1f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-34.59f, 5.72f, 8.22f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_leg", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(0f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-34.59f, -5.72f, -8.22f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_leg", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(0f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("frontloin", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(1f, 1f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("frontloin", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-60f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("upperbody", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(57.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("backloin", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition CHARGE = AnimationDefinition.Builder.create(1.0416767f).looping() - .addBoneAnimation("r", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -2.5f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 2.5f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -2.5f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("upperbody", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(2.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-47.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-47.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(25f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-50f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(25f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(22.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(22.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("frontloin", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-47.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.25f, AnimationHelper.createRotationalVector(-22.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-47.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(-22.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-45f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("backloin", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.25f, AnimationHelper.createRotationalVector(-17.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(-17.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-2.5f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-30f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-35f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-35f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition THROW = AnimationDefinition.Builder.create(2.4167665f).looping() - .addBoneAnimation("r", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.125f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("upperbody", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(42.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-10f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(17.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.125f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-51.55f, -9.07f, -12f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-46.58f, -11.47f, 0.52f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-184.11f, -13.88f, 13.05f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(-191.61f, -13.88f, 13.05f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(-91.61f, -13.88f, 13.05f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.125f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_arm", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(0f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.125f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-51.55f, 9.07f, 12f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-51.58f, 11.47f, -0.52f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-184.11f, 13.88f, -13.05f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(-191.61f, 13.88f, -13.05f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(-91.61f, 13.88f, -13.05f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.125f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_arm", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(0f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.125f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("frontloin", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-47.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(-15f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(2.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(37.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.0834335f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("jaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(20f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1.75f, AnimationHelper.createRotationalVector(16.5f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(2.0834335f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); - public static final AnimationDefinition ATTACK = AnimationDefinition.Builder.create(1f) - .addBoneAnimation("right_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-54.9f, -20.88f, -14.07f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); + public static final AnimationDefinition WALK = AnimationDefinition.Builder.withLength(1f).looping() + .addAnimation("right_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(15f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-15f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(15f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-15f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(15f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-15f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-17.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-17.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-17.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("frontloin", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-10f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-7.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-10f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("backloin", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(7.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("upperbody", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 5f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, -5f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-0.09f, 0.33f, 4.98f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition EATING = AnimationDefinition.Builder.withLength(1.4583433f) + .addAnimation("r", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25f, KeyframeAnimations.degreeVec(-60f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(-56.94f, -23.57f, -14.59f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25f, KeyframeAnimations.degreeVec(12.37f, 5.13f, -0.53f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.4583433f, KeyframeAnimations.degreeVec(11.49f, 13.5f, -3.91f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(13.65f, 11.31f, 6.08f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.875f, KeyframeAnimations.degreeVec(11.49f, 13.5f, -3.91f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.0834333f, KeyframeAnimations.degreeVec(13.65f, 11.31f, 6.08f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2916767f, KeyframeAnimations.degreeVec(11.49f, 13.5f, -3.91f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25f, KeyframeAnimations.degreeVec(-3.33f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.4583433f, KeyframeAnimations.degreeVec(10f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.875f, KeyframeAnimations.degreeVec(10f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.0834333f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.2916767f, KeyframeAnimations.degreeVec(10f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.4583433f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition SITDOWN = AnimationDefinition.Builder.withLength(1.5f) + .addAnimation("r", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, -4f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("r", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-55f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-57.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-50f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-20f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_arm", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(0f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.scaleVec(1f, 1.1f, 1f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-57.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-55f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-20f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_arm", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(0f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.scaleVec(1f, 1.1f, 1f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-34.59f, 5.72f, 8.22f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_leg", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(0f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-34.59f, -5.72f, -8.22f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_leg", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(0f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("frontloin", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(1f, 1f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("frontloin", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-60f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("upperbody", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(57.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("backloin", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition CHARGE = AnimationDefinition.Builder.withLength(1.0416767f).looping() + .addAnimation("r", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -2.5f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 2.5f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -2.5f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("upperbody", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(2.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-47.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-47.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(25f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-50f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(25f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(22.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(22.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("frontloin", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-47.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25f, KeyframeAnimations.degreeVec(-22.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-47.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(-22.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-45f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("backloin", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-7.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25f, KeyframeAnimations.degreeVec(-17.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-7.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(-17.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-2.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-30f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-35f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-35f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition THROW = AnimationDefinition.Builder.withLength(2.4167665f).looping() + .addAnimation("r", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.125f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("upperbody", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(42.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-10f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(17.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.125f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-51.55f, -9.07f, -12f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-46.58f, -11.47f, 0.52f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-184.11f, -13.88f, 13.05f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(-191.61f, -13.88f, 13.05f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(-91.61f, -13.88f, 13.05f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.125f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_arm", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(0f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.125f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-51.55f, 9.07f, 12f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-51.58f, 11.47f, -0.52f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-184.11f, 13.88f, -13.05f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(-191.61f, 13.88f, -13.05f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(-91.61f, 13.88f, -13.05f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.125f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_arm", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(0f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.125f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("frontloin", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-47.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(-15f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(2.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(37.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.0834335f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("jaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(20f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.75f, KeyframeAnimations.degreeVec(16.5f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.0834335f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); + public static final AnimationDefinition ATTACK = AnimationDefinition.Builder.withLength(1f) + .addAnimation("right_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-54.9f, -20.88f, -14.07f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); - public static final AnimationDefinition SITTING = AnimationDefinition.Builder.create(1f).looping() - .addBoneAnimation("right_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-20f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_arm", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(0f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_arm", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-20f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_arm", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(0f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-74.59f, 5.72f, 8.22f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("right_leg", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(0f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_leg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-74.59f, -5.72f, -8.22f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("left_leg", - new Transformation(Transformation.Targets.SCALE, - new Keyframe(0f, AnimationHelper.createScalingVector(1f, 1f, 1f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("head", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("frontloin", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(1f, 1f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("frontloin", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-60f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("upperbody", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -13f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("backloin", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("legs", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -13f, 0f), - Transformation.Interpolations.LINEAR))).build(); + public static final AnimationDefinition SITTING = AnimationDefinition.Builder.withLength(1f).looping() + .addAnimation("right_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-20f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_arm", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(0f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_arm", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-20f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_arm", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(0f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-74.59f, 5.72f, 8.22f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("right_leg", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(0f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_leg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-74.59f, -5.72f, -8.22f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("left_leg", + new AnimationChannel(AnimationChannel.Targets.SCALE, + new Keyframe(0f, KeyframeAnimations.scaleVec(1f, 1f, 1f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("head", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("frontloin", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(1f, 1f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("frontloin", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-60f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("upperbody", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -13f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("backloin", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("legs", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -13f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/stone/StoneTrollEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/stone/StoneTrollEntity.java index 96988c2b41..704180b27a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/stone/StoneTrollEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/stone/StoneTrollEntity.java @@ -1,33 +1,31 @@ package net.sevenstars.middleearth.entity.beasts.trolls.stone; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.SpawnReason; -import net.minecraft.entity.ai.goal.AvoidSunlightGoal; -import net.minecraft.entity.ai.goal.EscapeSunlightGoal; -import net.minecraft.entity.conversion.EntityConversionContext; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.data.TrackedData; -import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.item.ItemStack; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.sound.SoundEvents; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.ServerWorldAccess; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.biome.Biome; +import net.minecraft.core.BlockPos; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.tags.TagKey; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.ai.goal.FleeSunGoal; +import net.minecraft.world.entity.ai.goal.RestrictSunGoal; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.ServerLevelAccessor; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntitiesME; import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntity; @@ -38,59 +36,59 @@ import java.util.List; public class StoneTrollEntity extends TrollEntity { - public static final TrackedData PETRIFYING = DataTracker.registerData(StoneTrollEntity.class, TrackedDataHandlerRegistry.INTEGER); - public static final List> darkBiomes = List.of( + public static final EntityDataAccessor PETRIFYING = SynchedEntityData.defineId(StoneTrollEntity.class, EntityDataSerializers.INT); + public static final List> darkBiomes = List.of( ); private final int PETRIFYING_DURATION = 600; - public StoneTrollEntity(EntityType entityType, World world) { + public StoneTrollEntity(EntityType entityType, Level world) { super(entityType, world); } @Override - protected void initGoals() { - super.initGoals(); - this.goalSelector.add(0, new AvoidSunlightGoal(this)); - this.goalSelector.add(1, new EscapeSunlightGoal(this, 1.2d)); - this.targetSelector.add(4, new BeastTargetPlayerGoal(this, this.getDisposition())); + protected void registerGoals() { + super.registerGoals(); + this.goalSelector.addGoal(0, new RestrictSunGoal(this)); + this.goalSelector.addGoal(1, new FleeSunGoal(this, 1.2d)); + this.targetSelector.addGoal(4, new BeastTargetPlayerGoal(this, this.getDisposition())); } @Override - protected void initDataTracker(DataTracker.Builder builder) { - super.initDataTracker(builder); - builder.add(PETRIFYING, PETRIFYING_DURATION); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(PETRIFYING, PETRIFYING_DURATION); } @Override public double getMountedHeightOffset() { - float f = Math.min(0.25F, this.limbAnimator.getSpeed()); - float g = this.limbAnimator.getAnimationProgress(); // Todo : getPos() + float f = Math.min(0.25F, this.walkAnimation.speed()); + float g = this.walkAnimation.position(); // Todo : getPos() float h = this.isSitting() ? -0.75f : 0; - return (double)this.getHeight() - 1.0d + (double)(0.12F * MathHelper.cos(g * 1.5F) * 2.0F * f) + h; + return (double)this.getBbHeight() - 1.0d + (double)(0.12F * Mth.cos(g * 1.5F) * 2.0F * f) + h; } @Override - protected void updatePassengerPosition(Entity passenger, PositionUpdater positionUpdater) { - int i = this.getPassengerList().indexOf(passenger); + protected void positionRider(Entity passenger, MoveFunction positionUpdater) { + int i = this.getPassengers().indexOf(passenger); if (i < 0) { return; } float f = -0.5f; // Z-Offset - Vec3d vec3d = new Vec3d(0.0, 0.0, f).rotateY(-this.bodyYaw * ((float)Math.PI / 180)); + Vec3 vec3d = new Vec3(0.0, 0.0, f).yRot(-this.yBodyRot * ((float)Math.PI / 180)); positionUpdater.accept(passenger, this.getX() + vec3d.x, this.getY() + this.getMountedHeightOffset(), this.getZ() + vec3d.z); } public void setPetrifying(int petrifying) { - this.dataTracker.set(PETRIFYING, petrifying); + this.entityData.set(PETRIFYING, petrifying); } public int getPetrifying() { - return this.dataTracker.get(PETRIFYING); + return this.entityData.get(PETRIFYING); } public boolean isPetrified() { - return this.dataTracker.get(PETRIFYING) == -1; + return this.entityData.get(PETRIFYING) == -1; } @Override @@ -112,79 +110,75 @@ public boolean isBondingItem(ItemStack itemStack) { } @Override - protected boolean isAffectedByDaylight() { - if (this.getWorld().isDay() && !this.getWorld().isClient()) { - if(this.getWorld().getBiome(getBlockPos()).isIn(TagKey.of(RegistryKeys.BIOME, Identifier.of(MiddleEarth.MOD_ID, "is_biome_in_darkness")))){ + protected boolean isSunBurnTick() { + if (this.level().isDay() && !this.level().isClientSide()) { + if(this.level().getBiome(blockPosition()).is(TagKey.create(Registries.BIOME, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "is_biome_in_darkness")))){ return false; } - float f = this.getWorld().getBlockState(getBlockPos()).getAmbientOcclusionLightLevel(getWorld(), getBlockPos()); - BlockPos blockPos = BlockPos.ofFloored(this.getX(), this.getEyeY(), this.getZ()); - return f > 0.5f && this.getWorld().isSkyVisible(blockPos); + float f = this.level().getBlockState(blockPosition()).getShadeBrightness(level(), blockPosition()); + BlockPos blockPos = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ()); + return f > 0.5f && this.level().canSeeSky(blockPos); } return false; } @Override - public void tickMovement() { - if (this.isAlive() && !this.getWorld().isClient() && this.getPetrifying() != -1 && this.getWorld().getBiome(this.getBlockPos()).getKey().isPresent()) { - RegistryKey biomeKey = this.getWorld().getBiome(this.getBlockPos()).getKey().get(); + public void aiStep() { + if (this.isAlive() && !this.level().isClientSide() && this.getPetrifying() != -1 && this.level().getBiome(this.blockPosition()).unwrapKey().isPresent()) { + ResourceKey biomeKey = this.level().getBiome(this.blockPosition()).unwrapKey().get(); - boolean inDaylight = this.isAffectedByDaylight() && this.getEquippedStack(EquipmentSlot.CHEST).isEmpty() && !darkBiomes.contains(biomeKey); + boolean inDaylight = this.isSunBurnTick() && this.getItemBySlot(EquipmentSlot.CHEST).isEmpty() && !darkBiomes.contains(biomeKey); if (inDaylight) { this.setPetrifying(this.getPetrifying() - 1); if(this.getPetrifying() <= 0) { this.turnToStone(); } - if(this.age % 10 == 0) { - this.playSound(SoundEvents.BLOCK_FIRE_AMBIENT, 1.0f, 1.0f); + if(this.tickCount % 10 == 0) { + this.playSound(SoundEvents.FIRE_AMBIENT, 1.0f, 1.0f); } } else { this.setPetrifying(PETRIFYING_DURATION); } } - if(getPetrifying() != -1 && getPetrifying() < PETRIFYING_DURATION && this.getWorld().isClient() && this.age % 3 == 0) { - this.getWorld().addParticleClient(ParticleTypes.LARGE_SMOKE, this.getX() + ((random.nextFloat() * 2f) - 1f), this.getY() + 1d + random.nextFloat(), this.getZ() + ((random.nextFloat() * 2f) - 1f), random.nextFloat() / 8.0f, 0.2f, random.nextFloat() / 8.0f); + if(getPetrifying() != -1 && getPetrifying() < PETRIFYING_DURATION && this.level().isClientSide() && this.tickCount % 3 == 0) { + this.level().addParticle(ParticleTypes.LARGE_SMOKE, this.getX() + ((random.nextFloat() * 2f) - 1f), this.getY() + 1d + random.nextFloat(), this.getZ() + ((random.nextFloat() * 2f) - 1f), random.nextFloat() / 8.0f, 0.2f, random.nextFloat() / 8.0f); } - super.tickMovement(); + super.aiStep(); } public void turnToStone() { - this.setAiDisabled(true); - this.convertTo( - EntitiesME.PETRIFIED_TROLL, - EntityConversionContext.create(this, true, false), - troll -> {} - ); + this.setNoAi(true); + this.convertTo(EntitiesME.PETRIFIED_TROLL, true); } @Override - protected void writeCustomData(WriteView view) { - super.writeCustomData(view); + public void addAdditionalSaveData(CompoundTag view) { + super.addAdditionalSaveData(view); view.putInt("Petrifying", this.getPetrifying()); } @Override - protected void readCustomData(ReadView view) { - super.readCustomData(view); - this.dataTracker.set(PETRIFYING, view.getInt("Petrifying", 0)); + public void readAdditionalSaveData(CompoundTag view) { + super.readAdditionalSaveData(view); + this.entityData.set(PETRIFYING, view.getInt("Petrifying")); } @Override - public void onDamaged(DamageSource damageSource) { + public void handleDamageEvent(DamageSource damageSource) { if(!this.isPetrified()) { - super.onDamaged(damageSource); + super.handleDamageEvent(damageSource); } } - public static boolean canSpawn(EntityType type, ServerWorldAccess serverWorldAccess, SpawnReason spawnReason, BlockPos blockPos, Random random) { + public static boolean canSpawn(EntityType type, ServerLevelAccessor serverWorldAccess, MobSpawnType spawnReason, BlockPos blockPos, RandomSource random) { return SpawnUtil.canSpawn(blockPos, serverWorldAccess, spawnReason); } @Override - public boolean canSpawn(WorldAccess world, SpawnReason spawnReason) { + public boolean checkSpawnRules(LevelAccessor world, MobSpawnType spawnReason) { return true; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/stone/StoneTrollModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/stone/StoneTrollModel.java index 221e460c3a..179969729b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/stone/StoneTrollModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/stone/StoneTrollModel.java @@ -1,103 +1,98 @@ package net.sevenstars.middleearth.entity.beasts.trolls.stone; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.animation.Animation; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.util.math.MathHelper; -import net.sevenstars.middleearth.entity.beasts.trolls.TrollEntityRenderState; -import net.sevenstars.middleearth.entity.beasts.trolls.snow.SnowTrollAnimations; -import net.sevenstars.middleearth.entity.beasts.warg.WargAnimations; - -public class StoneTrollModel extends EntityModel { +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.util.Mth; + +public class StoneTrollModel extends HierarchicalModel { private final ModelPart r; private final ModelPart head; - private final Animation walkingAnimation; - private final Animation attackinggAnimation; - private final Animation chargingAnimation; - private final Animation throwingAnimation; - public StoneTrollModel(ModelPart root) { - super(root); - this.r = root.getChild("r"); this.head = r.getChild("upperbody").getChild("upperbodynoarms").getChild("head"); - - this.walkingAnimation = StoneTrollAnimations.WALK.createAnimation(root); - this.attackinggAnimation = StoneTrollAnimations.ATTACK.createAnimation(root); - this.chargingAnimation = StoneTrollAnimations.CHARGE.createAnimation(root); - this.throwingAnimation = StoneTrollAnimations.THROW.createAnimation(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData r = modelPartData.addChild("r", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 26.0F, 0.0F)); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition r = modelPartData.addOrReplaceChild("r", CubeListBuilder.create(), PartPose.offset(0.0F, 26.0F, 0.0F)); - ModelPartData upperbody = r.addChild("upperbody", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -20.0F, 1.0F)); + PartDefinition upperbody = r.addOrReplaceChild("upperbody", CubeListBuilder.create(), PartPose.offset(0.0F, -20.0F, 1.0F)); - ModelPartData arms = upperbody.addChild("arms", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 20.0F, -1.0F)); + PartDefinition arms = upperbody.addOrReplaceChild("arms", CubeListBuilder.create(), PartPose.offset(0.0F, 20.0F, -1.0F)); - ModelPartData right_arm = arms.addChild("right_arm", ModelPartBuilder.create().uv(28, 82).cuboid(-5.0F, -2.0F, -4.0F, 6.0F, 36.0F, 8.0F, new Dilation(0.2F)) - .uv(84, 96).cuboid(-5.0F, -2.0F, -4.0F, 6.0F, 36.0F, 8.0F, new Dilation(0.0F)), ModelTransform.origin(-14.0F, -46.0F, 2.0F)); + PartDefinition right_arm = arms.addOrReplaceChild("right_arm", CubeListBuilder.create().texOffs(28, 82).addBox(-5.0F, -2.0F, -4.0F, 6.0F, 36.0F, 8.0F, new CubeDeformation(0.2F)) + .texOffs(84, 96).addBox(-5.0F, -2.0F, -4.0F, 6.0F, 36.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(-14.0F, -46.0F, 2.0F)); - ModelPartData left_arm = arms.addChild("left_arm", ModelPartBuilder.create().uv(0, 82).cuboid(-3.0F, -2.0F, -4.0F, 6.0F, 36.0F, 8.0F, new Dilation(0.2F)) - .uv(56, 96).mirrored().cuboid(-3.0F, -2.0F, -4.0F, 6.0F, 36.0F, 8.0F, new Dilation(0.0F)).mirrored(), ModelTransform.origin(15.0F, -46.0F, 2.0F)); + PartDefinition left_arm = arms.addOrReplaceChild("left_arm", CubeListBuilder.create().texOffs(0, 82).addBox(-3.0F, -2.0F, -4.0F, 6.0F, 36.0F, 8.0F, new CubeDeformation(0.2F)) + .texOffs(56, 96).mirror().addBox(-3.0F, -2.0F, -4.0F, 6.0F, 36.0F, 8.0F, new CubeDeformation(0.0F)).mirror(), PartPose.offset(15.0F, -46.0F, 2.0F)); - ModelPartData upperbodynoarms = upperbody.addChild("upperbodynoarms", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -2.0F, -1.0F)); + PartDefinition upperbodynoarms = upperbody.addOrReplaceChild("upperbodynoarms", CubeListBuilder.create(), PartPose.offset(0.0F, -2.0F, -1.0F)); - ModelPartData head = upperbodynoarms.addChild("head", ModelPartBuilder.create().uv(74, 0).cuboid(-6.5F, -9.6306F, -6.7491F, 13.0F, 14.0F, 12.0F, new Dilation(0.0F)) - .uv(62, 70).cuboid(-6.5F, -9.6306F, -6.7491F, 13.0F, 14.0F, 12.0F, new Dilation(0.2F)) - .uv(0, 0).mirrored().cuboid(6.4F, -5.6306F, -1.7491F, 4.0F, 4.0F, 1.0F, new Dilation(0.0F)).mirrored(false) - .uv(0, 5).cuboid(-10.4F, -5.6306F, -1.7491F, 4.0F, 4.0F, 1.0F, new Dilation(0.0F)), ModelTransform.origin(-0.5F, -27.3694F, -1.2509F)); + PartDefinition head = upperbodynoarms.addOrReplaceChild("head", CubeListBuilder.create().texOffs(74, 0).addBox(-6.5F, -9.6306F, -6.7491F, 13.0F, 14.0F, 12.0F, new CubeDeformation(0.0F)) + .texOffs(62, 70).addBox(-6.5F, -9.6306F, -6.7491F, 13.0F, 14.0F, 12.0F, new CubeDeformation(0.2F)) + .texOffs(0, 0).mirror().addBox(6.4F, -5.6306F, -1.7491F, 4.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(0, 5).addBox(-10.4F, -5.6306F, -1.7491F, 4.0F, 4.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(-0.5F, -27.3694F, -1.2509F)); - ModelPartData nose = head.addChild("nose", ModelPartBuilder.create().uv(62, 0).cuboid(-2.5F, -1.5F, -3.0F, 5.0F, 5.0F, 4.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, -3.1306F, -4.7491F, -0.3054F, 0.0F, 0.0F)); + PartDefinition nose = head.addOrReplaceChild("nose", CubeListBuilder.create().texOffs(62, 0).addBox(-2.5F, -1.5F, -3.0F, 5.0F, 5.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -3.1306F, -4.7491F, -0.3054F, 0.0F, 0.0F)); - ModelPartData jaw = head.addChild("jaw", ModelPartBuilder.create().uv(126, 29).cuboid(-4.5F, -2.0F, -4.0F, 9.0F, 4.0F, 4.0F, new Dilation(0.3F)), ModelTransform.origin(0.0F, 3.3694F, -2.7491F)); + PartDefinition jaw = head.addOrReplaceChild("jaw", CubeListBuilder.create().texOffs(126, 29).addBox(-4.5F, -2.0F, -4.0F, 9.0F, 4.0F, 4.0F, new CubeDeformation(0.3F)), PartPose.offset(0.0F, 3.3694F, -2.7491F)); - ModelPartData hair = head.addChild("hair", ModelPartBuilder.create().uv(192, 158).cuboid(-33.0F, -55.2728F, -0.4462F, 13.0F, 19.0F, 12.0F, new Dilation(0.1F)), ModelTransform.origin(26.5F, 51.3694F, -5.7491F)); + PartDefinition hair = head.addOrReplaceChild("hair", CubeListBuilder.create().texOffs(192, 158).addBox(-33.0F, -55.2728F, -0.4462F, 13.0F, 19.0F, 12.0F, new CubeDeformation(0.1F)), PartPose.offset(26.5F, 51.3694F, -5.7491F)); - ModelPartData hair1 = hair.addChild("hair1", ModelPartBuilder.create().uv(204, 105).cuboid(-6.3F, -22.2272F, -5.9945F, 13.0F, 19.0F, 12.0F, new Dilation(0.1F)), ModelTransform.of(-26.7F, -37.5249F, 16.9945F, 0.5236F, 0.0F, 0.0F)); + PartDefinition hair1 = hair.addOrReplaceChild("hair1", CubeListBuilder.create().texOffs(204, 105).addBox(-6.3F, -22.2272F, -5.9945F, 13.0F, 19.0F, 12.0F, new CubeDeformation(0.1F)), PartPose.offsetAndRotation(-26.7F, -37.5249F, 16.9945F, 0.5236F, 0.0F, 0.0F)); - ModelPartData torso = upperbodynoarms.addChild("torso", ModelPartBuilder.create().uv(0, 41).cuboid(-13.0F, -50.0F, -4.0F, 25.0F, 29.0F, 12.0F, new Dilation(0.0F)) - .uv(0, 0).cuboid(-13.0F, -50.0F, -4.0F, 25.0F, 29.0F, 12.0F, new Dilation(0.2F)), ModelTransform.origin(0.0F, 22.0F, 0.0F)); + PartDefinition torso = upperbodynoarms.addOrReplaceChild("torso", CubeListBuilder.create().texOffs(0, 41).addBox(-13.0F, -50.0F, -4.0F, 25.0F, 29.0F, 12.0F, new CubeDeformation(0.0F)) + .texOffs(0, 0).addBox(-13.0F, -50.0F, -4.0F, 25.0F, 29.0F, 12.0F, new CubeDeformation(0.2F)), PartPose.offset(0.0F, 22.0F, 0.0F)); - ModelPartData frontloin = torso.addChild("frontloin", ModelPartBuilder.create().uv(74, 48).cuboid(-12.5F, -1.5F, -0.5F, 25.0F, 21.0F, 1.0F, new Dilation(0.3F)), ModelTransform.origin(-0.5F, -26.5F, -3.504F)); + PartDefinition frontloin = torso.addOrReplaceChild("frontloin", CubeListBuilder.create().texOffs(74, 48).addBox(-12.5F, -1.5F, -0.5F, 25.0F, 21.0F, 1.0F, new CubeDeformation(0.3F)), PartPose.offset(-0.5F, -26.5F, -3.504F)); - ModelPartData backloin = torso.addChild("backloin", ModelPartBuilder.create().uv(74, 26).cuboid(-12.5F, -1.5F, -0.5F, 25.0F, 21.0F, 1.0F, new Dilation(0.3F)), ModelTransform.origin(-0.5F, -26.5F, 7.85F)); + PartDefinition backloin = torso.addOrReplaceChild("backloin", CubeListBuilder.create().texOffs(74, 26).addBox(-12.5F, -1.5F, -0.5F, 25.0F, 21.0F, 1.0F, new CubeDeformation(0.3F)), PartPose.offset(-0.5F, -26.5F, 7.85F)); - ModelPartData bodynoarmswithlegs = upperbodynoarms.addChild("bodynoarmswithlegs", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -11.0F, 0.0F)); + PartDefinition bodynoarmswithlegs = upperbodynoarms.addOrReplaceChild("bodynoarmswithlegs", CubeListBuilder.create(), PartPose.offset(0.0F, -11.0F, 0.0F)); - ModelPartData legs = r.addChild("legs", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition legs = r.addOrReplaceChild("legs", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData right_leg = legs.addChild("right_leg", ModelPartBuilder.create().uv(126, 0).cuboid(-5.0F, 0.5F, -5.0F, 10.0F, 19.0F, 10.0F, new Dilation(0.0F)) - .uv(112, 99).cuboid(-5.0F, 0.5F, -5.0F, 10.0F, 19.0F, 10.0F, new Dilation(0.2F)), ModelTransform.origin(-7.0F, -21.5F, 2.0F)); + PartDefinition right_leg = legs.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(126, 0).addBox(-5.0F, 0.5F, -5.0F, 10.0F, 19.0F, 10.0F, new CubeDeformation(0.0F)) + .texOffs(112, 99).addBox(-5.0F, 0.5F, -5.0F, 10.0F, 19.0F, 10.0F, new CubeDeformation(0.2F)), PartPose.offset(-7.0F, -21.5F, 2.0F)); - ModelPartData left_leg = legs.addChild("left_leg", ModelPartBuilder.create().uv(0, 126).cuboid(-5.0F, 0.5F, -5.0F, 10.0F, 19.0F, 10.0F, new Dilation(0.0F)) - .uv(112, 70).cuboid(-5.0F, 0.5F, -5.0F, 10.0F, 19.0F, 10.0F, new Dilation(0.2F)), ModelTransform.origin(6.0F, -21.5F, 2.0F)); + PartDefinition left_leg = legs.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(0, 126).addBox(-5.0F, 0.5F, -5.0F, 10.0F, 19.0F, 10.0F, new CubeDeformation(0.0F)) + .texOffs(112, 70).addBox(-5.0F, 0.5F, -5.0F, 10.0F, 19.0F, 10.0F, new CubeDeformation(0.2F)), PartPose.offset(6.0F, -21.5F, 2.0F)); - ModelPartData club = modelPartData.addChild("club", ModelPartBuilder.create(), ModelTransform.of(-15.3115F, 10.3091F, -12.2077F, -0.1309F, 0.0F, 0.0873F)); + PartDefinition club = modelPartData.addOrReplaceChild("club", CubeListBuilder.create(), PartPose.offsetAndRotation(-15.3115F, 10.3091F, -12.2077F, -0.1309F, 0.0F, 0.0873F)); - ModelPartData cube_r1 = club.addChild("cube_r1", ModelPartBuilder.create().uv(16, 158).mirrored().cuboid(-4.5F, -4.5F, -22.0F, 9.0F, 9.0F, 22.0F, new Dilation(0.0F)).mirrored(false) - .uv(17, 194).cuboid(-3.5F, -3.5F, 0.0F, 7.0F, 7.0F, 22.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, 0.1993F, 0.0145F, -0.0979F)); - return TexturedModelData.of(modelData, 256, 256); + PartDefinition cube_r1 = club.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(16, 158).mirror().addBox(-4.5F, -4.5F, -22.0F, 9.0F, 9.0F, 22.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(17, 194).addBox(-3.5F, -3.5F, 0.0F, 7.0F, 7.0F, 22.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.1993F, 0.0145F, -0.0979F)); + return LayerDefinition.create(modelData, 256, 256); } @Override - public void setAngles(TrollEntityRenderState state) { - super.setAngles(state); - this.setHeadAngles(state.relativeHeadYaw, state.pitch); - - this.walkingAnimation.applyWalking(state.limbSwingAnimationProgress, state.limbSwingAmplitude, 1.0F, 2.5F); - this.attackinggAnimation.apply(state.attackAnimationState, state.age); - this.chargingAnimation.apply(state.chargeAnimationState, state.age); - this.throwingAnimation.apply(state.throwingAnimationState, state.age); + public void setupAnim(StoneTrollEntity entity, float limbSwing, float limbSwingAmount, + float ageInTicks, float netHeadYaw, float headPitch) { + this.root().getAllParts().forEach(ModelPart::resetPose); + this.setHeadAngles(netHeadYaw, headPitch); + this.animateWalk(StoneTrollAnimations.WALK, limbSwing, limbSwingAmount, 1.0F, 2.5F); + this.animate(entity.attackAnimationState, StoneTrollAnimations.ATTACK, ageInTicks); + this.animate(entity.chargeAnimationState, StoneTrollAnimations.CHARGE, ageInTicks); + this.animate(entity.throwingAnimationState, StoneTrollAnimations.THROW, ageInTicks); } private void setHeadAngles(float headYaw, float headPitch) { - headYaw = MathHelper.clamp(headYaw, -30.0F, 30.0F); - headPitch = MathHelper.clamp(headPitch, -25.0F, 40.0F); + headYaw = Mth.clamp(headYaw, -30.0F, 30.0F); + headPitch = Mth.clamp(headPitch, -25.0F, 40.0F); - this.head.yaw = headYaw * 0.017453292F; - this.head.pitch = headPitch * 0.017453292F; + this.head.yRot = headYaw * 0.017453292F; + this.head.xRot = headPitch * 0.017453292F; + } + + @Override + public ModelPart root() { + return this.r; } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/stone/StoneTrollRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/stone/StoneTrollRenderer.java index 6792925b5c..8434db15e2 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/stone/StoneTrollRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/trolls/stone/StoneTrollRenderer.java @@ -1,25 +1,20 @@ package net.sevenstars.middleearth.entity.beasts.trolls.stone; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.MobEntityRenderer; -import net.minecraft.util.Identifier; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.MobRenderer; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import net.sevenstars.middleearth.entity.beasts.trolls.TrollEntityRenderState; -public class StoneTrollRenderer extends MobEntityRenderer { +public class StoneTrollRenderer extends MobRenderer { private static final String PATH = "textures/entities/trolls/stone/stone_troll1.png"; - public StoneTrollRenderer(EntityRendererFactory.Context context) { - super(context, new StoneTrollModel(context.getPart(EntityModelLayersME.STONE_TROLL)), 1.1f); + public StoneTrollRenderer(EntityRendererProvider.Context context) { + super(context, new StoneTrollModel(context.bakeLayer(EntityModelLayersME.STONE_TROLL)), 1.1f); } @Override - public TrollEntityRenderState createRenderState() { - return new TrollEntityRenderState(); - } - @Override - public Identifier getTexture(TrollEntityRenderState state) { - return Identifier.of(MiddleEarth.MOD_ID, PATH); + public ResourceLocation getTextureLocation(StoneTrollEntity entity) { + return ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargAnimations.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargAnimations.java index dd373b933f..323d8a2920 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargAnimations.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargAnimations.java @@ -1,635 +1,638 @@ package net.sevenstars.middleearth.entity.beasts.warg; -import net.minecraft.client.render.entity.animation.*; +import net.minecraft.client.animation.AnimationChannel; +import net.minecraft.client.animation.AnimationDefinition; +import net.minecraft.client.animation.Keyframe; +import net.minecraft.client.animation.KeyframeAnimations; public class WargAnimations { - public static final AnimationDefinition IDLE = AnimationDefinition.Builder.create(1.0F).looping() - .addBoneAnimation("body_fur", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 0.2F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("jaw", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.375F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -2.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR) - )) - .addBoneAnimation("jaw", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.375F, AnimationHelper.createTranslationalVector(0.0F, 0.1F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("tongue", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 5.0F), Transformation.Interpolations.LINEAR) - )) - .addBoneAnimation("tongue", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.6F, 0.0F), Transformation.Interpolations.LINEAR) - )) - .addBoneAnimation("tail", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 1.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.375F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -2.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 1.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 1.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("body_no_legs", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 0.2F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) + public static final AnimationDefinition IDLE = AnimationDefinition.Builder.withLength(1.0F).looping() + .addAnimation("body_fur", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.2F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("jaw", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -2.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("jaw", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375F, KeyframeAnimations.posVec(0.0F, 0.1F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("tongue", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 5.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("tongue", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.6F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("tail", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -2.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("body_no_legs", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.2F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) )) .build(); - public static final AnimationDefinition WALK = AnimationDefinition.Builder.create(2.0F).looping() - .addBoneAnimation("right_front_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 22.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.1667F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 21.25F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -17.5F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 22.5F), Transformation.Interpolations.CUBIC), - new Keyframe(1.1667F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 21.25F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -17.5F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 22.5F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("right_front_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(-2.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createTranslationalVector(-1.0F, 2.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(-1.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(-2.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.25F, AnimationHelper.createTranslationalVector(-1.0F, 2.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.75F, AnimationHelper.createTranslationalVector(-1.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(-2.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("left_front_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -17.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 22.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.6667F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 21.25F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -17.5F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 22.5F), Transformation.Interpolations.CUBIC), - new Keyframe(1.6667F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 21.25F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -17.5F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("left_front_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createTranslationalVector(-1.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(-2.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(-1.0F, 2.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.25F, AnimationHelper.createTranslationalVector(-1.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(-2.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.75F, AnimationHelper.createTranslationalVector(-1.0F, 2.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("left_back_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 22.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.1667F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 21.25F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -17.5F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 22.5F), Transformation.Interpolations.CUBIC), - new Keyframe(1.1667F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 21.25F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -17.5F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 22.5F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("left_back_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(-2.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createTranslationalVector(-1.0F, 0.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(1.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(-1.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(-2.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.25F, AnimationHelper.createTranslationalVector(-1.0F, 0.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(1.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.75F, AnimationHelper.createTranslationalVector(-1.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(-2.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("right_back_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -17.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 22.5F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -17.5F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 22.5F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -17.5F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("right_back_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(1.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createTranslationalVector(-1.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(-2.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(-1.0F, 0.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(1.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.25F, AnimationHelper.createTranslationalVector(-1.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(-2.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.75F, AnimationHelper.createTranslationalVector(-1.0F, 0.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(1.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("body", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.8F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 0.8F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.8F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.25F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.8F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.75F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.8F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("body_fur", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(-2.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(2.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(-2.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(2.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(-2.5F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("body_fur", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 0.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.25F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.75F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.5F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("ear_right", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 27.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.2083F, AnimationHelper.createRotationalVector(8.0633F, 28.924F, -8.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, 27.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.7083F, AnimationHelper.createRotationalVector(8.0633F, 28.924F, -8.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 27.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.2083F, AnimationHelper.createRotationalVector(8.0633F, 28.924F, -13.0088F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(0.0F, 27.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.7917F, AnimationHelper.createRotationalVector(8.0633F, 28.924F, -8.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 27.5F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("ear_right", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.2083F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.7083F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.2083F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.7917F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("ear_left", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, -27.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.2083F, AnimationHelper.createRotationalVector(-8.0633F, -28.924F, -8.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, -27.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.7083F, AnimationHelper.createRotationalVector(-8.0633F, -28.924F, -8.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, -27.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.2083F, AnimationHelper.createRotationalVector(-8.0633F, -28.924F, -8.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(0.0F, -27.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.7917F, AnimationHelper.createRotationalVector(-8.0633F, -28.924F, -8.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, -27.5F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("ear_left", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.2083F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.7083F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.2083F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.7917F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("jaw", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4583F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -3.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.9583F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -3.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("jaw", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4583F, AnimationHelper.createTranslationalVector(0.0F, 0.1F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.9583F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.1F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("tongue", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -2.5F), Transformation.Interpolations.LINEAR) - )) - .addBoneAnimation("tongue", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR) - )) - .addBoneAnimation("tail", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2.5F), Transformation.Interpolations.CUBIC), - new Keyframe(1.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2.5F), Transformation.Interpolations.CUBIC), - new Keyframe(1.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2.5F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("tail", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.3F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 0.3F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.3F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.25F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.3F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.75F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.3F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("left_back_foot", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 2.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 2.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.25F, AnimationHelper.createTranslationalVector(0.0F, 2.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 2.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.75F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("right_back_foot", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 2.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, 2.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 1.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.25F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.75F, AnimationHelper.createTranslationalVector(0.0F, 2.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createTranslationalVector(0.0F, 2.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("wait_tail", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(3.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(-3.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(3.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.5F, AnimationHelper.createRotationalVector(-3.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(2.0F, AnimationHelper.createRotationalVector(3.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) + public static final AnimationDefinition WALK = AnimationDefinition.Builder.withLength(2.0F).looping() + .addAnimation("right_front_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 22.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.1667F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 21.25F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -17.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 22.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.1667F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 21.25F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -17.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 22.5F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("right_front_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(-2.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.posVec(-1.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(-1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(-2.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25F, KeyframeAnimations.posVec(-1.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75F, KeyframeAnimations.posVec(-1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(-2.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("left_front_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -17.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 22.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.6667F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 21.25F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -17.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 22.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.6667F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 21.25F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -17.5F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("left_front_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.posVec(-1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(-2.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(-1.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25F, KeyframeAnimations.posVec(-1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(-2.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75F, KeyframeAnimations.posVec(-1.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("left_back_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 22.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.1667F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 21.25F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -17.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 22.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.1667F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 21.25F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -17.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 22.5F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("left_back_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(-2.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.posVec(-1.0F, 0.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(-1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(-2.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25F, KeyframeAnimations.posVec(-1.0F, 0.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75F, KeyframeAnimations.posVec(-1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(-2.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("right_back_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -17.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 22.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -17.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 22.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -17.5F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("right_back_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.posVec(-1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(-2.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(-1.0F, 0.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25F, KeyframeAnimations.posVec(-1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(-2.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75F, KeyframeAnimations.posVec(-1.0F, 0.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("body", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.8F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.8F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.8F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 0.8F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.8F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("body_fur", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(-2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(-2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("body_fur", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 0.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("ear_right", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 27.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2083F, KeyframeAnimations.degreeVec(8.0633F, 28.924F, -8.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 27.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.7083F, KeyframeAnimations.degreeVec(8.0633F, 28.924F, -8.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 27.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.2083F, KeyframeAnimations.degreeVec(8.0633F, 28.924F, -13.0088F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(0.0F, 27.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.7917F, KeyframeAnimations.degreeVec(8.0633F, 28.924F, -8.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(0.0F, 27.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("ear_right", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2083F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.7083F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.2083F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.7917F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("ear_left", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, -27.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2083F, KeyframeAnimations.degreeVec(-8.0633F, -28.924F, -8.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, -27.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.7083F, KeyframeAnimations.degreeVec(-8.0633F, -28.924F, -8.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, -27.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.2083F, KeyframeAnimations.degreeVec(-8.0633F, -28.924F, -8.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(0.0F, -27.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.7917F, KeyframeAnimations.degreeVec(-8.0633F, -28.924F, -8.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(0.0F, -27.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("ear_left", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2083F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.7083F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.2083F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.7917F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("jaw", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -3.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.9583F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -3.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("jaw", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583F, KeyframeAnimations.posVec(0.0F, 0.1F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.9583F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 0.1F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("tongue", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -2.5F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("tongue", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("tail", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 2.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 2.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 2.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 2.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 2.5F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("tail", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.3F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.3F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.3F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 0.3F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.3F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("left_back_foot", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25F, KeyframeAnimations.posVec(0.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("right_back_foot", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.25F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.75F, KeyframeAnimations.posVec(0.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.posVec(0.0F, 2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("wait_tail", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(3.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(-3.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(3.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.5F, KeyframeAnimations.degreeVec(-3.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(2.0F, KeyframeAnimations.degreeVec(3.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) )) .build(); - public static final AnimationDefinition RUN = AnimationDefinition.Builder.create(0.75F).looping() - .addBoneAnimation("body", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 7.5F), Transformation.Interpolations.LINEAR), - new Keyframe(0.2917F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -10.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 7.5F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("body", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.2917F, AnimationHelper.createTranslationalVector(2.0F, 3.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("upper_body", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.375F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2.5F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("upper_body", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.375F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("body_fur", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 4.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.1667F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 4.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.375F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -9.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5833F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -9.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 4.5F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("body_fur", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.5F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.1667F, AnimationHelper.createTranslationalVector(0.0F, 0.5F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, 0.5F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("mane", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -12.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.2083F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -2.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.375F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -12.5F), Transformation.Interpolations.LINEAR), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -12.5F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("mane", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("right_front_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 32.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4167F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -67.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 32.5F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("right_front_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(-2.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.125F, AnimationHelper.createTranslationalVector(-1.39F, 2.89F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.2917F, AnimationHelper.createTranslationalVector(0.0F, 4.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.4167F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5417F, AnimationHelper.createTranslationalVector(1.0F, -0.47F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(-2.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("left_front_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 30.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5417F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -67.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 30.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("left_front_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(-2.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.2083F, AnimationHelper.createTranslationalVector(-1.25F, 3.25F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4167F, AnimationHelper.createTranslationalVector(0.0F, 4.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.5417F, AnimationHelper.createTranslationalVector(1.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(-2.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("head", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -5.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.1667F, AnimationHelper.createRotationalVector(5.0F, 0.0F, 7.5103F), Transformation.Interpolations.CUBIC), - new Keyframe(0.375F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 25.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5417F, AnimationHelper.createRotationalVector(-5.6173F, 0.0F, 12.5913F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -5.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("ear_right", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(3.237F, 19.8207F, -36.0243F), Transformation.Interpolations.CUBIC), - new Keyframe(0.375F, AnimationHelper.createRotationalVector(3.237F, 19.8207F, -36.0243F), Transformation.Interpolations.LINEAR), - new Keyframe(0.5417F, AnimationHelper.createRotationalVector(-13.7415F, 14.4596F, -5.4885F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(3.237F, 19.8207F, -36.0243F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("ear_left", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(-3.237F, -19.8207F, -36.0243F), Transformation.Interpolations.CUBIC), - new Keyframe(0.375F, AnimationHelper.createRotationalVector(-3.237F, -19.8207F, -36.0243F), Transformation.Interpolations.LINEAR), - new Keyframe(0.5417F, AnimationHelper.createRotationalVector(13.7415F, -14.4596F, -5.4885F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(-3.237F, -19.8207F, -36.0243F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("jaw", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -2.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4583F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -2.5F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("tail", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.4447F, -0.3801F, 27.4292F), Transformation.Interpolations.CUBIC), - new Keyframe(0.2083F, AnimationHelper.createRotationalVector(0.2503F, -0.5217F, 51.3493F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.4762F, -0.3399F, 22.4292F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.4447F, -0.3801F, 27.4292F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("tail", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(1.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.2917F, AnimationHelper.createTranslationalVector(1.0F, 1.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(1.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("left_back_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -35.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.1667F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -3.75F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 55.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -35.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("left_back_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(3.0F, -3.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(-1.0F, -1.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.625F, AnimationHelper.createTranslationalVector(1.0F, -1.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(3.0F, -3.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("right_back_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -35.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.125F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -3.75F), Transformation.Interpolations.CUBIC), - new Keyframe(0.375F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 55.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -35.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("right_back_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(3.0F, -3.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.375F, AnimationHelper.createTranslationalVector(-1.0F, -1.5F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5833F, AnimationHelper.createTranslationalVector(1.0F, -1.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(3.0F, -3.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("left_back_foot", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 3.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.2083F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.625F, AnimationHelper.createTranslationalVector(0.0F, 3.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, 3.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("right_back_foot", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 3.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.125F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4167F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.5417F, AnimationHelper.createTranslationalVector(0.0F, 3.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, 3.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("headmane", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -12.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.2083F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -2.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.375F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -12.5F), Transformation.Interpolations.LINEAR), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -12.5F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("headmane", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createTranslationalVector(0.0F, -1.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("tongue", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 2.5F), Transformation.Interpolations.LINEAR) - )) - .addBoneAnimation("tongue", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(-0.2F, 0.2F, 0.0F), Transformation.Interpolations.LINEAR) - )) - .addBoneAnimation("back_body", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 7.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.375F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.75F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 7.5F), Transformation.Interpolations.CUBIC) + public static final AnimationDefinition RUN = AnimationDefinition.Builder.withLength(0.75F).looping() + .addAnimation("body", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 7.5F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.2917F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -10.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 7.5F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("body", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2917F, KeyframeAnimations.posVec(2.0F, 3.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("upper_body", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 2.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 2.5F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("upper_body", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("body_fur", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 4.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.1667F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 4.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -9.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5833F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -9.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 4.5F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("body_fur", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.5F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.1667F, KeyframeAnimations.posVec(0.0F, 0.5F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 0.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("mane", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -12.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2083F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -2.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -12.5F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -12.5F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("mane", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("right_front_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 32.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4167F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -67.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 32.5F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("right_front_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(-2.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.125F, KeyframeAnimations.posVec(-1.39F, 2.89F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2917F, KeyframeAnimations.posVec(0.0F, 4.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.4167F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5417F, KeyframeAnimations.posVec(1.0F, -0.47F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(-2.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("left_front_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 30.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5417F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -67.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 30.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("left_front_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(-2.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2083F, KeyframeAnimations.posVec(-1.25F, 3.25F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4167F, KeyframeAnimations.posVec(0.0F, 4.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5417F, KeyframeAnimations.posVec(1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(-2.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("head", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -5.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.1667F, KeyframeAnimations.degreeVec(5.0F, 0.0F, 7.5103F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 25.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5417F, KeyframeAnimations.degreeVec(-5.6173F, 0.0F, 12.5913F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -5.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("ear_right", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(3.237F, 19.8207F, -36.0243F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375F, KeyframeAnimations.degreeVec(3.237F, 19.8207F, -36.0243F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5417F, KeyframeAnimations.degreeVec(-13.7415F, 14.4596F, -5.4885F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(3.237F, 19.8207F, -36.0243F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("ear_left", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-3.237F, -19.8207F, -36.0243F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375F, KeyframeAnimations.degreeVec(-3.237F, -19.8207F, -36.0243F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5417F, KeyframeAnimations.degreeVec(13.7415F, -14.4596F, -5.4885F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(-3.237F, -19.8207F, -36.0243F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("jaw", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -2.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 2.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -2.5F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("tail", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.4447F, -0.3801F, 27.4292F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2083F, KeyframeAnimations.degreeVec(0.2503F, -0.5217F, 51.3493F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.4762F, -0.3399F, 22.4292F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.4447F, -0.3801F, 27.4292F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("tail", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2917F, KeyframeAnimations.posVec(1.0F, 1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("left_back_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -35.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.1667F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -3.75F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 55.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -35.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("left_back_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(3.0F, -3.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(-1.0F, -1.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625F, KeyframeAnimations.posVec(1.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(3.0F, -3.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("right_back_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -35.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.125F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -3.75F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 55.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -35.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("right_back_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(3.0F, -3.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375F, KeyframeAnimations.posVec(-1.0F, -1.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5833F, KeyframeAnimations.posVec(1.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(3.0F, -3.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("left_back_foot", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 3.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2083F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625F, KeyframeAnimations.posVec(0.0F, 3.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 3.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("right_back_foot", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 3.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.125F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4167F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5417F, KeyframeAnimations.posVec(0.0F, 3.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, 3.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("headmane", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -12.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2083F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -2.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -12.5F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -12.5F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("headmane", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.posVec(0.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("tongue", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 2.5F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("tongue", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(-0.2F, 0.2F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("back_body", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 7.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.75F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 7.5F), AnimationChannel.Interpolations.CATMULLROM) )) .build(); - public static final AnimationDefinition BITE = AnimationDefinition.Builder.create(0.75F) - .addBoneAnimation("head", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.3333F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -30.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.5417F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR) - )) - .addBoneAnimation("jaw", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.2917F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 57.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.4583F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.625F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) + public static final AnimationDefinition BITE = AnimationDefinition.Builder.withLength(0.75F) + .addAnimation("head", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3333F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -30.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5417F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("jaw", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2917F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 57.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.4583F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) )) .build(); - public static final AnimationDefinition SITTING = AnimationDefinition.Builder.create(5.0F).looping() - .addBoneAnimation("right_front_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(-1.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR) + public static final AnimationDefinition SITTING = AnimationDefinition.Builder.withLength(5.0F).looping() + .addAnimation("right_front_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(-1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) - .addBoneAnimation("left_front_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(-1.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR) + .addAnimation("left_front_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(-1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) - .addBoneAnimation("head", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 42.5F), Transformation.Interpolations.LINEAR) + .addAnimation("head", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 42.5F), AnimationChannel.Interpolations.LINEAR) )) - .addBoneAnimation("tail", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 72.5F, 0.0F), Transformation.Interpolations.LINEAR) + .addAnimation("tail", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 72.5F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) - .addBoneAnimation("tail", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, -2.0F, 0.0F), Transformation.Interpolations.LINEAR) + .addAnimation("tail", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, -2.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) - .addBoneAnimation("left_back_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(5.0F, -9.0F, 0.0F), Transformation.Interpolations.LINEAR) + .addAnimation("left_back_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(5.0F, -9.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) - .addBoneAnimation("left_back_foot", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -90.0F), Transformation.Interpolations.LINEAR) + .addAnimation("left_back_foot", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -90.0F), AnimationChannel.Interpolations.LINEAR) )) - .addBoneAnimation("left_back_foot", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(2.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR) + .addAnimation("left_back_foot", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(2.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) - .addBoneAnimation("right_back_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(5.0F, -9.0F, 0.0F), Transformation.Interpolations.LINEAR) + .addAnimation("right_back_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(5.0F, -9.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) - .addBoneAnimation("right_back_foot", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -90.0F), Transformation.Interpolations.LINEAR) + .addAnimation("right_back_foot", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -90.0F), AnimationChannel.Interpolations.LINEAR) )) - .addBoneAnimation("right_back_foot", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(2.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR) + .addAnimation("right_back_foot", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(2.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) )) - .addBoneAnimation("body_no_legs", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -37.5F), Transformation.Interpolations.LINEAR) + .addAnimation("body_no_legs", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -37.5F), AnimationChannel.Interpolations.LINEAR) )) .build(); - public static final AnimationDefinition STANDING_TO_SITTING = AnimationDefinition.Builder.create(2.0F).looping() - .addBoneAnimation("right_front_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR) - )) - .addBoneAnimation("right_front_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("left_front_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR) - )) - .addBoneAnimation("left_front_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("head", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5417F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 30.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 32.5F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("tail", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(-25.8389F, 74.8249F, -37.7453F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("tail", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(-3.0F, -1.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("left_back_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR) - )) - .addBoneAnimation("left_back_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, -2.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(3.0F, -9.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("left_back_foot", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -30.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -90.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("left_back_foot", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(2.0F, 1.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("right_back_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("right_back_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createTranslationalVector(0.0F, -2.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(3.0F, -9.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("right_back_foot", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -30.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -90.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("right_back_foot", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(2.0F, 1.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("body_no_legs", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -12.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -20.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -32.5F), Transformation.Interpolations.CUBIC) + public static final AnimationDefinition STANDING_TO_SITTING = AnimationDefinition.Builder.withLength(2.0F).looping() + .addAnimation("right_front_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("right_front_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("left_front_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("left_front_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("head", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5417F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 30.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 32.5F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("tail", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(-25.8389F, 74.8249F, -37.7453F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("tail", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(-3.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("left_back_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("left_back_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, -2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(3.0F, -9.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("left_back_foot", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -30.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -90.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("left_back_foot", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(2.0F, 1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("right_back_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("right_back_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, -2.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(3.0F, -9.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("right_back_foot", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -30.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -90.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("right_back_foot", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(2.0F, 1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("body_no_legs", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -12.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -20.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -32.5F), AnimationChannel.Interpolations.CATMULLROM) )) .build(); - public static final AnimationDefinition SITTING_TO_STANDING = AnimationDefinition.Builder.create(1.5F).looping() - .addBoneAnimation("upper_body", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.625F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 5.0F), Transformation.Interpolations.LINEAR), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR) - )) - .addBoneAnimation("body_fur", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("head", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 32.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 20.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("head", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR) - )) - .addBoneAnimation("tail", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(-25.8389F, 74.8249F, -37.7453F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(-8.1078F, 36.0076F, -17.4827F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 1.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("tail", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(-3.0F, -1.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("left_back_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -5.0F), Transformation.Interpolations.LINEAR), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR) - )) - .addBoneAnimation("left_back_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(3.0F, -9.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(1.0F, -5.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("left_back_foot", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -90.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("left_back_foot", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(2.0F, 1.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(1.0F, 4.5F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("right_back_leg", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -5.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("right_back_leg", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(3.0F, -9.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(1.0F, -4.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("right_back_foot", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -90.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("right_back_foot", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(2.0F, 1.0F, 0.0F), Transformation.Interpolations.CUBIC), - new Keyframe(0.5F, AnimationHelper.createTranslationalVector(1.0F, 3.5F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("body_no_legs", new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -32.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.25F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -32.5F), Transformation.Interpolations.CUBIC), - new Keyframe(0.625F, AnimationHelper.createRotationalVector(0.0F, 0.0F, -15.0F), Transformation.Interpolations.CUBIC), - new Keyframe(1.0F, AnimationHelper.createRotationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) - )) - .addBoneAnimation("body_no_legs", new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.25F, AnimationHelper.createTranslationalVector(1.65F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(0.625F, AnimationHelper.createTranslationalVector(1.0F, 0.0F, 0.0F), Transformation.Interpolations.LINEAR), - new Keyframe(1.0F, AnimationHelper.createTranslationalVector(0.0F, 0.0F, 0.0F), Transformation.Interpolations.CUBIC) + public static final AnimationDefinition SITTING_TO_STANDING = AnimationDefinition.Builder.withLength(1.5F).looping() + .addAnimation("upper_body", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 5.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("body_fur", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("head", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 32.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 20.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("head", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("tail", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(-25.8389F, 74.8249F, -37.7453F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(-8.1078F, 36.0076F, -17.4827F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("tail", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(-3.0F, -1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("left_back_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -5.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR) + )) + .addAnimation("left_back_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(3.0F, -9.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(1.0F, -5.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("left_back_foot", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -90.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("left_back_foot", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(2.0F, 1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(1.0F, 4.5F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("right_back_leg", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -5.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("right_back_leg", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(3.0F, -9.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(1.0F, -4.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("right_back_foot", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -90.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("right_back_foot", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(2.0F, 1.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5F, KeyframeAnimations.posVec(1.0F, 3.5F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("body_no_legs", new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -32.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.25F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -32.5F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625F, KeyframeAnimations.degreeVec(0.0F, 0.0F, -15.0F), AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) + )) + .addAnimation("body_no_legs", new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.25F, KeyframeAnimations.posVec(1.65F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625F, KeyframeAnimations.posVec(1.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM) )) .build(); -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargEntity.java index cca0b0fb95..5d00258965 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargEntity.java @@ -1,40 +1,56 @@ package net.sevenstars.middleearth.entity.beasts.warg; -import net.minecraft.block.BlockState; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.FoodComponent; -import net.minecraft.entity.*; -import net.minecraft.entity.ai.goal.*; -import net.minecraft.entity.attribute.DefaultAttributeContainer; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.data.TrackedData; -import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.entity.passive.*; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.BlockSoundGroup; -import net.minecraft.sound.SoundEvent; -import net.minecraft.sound.SoundEvents; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.text.Text; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.Identifier; -import net.minecraft.util.Util; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.LocalDifficulty; -import net.minecraft.world.ServerWorldAccess; -import net.minecraft.world.World; +import net.minecraft.Util; +import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.tags.TagKey; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.AgeableMob; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntityEvent; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.Pose; +import net.minecraft.world.entity.SpawnGroupData; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.goal.BreedGoal; +import net.minecraft.world.entity.ai.goal.FloatGoal; +import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; +import net.minecraft.world.entity.ai.goal.MeleeAttackGoal; +import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; +import net.minecraft.world.entity.ai.goal.TemptGoal; +import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; +import net.minecraft.world.entity.animal.Animal; +import net.minecraft.world.entity.animal.goat.Goat; +import net.minecraft.world.entity.animal.horse.AbstractHorse; +import net.minecraft.world.entity.animal.Sheep; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.ServerLevelAccessor; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntitiesME; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; @@ -53,40 +69,40 @@ public class WargEntity extends AbstractBeastEntity { - private static final float MIN_MOVEMENT_SPEED_BONUS = (float) WargEntity.getChildMovementSpeedBonus(() -> 0.0); - private static final float MAX_MOVEMENT_SPEED_BONUS = (float)WargEntity.getChildMovementSpeedBonus(() -> 1.0); + private static final float MIN_MOVEMENT_SPEED_BONUS = (float) WargEntity.generateSpeed(() -> 0.0); + private static final float MAX_MOVEMENT_SPEED_BONUS = (float)WargEntity.generateSpeed(() -> 1.0); private static final float MIN_ATTACK_DAMAGE_BONUS = (float)WargEntity.getChildAttackDamageBonus(() -> 0.0); private static final float MAX_ATTACK_DAMAGE_BONUS = (float)WargEntity.getChildAttackDamageBonus(() -> 1.0); - private static final float MIN_HEALTH_BONUS = WargEntity.getChildHealthBonus(max -> 0); - private static final float MAX_HEALTH_BONUS = WargEntity.getChildHealthBonus(max -> max - 1); - private static final TrackedData VARIANT = DataTracker.registerData(WargEntity.class, TrackedDataHandlerRegistry.INTEGER); - private static final TrackedData EYE_VARIANT = DataTracker.registerData(WargEntity.class, TrackedDataHandlerRegistry.INTEGER); + private static final float MIN_HEALTH_BONUS = WargEntity.generateMaxHealth(max -> 0); + private static final float MAX_HEALTH_BONUS = WargEntity.generateMaxHealth(max -> max - 1); + private static final EntityDataAccessor VARIANT = SynchedEntityData.defineId(WargEntity.class, EntityDataSerializers.INT); + private static final EntityDataAccessor EYE_VARIANT = SynchedEntityData.defineId(WargEntity.class, EntityDataSerializers.INT); private static final double PASSENGER_SADDLE_Y_OFFSET = 0.12; private static final double PASSENGER_SADDLE_BACKWARD_OFFSET = 0.18; public int idleAnimationTimeout = this.random.nextInt(600) + 1700; - private static final EntityDimensions BABY_BASE_DIMENSIONS = EntitiesME.WARG.getDimensions().scaled(0.5f); + private static final EntityDimensions BABY_BASE_DIMENSIONS = EntitiesME.WARG.getDimensions().scale(0.5f); - public WargEntity(EntityType entityType, World world) { + public WargEntity(EntityType entityType, Level world) { super(entityType, world); } - public static DefaultAttributeContainer.Builder setAttributes() { - return AnimalEntity.createAnimalAttributes() - .add(EntityAttributes.MOVEMENT_SPEED, 0.4) - .add(EntityAttributes.MAX_HEALTH, 24.0d) - .add(EntityAttributes.KNOCKBACK_RESISTANCE, 0.2d) - .add(EntityAttributes.ATTACK_SPEED, 1.0d) - .add(EntityAttributes.FOLLOW_RANGE, 38.0d) - .add(EntityAttributes.ATTACK_DAMAGE, 4.0d) - .add(EntityAttributes.STEP_HEIGHT, 1.15d) - .add(EntityAttributes.SAFE_FALL_DISTANCE, 6.0d); + public static AttributeSupplier.Builder setAttributes() { + return Mob.createMobAttributes() + .add(Attributes.MOVEMENT_SPEED, 0.4) + .add(Attributes.MAX_HEALTH, 24.0d) + .add(Attributes.KNOCKBACK_RESISTANCE, 0.2d) + .add(Attributes.ATTACK_SPEED, 1.0d) + .add(Attributes.FOLLOW_RANGE, 38.0d) + .add(Attributes.ATTACK_DAMAGE, 4.0d) + .add(Attributes.STEP_HEIGHT, 1.15d) + .add(Attributes.SAFE_FALL_DISTANCE, 6.0d); } @Override - protected void initAttributes(Random random) { - this.getAttributeInstance(EntityAttributes.MAX_HEALTH).setBaseValue(this.getChildHealthBonus(random::nextInt)); - this.getAttributeInstance(EntityAttributes.MOVEMENT_SPEED).setBaseValue(this.getChildMovementSpeedBonus(random::nextDouble)); - this.getAttributeInstance(EntityAttributes.ATTACK_DAMAGE).setBaseValue(this.getChildAttackDamageBonus(random::nextDouble)); + protected void randomizeAttributes(RandomSource random) { + this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.generateMaxHealth(random::nextInt)); + this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.generateSpeed(random::nextDouble)); + this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(this.getChildAttackDamageBonus(random::nextDouble)); } @Override @@ -95,45 +111,45 @@ public boolean canUseSlot(EquipmentSlot slot) { } @Override - protected void initGoals() { - this.goalSelector.add(1, new SwimGoal(this)); - this.goalSelector.add(3, new MeleeAttackGoal(this, 2, false)); - this.goalSelector.add(4, new ChargeAttackGoal(this, this.getDisposition(), maxChargeCooldown())); - this.goalSelector.add(5, new AnimalMateGoal(this, 1.5)); - this.goalSelector.add(6, new TemptGoal(this, 0.9, (stack) -> stack.isIn(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "warg_food"))), false)); - this.goalSelector.add(7, new WanderAroundFarGoal(this, 0.5)); - this.goalSelector.add(8, new LookAtEntityGoal(this, PlayerEntity.class, 6.0f)); - this.goalSelector.add(9, new LookAroundGoal(this)); - this.targetSelector.add(3, new BeastRevengeGoal(this, new Class[0]).setGroupRevenge()); - this.targetSelector.add(4, new BeastTargetPlayerGoal(this, this.getDisposition())); - this.targetSelector.add(10, new BeastActiveTargetGoal<>(this, BroadhoofGoatEntity.class, true)); - this.targetSelector.add(10, new BeastActiveTargetGoal<>(this, GreatHornEntity.class, true)); - this.targetSelector.add(11, new BeastActiveTargetGoal<>(this, SheepEntity.class, true)); - this.targetSelector.add(12, new BeastActiveTargetGoal<>(this, GoatEntity.class, true)); + protected void registerGoals() { + this.goalSelector.addGoal(1, new FloatGoal(this)); + this.goalSelector.addGoal(3, new MeleeAttackGoal(this, 2, false)); + this.goalSelector.addGoal(4, new ChargeAttackGoal(this, this.getDisposition(), maxChargeCooldown())); + this.goalSelector.addGoal(5, new BreedGoal(this, 1.5)); + this.goalSelector.addGoal(6, new TemptGoal(this, 0.9, (stack) -> stack.is(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "warg_food"))), false)); + this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 0.5)); + this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 6.0f)); + this.goalSelector.addGoal(9, new RandomLookAroundGoal(this)); + this.targetSelector.addGoal(3, new BeastRevengeGoal(this, new Class[0]).setGroupRevenge()); + this.targetSelector.addGoal(4, new BeastTargetPlayerGoal(this, this.getDisposition())); + this.targetSelector.addGoal(10, new BeastActiveTargetGoal<>(this, BroadhoofGoatEntity.class, true)); + this.targetSelector.addGoal(10, new BeastActiveTargetGoal<>(this, GreatHornEntity.class, true)); + this.targetSelector.addGoal(11, new BeastActiveTargetGoal<>(this, Sheep.class, true)); + this.targetSelector.addGoal(12, new BeastActiveTargetGoal<>(this, Goat.class, true)); } @Override - protected void initDataTracker(DataTracker.Builder builder) { - super.initDataTracker(builder); - builder.add(VARIANT, 0); - builder.add(EYE_VARIANT, 0); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(VARIANT, 0); + builder.define(EYE_VARIANT, 0); } @Override - protected void writeCustomData(WriteView view) { - super.writeCustomData(view); + public void addAdditionalSaveData(CompoundTag view) { + super.addAdditionalSaveData(view); view.putInt("Variant", this.getTypeVariant()); view.putInt("EyeVariant", this.getEyeTypeVariant()); } @Override - protected void readCustomData(ReadView view) { - super.readCustomData(view); - this.dataTracker.set(VARIANT, view.getInt("Variant", 0)); - this.dataTracker.set(EYE_VARIANT, view.getInt("EyeVariant", 0)); + public void readAdditionalSaveData(CompoundTag view) { + super.readAdditionalSaveData(view); + this.entityData.set(VARIANT, view.getInt("Variant")); + this.entityData.set(EYE_VARIANT, view.getInt("EyeVariant")); } - protected static float getChildHealthBonus(IntUnaryOperator randomIntGetter) { + protected static float generateMaxHealth(IntUnaryOperator randomIntGetter) { return 12.0f + (float)randomIntGetter.applyAsInt(6) + (float)randomIntGetter.applyAsInt(6); } @@ -141,24 +157,20 @@ protected static double getChildAttackDamageBonus(DoubleSupplier randomDoubleGet return (double)4f + randomDoubleGetter.getAsDouble() + randomDoubleGetter.getAsDouble() + randomDoubleGetter.getAsDouble(); } - protected static double getChildMovementSpeedBonus(DoubleSupplier randomDoubleGetter) { + protected static double generateSpeed(DoubleSupplier randomDoubleGetter) { return ((double)0.5 + randomDoubleGetter.getAsDouble() * 0.25 + randomDoubleGetter.getAsDouble() * 0.25 + randomDoubleGetter.getAsDouble() * 0.25) * 0.3; } - private WolfSoundVariant getSoundVariant() { - return SoundEvents.WOLF_SOUNDS.get(WolfSoundVariants.Type.ANGRY); - } - @Override public void tick() { super.tick(); if(this.isCharging()) { - if(!chargeAnimationState.isRunning()) { - this.chargeAnimationState.start(this.age); + if(!chargeAnimationState.isStarted()) { + this.chargeAnimationState.start(this.tickCount); } - if(this.chargeTimeout <= maxChargeCooldown() - 10 && this.isOnGround()) { + if(this.chargeTimeout <= maxChargeCooldown() - 10 && this.onGround()) { this.setCharging(false); this.setHasCharged(false); } @@ -166,42 +178,42 @@ public void tick() { } @Override - public ActionResult interactMob(PlayerEntity player, Hand hand) { - ItemStack itemStack = player.getStackInHand(hand); + public InteractionResult mobInteract(Player player, InteractionHand hand) { + ItemStack itemStack = player.getItemInHand(hand); - if(!this.getWorld().isClient() && !player.isCreative()) { + if(!this.level().isClientSide() && !player.isCreative()) { RaceType playerRace = RaceUtil.getRaceType(player); if(playerRace == RaceType.NONE || (this.getCompatibleRaces() != null && !this.getCompatibleRaces().contains(playerRace))) { - return ActionResult.FAIL; + return InteractionResult.FAIL; } } - if(this.isTame()) { - if (this.isBreedingItem(itemStack)) { + if(this.isTamed()) { + if (this.isFood(itemStack)) { if(this.getHealth() < this.getMaxHealth()) { - itemStack.decrementUnlessCreative(1, player); - FoodComponent foodComponent = itemStack.get(DataComponentTypes.FOOD); + itemStack.consume(1, player); + FoodProperties foodComponent = itemStack.get(DataComponents.FOOD); float f = foodComponent != null ? (float)foodComponent.nutrition() : 1.0f; this.heal(2.0f * f); - return ActionResult.SUCCESS; + return InteractionResult.SUCCESS; } - else if (!this.getWorld().isClient && this.getBreedingAge() == 0 && this.canEat()) { - this.eat(player, hand, itemStack); - this.lovePlayer(player); - return ActionResult.SUCCESS; + else if (!this.level().isClientSide && this.getAge() == 0 && this.canFallInLove()) { + this.usePlayerItem(player, hand, itemStack); + this.setInLove(player); + return InteractionResult.SUCCESS; } } } - return super.interactMob(player, hand); + return super.mobInteract(player, hand); } @Override @Nullable - public PassiveEntity createChild(ServerWorld world, PassiveEntity entity) { + public AgeableMob getBreedOffspring(ServerLevel world, AgeableMob entity) { WargEntity wargEntity = (WargEntity) entity; - WargEntity wargEntity2 = EntitiesME.WARG.create(world, SpawnReason.BREEDING); + WargEntity wargEntity2 = EntitiesME.WARG.create(world); if (wargEntity2 != null) { int i = this.random.nextInt(9); WargVariant wargVariant = i < 4 ? this.getVariant() : (i < 8 ? wargEntity.getVariant() : Util.getRandom(WargVariant.values(), this.random)); @@ -209,16 +221,16 @@ public PassiveEntity createChild(ServerWorld world, PassiveEntity entity) { int j = this.random.nextInt(9); WargEyeVariant eyeVariant = j < 4 ? this.getEyeVariant() : (j < 8 ? wargEntity.getEyeVariant() : Util.getRandom(WargEyeVariant.values(), this.random)); wargEntity2.setEyeVariant(eyeVariant); - this.setChildAttributes(entity, wargEntity2); + this.setOffspringAttributes(entity, wargEntity2); } return wargEntity2; } @Override - protected void setChildAttributes(PassiveEntity other, AbstractHorseEntity child) { - this.setChildAttribute(other, child, EntityAttributes.MAX_HEALTH, MIN_HEALTH_BONUS, MAX_HEALTH_BONUS); - this.setChildAttribute(other, child, EntityAttributes.ATTACK_DAMAGE, MIN_ATTACK_DAMAGE_BONUS, MAX_ATTACK_DAMAGE_BONUS); - this.setChildAttribute(other, child, EntityAttributes.MOVEMENT_SPEED, MIN_MOVEMENT_SPEED_BONUS, MAX_MOVEMENT_SPEED_BONUS); + protected void setOffspringAttributes(AgeableMob other, AbstractHorse child) { + this.setOffspringAttribute(other, child, Attributes.MAX_HEALTH, MIN_HEALTH_BONUS, MAX_HEALTH_BONUS); + this.setOffspringAttribute(other, child, Attributes.ATTACK_DAMAGE, MIN_ATTACK_DAMAGE_BONUS, MAX_ATTACK_DAMAGE_BONUS); + this.setOffspringAttribute(other, child, Attributes.MOVEMENT_SPEED, MIN_MOVEMENT_SPEED_BONUS, MAX_MOVEMENT_SPEED_BONUS); } @Override @@ -237,48 +249,48 @@ public boolean usesTameness() { } @Override - public EntityDimensions getBaseDimensions(EntityPose pose) { - return this.isBaby() ? BABY_BASE_DIMENSIONS : super.getBaseDimensions(pose); + public EntityDimensions getDefaultDimensions(Pose pose) { + return this.isBaby() ? BABY_BASE_DIMENSIONS : super.getDefaultDimensions(pose); } @Override - public boolean canBreedWith(AnimalEntity other) { + public boolean canMate(Animal other) { return other instanceof WargEntity; } @Override - public boolean isBreedingItem(ItemStack stack) { - return stack.isIn(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "warg_food"))); + public boolean isFood(ItemStack stack) { + return stack.is(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "warg_food"))); } @Override - protected float getSaddledSpeed(PlayerEntity controllingPlayer) { + protected float getRiddenSpeed(Player controllingPlayer) { if(!this.isSitting()) { - return controllingPlayer.isSprinting() ? ((float)this.getAttributeValue(EntityAttributes.MOVEMENT_SPEED)) : ((float)this.getAttributeValue(EntityAttributes.MOVEMENT_SPEED) * 0.25f); + return controllingPlayer.isSprinting() ? ((float)this.getAttributeValue(Attributes.MOVEMENT_SPEED)) : ((float)this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 0.25f); } - return super.getSaddledSpeed(controllingPlayer); + return super.getRiddenSpeed(controllingPlayer); } @Override protected float getNpcSaddledSpeed(NpcEntity controllingNpc) { if(!this.isSitting()) { - return controllingNpc.isSprinting() ? ((float)this.getAttributeValue(EntityAttributes.MOVEMENT_SPEED)) : ((float)this.getAttributeValue(EntityAttributes.MOVEMENT_SPEED) * 0.25f); + return controllingNpc.isSprinting() ? ((float)this.getAttributeValue(Attributes.MOVEMENT_SPEED)) : ((float)this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 0.25f); } return super.getNpcSaddledSpeed(controllingNpc); } @Override - public boolean canSprintAsVehicle() { + public boolean canSprint() { return true; } @Override - protected Vec3d getPassengerAttachmentPos(Entity passenger, EntityDimensions dimensions, float scaleFactor) { - float animationSpeed = this.limbAnimator.getSpeed(); - float animationProgress = this.limbAnimator.getAnimationProgress() * (MathHelper.PI / 180) * 18; - float f = this.limbAnimator.getAnimationProgress() / 20; + protected Vec3 getPassengerAttachmentPoint(Entity passenger, EntityDimensions dimensions, float scaleFactor) { + float animationSpeed = this.walkAnimation.speed(); + float animationProgress = this.walkAnimation.position() * (Mth.PI / 180) * 18; + float f = this.walkAnimation.position() / 20; boolean sprinting = passenger.isSprinting(); @@ -286,8 +298,8 @@ protected Vec3d getPassengerAttachmentPos(Entity passenger, EntityDimensions dim float frequency = sprinting ? (0.75f/1.4f) : 4; double y = sprinting ? - 0.025 - MathHelper.cos((f/frequency) * (MathHelper.PI*2)) * 0.06f : - MathHelper.cos(animationProgress * frequency) * 0.06 * animationSpeed - 0.05; + 0.025 - Mth.cos((f/frequency) * (Mth.PI*2)) * 0.06f : + Mth.cos(animationProgress * frequency) * 0.06 * animationSpeed - 0.05; if(this.isSitting()) { y = -0.5; @@ -295,18 +307,18 @@ protected Vec3d getPassengerAttachmentPos(Entity passenger, EntityDimensions dim double side = 0; double front = -PASSENGER_SADDLE_BACKWARD_OFFSET; - double x = MathHelper.cos((float)Math.toRadians(this.getBodyYaw())) * side - MathHelper.sin((float)Math.toRadians(this.getBodyYaw())) * front; - double z = MathHelper.sin((float)Math.toRadians(this.getBodyYaw())) * side + MathHelper.cos((float)Math.toRadians(this.getBodyYaw())) * front; + double x = Mth.cos((float)Math.toRadians(this.getVisualRotationYInDegrees())) * side - Mth.sin((float)Math.toRadians(this.getVisualRotationYInDegrees())) * front; + double z = Mth.sin((float)Math.toRadians(this.getVisualRotationYInDegrees())) * side + Mth.cos((float)Math.toRadians(this.getVisualRotationYInDegrees())) * front; - return super.getPassengerAttachmentPos(passenger, dimensions, scaleFactor).add(x, y + PASSENGER_SADDLE_Y_OFFSET, z); + return super.getPassengerAttachmentPoint(passenger, dimensions, scaleFactor).add(x, y + PASSENGER_SADDLE_Y_OFFSET, z); } @Override - public void tickMovement() { - super.tickMovement(); + public void aiStep() { + super.aiStep(); - if(this.isAttacking() || this.getAttacker() != null) { - if(!this.isTame() || this.isTame() && this.getAttacker() != null) { + if(this.isAggressive() || this.getLastHurtByMob() != null) { + if(!this.isTamed() || this.isTamed() && this.getLastHurtByMob() != null) { this.setSitting(false); } @@ -317,7 +329,7 @@ public void tickMovement() { //this.idleAnimationTimeout = this.random.nextInt(600) + 1700; } - if(!this.isAttacking() && this.getAttacker() == null) { + if(!this.isAggressive() && this.getLastHurtByMob() == null) { this.setRunning(false); } @@ -328,28 +340,28 @@ public void tickMovement() { @Override protected void setupAnimationStates() { - this.idleAnimationState.startIfNotRunning(this.age); + this.idleAnimationState.startIfStopped(this.tickCount); if(this.isSitting()) { - if(!this.startSittingAnimationState.isRunning() && !this.sittingAnimationState.isRunning()) { - this.startSittingAnimationState.startIfNotRunning(this.age); + if(!this.startSittingAnimationState.isStarted() && !this.sittingAnimationState.isStarted()) { + this.startSittingAnimationState.startIfStopped(this.tickCount); } - if(this.startSittingAnimationState.getTimeInMilliseconds(this.age) > 2000) { - this.sittingAnimationState.startIfNotRunning(this.age); + if(this.startSittingAnimationState.getAccumulatedTime() > 2000) { + this.sittingAnimationState.startIfStopped(this.tickCount); this.startSittingAnimationState.stop(); } } - else if(this.startSittingAnimationState.isRunning() || this.sittingAnimationState.isRunning()) { + else if(this.startSittingAnimationState.isStarted() || this.sittingAnimationState.isStarted()) { this.startSittingAnimationState.stop(); this.sittingAnimationState.stop(); - this.stopSittingAnimationState.startIfNotRunning(this.age); + this.stopSittingAnimationState.startIfStopped(this.tickCount); } - if(this.stopSittingAnimationState.getTimeInMilliseconds(this.age) > 1500) { + if(this.stopSittingAnimationState.getAccumulatedTime() > 1500) { this.stopSittingAnimationState.stop(); } } @Override public boolean isCommandItem(ItemStack stack) { - return stack.isIn(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "bones"))); + return stack.is(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "bones"))); } @Override @@ -358,11 +370,11 @@ public boolean isFoodItem(ItemStack itemStack) { } @Override - public boolean tryAttack(ServerWorld world, Entity target) { - boolean result = super.tryAttack(world, target); + public boolean doHurtTarget(Entity target) { + boolean result = super.doHurtTarget(target); if(result) { this.setRunning(true); - this.getWorld().sendEntityStatus(this, EntityStatuses.PLAY_ATTACK_SOUND); + this.level().broadcastEntityEvent(this, EntityEvent.START_ATTACKING); } return result; } @@ -371,39 +383,40 @@ public boolean tryAttack(ServerWorld world, Entity target) { public void chargeAttack() { if(!this.hasCharged()) { this.setHasCharged(true); - if(!this.isTame() && !this.getWorld().isClient) { - if(targetDir == Vec3d.ZERO && this.getTarget() != null) { - targetDir = new Vec3d( this.getTarget().getBlockPos().getX() - this.getBlockPos().getX(), - this.getTarget().getBlockPos().getY() - this.getBlockPos().getY(), - this.getTarget().getBlockPos().getZ() - this.getBlockPos().getZ()); + if(!this.isTamed() && !this.level().isClientSide) { + if(targetDir == Vec3.ZERO && this.getTarget() != null) { + targetDir = new Vec3( this.getTarget().blockPosition().getX() - this.blockPosition().getX(), + this.getTarget().blockPosition().getY() - this.blockPosition().getY(), + this.getTarget().blockPosition().getZ() - this.blockPosition().getZ()); } - this.setVelocity(targetDir.multiply(1,0,1).normalize().add(0,0.6,0).multiply(0.7f)); + this.setDeltaMovement(targetDir.multiply(1,0,1).normalize().add(0,0.6,0).scale(0.7f)); } - else if (this.getWorld().isClient) { + else if (this.level().isClientSide) { this.setHasCharged(true); - this.setVelocity(this.getRotationVector().multiply(1,0,1).normalize().add(0,0.35,0).multiply(1.3f)); + this.setDeltaMovement(this.getLookAngle().multiply(1,0,1).normalize().add(0,0.35,0).scale(1.3f)); } } - if(!this.isTame() && !this.getWorld().isClient) { - this.setYaw((float) Math.toDegrees(Math.atan2(-targetDir.x, targetDir.z))); + if(!this.isTamed() && !this.level().isClientSide) { + this.setYRot((float) Math.toDegrees(Math.atan2(-targetDir.x, targetDir.z))); } - List entities = this.getWorld().getOtherEntities(this, this.getBoundingBox().expand(0.2f, 0.0, 0.2f)); - - Entity owner = this.getOwner(); - for(Entity entity : entities) { - if((owner == null || entity.getUuid() != owner.getUuid()) && entity != this && !this.getPassengerList().contains(entity) && !((entity instanceof WargEntity) && !this.isTame())) { - if(getWorld() instanceof ServerWorld serverWorld) - entity.damage(serverWorld, entity.getDamageSources().mobAttack(this), this.getAttackDamage()); - - if(entity instanceof ServerPlayerEntity) { + if (this.level() instanceof ServerLevel serverLevel) { + Entity owner = this.getOwner(); + List entities = serverLevel.getEntities( + this, + this.getBoundingBox().inflate(0.2f, 0.0, 0.2f), + entity -> (owner == null || entity != owner) + && !this.getPassengers().contains(entity) + && !(entity instanceof WargEntity && !this.isTamed()) + ); + for(Entity entity : entities) { + entity.hurt(entity.damageSources().mobAttack(this), this.getAttackDamage()); + if(entity instanceof ServerPlayer) { entity.stopRiding(); + } else { + entity.removeVehicle(); + entity.ejectPassengers(); } - else if(!this.getWorld().isClient) { - entity.dismountVehicle(); - entity.removeAllPassengers(); - } - this.setCharging(false); this.setHasCharged(false); } @@ -416,19 +429,19 @@ public boolean shouldAttackWhenMounted() { } @Override - public boolean handleFallDamage(double fallDistance, float damagePerDistance, DamageSource damageSource) { + public boolean causeFallDamage(float fallDistance, float damagePerDistance, DamageSource damageSource) { int i; if (fallDistance > 1.0f) { - this.playSound(SoundEvents.ENTITY_WOLF_STEP, 2.5f, 0.7f); + this.playSound(SoundEvents.WOLF_STEP, 2.5f, 0.7f); } - if ((i = this.computeFallDamage(fallDistance, damagePerDistance)) <= 0) { + if ((i = this.calculateFallDamage(fallDistance, damagePerDistance)) <= 0) { return false; } - this.damage(damageSource, i); - if (this.hasPassengers()) { - if(getWorld() instanceof ServerWorld serverWorld){ - for (Entity entity : this.getPassengersDeep()) { - entity.damage(serverWorld, damageSource, i); + this.hurt(damageSource, i); + if (this.isVehicle()) { + if(!level().isClientSide()) { + for (Entity entity : this.getIndirectPassengers()) { + entity.hurt(damageSource, i); } } } @@ -438,7 +451,7 @@ public boolean handleFallDamage(double fallDistance, float damagePerDistance, Da //@Override public boolean isHorseArmor(ItemStack stack) { - return stack.isIn(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "warg_armor"))); + return stack.is(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "warg_armor"))); } public boolean hasCharged() { @@ -451,7 +464,7 @@ public void setHasCharged(boolean hasCharged) { @Override public boolean isBondingItem(ItemStack itemStack) { - return itemStack.isIn(TagKey.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "warg_food"))); + return itemStack.is(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "warg_food"))); } @Override @@ -470,13 +483,13 @@ public boolean canCarryChest() { } /* VARIANTS */ - public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, - @Nullable EntityData entityData) { + public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, + @Nullable SpawnGroupData entityData) { WargVariant variant = Util.getRandom(WargVariant.values(), this.random); setVariant(variant); WargEyeVariant eyeVariant = Util.getRandom(WargEyeVariant.values(), this.random); setEyeVariant(eyeVariant); - return super.initialize(world, difficulty, spawnReason, entityData); + return super.finalizeSpawn(world, difficulty, spawnReason, entityData); } public WargVariant getVariant() { @@ -487,29 +500,29 @@ public WargEyeVariant getEyeVariant() { return WargEyeVariant.byId(this.getEyeTypeVariant() & 255); } private int getTypeVariant() { - return this.dataTracker.get(VARIANT); + return this.entityData.get(VARIANT); } private int getEyeTypeVariant() { - return this.dataTracker.get(EYE_VARIANT); + return this.entityData.get(EYE_VARIANT); } private void setVariant(WargVariant variant) { - this.dataTracker.set(VARIANT, variant.getId() & 255); + this.entityData.set(VARIANT, variant.getId() & 255); } private void setEyeVariant(WargEyeVariant variant) { - this.dataTracker.set(EYE_VARIANT, variant.getId() & 255); + this.entityData.set(EYE_VARIANT, variant.getId() & 255); } @Nullable @Override protected SoundEvent getDeathSound() { - return this.getSoundVariant().deathSound().value(); + return SoundEvents.WOLF_DEATH; } @Nullable @Override protected SoundEvent getHurtSound(DamageSource source) { - return this.getSoundVariant().hurtSound().value(); + return SoundEvents.WOLF_HURT; } @Override protected void playHurtSound(DamageSource damageSource) { @@ -519,7 +532,7 @@ protected void playHurtSound(DamageSource damageSource) { @Nullable @Override protected SoundEvent getAmbientSound() { - return this.getSoundVariant().ambientSound().value(); + return SoundEvents.WOLF_AMBIENT; } @@ -531,32 +544,32 @@ public void playAmbientSound() { @Nullable @Override public SoundEvent getAmbientStandSound() { - return this.getSoundVariant().pantSound().value(); + return SoundEvents.WOLF_PANT; } @Nullable @Override protected SoundEvent getAngrySound() { - return this.getSoundVariant().growlSound().value(); + return SoundEvents.WOLF_GROWL; } @Override - public void playAngrySound() { + public void makeMad() { this.playSound(this.getAngrySound(), 1.0f, 0.7f); } @Override protected void playStepSound(BlockPos pos, BlockState state) { - this.playSound(SoundEvents.ENTITY_WOLF_STEP, 0.15f, 0.7f); + this.playSound(SoundEvents.WOLF_STEP, 0.15f, 0.7f); } @Override - protected void playWalkSound(BlockSoundGroup group) { - this.playSound(SoundEvents.ENTITY_WOLF_STEP, 1.0f, 0.7f); + protected void playGallopSound(SoundType group) { + this.playSound(SoundEvents.WOLF_STEP, 1.0f, 0.7f); } @Override protected void playJumpSound() { - this.playSound(SoundEvents.ENTITY_WOLF_STEP, 1.1f, 0.7f); + this.playSound(SoundEvents.WOLF_STEP, 1.1f, 0.7f); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargEntityRenderState.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargEntityRenderState.java deleted file mode 100644 index e68b574677..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargEntityRenderState.java +++ /dev/null @@ -1,21 +0,0 @@ -package net.sevenstars.middleearth.entity.beasts.warg; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.entity.AnimationState; -import net.minecraft.item.ItemStack; -import net.sevenstars.middleearth.entity.beasts.BeastEntityRenderState; - -@Environment(EnvType.CLIENT) -public class WargEntityRenderState extends BeastEntityRenderState { - WargVariant variant = WargVariant.BROWN; - public WargEyeVariant eyeVariant = WargEyeVariant.BLUE; - public ItemStack armor = ItemStack.EMPTY; - public ItemStack saddle = ItemStack.EMPTY; - public boolean haveEmissiveEyes; - public boolean isRunning; - - public AnimationState idleAnimationState = new AnimationState(); - public AnimationState attackAnimationState = new AnimationState(); - public AnimationState sittingAnimationState = new AnimationState(); -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargModel.java index 868e026411..32c0e4a590 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargModel.java @@ -1,153 +1,149 @@ package net.sevenstars.middleearth.entity.beasts.warg; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.animation.Animation; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.render.entity.model.EntityModelPartNames; - -public class WargModel extends EntityModel { +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.util.Mth; + +public class WargModel extends HierarchicalModel { private final ModelPart warg; private final ModelPart head; private final ModelPart mane; - private final Animation runningAnimation; - private final Animation walkingAnimation; - private final Animation idleAnimation; - private final Animation bitingAnimation; - private final Animation startSittingAnimation; - private final Animation stopSittingAnimation; - private final Animation sittingAnimation; - public WargModel(ModelPart root) { - super(root); - this.warg = root.getChild("root"); - ModelPart body = this.warg.getChild(EntityModelPartNames.BODY); + ModelPart body = this.warg.getChild(PartNames.BODY); ModelPart upperBody = body.getChild("upper_body"); ModelPart bodyNoLegs = upperBody.getChild("body_no_legs"); - this.head = bodyNoLegs.getChild(EntityModelPartNames.HEAD); + this.head = bodyNoLegs.getChild(PartNames.HEAD); this.mane = bodyNoLegs.getChild("body_fur").getChild("mane"); - this.walkingAnimation = WargAnimations.WALK.createAnimation(root); - this.runningAnimation = WargAnimations.RUN.createAnimation(root); - this.idleAnimation = WargAnimations.IDLE.createAnimation(root); - this.bitingAnimation = WargAnimations.BITE.createAnimation(root); - this.startSittingAnimation = WargAnimations.STANDING_TO_SITTING.createAnimation(root); - this.stopSittingAnimation = WargAnimations.SITTING_TO_STANDING.createAnimation(root); - this.sittingAnimation = WargAnimations.SITTING.createAnimation(root); } - public static TexturedModelData getTexturedModelData() { - return TexturedModelData.of(getModelData(), 128, 128); + public static LayerDefinition getTexturedModelData() { + return LayerDefinition.create(getModelData(), 128, 128); } - public static ModelData getModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData root = modelPartData.addChild("root", ModelPartBuilder.create(), ModelTransform.of(-1.0F, 6.0F, -2.0F, 0.0F, 1.5708F, 0.0F)); - ModelPartData body = root.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(-2.6142F, 2.1138F, 1.5F)); - ModelPartData upperBody = body.addChild("upper_body", ModelPartBuilder.create(), ModelTransform.origin(-1.3858F, -1.1138F, -1.5F)); - ModelPartData bodyNoLegs = upperBody.addChild("body_no_legs", ModelPartBuilder.create(), ModelTransform.origin(7.5F, -0.25F, 0.5F)); - ModelPartData bodyFur = bodyNoLegs.addChild("body_fur", ModelPartBuilder.create().uv(0, 0).cuboid(-6.5F, -7.5F, -6.0F, 14.0F, 15.0F, 13.0F, new Dilation(-0.3F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - bodyFur.addChild("mane", ModelPartBuilder.create().uv(54, 15).cuboid(-9.5F, -5.0F, 0.0F, 20.0F, 8.0F, 0.0F, new Dilation(0.0F)), ModelTransform.origin(-2.0F, -6.75F, 0.5F)); - bodyNoLegs.addChild("main_body", ModelPartBuilder.create().uv(0, 49).cuboid(-0.5F, -6.0F, -5.0F, 12.0F, 12.0F, 11.0F, new Dilation(0.0F)), ModelTransform.origin(-5.3F, 0.25F, 0.0F)); - - ModelPartData head = bodyNoLegs.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create() - .uv(74, 0).cuboid(-1.5F, -3.25F, -5.0F, 10.0F, 5.0F, 10.0F, new Dilation(0.0F)) - .uv(74, 0).cuboid(-1.5F, -3.25F, -5.0F, 10.0F, 5.0F, 10.0F, new Dilation(0.025F)) - .uv(54, 31).cuboid(-2.1142F, 1.6138F, -4.0F, 10.0F, 3.0F, 8.0F, new Dilation(0.0F)), ModelTransform.origin(7.25F, -2.0F, 0.5F)); - head.addChild("snout", ModelPartBuilder.create() - .uv(54, 23).cuboid(-9.5F, 0.5F, -2.5F, 15.0F, 4.0F, 4.0F, new Dilation(0.0F)) - .uv(46, 82).cuboid(-0.644F, 4.522F, -2.5F, 6.0F, 1.0F, 4.0F, new Dilation(0.05F)), ModelTransform.origin(8.0F, -1.5F, 0.5F)); - head.addChild("ear_right", ModelPartBuilder.create(), ModelTransform.of(4.0F, -2.25F, -4.478F, 0.0F, -0.8727F, 0.0F)); - head.addChild("ear_left", ModelPartBuilder.create(), ModelTransform.of(4.0F, -2.25F, 4.522F, 0.0F, 0.8727F, 0.0F)); - ModelPartData earRight = head.getChild("ear_right"); - earRight.addChild("earR_r1", ModelPartBuilder.create().uv(82, 72).cuboid(0.2802F, -4.8619F, -1.032F, 3.0F, 6.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(-1.0F, 1.0F, -0.022F, 0.0F, 0.0F, -1.0036F)); - ModelPartData earLeft = head.getChild("ear_left"); - earLeft.addChild("earL_r1", ModelPartBuilder.create().uv(82, 79).cuboid(0.2802F, -4.8619F, 0.01F, 3.0F, 6.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(-1.0F, 1.0F, 0.0F, 0.0F, 0.0F, -1.0036F)); - ModelPartData jaw = head.addChild("jaw", ModelPartBuilder.create() - .uv(54, 42).cuboid(-5.5F, -0.25F, -2.0F, 15.0F, 2.0F, 4.0F, new Dilation(0.0F)) - .uv(46, 60).cuboid(-5.564F, -1.75F, -2.0F, 15.0F, 2.0F, 4.0F, new Dilation(-0.09F)), ModelTransform.of(3.75F, 3.25F, 0.0F, 0.0F, 0.0F, 0.2618F)); - jaw.addChild("tongue", ModelPartBuilder.create().uv(8, 78).cuboid(-1.8F, 0.1F, -1.5F, 9.0F, 0.0F, 3.0F, new Dilation(0.0F)), ModelTransform.of(2.0F, -0.25F, 0.0F, 0.0F, 0.0F, -0.0349F)); - head.addChild("headmane", ModelPartBuilder.create().uv(68, 66).cuboid(-7.5F, -5.0F, 0.0F, 15.0F, 6.0F, 0.0F, new Dilation(0.0F)), ModelTransform.origin(-1.0F, -4.25F, 0.0F)); - - ModelPartData waitTail = bodyNoLegs.addChild("wait_tail", ModelPartBuilder.create().uv(0, 28).cuboid(-0.3F, -2.0F, -5.5F, 16.0F, 10.0F, 11.0F, new Dilation(0.0F)), ModelTransform.origin(-20.5F, -3.75F, 0.5F)); - waitTail.addChild("tail", ModelPartBuilder.create(), ModelTransform.of(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -0.829F)); - ModelPartData tail = waitTail.getChild("tail"); - tail.addChild("bone fluff_r1", ModelPartBuilder.create() - .uv(0, 108).cuboid(-13.0F, -5.0F, -0.75F, 15.0F, 2.0F, 1.0F, new Dilation(0.4F)) - .uv(0, 72).cuboid(-13.0F, -5.0F, -0.75F, 15.0F, 2.0F, 1.0F, new Dilation(0.0F)) - .uv(46, 49).cuboid(-18.0F, -6.0F, -2.75F, 20.0F, 6.0F, 5.0F, new Dilation(0.0F)), ModelTransform.of(-1.5979F, 4.1769F, 0.25F, 0.0F, 0.0F, 0.1745F)); - - upperBody.addChild("right_front_leg", ModelPartBuilder.create().uv(30, 72).cuboid(-2.0F, 0.0F, -2.0F, 4.0F, 13.0F, 4.0F, new Dilation(0.01F)), ModelTransform.origin(9.0F, 4.0F, -2.5F)); - upperBody.addChild("left_front_leg", ModelPartBuilder.create().uv(30, 89).cuboid(-2.0F, 0.0F, -2.5F, 4.0F, 13.0F, 4.0F, new Dilation(0.01F)), ModelTransform.origin(9.0F, 4.0F, 5.0F)); - - ModelPartData backBody = body.addChild("back_body", ModelPartBuilder.create(), ModelTransform.origin(2.3142F, -2.1138F, -0.5F)); - ModelPartData leftBackLeg = backBody.addChild("left_back_leg", ModelPartBuilder.create().uv(46, 66).cuboid(-3.5F, -1.0F, -1.0F, 7.0F, 12.0F, 4.0F, new Dilation(0.0F)), ModelTransform.origin(-14.7F, -2.0F, 3.5F)); - leftBackLeg.addChild("left_back_foot", ModelPartBuilder.create().uv(0, 78).cuboid(-2.0F, -2.0F, -1.5F, 4.0F, 12.0F, 3.0F, new Dilation(0.01F)), ModelTransform.origin(-3.2F, 10.0F, 0.5F)); - ModelPartData rightBackLeg = backBody.addChild("right_back_leg", ModelPartBuilder.create().uv(46, 66).cuboid(-4.5F, -1.0F, -4.0F, 7.0F, 12.0F, 4.0F, new Dilation(0.0F)), ModelTransform.origin(-13.7F, -2.0F, -2.5F)); - rightBackLeg.addChild("right_back_foot", ModelPartBuilder.create().uv(0, 93).cuboid(-2.0F, -2.0F, -1.5F, 4.0F, 12.0F, 3.0F, new Dilation(0.01F)), ModelTransform.origin(-4.2F, 10.0F, -1.5F)); + public static MeshDefinition getModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition root = modelPartData.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offsetAndRotation(-1.0F, 6.0F, -2.0F, 0.0F, 1.5708F, 0.0F)); + PartDefinition body = root.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(-2.6142F, 2.1138F, 1.5F)); + PartDefinition upperBody = body.addOrReplaceChild("upper_body", CubeListBuilder.create(), PartPose.offset(-1.3858F, -1.1138F, -1.5F)); + PartDefinition bodyNoLegs = upperBody.addOrReplaceChild("body_no_legs", CubeListBuilder.create(), PartPose.offset(7.5F, -0.25F, 0.5F)); + PartDefinition bodyFur = bodyNoLegs.addOrReplaceChild("body_fur", CubeListBuilder.create().texOffs(0, 0).addBox(-6.5F, -7.5F, -6.0F, 14.0F, 15.0F, 13.0F, new CubeDeformation(-0.3F)), PartPose.offset(0.0F, 0.0F, 0.0F)); + bodyFur.addOrReplaceChild("mane", CubeListBuilder.create().texOffs(54, 15).addBox(-9.5F, -5.0F, 0.0F, 20.0F, 8.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(-2.0F, -6.75F, 0.5F)); + bodyNoLegs.addOrReplaceChild("main_body", CubeListBuilder.create().texOffs(0, 49).addBox(-0.5F, -6.0F, -5.0F, 12.0F, 12.0F, 11.0F, new CubeDeformation(0.0F)), PartPose.offset(-5.3F, 0.25F, 0.0F)); + + PartDefinition head = bodyNoLegs.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create() + .texOffs(74, 0).addBox(-1.5F, -3.25F, -5.0F, 10.0F, 5.0F, 10.0F, new CubeDeformation(0.0F)) + .texOffs(74, 0).addBox(-1.5F, -3.25F, -5.0F, 10.0F, 5.0F, 10.0F, new CubeDeformation(0.025F)) + .texOffs(54, 31).addBox(-2.1142F, 1.6138F, -4.0F, 10.0F, 3.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(7.25F, -2.0F, 0.5F)); + head.addOrReplaceChild("snout", CubeListBuilder.create() + .texOffs(54, 23).addBox(-9.5F, 0.5F, -2.5F, 15.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)) + .texOffs(46, 82).addBox(-0.644F, 4.522F, -2.5F, 6.0F, 1.0F, 4.0F, new CubeDeformation(0.05F)), PartPose.offset(8.0F, -1.5F, 0.5F)); + head.addOrReplaceChild("ear_right", CubeListBuilder.create(), PartPose.offsetAndRotation(4.0F, -2.25F, -4.478F, 0.0F, -0.8727F, 0.0F)); + head.addOrReplaceChild("ear_left", CubeListBuilder.create(), PartPose.offsetAndRotation(4.0F, -2.25F, 4.522F, 0.0F, 0.8727F, 0.0F)); + PartDefinition earRight = head.getChild("ear_right"); + earRight.addOrReplaceChild("earR_r1", CubeListBuilder.create().texOffs(82, 72).addBox(0.2802F, -4.8619F, -1.032F, 3.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-1.0F, 1.0F, -0.022F, 0.0F, 0.0F, -1.0036F)); + PartDefinition earLeft = head.getChild("ear_left"); + earLeft.addOrReplaceChild("earL_r1", CubeListBuilder.create().texOffs(82, 79).addBox(0.2802F, -4.8619F, 0.01F, 3.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-1.0F, 1.0F, 0.0F, 0.0F, 0.0F, -1.0036F)); + PartDefinition jaw = head.addOrReplaceChild("jaw", CubeListBuilder.create() + .texOffs(54, 42).addBox(-5.5F, -0.25F, -2.0F, 15.0F, 2.0F, 4.0F, new CubeDeformation(0.0F)) + .texOffs(46, 60).addBox(-5.564F, -1.75F, -2.0F, 15.0F, 2.0F, 4.0F, new CubeDeformation(-0.09F)), PartPose.offsetAndRotation(3.75F, 3.25F, 0.0F, 0.0F, 0.0F, 0.2618F)); + jaw.addOrReplaceChild("tongue", CubeListBuilder.create().texOffs(8, 78).addBox(-1.8F, 0.1F, -1.5F, 9.0F, 0.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(2.0F, -0.25F, 0.0F, 0.0F, 0.0F, -0.0349F)); + head.addOrReplaceChild("headmane", CubeListBuilder.create().texOffs(68, 66).addBox(-7.5F, -5.0F, 0.0F, 15.0F, 6.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(-1.0F, -4.25F, 0.0F)); + + PartDefinition waitTail = bodyNoLegs.addOrReplaceChild("wait_tail", CubeListBuilder.create().texOffs(0, 28).addBox(-0.3F, -2.0F, -5.5F, 16.0F, 10.0F, 11.0F, new CubeDeformation(0.0F)), PartPose.offset(-20.5F, -3.75F, 0.5F)); + waitTail.addOrReplaceChild("tail", CubeListBuilder.create(), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -0.829F)); + PartDefinition tail = waitTail.getChild("tail"); + tail.addOrReplaceChild("bone fluff_r1", CubeListBuilder.create() + .texOffs(0, 108).addBox(-13.0F, -5.0F, -0.75F, 15.0F, 2.0F, 1.0F, new CubeDeformation(0.4F)) + .texOffs(0, 72).addBox(-13.0F, -5.0F, -0.75F, 15.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(46, 49).addBox(-18.0F, -6.0F, -2.75F, 20.0F, 6.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-1.5979F, 4.1769F, 0.25F, 0.0F, 0.0F, 0.1745F)); + + upperBody.addOrReplaceChild("right_front_leg", CubeListBuilder.create().texOffs(30, 72).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 13.0F, 4.0F, new CubeDeformation(0.01F)), PartPose.offset(9.0F, 4.0F, -2.5F)); + upperBody.addOrReplaceChild("left_front_leg", CubeListBuilder.create().texOffs(30, 89).addBox(-2.0F, 0.0F, -2.5F, 4.0F, 13.0F, 4.0F, new CubeDeformation(0.01F)), PartPose.offset(9.0F, 4.0F, 5.0F)); + + PartDefinition backBody = body.addOrReplaceChild("back_body", CubeListBuilder.create(), PartPose.offset(2.3142F, -2.1138F, -0.5F)); + PartDefinition leftBackLeg = backBody.addOrReplaceChild("left_back_leg", CubeListBuilder.create().texOffs(46, 66).addBox(-3.5F, -1.0F, -1.0F, 7.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(-14.7F, -2.0F, 3.5F)); + leftBackLeg.addOrReplaceChild("left_back_foot", CubeListBuilder.create().texOffs(0, 78).addBox(-2.0F, -2.0F, -1.5F, 4.0F, 12.0F, 3.0F, new CubeDeformation(0.01F)), PartPose.offset(-3.2F, 10.0F, 0.5F)); + PartDefinition rightBackLeg = backBody.addOrReplaceChild("right_back_leg", CubeListBuilder.create().texOffs(46, 66).addBox(-4.5F, -1.0F, -4.0F, 7.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(-13.7F, -2.0F, -2.5F)); + rightBackLeg.addOrReplaceChild("right_back_foot", CubeListBuilder.create().texOffs(0, 93).addBox(-2.0F, -2.0F, -1.5F, 4.0F, 12.0F, 3.0F, new CubeDeformation(0.01F)), PartPose.offset(-4.2F, 10.0F, -1.5F)); return modelData; } - public static ModelData getEmptyModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData root = modelPartData.addChild("root", ModelPartBuilder.create(), ModelTransform.of(-1.0F, 6.0F, -2.0F, 0.0F, 1.5708F, 0.0F)); - ModelPartData body = root.addChild(EntityModelPartNames.BODY, ModelPartBuilder.create(), ModelTransform.origin(-2.6142F, 2.1138F, 1.5F)); - ModelPartData upperBody = body.addChild("upper_body", ModelPartBuilder.create(), ModelTransform.origin(-1.3858F, -1.1138F, -1.5F)); - ModelPartData bodyNoLegs = upperBody.addChild("body_no_legs", ModelPartBuilder.create(), ModelTransform.origin(7.5F, -0.25F, 0.5F)); - ModelPartData bodyFur = bodyNoLegs.addChild("body_fur", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - bodyFur.addChild("mane", ModelPartBuilder.create(), ModelTransform.origin(-2.0F, -6.75F, 0.5F)); - bodyNoLegs.addChild("main_body", ModelPartBuilder.create(), ModelTransform.origin(-5.3F, 0.25F, 0.0F)); - - ModelPartData head = bodyNoLegs.addChild(EntityModelPartNames.HEAD, ModelPartBuilder.create(), ModelTransform.origin(7.25F, -2.0F, 0.5F)); - head.addChild("snout", ModelPartBuilder.create(), ModelTransform.origin(8.0F, -1.5F, 0.5F)); - head.addChild("ear_right", ModelPartBuilder.create(), ModelTransform.of(4.0F, -2.25F, -4.478F, 0.0F, -0.8727F, 0.0F)); - head.addChild("ear_left", ModelPartBuilder.create(), ModelTransform.of(4.0F, -2.25F, 4.522F, 0.0F, 0.8727F, 0.0F)); - ModelPartData jaw = head.addChild("jaw", ModelPartBuilder.create(), ModelTransform.of(3.75F, 3.25F, 0.0F, 0.0F, 0.0F, 0.2618F)); - jaw.addChild("tongue", ModelPartBuilder.create(), ModelTransform.of(2.0F, -0.25F, 0.0F, 0.0F, 0.0F, -0.0349F)); - head.addChild("headmane", ModelPartBuilder.create(), ModelTransform.origin(-1.0F, -4.25F, 0.0F)); - - ModelPartData waitTail = bodyNoLegs.addChild("wait_tail", ModelPartBuilder.create(), ModelTransform.origin(-20.5F, -3.75F, 0.5F)); - waitTail.addChild("tail", ModelPartBuilder.create(), ModelTransform.of(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -0.829F)); - - upperBody.addChild("right_front_leg", ModelPartBuilder.create(), ModelTransform.origin(9.0F, 4.0F, -2.5F)); - upperBody.addChild("left_front_leg", ModelPartBuilder.create(), ModelTransform.origin(9.0F, 4.0F, 5.0F)); - - ModelPartData backBody = body.addChild("back_body", ModelPartBuilder.create(), ModelTransform.origin(2.3142F, -2.1138F, -0.5F)); - ModelPartData leftBackLeg = backBody.addChild("left_back_leg", ModelPartBuilder.create(), ModelTransform.origin(-14.7F, -2.0F, 3.5F)); - leftBackLeg.addChild("left_back_foot", ModelPartBuilder.create(), ModelTransform.origin(-3.2F, 10.0F, 0.5F)); - ModelPartData rightBackLeg = backBody.addChild("right_back_leg", ModelPartBuilder.create(), ModelTransform.origin(-13.7F, -2.0F, -2.5F)); - rightBackLeg.addChild("right_back_foot", ModelPartBuilder.create(), ModelTransform.origin(-4.2F, 10.0F, -1.5F)); + public static MeshDefinition getEmptyModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition root = modelPartData.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offsetAndRotation(-1.0F, 6.0F, -2.0F, 0.0F, 1.5708F, 0.0F)); + PartDefinition body = root.addOrReplaceChild(PartNames.BODY, CubeListBuilder.create(), PartPose.offset(-2.6142F, 2.1138F, 1.5F)); + PartDefinition upperBody = body.addOrReplaceChild("upper_body", CubeListBuilder.create(), PartPose.offset(-1.3858F, -1.1138F, -1.5F)); + PartDefinition bodyNoLegs = upperBody.addOrReplaceChild("body_no_legs", CubeListBuilder.create(), PartPose.offset(7.5F, -0.25F, 0.5F)); + PartDefinition bodyFur = bodyNoLegs.addOrReplaceChild("body_fur", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + bodyFur.addOrReplaceChild("mane", CubeListBuilder.create(), PartPose.offset(-2.0F, -6.75F, 0.5F)); + bodyNoLegs.addOrReplaceChild("main_body", CubeListBuilder.create(), PartPose.offset(-5.3F, 0.25F, 0.0F)); + + PartDefinition head = bodyNoLegs.addOrReplaceChild(PartNames.HEAD, CubeListBuilder.create(), PartPose.offset(7.25F, -2.0F, 0.5F)); + head.addOrReplaceChild("snout", CubeListBuilder.create(), PartPose.offset(8.0F, -1.5F, 0.5F)); + head.addOrReplaceChild("ear_right", CubeListBuilder.create(), PartPose.offsetAndRotation(4.0F, -2.25F, -4.478F, 0.0F, -0.8727F, 0.0F)); + head.addOrReplaceChild("ear_left", CubeListBuilder.create(), PartPose.offsetAndRotation(4.0F, -2.25F, 4.522F, 0.0F, 0.8727F, 0.0F)); + PartDefinition jaw = head.addOrReplaceChild("jaw", CubeListBuilder.create(), PartPose.offsetAndRotation(3.75F, 3.25F, 0.0F, 0.0F, 0.0F, 0.2618F)); + jaw.addOrReplaceChild("tongue", CubeListBuilder.create(), PartPose.offsetAndRotation(2.0F, -0.25F, 0.0F, 0.0F, 0.0F, -0.0349F)); + head.addOrReplaceChild("headmane", CubeListBuilder.create(), PartPose.offset(-1.0F, -4.25F, 0.0F)); + + PartDefinition waitTail = bodyNoLegs.addOrReplaceChild("wait_tail", CubeListBuilder.create(), PartPose.offset(-20.5F, -3.75F, 0.5F)); + waitTail.addOrReplaceChild("tail", CubeListBuilder.create(), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, -0.829F)); + + upperBody.addOrReplaceChild("right_front_leg", CubeListBuilder.create(), PartPose.offset(9.0F, 4.0F, -2.5F)); + upperBody.addOrReplaceChild("left_front_leg", CubeListBuilder.create(), PartPose.offset(9.0F, 4.0F, 5.0F)); + + PartDefinition backBody = body.addOrReplaceChild("back_body", CubeListBuilder.create(), PartPose.offset(2.3142F, -2.1138F, -0.5F)); + PartDefinition leftBackLeg = backBody.addOrReplaceChild("left_back_leg", CubeListBuilder.create(), PartPose.offset(-14.7F, -2.0F, 3.5F)); + leftBackLeg.addOrReplaceChild("left_back_foot", CubeListBuilder.create(), PartPose.offset(-3.2F, 10.0F, 0.5F)); + PartDefinition rightBackLeg = backBody.addOrReplaceChild("right_back_leg", CubeListBuilder.create(), PartPose.offset(-13.7F, -2.0F, -2.5F)); + rightBackLeg.addOrReplaceChild("right_back_foot", CubeListBuilder.create(), PartPose.offset(-4.2F, 10.0F, -1.5F)); return modelData; } @Override - public void setAngles(WargEntityRenderState state) { - super.setAngles(state); + public void setupAnim(WargEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + this.root().getAllParts().forEach(ModelPart::resetPose); + if (!entity.hasControllingPassenger()) { + this.head.yRot = Mth.clamp(netHeadYaw, -30.0F, 30.0F) * Mth.DEG_TO_RAD; + this.head.xRot = Mth.clamp(headPitch, -25.0F, 40.0F) * Mth.DEG_TO_RAD; + } - boolean running = state.isRunning || state.isSprinting - || (state.conrollingPassenger != null && state.conrollingPassenger.isSprinting()) - || state.isCharging; + boolean running = entity.isRunning() || entity.isSprinting() + || (entity.getControllingPassenger() != null && entity.getControllingPassenger().isSprinting()) + || entity.isCharging(); if(!running) { - float speed = 3.5f; - if(state.conrollingPassenger != null) { - speed = 2f; - } - this.walkingAnimation.applyWalking(state.limbSwingAnimationProgress, state.limbSwingAmplitude, speed, 2f); + float speed = entity.getControllingPassenger() != null ? 2.0F : 3.5F; + this.animateWalk(WargAnimations.WALK, limbSwing, limbSwingAmount, speed, 2.0F); } else { - this.runningAnimation.applyWalking(state.limbSwingAnimationProgress, state.limbSwingAmplitude, 1.4f, 1.2f); + this.animateWalk(WargAnimations.RUN, limbSwing, limbSwingAmount, 1.4F, 1.2F); } - this.idleAnimation.apply(state.idleAnimationState, state.age); - this.bitingAnimation.apply(state.attackAnimationState, state.age); - this.startSittingAnimation.apply(state.startSittingAnimationState, state.age); - this.stopSittingAnimation.apply(state.stopSittingAnimationState, state.age); - this.sittingAnimation.apply(state.sittingAnimationState, state.age); + this.mane.visible = !(entity.isSaddled() || entity.isWearingBodyArmor()); + this.animate(entity.idleAnimationState, WargAnimations.IDLE, ageInTicks); + this.animate(entity.attackAnimationState, WargAnimations.BITE, ageInTicks); + this.animate(entity.startSittingAnimationState, WargAnimations.STANDING_TO_SITTING, ageInTicks); + this.animate(entity.stopSittingAnimationState, WargAnimations.SITTING_TO_STANDING, ageInTicks); + this.animate(entity.sittingAnimationState, WargAnimations.SITTING, ageInTicks); + } + + @Override + public ModelPart root() { + return this.warg; } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargRenderer.java index 57f0991180..1406de01f6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/WargRenderer.java @@ -1,106 +1,71 @@ package net.sevenstars.middleearth.entity.beasts.warg; import com.google.common.collect.Maps; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.equipment.EquipmentModel; -import net.minecraft.client.render.entity.feature.SaddleFeatureRenderer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.EquipmentSlot; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.Util; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.MobRenderer; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.beasts.warg.features.*; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.MobEntityRenderer; -import net.minecraft.util.Identifier; -import net.minecraft.util.Util; - import java.util.Map; -public class WargRenderer extends MobEntityRenderer { +public class WargRenderer extends MobRenderer { private static final String PATH = "textures/entities/warg/"; private static final float SIZE = 1f; private static final int LIGHT_LEVEL_EMISSIVE_EYES = 8; - public WargRenderer(EntityRendererFactory.Context context) { - super(context, new WargModel(context.getPart(EntityModelLayersME.WARG)), 0.8f); - this.addFeature(new WargEyesFeatureRenderer(this)); - this.addFeature( // Armor Feature - new SaddleFeatureRenderer<>( - this, - context.getEquipmentRenderer(), - new WargModel(context.getPart(EntityModelLayersME.WARG_ARMOR)), - EquipmentModel.LayerType.HORSE_BODY, - state -> state.armor - ) - ); - this.addFeature(new WargArmorSpineFeatureRenderer(this, context.getEntityModels(), context.getEquipmentRenderer())); - this.addFeature(new WargArmorSideSkullsFeatureRenderer(this, context.getEntityModels(), context.getEquipmentRenderer())); - this.addFeature(new WargArmorFrontSkullFeatureRenderer(this, context.getEntityModels(), context.getEquipmentRenderer())); - this.addFeature(new WargArmorBackSkullFeatureRenderer(this, context.getEntityModels(), context.getEquipmentRenderer())); - this.addFeature(new WargSaddleFeatureRenderer(this, context.getEntityModels(), context.getEquipmentRenderer())); + public WargRenderer(EntityRendererProvider.Context context) { + super(context, new WargModel(context.bakeLayer(EntityModelLayersME.WARG)), 0.8f); + this.addLayer(new WargEyesFeatureRenderer(this)); + this.addLayer(new WargArmorFeatureRenderer(this, context.getModelSet())); + this.addLayer(new WargArmorSpineFeatureRenderer(this, context.getModelSet())); + this.addLayer(new WargArmorSideSkullsFeatureRenderer(this, context.getModelSet())); + this.addLayer(new WargArmorFrontSkullFeatureRenderer(this, context.getModelSet())); + this.addLayer(new WargArmorBackSkullFeatureRenderer(this, context.getModelSet())); + this.addLayer(new WargSaddleFeatureRenderer(this, context.getModelSet())); } @Override - public void render(WargEntityRenderState state, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) { - if(state.baby) { + public void render(WargEntity entity, float entityYaw, float partialTick, PoseStack matrixStack, MultiBufferSource vertexConsumerProvider, int light) { + if(entity.isBaby()) { matrixStack.scale(SIZE/2, SIZE/2, SIZE/2); } else { matrixStack.scale(SIZE, SIZE, SIZE); } - super.render(state, matrixStack, vertexConsumerProvider, i); - } - - @Override - public WargEntityRenderState createRenderState() { - return new WargEntityRenderState(); + super.render(entity, entityYaw, partialTick, matrixStack, vertexConsumerProvider, light); } - public static final Map LOCATION_BY_VARIANT = + public static final Map LOCATION_BY_VARIANT = Util.make(Maps.newEnumMap(WargVariant.class), (map) -> { map.put(WargVariant.BROWN, - Identifier.of(MiddleEarth.MOD_ID, PATH + "warg_brown.png")); + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "warg_brown.png")); map.put(WargVariant.BLACK, - Identifier.of(MiddleEarth.MOD_ID, PATH + "warg_black.png")); + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "warg_black.png")); map.put(WargVariant.GRAY, - Identifier.of(MiddleEarth.MOD_ID, PATH + "warg_gray.png")); + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "warg_gray.png")); map.put(WargVariant.LIGHT_GRAY, - Identifier.of(MiddleEarth.MOD_ID, PATH + "warg_light_gray.png")); + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "warg_light_gray.png")); map.put(WargVariant.SNOW, - Identifier.of(MiddleEarth.MOD_ID, PATH + "warg_snow.png")); + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "warg_snow.png")); map.put(WargVariant.MOTTLED, - Identifier.of(MiddleEarth.MOD_ID, PATH + "warg_mottled.png")); + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "warg_mottled.png")); map.put(WargVariant.TAN, - Identifier.of(MiddleEarth.MOD_ID, PATH + "warg_tan.png")); + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "warg_tan.png")); }); @Override - public Identifier getTexture(WargEntityRenderState state) { - return LOCATION_BY_VARIANT.get(state.variant); + public ResourceLocation getTextureLocation(WargEntity entity) { + return LOCATION_BY_VARIANT.get(entity.getVariant()); } @Override - public void updateRenderState(WargEntity warg, WargEntityRenderState state, float f) { - super.updateRenderState(warg, state, f); - - state.variant = warg.getVariant(); - state.eyeVariant = warg.getEyeVariant(); - - state.isSprinting = warg.isSprinting(); - state.isRunning = warg.isRunning(); - state.isCharging = warg.isCharging(); - state.isTame = warg.isTame(); - state.conrollingPassenger = warg.getControllingPassenger(); - state.saddle = warg.getEquippedStack(EquipmentSlot.SADDLE); - state.armor = warg.getBodyArmor(); - state.haveEmissiveEyes = warg.getWorld().isNight() || warg.getWorld().getLightLevel(warg.getBlockPos()) <= LIGHT_LEVEL_EMISSIVE_EYES; - - state.chargeAnimationState = warg.chargeAnimationState; - state.startSittingAnimationState = warg.startSittingAnimationState; - state.stopSittingAnimationState = warg.stopSittingAnimationState; - state.sittingAnimationState = warg.sittingAnimationState; - state.attackAnimationState = warg.attackAnimationState; - state.idleAnimationState = warg.idleAnimationState; + protected int getBlockLightLevel(WargEntity entity, BlockPos pos) { + return !entity.level().isDay() ? 0 : Math.max(super.getBlockLightLevel(entity, pos), LIGHT_LEVEL_EMISSIVE_EYES); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorBackSkullFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorBackSkullFeatureRenderer.java index 9df1a6d67b..7c814b2ed6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorBackSkullFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorBackSkullFeatureRenderer.java @@ -1,44 +1,45 @@ package net.sevenstars.middleearth.entity.beasts.warg.features; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.entity.equipment.EquipmentRenderer; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.util.Identifier; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import net.sevenstars.middleearth.entity.beasts.warg.WargEntityRenderState; +import net.sevenstars.middleearth.entity.beasts.warg.WargEntity; import net.sevenstars.middleearth.entity.beasts.warg.WargModel; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.item.ItemStack; import net.sevenstars.middleearth.item.DataComponentTypesME; import net.sevenstars.middleearth.item.EquipmentItemsME; import net.sevenstars.middleearth.item.dataComponents.MountArmorAddonComponent; -public class WargArmorBackSkullFeatureRenderer extends FeatureRenderer { +public class WargArmorBackSkullFeatureRenderer extends RenderLayer { private final WargArmorTopAddonsModel model; - public WargArmorBackSkullFeatureRenderer(FeatureRendererContext context, LoadedEntityModels loader, EquipmentRenderer equipmentRenderer) { + public WargArmorBackSkullFeatureRenderer(RenderLayerParent context, EntityModelSet loader) { super(context); - this.model = new WargArmorTopAddonsModel(loader.getModelPart(EntityModelLayersME.WARG_ARMOR_ADDONS_BACK)); + this.model = new WargArmorTopAddonsModel(loader.bakeLayer(EntityModelLayersME.WARG_ARMOR_ADDONS_BACK)); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, WargEntityRenderState state, float limbAngle, float limbDistance) { - ItemStack itemStack = state.armor; + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, WargEntity entity, + float limbAngle, float limbDistance, float tickDelta, float animationProgress, + float headYaw, float headPitch) { + ItemStack itemStack = entity.getBodyArmorItem(); MountArmorAddonComponent component = itemStack.get(DataComponentTypesME.MOUNT_ARMOR_DATA); - if(component != null && component.topArmorAddon() && itemStack.isOf(EquipmentItemsME.WARG_GUNDABAD_PLATE_ARMOR)) { - VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumers, RenderLayer.getArmorCutoutNoCull(Identifier.of(MiddleEarth.MOD_ID, "textures/entities/warg/feature/warg_armor_addons.png")), itemStack.hasGlint()); + if(component != null && component.topArmorAddon() && itemStack.is(EquipmentItemsME.WARG_GUNDABAD_PLATE_ARMOR)) { + VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer(vertexConsumers, RenderType.armorCutoutNoCull(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "textures/entities/warg/feature/warg_armor_addons.png")), itemStack.hasFoil()); - model.setAngles(state); - model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV); + model.setupAnim(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch); + model.renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorBaseAddonsModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorBaseAddonsModel.java index a4704c8e66..06cd9f69ef 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorBaseAddonsModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorBaseAddonsModel.java @@ -1,9 +1,14 @@ package net.sevenstars.middleearth.entity.beasts.warg.features; -import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; -import net.sevenstars.middleearth.entity.beasts.warg.WargEntityRenderState; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class WargArmorBaseAddonsModel extends WargArmorModel { private final ModelPart warg; @@ -12,17 +17,17 @@ public WargArmorBaseAddonsModel(ModelPart root) { this.warg = root.getChild("root"); } - public static TexturedModelData getTexturedModelDataSpine() { - ModelData modelData = getArmorModelData(); - ModelPartData front_armor = modelData.getRoot().getChild("root").getChild(EntityModelPartNames.BODY).getChild("upper_body").getChild("body_no_legs").getChild("body_fur").getChild("body_armor").getChild("front_armor"); + public static LayerDefinition getTexturedModelDataSpine() { + MeshDefinition modelData = getArmorModelData(); + PartDefinition front_armor = modelData.getRoot().getChild("root").getChild(PartNames.BODY).getChild("upper_body").getChild("body_no_legs").getChild("body_fur").getChild("body_armor").getChild("front_armor"); - ModelPartData addons_front_armor = front_armor.addChild("addons_front_armor", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition addons_front_armor = front_armor.addOrReplaceChild("addons_front_armor", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData spine = addons_front_armor.addChild("spine", ModelPartBuilder.create().uv(8, 0).cuboid(2.0F, -2.4F, -1.0F, 2.0F, 2.0F, 2.0F, new Dilation(0.0F)) - .uv(16, 0).cuboid(-1.0F, -2.1F, -1.0F, 2.0F, 2.0F, 2.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, -6.0F, 0.0F)); - ModelPartData spine_04_r1 = spine.addChild("spine_04_r1", ModelPartBuilder.create().uv(24, 0).cuboid(-1.0F, -1.0F, -1.0F, 2.0F, 2.0F, 2.0F, new Dilation(0.0F)), ModelTransform.of(-3.0F, -0.7F, 0.0F, 0.0F, 0.0F, 0.0873F)); - ModelPartData spine_01_r1 = spine.addChild("spine_01_r1", ModelPartBuilder.create().uv(0, 0).cuboid(-1.0F, -1.0F, -1.0F, 2.0F, 2.0F, 2.0F, new Dilation(0.0F)), ModelTransform.of(6.0F, -1.2F, 0.0F, 0.0F, 0.0F, 0.1309F)); + PartDefinition spine = addons_front_armor.addOrReplaceChild("spine", CubeListBuilder.create().texOffs(8, 0).addBox(2.0F, -2.4F, -1.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(16, 0).addBox(-1.0F, -2.1F, -1.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -6.0F, 0.0F)); + PartDefinition spine_04_r1 = spine.addOrReplaceChild("spine_04_r1", CubeListBuilder.create().texOffs(24, 0).addBox(-1.0F, -1.0F, -1.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-3.0F, -0.7F, 0.0F, 0.0F, 0.0F, 0.0873F)); + PartDefinition spine_01_r1 = spine.addOrReplaceChild("spine_01_r1", CubeListBuilder.create().texOffs(0, 0).addBox(-1.0F, -1.0F, -1.0F, 2.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(6.0F, -1.2F, 0.0F, 0.0F, 0.0F, 0.1309F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorFeatureRenderer.java new file mode 100644 index 0000000000..740758edc3 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorFeatureRenderer.java @@ -0,0 +1,57 @@ +package net.sevenstars.middleearth.entity.beasts.warg.features; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.DyedItemColor; +import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.middleearth.entity.EntityModelLayersME; +import net.sevenstars.middleearth.entity.beasts.warg.WargEntity; +import net.sevenstars.middleearth.entity.beasts.warg.WargModel; +import net.sevenstars.middleearth.item.items.armor.MountArmorItem; + +public class WargArmorFeatureRenderer extends RenderLayer { + private static final String TEXTURE_PATH = "textures/entity/equipment/horse_body/beast_armor/"; + private final WargArmorModel model; + + public WargArmorFeatureRenderer(RenderLayerParent parent, EntityModelSet modelSet) { + super(parent); + this.model = new WargArmorModel(modelSet.bakeLayer(EntityModelLayersME.WARG_ARMOR)); + } + + @Override + public void render(PoseStack matrices, MultiBufferSource buffers, int light, WargEntity entity, + float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, + float netHeadYaw, float headPitch) { + ItemStack stack = entity.getBodyArmorItem(); + if (!(stack.getItem() instanceof MountArmorItem)) { + return; + } + + ResourceLocation itemId = BuiltInRegistries.ITEM.getKey(stack.getItem()); + ResourceLocation texture = ResourceLocation.fromNamespaceAndPath( + MiddleEarth.MOD_ID, TEXTURE_PATH + itemId.getPath() + ".png"); + VertexConsumer vertices = buffers.getBuffer(RenderType.entityCutoutNoCull(texture)); + int color = stack.has(DataComponents.DYED_COLOR) + ? DyedItemColor.getOrDefault(stack, DyedItemColor.LEATHER_COLOR) + : -1; + this.model.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); + this.model.renderToBuffer(matrices, vertices, light, OverlayTexture.NO_OVERLAY, color); + + if (stack.has(DataComponents.DYED_COLOR)) { + ResourceLocation overlay = ResourceLocation.fromNamespaceAndPath( + MiddleEarth.MOD_ID, TEXTURE_PATH + itemId.getPath() + "_overlay.png"); + this.model.renderToBuffer(matrices, buffers.getBuffer(RenderType.entityCutoutNoCull(overlay)), + light, OverlayTexture.NO_OVERLAY); + } + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorFrontSkullFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorFrontSkullFeatureRenderer.java index f8af17e08d..864079834b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorFrontSkullFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorFrontSkullFeatureRenderer.java @@ -1,44 +1,45 @@ package net.sevenstars.middleearth.entity.beasts.warg.features; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.entity.equipment.EquipmentRenderer; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.util.Identifier; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; import net.sevenstars.middleearth.MiddleEarth; -import net.sevenstars.middleearth.entity.beasts.warg.WargEntityRenderState; +import net.sevenstars.middleearth.entity.beasts.warg.WargEntity; import net.sevenstars.middleearth.entity.beasts.warg.WargModel; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.item.ItemStack; import net.sevenstars.middleearth.item.DataComponentTypesME; import net.sevenstars.middleearth.item.EquipmentItemsME; import net.sevenstars.middleearth.item.dataComponents.MountArmorAddonComponent; -public class WargArmorFrontSkullFeatureRenderer extends FeatureRenderer { +public class WargArmorFrontSkullFeatureRenderer extends RenderLayer { private final WargArmorTopAddonsModel model; - public WargArmorFrontSkullFeatureRenderer(FeatureRendererContext context, LoadedEntityModels loader, EquipmentRenderer equipmentRenderer) { + public WargArmorFrontSkullFeatureRenderer(RenderLayerParent context, EntityModelSet loader) { super(context); - this.model = new WargArmorTopAddonsModel(loader.getModelPart(EntityModelLayersME.WARG_ARMOR_ADDONS_FRONT)); + this.model = new WargArmorTopAddonsModel(loader.bakeLayer(EntityModelLayersME.WARG_ARMOR_ADDONS_FRONT)); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, WargEntityRenderState state, float limbAngle, float limbDistance) { - ItemStack itemStack = state.armor; + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, WargEntity entity, + float limbAngle, float limbDistance, float tickDelta, float animationProgress, + float headYaw, float headPitch) { + ItemStack itemStack = entity.getBodyArmorItem(); MountArmorAddonComponent component = itemStack.get(DataComponentTypesME.MOUNT_ARMOR_DATA); - if(component != null && component.topArmorAddon() && itemStack.isOf(EquipmentItemsME.WARG_MORDOR_PLATE_ARMOR)) { - VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumers, RenderLayer.getArmorCutoutNoCull(Identifier.of(MiddleEarth.MOD_ID, "textures/entities/warg/feature/warg_armor_addons.png")), itemStack.hasGlint()); + if(component != null && component.topArmorAddon() && itemStack.is(EquipmentItemsME.WARG_MORDOR_PLATE_ARMOR)) { + VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer(vertexConsumers, RenderType.armorCutoutNoCull(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "textures/entities/warg/feature/warg_armor_addons.png")), itemStack.hasFoil()); - model.setAngles(state); - model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV); + model.setupAnim(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch); + model.renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorModel.java index 9505094278..ed41528f44 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorModel.java @@ -1,9 +1,14 @@ package net.sevenstars.middleearth.entity.beasts.warg.features; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.render.entity.model.EntityModelPartNames; -import net.sevenstars.middleearth.entity.beasts.warg.WargEntityRenderState; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.entity.beasts.warg.WargModel; public class WargArmorModel extends WargModel { @@ -13,63 +18,63 @@ public WargArmorModel(ModelPart root) { super(root); this.warg = root.getChild("root"); - this.head = warg.getChild(EntityModelPartNames.BODY).getChild("upper_body").getChild("body_no_legs").getChild(EntityModelPartNames.HEAD); + this.head = warg.getChild(PartNames.BODY).getChild("upper_body").getChild("body_no_legs").getChild(PartNames.HEAD); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getArmorModelData(); - ModelPartData upper_body = modelData.getRoot().getChild("root").getChild(EntityModelPartNames.BODY).getChild("upper_body"); - ModelPartData body_no_legs = upper_body.getChild("body_no_legs"); - ModelPartData body_armor = body_no_legs.getChild("body_fur").getChild("body_armor"); - ModelPartData head = body_no_legs.getChild(EntityModelPartNames.HEAD); - ModelPartData front_armor = body_armor.getChild("front_armor"); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getArmorModelData(); + PartDefinition upper_body = modelData.getRoot().getChild("root").getChild(PartNames.BODY).getChild("upper_body"); + PartDefinition body_no_legs = upper_body.getChild("body_no_legs"); + PartDefinition body_armor = body_no_legs.getChild("body_fur").getChild("body_armor"); + PartDefinition head = body_no_legs.getChild(PartNames.HEAD); + PartDefinition front_armor = body_armor.getChild("front_armor"); - front_armor.addChild("front_armor_cube", ModelPartBuilder.create() - .uv(0, 0).cuboid(-7.0F, -6.4F, -6.0F, 14.0F, 12.0F, 12.0F, new Dilation(0.3F)) - .uv(52, 47).cuboid(-4.0F, -6.5F, -6.0F, 11.0F, 8.0F, 12.0F, new Dilation(0.5F)), ModelTransform.origin(0F, 0F, 0F)); + front_armor.addOrReplaceChild("front_armor_cube", CubeListBuilder.create() + .texOffs(0, 0).addBox(-7.0F, -6.4F, -6.0F, 14.0F, 12.0F, 12.0F, new CubeDeformation(0.3F)) + .texOffs(52, 47).addBox(-4.0F, -6.5F, -6.0F, 11.0F, 8.0F, 12.0F, new CubeDeformation(0.5F)), PartPose.offset(0F, 0F, 0F)); - ModelPartData left_chains = front_armor.getChild("left_chains"); - left_chains.addChild("chains_r1", ModelPartBuilder.create().uv(34, 69).cuboid(-6.5F, -2.0F, 1.5F, 13.0F, 10.0F, 0.0F, new Dilation(0.1F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition left_chains = front_armor.getChild("left_chains"); + left_chains.addOrReplaceChild("chains_r1", CubeListBuilder.create().texOffs(34, 69).addBox(-6.5F, -2.0F, 1.5F, 13.0F, 10.0F, 0.0F, new CubeDeformation(0.1F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData right_chains = front_armor.getChild("right_chains"); - right_chains.addChild("chains_r2", ModelPartBuilder.create().uv(34, 69).cuboid(-6.5F, -3.0F, -1.5F, 13.0F, 10.0F, 0.0F, new Dilation(0.1F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition right_chains = front_armor.getChild("right_chains"); + right_chains.addOrReplaceChild("chains_r2", CubeListBuilder.create().texOffs(34, 69).addBox(-6.5F, -3.0F, -1.5F, 13.0F, 10.0F, 0.0F, new CubeDeformation(0.1F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData back_armor = body_no_legs.getChild("back_armor"); - back_armor.addChild("backlegplate_r1", ModelPartBuilder.create().uv(0, 45).cuboid(-8.2F, -6.5F, -5.0F, 15.0F, 9.0F, 11.0F, new Dilation(0.7F)), ModelTransform.of(-0.5F, 0.0F, 0.5F, 3.1416F, 0.0F, -3.1416F)); - back_armor.addChild("backarmor_r1", ModelPartBuilder.create().uv(0, 24).cuboid(-7.8F, -6.5F, -5.0F, 14.0F, 10.0F, 11.0F, new Dilation(0.3F)), ModelTransform.of(-0.7F, -0.9F, 0.5F, 3.1416F, 0.0F, -3.1416F)); + PartDefinition back_armor = body_no_legs.getChild("back_armor"); + back_armor.addOrReplaceChild("backlegplate_r1", CubeListBuilder.create().texOffs(0, 45).addBox(-8.2F, -6.5F, -5.0F, 15.0F, 9.0F, 11.0F, new CubeDeformation(0.7F)), PartPose.offsetAndRotation(-0.5F, 0.0F, 0.5F, 3.1416F, 0.0F, -3.1416F)); + back_armor.addOrReplaceChild("backarmor_r1", CubeListBuilder.create().texOffs(0, 24).addBox(-7.8F, -6.5F, -5.0F, 14.0F, 10.0F, 11.0F, new CubeDeformation(0.3F)), PartPose.offsetAndRotation(-0.7F, -0.9F, 0.5F, 3.1416F, 0.0F, -3.1416F)); - ModelPartData head_armor = head.getChild("head_armor"); - head_armor.addChild("Lbone_snout_r1", ModelPartBuilder.create().uv(60, 67).cuboid(-7.2076F, -0.8956F, -2.3986F, 11.0F, 6.0F, 0.0F, new Dilation(0.0F)), ModelTransform.of(6.4218F, 0.1634F, -4.6014F, -2.7477F, -0.1032F, -3.0907F)); - head_armor.addChild("Lbone_snout_r2", ModelPartBuilder.create().uv(60, 67).cuboid(-7.2076F, -0.8956F, 2.3986F, 11.0F, 6.0F, 0.0F, new Dilation(0.0F)), ModelTransform.of(6.4218F, 0.1634F, 3.6014F, 2.7477F, 0.1032F, -3.0907F)); - head_armor.addChild("underhelmet_r1", ModelPartBuilder.create().uv(62, 4).cuboid(-3.2F, -6.6623F, -5.3552F, 11.0F, 9.0F, 10.0F, new Dilation(-0.3F)), ModelTransform.of(5.859F, 2.9485F, -0.9F, -3.1416F, 0.0F, 3.1416F)); - head_armor.addChild("helmet_r1", ModelPartBuilder.create().uv(50, 23).cuboid(-3.2F, -6.2623F, -5.3552F, 11.0F, 13.0F, 11.0F, new Dilation(-0.1F)), ModelTransform.of(5.859F, 0.9485F, -0.4F, -3.1416F, 0.0F, 3.1416F)); + PartDefinition head_armor = head.getChild("head_armor"); + head_armor.addOrReplaceChild("Lbone_snout_r1", CubeListBuilder.create().texOffs(60, 67).addBox(-7.2076F, -0.8956F, -2.3986F, 11.0F, 6.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(6.4218F, 0.1634F, -4.6014F, -2.7477F, -0.1032F, -3.0907F)); + head_armor.addOrReplaceChild("Lbone_snout_r2", CubeListBuilder.create().texOffs(60, 67).addBox(-7.2076F, -0.8956F, 2.3986F, 11.0F, 6.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(6.4218F, 0.1634F, 3.6014F, 2.7477F, 0.1032F, -3.0907F)); + head_armor.addOrReplaceChild("underhelmet_r1", CubeListBuilder.create().texOffs(62, 4).addBox(-3.2F, -6.6623F, -5.3552F, 11.0F, 9.0F, 10.0F, new CubeDeformation(-0.3F)), PartPose.offsetAndRotation(5.859F, 2.9485F, -0.9F, -3.1416F, 0.0F, 3.1416F)); + head_armor.addOrReplaceChild("helmet_r1", CubeListBuilder.create().texOffs(50, 23).addBox(-3.2F, -6.2623F, -5.3552F, 11.0F, 13.0F, 11.0F, new CubeDeformation(-0.1F)), PartPose.offsetAndRotation(5.859F, 0.9485F, -0.4F, -3.1416F, 0.0F, 3.1416F)); - ModelPartData snout2 = head_armor.getChild("snout2"); - snout2.addChild("snout_r1", ModelPartBuilder.create().uv(0, 65).cuboid(-6.2076F, 0.1044F, 1.6F, 13.0F, 5.0F, 4.0F, new Dilation(0.1F)), ModelTransform.of(0.0F, 0.0F, 0.0F, -3.1416F, 0.0F, 3.1416F)); - snout2.addChild("snout_r2", ModelPartBuilder.create().uv(52, 18).cuboid(-5.2076F, 3.2829F, 1.6F, 1.0F, 1.0F, 4.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, -4.2F, 0.0F, -3.1416F, 0.0F, 3.1416F)); + PartDefinition snout2 = head_armor.getChild("snout2"); + snout2.addOrReplaceChild("snout_r1", CubeListBuilder.create().texOffs(0, 65).addBox(-6.2076F, 0.1044F, 1.6F, 13.0F, 5.0F, 4.0F, new CubeDeformation(0.1F)), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, -3.1416F, 0.0F, 3.1416F)); + snout2.addOrReplaceChild("snout_r2", CubeListBuilder.create().texOffs(52, 18).addBox(-5.2076F, 3.2829F, 1.6F, 1.0F, 1.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -4.2F, 0.0F, -3.1416F, 0.0F, 3.1416F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } - public static ModelData getArmorModelData() { - ModelData modelData = getEmptyModelData(); - ModelPartData upper_body = modelData.getRoot().getChild("root").getChild(EntityModelPartNames.BODY).getChild("upper_body"); - ModelPartData body_no_legs = upper_body.getChild("body_no_legs"); - ModelPartData head = body_no_legs.getChild(EntityModelPartNames.HEAD); - ModelPartData body_armor = body_no_legs.getChild("body_fur").addChild("body_armor", ModelPartBuilder.create(), ModelTransform.origin(-6.5F, -2.75F, 1.5F)); + public static MeshDefinition getArmorModelData() { + MeshDefinition modelData = getEmptyModelData(); + PartDefinition upper_body = modelData.getRoot().getChild("root").getChild(PartNames.BODY).getChild("upper_body"); + PartDefinition body_no_legs = upper_body.getChild("body_no_legs"); + PartDefinition head = body_no_legs.getChild(PartNames.HEAD); + PartDefinition body_armor = body_no_legs.getChild("body_fur").addOrReplaceChild("body_armor", CubeListBuilder.create(), PartPose.offset(-6.5F, -2.75F, 1.5F)); - ModelPartData front_armor = body_armor.addChild("front_armor", ModelPartBuilder.create(), ModelTransform.origin(7.8F, 1.5F, -1.0F)); + PartDefinition front_armor = body_armor.addOrReplaceChild("front_armor", CubeListBuilder.create(), PartPose.offset(7.8F, 1.5F, -1.0F)); - ModelPartData left_chains = front_armor.addChild("left_chains", ModelPartBuilder.create(), ModelTransform.origin(0.5F, -3.5F, 5.3F)); - ModelPartData right_chains = front_armor.addChild("right_chains", ModelPartBuilder.create(), ModelTransform.origin(0.5F, -2.5F, -5.3F)); + PartDefinition left_chains = front_armor.addOrReplaceChild("left_chains", CubeListBuilder.create(), PartPose.offset(0.5F, -3.5F, 5.3F)); + PartDefinition right_chains = front_armor.addOrReplaceChild("right_chains", CubeListBuilder.create(), PartPose.offset(0.5F, -2.5F, -5.3F)); - ModelPartData back_armor = body_no_legs.addChild("back_armor", ModelPartBuilder.create(), ModelTransform.origin(-13.7F, 1.25F, 0.5F)); + PartDefinition back_armor = body_no_legs.addOrReplaceChild("back_armor", CubeListBuilder.create(), PartPose.offset(-13.7F, 1.25F, 0.5F)); - ModelPartData head_armor = head.addChild("head_armor", ModelPartBuilder.create(), ModelTransform.origin(-0.1142F, 1.8638F, 0.5F)); + PartDefinition head_armor = head.addOrReplaceChild("head_armor", CubeListBuilder.create(), PartPose.offset(-0.1142F, 1.8638F, 0.5F)); - ModelPartData snout2 = head_armor.addChild("snout2", ModelPartBuilder.create(), ModelTransform.origin(7.3218F, -3.3967F, 3.1F)); + PartDefinition snout2 = head_armor.addOrReplaceChild("snout2", CubeListBuilder.create(), PartPose.offset(7.3218F, -3.3967F, 3.1F)); return modelData; } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorSideAddonsModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorSideAddonsModel.java index 5591ecbf24..083c39f497 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorSideAddonsModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorSideAddonsModel.java @@ -1,9 +1,14 @@ package net.sevenstars.middleearth.entity.beasts.warg.features; -import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; -import net.sevenstars.middleearth.entity.beasts.warg.WargEntityRenderState; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class WargArmorSideAddonsModel extends WargArmorModel { @@ -14,22 +19,22 @@ public WargArmorSideAddonsModel(ModelPart root) { this.warg = root.getChild("root"); } - public static TexturedModelData getTexturedModelDataSideSkulls() { - ModelData modelData = getArmorModelData(); - ModelPartData front_armor = modelData.getRoot().getChild("root").getChild(EntityModelPartNames.BODY).getChild("upper_body").getChild("body_no_legs").getChild("body_fur").getChild("body_armor").getChild("front_armor"); + public static LayerDefinition getTexturedModelDataSideSkulls() { + MeshDefinition modelData = getArmorModelData(); + PartDefinition front_armor = modelData.getRoot().getChild("root").getChild(PartNames.BODY).getChild("upper_body").getChild("body_no_legs").getChild("body_fur").getChild("body_armor").getChild("front_armor"); - ModelPartData addons_front_armor = front_armor.addChild("addons_front_armor", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - ModelPartData skulls = addons_front_armor.addChild("skulls", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 1.0F)); - ModelPartData skull_01 = skulls.addChild("skull_01", ModelPartBuilder.create(), ModelTransform.of(0.092F, 2.1315F, 6.8137F, -2.7489F, -0.3054F, 3.1416F)); - ModelPartData cube_r1 = skull_01.addChild("cube_r1", ModelPartBuilder.create().uv(0, 0).cuboid(-1.0F, -6.0F, 0.0F, 2.0F, 6.0F, 0.0F, new Dilation(0.0F)), ModelTransform.of(-2.0F, -2.0F, 0.0F, -0.7969F, -0.0393F, 0.3624F)); - ModelPartData skull_hat_r1 = skull_01.addChild("skull_hat_r1", ModelPartBuilder.create().uv(24, 0).cuboid(-3.0F, -3.5F, -3.0F, 6.0F, 8.0F, 6.0F, new Dilation(-0.75F)), ModelTransform.of(-2.0F, 0.0F, 0.0F, -0.2182F, 0.2182F, 0.0F)); - ModelPartData skull_r1 = skull_01.addChild("skull_r1", ModelPartBuilder.create().uv(0, 0).cuboid(-3.0F, -3.5F, -3.0F, 6.0F, 7.0F, 6.0F, new Dilation(-1.0F)), ModelTransform.of(-2.0F, 0.0F, 0.0F, -0.2182F, 0.2182F, 0.0F)); - ModelPartData skull_02 = skulls.addChild("skull_02", ModelPartBuilder.create(), ModelTransform.of(-0.6F, 3.5F, 5.0F, 0.0F, 3.098F, 0.0F)); - ModelPartData cube_r2 = skull_02.addChild("cube_r2", ModelPartBuilder.create().uv(0, 32).cuboid(-1.0F, -6.0F, 0.0F, 2.0F, 6.0F, 0.0F, new Dilation(0.0F)), ModelTransform.of(1.692F, -2.8685F, -1.8863F, -0.4037F, -0.2145F, -0.1479F)); - ModelPartData skull_hat_r2 = skull_02.addChild("skull_hat_r2", ModelPartBuilder.create().uv(24, 32).cuboid(-3.0F, -3.5F, -3.0F, 6.0F, 9.0F, 6.0F, new Dilation(-0.75F)) - .uv(0, 32).cuboid(-3.0F, -3.5F, -3.0F, 6.0F, 7.0F, 6.0F, new Dilation(-1.0F)), ModelTransform.of(1.5129F, -0.8639F, -1.0609F, 0.1309F, -0.1745F, 0.0F)); - skull_02.addChild("back_body_no_legs", ModelPartBuilder.create(), ModelTransform.origin(-4.5F, -3.0F, -6.0F)); + PartDefinition addons_front_armor = front_armor.addOrReplaceChild("addons_front_armor", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition skulls = addons_front_armor.addOrReplaceChild("skulls", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 1.0F)); + PartDefinition skull_01 = skulls.addOrReplaceChild("skull_01", CubeListBuilder.create(), PartPose.offsetAndRotation(0.092F, 2.1315F, 6.8137F, -2.7489F, -0.3054F, 3.1416F)); + PartDefinition cube_r1 = skull_01.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 0).addBox(-1.0F, -6.0F, 0.0F, 2.0F, 6.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-2.0F, -2.0F, 0.0F, -0.7969F, -0.0393F, 0.3624F)); + PartDefinition skull_hat_r1 = skull_01.addOrReplaceChild("skull_hat_r1", CubeListBuilder.create().texOffs(24, 0).addBox(-3.0F, -3.5F, -3.0F, 6.0F, 8.0F, 6.0F, new CubeDeformation(-0.75F)), PartPose.offsetAndRotation(-2.0F, 0.0F, 0.0F, -0.2182F, 0.2182F, 0.0F)); + PartDefinition skull_r1 = skull_01.addOrReplaceChild("skull_r1", CubeListBuilder.create().texOffs(0, 0).addBox(-3.0F, -3.5F, -3.0F, 6.0F, 7.0F, 6.0F, new CubeDeformation(-1.0F)), PartPose.offsetAndRotation(-2.0F, 0.0F, 0.0F, -0.2182F, 0.2182F, 0.0F)); + PartDefinition skull_02 = skulls.addOrReplaceChild("skull_02", CubeListBuilder.create(), PartPose.offsetAndRotation(-0.6F, 3.5F, 5.0F, 0.0F, 3.098F, 0.0F)); + PartDefinition cube_r2 = skull_02.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(0, 32).addBox(-1.0F, -6.0F, 0.0F, 2.0F, 6.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(1.692F, -2.8685F, -1.8863F, -0.4037F, -0.2145F, -0.1479F)); + PartDefinition skull_hat_r2 = skull_02.addOrReplaceChild("skull_hat_r2", CubeListBuilder.create().texOffs(24, 32).addBox(-3.0F, -3.5F, -3.0F, 6.0F, 9.0F, 6.0F, new CubeDeformation(-0.75F)) + .texOffs(0, 32).addBox(-3.0F, -3.5F, -3.0F, 6.0F, 7.0F, 6.0F, new CubeDeformation(-1.0F)), PartPose.offsetAndRotation(1.5129F, -0.8639F, -1.0609F, 0.1309F, -0.1745F, 0.0F)); + skull_02.addOrReplaceChild("back_body_no_legs", CubeListBuilder.create(), PartPose.offset(-4.5F, -3.0F, -6.0F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorSideSkullsFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorSideSkullsFeatureRenderer.java index 40be6815fd..7808671e11 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorSideSkullsFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorSideSkullsFeatureRenderer.java @@ -1,43 +1,44 @@ package net.sevenstars.middleearth.entity.beasts.warg.features; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.entity.equipment.EquipmentRenderer; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.util.Identifier; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; import net.sevenstars.middleearth.MiddleEarth; -import net.sevenstars.middleearth.entity.beasts.warg.WargEntityRenderState; +import net.sevenstars.middleearth.entity.beasts.warg.WargEntity; import net.sevenstars.middleearth.entity.beasts.warg.WargModel; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.item.ItemStack; import net.sevenstars.middleearth.item.DataComponentTypesME; import net.sevenstars.middleearth.item.dataComponents.MountArmorAddonComponent; -public class WargArmorSideSkullsFeatureRenderer extends FeatureRenderer { +public class WargArmorSideSkullsFeatureRenderer extends RenderLayer { private final WargArmorSideAddonsModel model; - public WargArmorSideSkullsFeatureRenderer(FeatureRendererContext context, LoadedEntityModels loader, EquipmentRenderer equipmentRenderer) { + public WargArmorSideSkullsFeatureRenderer(RenderLayerParent context, EntityModelSet loader) { super(context); - this.model = new WargArmorSideAddonsModel(loader.getModelPart(EntityModelLayersME.WARG_ARMOR_ADDONS_SIDE_SKULL)); + this.model = new WargArmorSideAddonsModel(loader.bakeLayer(EntityModelLayersME.WARG_ARMOR_ADDONS_SIDE_SKULL)); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, WargEntityRenderState state, float limbAngle, float limbDistance) { - ItemStack itemStack = state.armor; + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, WargEntity entity, + float limbAngle, float limbDistance, float tickDelta, float animationProgress, + float headYaw, float headPitch) { + ItemStack itemStack = entity.getBodyArmorItem(); MountArmorAddonComponent component = itemStack.get(DataComponentTypesME.MOUNT_ARMOR_DATA); if(component != null && component.sideArmorAddon()) { - VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumers, RenderLayer.getArmorCutoutNoCull(Identifier.of(MiddleEarth.MOD_ID, "textures/entities/warg/feature/warg_armor_side_skull_addon.png")), itemStack.hasGlint()); + VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer(vertexConsumers, RenderType.armorCutoutNoCull(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "textures/entities/warg/feature/warg_armor_side_skull_addon.png")), itemStack.hasFoil()); - model.setAngles(state); - model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV); + model.setupAnim(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch); + model.renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorSpineFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorSpineFeatureRenderer.java index bb64e49eb9..231ed092fa 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorSpineFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorSpineFeatureRenderer.java @@ -1,45 +1,46 @@ package net.sevenstars.middleearth.entity.beasts.warg.features; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.equipment.EquipmentRenderer; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Identifier; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import net.sevenstars.middleearth.entity.beasts.warg.WargEntityRenderState; +import net.sevenstars.middleearth.entity.beasts.warg.WargEntity; import net.sevenstars.middleearth.entity.beasts.warg.WargModel; import net.sevenstars.middleearth.item.EquipmentItemsME; -public class WargArmorSpineFeatureRenderer extends FeatureRenderer { +public class WargArmorSpineFeatureRenderer extends RenderLayer { private final WargArmorBaseAddonsModel model; - public WargArmorSpineFeatureRenderer(FeatureRendererContext context, LoadedEntityModels loader, EquipmentRenderer equipmentRenderer) { + public WargArmorSpineFeatureRenderer(RenderLayerParent context, EntityModelSet loader) { super(context); - this.model = new WargArmorBaseAddonsModel(loader.getModelPart(EntityModelLayersME.WARG_ARMOR_ADDONS_SPINE)); + this.model = new WargArmorBaseAddonsModel(loader.bakeLayer(EntityModelLayersME.WARG_ARMOR_ADDONS_SPINE)); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, WargEntityRenderState state, float limbAngle, float limbDistance) { - ItemStack itemStack = state.armor; - if(itemStack.isOf(EquipmentItemsME.WARG_REINFORCED_LEATHER_ARMOR)) { - VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumers, RenderLayer.getArmorCutoutNoCull(Identifier.of(MiddleEarth.MOD_ID, "textures/entities/warg/feature/warg_armor_bone_spine_addon.png")), itemStack.hasGlint()); + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, WargEntity entity, + float limbAngle, float limbDistance, float tickDelta, float animationProgress, + float headYaw, float headPitch) { + ItemStack itemStack = entity.getBodyArmorItem(); + if(itemStack.is(EquipmentItemsME.WARG_REINFORCED_LEATHER_ARMOR)) { + VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer(vertexConsumers, RenderType.armorCutoutNoCull(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "textures/entities/warg/feature/warg_armor_bone_spine_addon.png")), itemStack.hasFoil()); - model.setAngles(state); - model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV); + model.setupAnim(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch); + model.renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY); } - else if(itemStack.isOf(EquipmentItemsME.WARG_MORDOR_PLATE_ARMOR) || itemStack.isOf(EquipmentItemsME.WARG_MORDOR_MAIL_ARMOR)) { - VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumers, RenderLayer.getArmorCutoutNoCull(Identifier.of(MiddleEarth.MOD_ID, "textures/entities/warg/feature/warg_armor_mordor_spine_addon.png")), itemStack.hasGlint()); + else if(itemStack.is(EquipmentItemsME.WARG_MORDOR_PLATE_ARMOR) || itemStack.is(EquipmentItemsME.WARG_MORDOR_MAIL_ARMOR)) { + VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer(vertexConsumers, RenderType.armorCutoutNoCull(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "textures/entities/warg/feature/warg_armor_mordor_spine_addon.png")), itemStack.hasFoil()); - model.setAngles(state); - model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV); + model.setupAnim(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch); + model.renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorTopAddonsModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorTopAddonsModel.java index 69d712e870..54aa6822e6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorTopAddonsModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargArmorTopAddonsModel.java @@ -1,9 +1,14 @@ package net.sevenstars.middleearth.entity.beasts.warg.features; -import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; -import net.sevenstars.middleearth.entity.beasts.warg.WargEntityRenderState; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; public class WargArmorTopAddonsModel extends WargArmorModel { @@ -13,39 +18,39 @@ public WargArmorTopAddonsModel(ModelPart root) { this.warg = root.getChild("root"); } - public static TexturedModelData getTexturedModelDataFront() { - ModelData modelData = getArmorModelData(); - ModelPartData body_armor = modelData.getRoot().getChild("root").getChild(EntityModelPartNames.BODY).getChild("upper_body").getChild("body_no_legs").getChild("body_fur").getChild("body_armor"); + public static LayerDefinition getTexturedModelDataFront() { + MeshDefinition modelData = getArmorModelData(); + PartDefinition body_armor = modelData.getRoot().getChild("root").getChild(PartNames.BODY).getChild("upper_body").getChild("body_no_legs").getChild("body_fur").getChild("body_armor"); - ModelPartData armor_addons = body_armor.addChild("armor_addons", ModelPartBuilder.create(), ModelTransform.origin(-5.0F, -5.0F, -4.0F)); - ModelPartData front_addons = armor_addons.addChild("front_addons", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - ModelPartData skull2 = front_addons.addChild("skull2", ModelPartBuilder.create().uv(6, 43).cuboid(-3.0F, -4.0F, -3.0F, 6.0F, 10.0F, 6.0F, new Dilation(0.1F)) - .uv(79, 48).cuboid(-3.0F, -4.0F, -3.0F, 6.0F, 10.0F, 6.0F, new Dilation(0.2F)) - .uv(6, 30).cuboid(-3.0F, -4.0F, -3.0F, 6.0F, 7.0F, 6.0F, new Dilation(0.0F)) - .uv(6, 60).cuboid(-1.0F, -6.0F, -1.0F, 2.0F, 11.0F, 2.0F, new Dilation(-0.1F)), ModelTransform.of(13.0F, -4.0F, 3.0F, 0.0F, -1.5708F, 0.0F)); + PartDefinition armor_addons = body_armor.addOrReplaceChild("armor_addons", CubeListBuilder.create(), PartPose.offset(-5.0F, -5.0F, -4.0F)); + PartDefinition front_addons = armor_addons.addOrReplaceChild("front_addons", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition skull2 = front_addons.addOrReplaceChild("skull2", CubeListBuilder.create().texOffs(6, 43).addBox(-3.0F, -4.0F, -3.0F, 6.0F, 10.0F, 6.0F, new CubeDeformation(0.1F)) + .texOffs(79, 48).addBox(-3.0F, -4.0F, -3.0F, 6.0F, 10.0F, 6.0F, new CubeDeformation(0.2F)) + .texOffs(6, 30).addBox(-3.0F, -4.0F, -3.0F, 6.0F, 7.0F, 6.0F, new CubeDeformation(0.0F)) + .texOffs(6, 60).addBox(-1.0F, -6.0F, -1.0F, 2.0F, 11.0F, 2.0F, new CubeDeformation(-0.1F)), PartPose.offsetAndRotation(13.0F, -4.0F, 3.0F, 0.0F, -1.5708F, 0.0F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } - public static TexturedModelData getTexturedModelDataBack() { - ModelData modelData = getArmorModelData(); - ModelPartData body_armor = modelData.getRoot().getChild("root").getChild(EntityModelPartNames.BODY).getChild("upper_body").getChild("body_no_legs").getChild("body_fur").getChild("body_armor"); + public static LayerDefinition getTexturedModelDataBack() { + MeshDefinition modelData = getArmorModelData(); + PartDefinition body_armor = modelData.getRoot().getChild("root").getChild(PartNames.BODY).getChild("upper_body").getChild("body_no_legs").getChild("body_fur").getChild("body_armor"); - ModelPartData armor_addons = body_armor.addChild("armor_addons", ModelPartBuilder.create(), ModelTransform.origin(-5.0F, -5.0F, -4.0F)); + PartDefinition armor_addons = body_armor.addOrReplaceChild("armor_addons", CubeListBuilder.create(), PartPose.offset(-5.0F, -5.0F, -4.0F)); - ModelPartData back_addons = armor_addons.addChild("back_addons", ModelPartBuilder.create().uv(0, 0).cuboid(-1.0F, -2.0F, -2.0F, 2.0F, 2.0F, 10.0F, new Dilation(0.0F)) - .uv(0, 12).cuboid(-1.0F, -9.0F, -1.0F, 2.0F, 7.0F, 8.0F, new Dilation(0.0F)) - .uv(6, 60).cuboid(-1.0F, -23.0F, 2.0F, 2.0F, 23.0F, 2.0F, new Dilation(-0.1F)) - .uv(20, 63).cuboid(-1.0F, -27.0F, 3.0F, 2.0F, 5.0F, 0.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition back_addons = armor_addons.addOrReplaceChild("back_addons", CubeListBuilder.create().texOffs(0, 0).addBox(-1.0F, -2.0F, -2.0F, 2.0F, 2.0F, 10.0F, new CubeDeformation(0.0F)) + .texOffs(0, 12).addBox(-1.0F, -9.0F, -1.0F, 2.0F, 7.0F, 8.0F, new CubeDeformation(0.0F)) + .texOffs(6, 60).addBox(-1.0F, -23.0F, 2.0F, 2.0F, 23.0F, 2.0F, new CubeDeformation(-0.1F)) + .texOffs(20, 63).addBox(-1.0F, -27.0F, 3.0F, 2.0F, 5.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData cube_r1 = back_addons.addChild("cube_r1", ModelPartBuilder.create().uv(4, 99).cuboid(-16.0F, -8.5F, 0.0F, 17.0F, 12.0F, 0.0F, new Dilation(0.0F)), ModelTransform.of(-2.0F, -21.5F, 3.0F, 0.0F, 0.0F, -1.4399F)); + PartDefinition cube_r1 = back_addons.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(4, 99).addBox(-16.0F, -8.5F, 0.0F, 17.0F, 12.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-2.0F, -21.5F, 3.0F, 0.0F, 0.0F, -1.4399F)); - ModelPartData cube_r2 = back_addons.addChild("cube_r2", ModelPartBuilder.create().uv(19, 81).cuboid(-1.0F, -8.5F, -1.0F, 2.0F, 12.0F, 2.0F, new Dilation(-0.3F)), ModelTransform.of(-2.0F, -21.5F, 3.0F, 0.0F, 0.0F, -1.5708F)); + PartDefinition cube_r2 = back_addons.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(19, 81).addBox(-1.0F, -8.5F, -1.0F, 2.0F, 12.0F, 2.0F, new CubeDeformation(-0.3F)), PartPose.offsetAndRotation(-2.0F, -21.5F, 3.0F, 0.0F, 0.0F, -1.5708F)); - ModelPartData skull = back_addons.addChild("skull", ModelPartBuilder.create().uv(6, 43).cuboid(-3.0F, -3.0F, -3.0F, 6.0F, 10.0F, 6.0F, new Dilation(0.1F)) - .uv(6, 30).cuboid(-3.0F, -3.0F, -3.0F, 6.0F, 7.0F, 6.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, -11.0F, 3.0F, 0.0F, -1.5708F, 0.0F)); - return TexturedModelData.of(modelData, 128, 128); + PartDefinition skull = back_addons.addOrReplaceChild("skull", CubeListBuilder.create().texOffs(6, 43).addBox(-3.0F, -3.0F, -3.0F, 6.0F, 10.0F, 6.0F, new CubeDeformation(0.1F)) + .texOffs(6, 30).addBox(-3.0F, -3.0F, -3.0F, 6.0F, 7.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -11.0F, 3.0F, 0.0F, -1.5708F, 0.0F)); + return LayerDefinition.create(modelData, 128, 128); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargEyesFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargEyesFeatureRenderer.java index ddb67d0fda..48441b8550 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargEyesFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargEyesFeatureRenderer.java @@ -1,43 +1,46 @@ package net.sevenstars.middleearth.entity.beasts.warg.features; import com.google.common.collect.Maps; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; -import net.minecraft.util.Util; +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.Util; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.client.RenderUtil; import net.sevenstars.middleearth.entity.beasts.warg.WargEyeVariant; -import net.sevenstars.middleearth.entity.beasts.warg.WargEntityRenderState; +import net.sevenstars.middleearth.entity.beasts.warg.WargEntity; import net.sevenstars.middleearth.entity.beasts.warg.WargModel; import java.util.Map; -public class WargEyesFeatureRenderer extends FeatureRenderer { +public class WargEyesFeatureRenderer extends RenderLayer { private static final String PATH = "textures/entities/warg/eyes/"; - private static final Identifier EMISSIVE_TEXTURE = Identifier.of(MiddleEarth.MOD_ID, PATH + "warg_eyes_emissive.png"); - private static final Map LOCATION_BY_VARIANT = + private static final ResourceLocation EMISSIVE_TEXTURE = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "warg_eyes_emissive.png"); + private static final Map LOCATION_BY_VARIANT = Util.make(Maps.newEnumMap(WargEyeVariant.class), (map) -> { map.put(WargEyeVariant.BLUE, - Identifier.of(MiddleEarth.MOD_ID, PATH + "warg_eyes_blue.png")); + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "warg_eyes_blue.png")); map.put(WargEyeVariant.ORANGE, - Identifier.of(MiddleEarth.MOD_ID, PATH + "warg_eyes_orange.png")); + ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "warg_eyes_orange.png")); }); - public WargEyesFeatureRenderer(FeatureRendererContext featureRendererContext) { + public WargEyesFeatureRenderer(RenderLayerParent featureRendererContext) { super(featureRendererContext); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, WargEntityRenderState state, float limbAngle, float limbDistance) { - RenderUtil.renderCutoutTexture(this.getContextModel(), matrices, vertexConsumers, - LOCATION_BY_VARIANT.get(state.eyeVariant), light, OverlayTexture.DEFAULT_UV); + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, WargEntity entity, + float limbAngle, float limbDistance, float tickDelta, float animationProgress, + float headYaw, float headPitch) { + RenderUtil.renderCutoutTexture(this.getParentModel(), matrices, vertexConsumers, + LOCATION_BY_VARIANT.get(entity.getEyeVariant()), light, OverlayTexture.NO_OVERLAY); - if(state.haveEmissiveEyes) { - RenderUtil.renderEmissiveTexture(this.getContextModel(), matrices, vertexConsumers, - EMISSIVE_TEXTURE, light, OverlayTexture.DEFAULT_UV); + if(!entity.level().isDay() + || entity.level().getMaxLocalRawBrightness(entity.blockPosition()) <= 8) { + RenderUtil.renderEmissiveTexture(this.getParentModel(), matrices, vertexConsumers, + EMISSIVE_TEXTURE, light, OverlayTexture.NO_OVERLAY); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargSaddleFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargSaddleFeatureRenderer.java index ffa5688756..05f9ba4bf0 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargSaddleFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargSaddleFeatureRenderer.java @@ -1,39 +1,40 @@ package net.sevenstars.middleearth.entity.beasts.warg.features; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.entity.equipment.EquipmentRenderer; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Identifier; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.entity.animal.horse.AbstractHorse; import net.sevenstars.middleearth.MiddleEarth; -import net.sevenstars.middleearth.entity.beasts.warg.WargEntityRenderState; +import net.sevenstars.middleearth.entity.beasts.warg.WargEntity; import net.sevenstars.middleearth.entity.beasts.warg.WargModel; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.util.math.MatrixStack; -public class WargSaddleFeatureRenderer extends FeatureRenderer { +public class WargSaddleFeatureRenderer extends RenderLayer { private final WargSaddleModel model; - public WargSaddleFeatureRenderer(FeatureRendererContext context, LoadedEntityModels loader, EquipmentRenderer equipmentRenderer) { + public WargSaddleFeatureRenderer(RenderLayerParent context, EntityModelSet loader) { super(context); - this.model = new WargSaddleModel(loader.getModelPart(EntityModelLayersME.WARG_SADDLE)); + this.model = new WargSaddleModel(loader.bakeLayer(EntityModelLayersME.WARG_SADDLE)); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, WargEntityRenderState state, float limbAngle, float limbDistance) { - ItemStack itemStack = state.saddle; - boolean hasArmor = !state.armor.isEmpty(); + public void render(PoseStack matrices, MultiBufferSource vertexConsumers, int light, WargEntity entity, + float limbAngle, float limbDistance, float tickDelta, float animationProgress, + float headYaw, float headPitch) { + ItemStack itemStack = entity.getInventory().getItem(AbstractHorse.INV_SLOT_SADDLE); if(!itemStack.isEmpty()) { - VertexConsumer vertexConsumer = ItemRenderer.getArmorGlintConsumer(vertexConsumers, RenderLayer.getArmorCutoutNoCull(Identifier.of(MiddleEarth.MOD_ID, "textures/entities/warg/feature/warg_saddle.png")), itemStack.hasGlint()); + VertexConsumer vertexConsumer = ItemRenderer.getArmorFoilBuffer(vertexConsumers, RenderType.armorCutoutNoCull(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "textures/entities/warg/feature/warg_saddle.png")), itemStack.hasFoil()); - model.setAngles(state); - model.renderSaddle(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV); + model.setupAnim(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch); + model.renderSaddle(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY); } } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargSaddleModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargSaddleModel.java index 9880a5bfa4..6beef77174 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargSaddleModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/beasts/warg/features/WargSaddleModel.java @@ -1,9 +1,16 @@ package net.sevenstars.middleearth.entity.beasts.warg.features; -import net.minecraft.client.render.VertexConsumer; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModelPartNames; -import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartNames; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.entity.beasts.warg.WargModel; public class WargSaddleModel extends WargModel { @@ -21,36 +28,36 @@ public WargSaddleModel(ModelPart root) { super(root); this.warg = root.getChild("root"); - ModelPart body = this.warg.getChild(EntityModelPartNames.BODY); + ModelPart body = this.warg.getChild(PartNames.BODY); ModelPart upperBody = body.getChild("upper_body"); ModelPart bodyNoLegs = upperBody.getChild("body_no_legs"); this.saddle = bodyNoLegs.getChild("saddle"); this.bodyFur = bodyNoLegs.getChild("body_fur"); this.mainBody = bodyNoLegs.getChild("main_body"); - this.head = bodyNoLegs.getChild(EntityModelPartNames.HEAD); + this.head = bodyNoLegs.getChild(PartNames.HEAD); this.waitTail = bodyNoLegs.getChild("wait_tail"); this.rightFrontLeg = upperBody.getChild("right_front_leg"); this.leftFrontLeg = upperBody.getChild("left_front_leg"); this.backBody = body.getChild("back_body"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = getEmptyModelData(); - ModelPartData bodyNoLegs = modelData.getRoot().getChild("root").getChild(EntityModelPartNames.BODY).getChild("upper_body").getChild("body_no_legs"); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = getEmptyModelData(); + PartDefinition bodyNoLegs = modelData.getRoot().getChild("root").getChild(PartNames.BODY).getChild("upper_body").getChild("body_no_legs"); - ModelPartData saddle = bodyNoLegs.addChild("saddle", ModelPartBuilder.create(), ModelTransform.origin(-9.5F, -3.75F, -4.5F)); + PartDefinition saddle = bodyNoLegs.addOrReplaceChild("saddle", CubeListBuilder.create(), PartPose.offset(-9.5F, -3.75F, -4.5F)); - saddle.addChild("cube_r3", ModelPartBuilder.create().uv(26, 12).cuboid(-2.5F, -0.5F, -7.0F, 11.0F, 16.0F, 11.0F, new Dilation(0.4F)), ModelTransform.of(-1.0F, -2.0F, 2.0F, 0.0F, -1.5708F, 0.0F)); + saddle.addOrReplaceChild("cube_r3", CubeListBuilder.create().texOffs(26, 12).addBox(-2.5F, -0.5F, -7.0F, 11.0F, 16.0F, 11.0F, new CubeDeformation(0.4F)), PartPose.offsetAndRotation(-1.0F, -2.0F, 2.0F, 0.0F, -1.5708F, 0.0F)); - ModelPartData cloth = saddle.addChild("cloth", ModelPartBuilder.create(), ModelTransform.origin(-1.0F, -2.0F, 2.0F)); - cloth.addChild("cube_r4", ModelPartBuilder.create().uv(4, 44).cuboid(-2.5F, -0.5F, -9.0F, 11.0F, 16.0F, 12.0F, new Dilation(0.2F)), ModelTransform.of(-3.0F, 0.25F, 0.0F, 0.0F, -1.5708F, 0.0F)); + PartDefinition cloth = saddle.addOrReplaceChild("cloth", CubeListBuilder.create(), PartPose.offset(-1.0F, -2.0F, 2.0F)); + cloth.addOrReplaceChild("cube_r4", CubeListBuilder.create().texOffs(4, 44).addBox(-2.5F, -0.5F, -9.0F, 11.0F, 16.0F, 12.0F, new CubeDeformation(0.2F)), PartPose.offsetAndRotation(-3.0F, 0.25F, 0.0F, 0.0F, -1.5708F, 0.0F)); - saddle.addChild("saddle_addons", ModelPartBuilder.create(), ModelTransform.origin(-6.0F, -2.0F, 2.0F)); + saddle.addOrReplaceChild("saddle_addons", CubeListBuilder.create(), PartPose.offset(-6.0F, -2.0F, 2.0F)); - return TexturedModelData.of(modelData, 128, 128); + return LayerDefinition.create(modelData, 128, 128); } - public void renderSaddle(MatrixStack matrices, VertexConsumer vertices, int light, int overlay) { + public void renderSaddle(PoseStack matrices, VertexConsumer vertices, int light, int overlay) { boolean bodyFurVisible = this.bodyFur.visible; boolean mainBodyVisible = this.mainBody.visible; boolean headVisible = this.head.visible; @@ -68,7 +75,7 @@ public void renderSaddle(MatrixStack matrices, VertexConsumer vertices, int ligh this.backBody.visible = false; try { - super.render(matrices, vertices, light, overlay); + super.renderToBuffer(matrices, vertices, light, overlay); } finally { this.bodyFur.visible = bodyFurVisible; diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastActiveTargetGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastActiveTargetGoal.java index 443ea852bf..87283f6857 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastActiveTargetGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastActiveTargetGoal.java @@ -1,20 +1,20 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; +import net.minecraft.world.entity.ai.goal.target.TargetGoal; +import net.minecraft.world.entity.ai.targeting.TargetingConditions; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.phys.AABB; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.TargetPredicate; -import net.minecraft.entity.ai.goal.ActiveTargetGoal; -import net.minecraft.entity.ai.goal.TrackTargetGoal; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.util.math.Box; import org.jetbrains.annotations.Nullable; import java.util.EnumSet; import java.util.function.Predicate; -public class BeastActiveTargetGoal extends TrackTargetGoal { +public class BeastActiveTargetGoal extends TargetGoal { private static final int DEFAULT_RECIPROCAL_CHANCE = 10; protected final Class targetClass; /** @@ -25,13 +25,13 @@ public class BeastActiveTargetGoal extends TrackTargetGo protected final int reciprocalChance; @Nullable protected LivingEntity targetEntity; - protected TargetPredicate targetPredicate; + protected TargetingConditions targetPredicate; public BeastActiveTargetGoal(AbstractBeastEntity mob, Class targetClass, boolean checkVisibility) { this(mob, targetClass, 10, checkVisibility, false, null); } - public BeastActiveTargetGoal(AbstractBeastEntity mob, Class targetClass, boolean checkVisibility, TargetPredicate.EntityPredicate targetPredicate) { + public BeastActiveTargetGoal(AbstractBeastEntity mob, Class targetClass, boolean checkVisibility, Predicate targetPredicate) { this(mob, targetClass, 10, checkVisibility, false, targetPredicate); } @@ -39,33 +39,33 @@ public BeastActiveTargetGoal(AbstractBeastEntity mob, Class targetClass, bool this(mob, targetClass, 10, checkVisibility, checkCanNavigate, null); } - public BeastActiveTargetGoal(AbstractBeastEntity mob, Class targetClass, int reciprocalChance, boolean checkVisibility, boolean checkCanNavigate, @Nullable TargetPredicate.EntityPredicate targetPredicate) { + public BeastActiveTargetGoal(AbstractBeastEntity mob, Class targetClass, int reciprocalChance, boolean checkVisibility, boolean checkCanNavigate, @Nullable Predicate targetPredicate) { super(mob, checkVisibility, checkCanNavigate); this.targetClass = targetClass; - this.reciprocalChance = ActiveTargetGoal.toGoalTicks(reciprocalChance); - this.setControls(EnumSet.of(Control.TARGET)); - this.targetPredicate = TargetPredicate.createAttackable().setBaseMaxDistance(this.getFollowRange()).setPredicate(targetPredicate); + this.reciprocalChance = NearestAttackableTargetGoal.reducedTickDelay(reciprocalChance); + this.setFlags(EnumSet.of(Flag.TARGET)); + this.targetPredicate = TargetingConditions.forCombat().range(this.getFollowDistance()).selector(targetPredicate); } @Override - public boolean canStart() { + public boolean canUse() { if (this.reciprocalChance > 0 && this.mob.getRandom().nextInt(this.reciprocalChance) != 0) { return false; } - if(((AbstractBeastEntity)this.mob).isTame()) { + if(((AbstractBeastEntity)this.mob).isTamed()) { return false; } this.findClosestTarget(); return this.targetEntity != null; } - protected Box getSearchBox(double distance) { - return this.mob.getBoundingBox().expand(distance, 4.0, distance); + protected AABB getSearchBox(double distance) { + return this.mob.getBoundingBox().inflate(distance, 4.0, distance); } protected void findClosestTarget() { - if(this.mob.getWorld() instanceof ServerWorld serverWorld) { - this.targetEntity = this.targetClass == PlayerEntity.class || this.targetClass == ServerPlayerEntity.class ? serverWorld.getClosestPlayer(this.targetPredicate, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ()) : serverWorld.getClosestEntity(this.mob.getWorld().getEntitiesByClass(this.targetClass, this.getSearchBox(this.getFollowRange()), livingEntity -> true), this.targetPredicate, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ()); + if(this.mob.level() instanceof ServerLevel serverWorld) { + this.targetEntity = this.targetClass == Player.class || this.targetClass == ServerPlayer.class ? serverWorld.getNearestPlayer(this.targetPredicate, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ()) : serverWorld.getNearestEntity(this.mob.level().getEntitiesOfClass(this.targetClass, this.getSearchBox(this.getFollowDistance()), livingEntity -> true), this.targetPredicate, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ()); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastAttackWithOwnerGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastAttackWithOwnerGoal.java index 5bb3357e38..6406f8dc26 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastAttackWithOwnerGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastAttackWithOwnerGoal.java @@ -1,13 +1,12 @@ package net.sevenstars.middleearth.entity.goals; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.goal.target.TargetGoal; +import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.TargetPredicate; -import net.minecraft.entity.ai.goal.TrackTargetGoal; - import java.util.EnumSet; -public class BeastAttackWithOwnerGoal extends TrackTargetGoal { +public class BeastAttackWithOwnerGoal extends TargetGoal { private final AbstractBeastEntity mob; private LivingEntity attacking; private int lastAttackTime; @@ -15,12 +14,12 @@ public class BeastAttackWithOwnerGoal extends TrackTargetGoal { public BeastAttackWithOwnerGoal(AbstractBeastEntity mob) { super(mob, false); this.mob = mob; - this.setControls(EnumSet.of(Control.TARGET)); + this.setFlags(EnumSet.of(Flag.TARGET)); } @Override - public boolean canStart() { - if (!this.mob.isTame() || this.mob.isSitting()) { + public boolean canUse() { + if (!this.mob.isTamed() || this.mob.isSitting()) { return false; } if(!this.mob.shouldAttackWhenMounted() && this.mob.hasControllingPassenger()) { @@ -30,14 +29,14 @@ public boolean canStart() { if (livingEntity == null) { return false; } - this.attacking = livingEntity.getAttacking(); + this.attacking = livingEntity.getLastHurtMob(); if(this.attacking instanceof AbstractBeastEntity && ((AbstractBeastEntity) this.attacking).getOwner() == this.mob.getOwner()) { return false; } - int i = livingEntity.getLastAttackTime(); - return i != this.lastAttackTime && this.canTrack(this.attacking, TargetPredicate.DEFAULT); + int i = livingEntity.getLastHurtMobTimestamp(); + return i != this.lastAttackTime && this.canAttack(this.attacking, TargetingConditions.DEFAULT); } @Override @@ -45,7 +44,7 @@ public void start() { this.mob.setTarget(this.attacking); LivingEntity livingEntity = this.mob.getOwner(); if (livingEntity != null) { - this.lastAttackTime = livingEntity.getLastAttackTime(); + this.lastAttackTime = livingEntity.getLastHurtMobTimestamp(); } super.start(); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastFollowOwnerGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastFollowOwnerGoal.java index d347698dee..480b88dea4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastFollowOwnerGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastFollowOwnerGoal.java @@ -1,20 +1,19 @@ package net.sevenstars.middleearth.entity.goals; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.goal.Goal; +import net.minecraft.world.entity.ai.navigation.FlyingPathNavigation; +import net.minecraft.world.entity.ai.navigation.GroundPathNavigation; +import net.minecraft.world.entity.ai.navigation.PathNavigation; +import net.minecraft.world.level.pathfinder.PathType; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.ai.pathing.BirdNavigation; -import net.minecraft.entity.ai.pathing.EntityNavigation; -import net.minecraft.entity.ai.pathing.MobNavigation; -import net.minecraft.entity.ai.pathing.PathNodeType; - import java.util.EnumSet; public class BeastFollowOwnerGoal extends Goal { private final AbstractBeastEntity mob; private LivingEntity owner; private final double speed; - private final EntityNavigation navigation; + private final PathNavigation navigation; private int updateCountdownTicks; private final float maxDistance; private final float minDistance; @@ -26,14 +25,14 @@ public BeastFollowOwnerGoal(AbstractBeastEntity mob, double speed, float minDist this.navigation = mob.getNavigation(); this.minDistance = minDistance; this.maxDistance = maxDistance; - this.setControls(EnumSet.of(Control.MOVE, Control.LOOK)); - if (!(mob.getNavigation() instanceof MobNavigation) && !(mob.getNavigation() instanceof BirdNavigation)) { + this.setFlags(EnumSet.of(Flag.MOVE, Flag.LOOK)); + if (!(mob.getNavigation() instanceof GroundPathNavigation) && !(mob.getNavigation() instanceof FlyingPathNavigation)) { throw new IllegalArgumentException("Unsupported mob type for BeastFollowOwnerGoal"); } } @Override - public boolean canStart() { + public boolean canUse() { LivingEntity livingEntity = this.mob.getOwner(); if (livingEntity == null) { return false; @@ -41,7 +40,7 @@ public boolean canStart() { if (this.mob.cannotFollowOwner()) { return false; } - if (this.mob.squaredDistanceTo(livingEntity) < (double)(this.minDistance * this.minDistance)) { + if (this.mob.distanceToSqr(livingEntity) < (double)(this.minDistance * this.minDistance)) { return false; } this.owner = livingEntity; @@ -49,21 +48,21 @@ public boolean canStart() { } @Override - public boolean shouldContinue() { - if (this.navigation.isIdle()) { + public boolean canContinueToUse() { + if (this.navigation.isDone()) { return false; } if (this.mob.cannotFollowOwner()) { return false; } - return !(this.mob.squaredDistanceTo(this.owner) <= (double)(this.maxDistance * this.maxDistance)); + return !(this.mob.distanceToSqr(this.owner) <= (double)(this.maxDistance * this.maxDistance)); } @Override public void start() { this.updateCountdownTicks = 0; - this.oldWaterPathfindingPenalty = this.mob.getPathfindingPenalty(PathNodeType.WATER); - this.mob.setPathfindingPenalty(PathNodeType.WATER, 0.0f); + this.oldWaterPathfindingPenalty = this.mob.getPathfindingMalus(PathType.WATER); + this.mob.setPathfindingMalus(PathType.WATER, 0.0f); this.mob.setRunning(true); } @@ -71,18 +70,18 @@ public void start() { public void stop() { this.owner = null; this.navigation.stop(); - this.mob.setPathfindingPenalty(PathNodeType.WATER, this.oldWaterPathfindingPenalty); + this.mob.setPathfindingMalus(PathType.WATER, this.oldWaterPathfindingPenalty); this.mob.setRunning(false); } @Override public void tick() { - this.mob.getLookControl().lookAt(this.owner, 10.0f, this.mob.getMaxLookPitchChange()); + this.mob.getLookControl().setLookAt(this.owner, 10.0f, this.mob.getMaxHeadXRot()); if (--this.updateCountdownTicks > 0) { return; } - this.updateCountdownTicks = this.getTickCount(10); - this.navigation.startMovingTo(this.owner, this.speed); + this.updateCountdownTicks = this.adjustedTickDelay(10); + this.navigation.moveTo(this.owner, this.speed); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastRevengeGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastRevengeGoal.java index 8468f69bb2..2ee3c5d4ea 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastRevengeGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastRevengeGoal.java @@ -1,23 +1,23 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.TamableAnimal; +import net.minecraft.world.entity.ai.goal.target.TargetGoal; +import net.minecraft.world.entity.ai.targeting.TargetingConditions; +import net.minecraft.world.level.GameRules; +import net.minecraft.world.phys.AABB; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.TargetPredicate; -import net.minecraft.entity.ai.goal.TrackTargetGoal; -import net.minecraft.entity.mob.MobEntity; -import net.minecraft.entity.passive.TameableEntity; -import net.minecraft.predicate.entity.EntityPredicates; -import net.minecraft.util.math.Box; -import net.minecraft.world.GameRules; import org.jetbrains.annotations.Nullable; import java.util.EnumSet; import java.util.List; -public class BeastRevengeGoal extends TrackTargetGoal { - private static final TargetPredicate VALID_AVOIDABLES_PREDICATE = TargetPredicate.createAttackable().ignoreVisibility().ignoreDistanceScalingFactor(); +public class BeastRevengeGoal extends TargetGoal { + private static final TargetingConditions VALID_AVOIDABLES_PREDICATE = TargetingConditions.forCombat().ignoreLineOfSight().ignoreInvisibilityTesting(); private static final int BOX_VERTICAL_EXPANSION = 10; private boolean groupRevenge; private int lastAttackedTime; @@ -28,27 +28,27 @@ public class BeastRevengeGoal extends TrackTargetGoal { public BeastRevengeGoal(AbstractBeastEntity mob, Class ... noRevengeTypes) { super(mob, true); this.noRevengeTypes = noRevengeTypes; - this.setControls(EnumSet.of(Control.TARGET)); + this.setFlags(EnumSet.of(Flag.TARGET)); } @Override - public boolean canStart() { - int i = this.mob.getLastAttackedTime(); - LivingEntity livingEntity = this.mob.getAttacker(); + public boolean canUse() { + int i = this.mob.getLastHurtByMobTimestamp(); + LivingEntity livingEntity = this.mob.getLastHurtByMob(); if (i == this.lastAttackedTime || livingEntity == null) { return false; } - if (this.mob.getWorld() instanceof ServerWorld serverWorld && livingEntity.getType() == EntityType.PLAYER && serverWorld.getGameRules().getBoolean(GameRules.UNIVERSAL_ANGER)) { + if (this.mob.level() instanceof ServerLevel serverWorld && livingEntity.getType() == EntityType.PLAYER && serverWorld.getGameRules().getBoolean(GameRules.RULE_UNIVERSAL_ANGER)) { return false; } - if (((AbstractBeastEntity)this.mob).isTame()) { + if (((AbstractBeastEntity)this.mob).isTamed()) { return false; } for (Class class_ : this.noRevengeTypes) { if (!class_.isAssignableFrom(livingEntity.getClass())) continue; return false; } - return this.canTrack(livingEntity, VALID_AVOIDABLES_PREDICATE); + return this.canAttack(livingEntity, VALID_AVOIDABLES_PREDICATE); } public BeastRevengeGoal setGroupRevenge(Class ... noHelpTypes) { @@ -59,10 +59,10 @@ public BeastRevengeGoal setGroupRevenge(Class ... noHelpTypes) { @Override public void start() { - this.mob.setTarget(this.mob.getAttacker()); - this.target = this.mob.getTarget(); - this.lastAttackedTime = this.mob.getLastAttackedTime(); - this.maxTimeWithoutVisibility = 300; + this.mob.setTarget(this.mob.getLastHurtByMob()); + this.targetMob = this.mob.getTarget(); + this.lastAttackedTime = this.mob.getLastHurtByMobTimestamp(); + this.unseenMemoryTicks = 300; if (this.groupRevenge) { this.callSameTypeForRevenge(); } @@ -70,11 +70,11 @@ public void start() { } protected void callSameTypeForRevenge() { - double d = this.getFollowRange(); - Box box = Box.from(this.mob.getPos()).expand(d, 10.0, d); - List list = (List)this.mob.getWorld().getEntitiesByClass(this.mob.getClass(), box, EntityPredicates.EXCEPT_SPECTATOR); - for (MobEntity mobEntity : list) { - if (this.mob == mobEntity || mobEntity.getTarget() != null || this.mob instanceof TameableEntity && ((TameableEntity)this.mob).getOwner() != ((TameableEntity)mobEntity).getOwner() || mobEntity.isTeammate(this.mob.getAttacker())) continue; + double d = this.getFollowDistance(); + AABB box = AABB.unitCubeFromLowerCorner(this.mob.position()).inflate(d, 10.0, d); + List list = (List)this.mob.level().getEntitiesOfClass(this.mob.getClass(), box, EntitySelector.NO_SPECTATORS); + for (Mob mobEntity : list) { + if (this.mob == mobEntity || mobEntity.getTarget() != null || this.mob instanceof TamableAnimal && ((TamableAnimal)this.mob).getOwner() != ((TamableAnimal)mobEntity).getOwner() || mobEntity.isAlliedTo(this.mob.getLastHurtByMob())) continue; if (this.noHelpTypes != null) { boolean bl = false; for (Class class_ : this.noHelpTypes) { @@ -84,11 +84,11 @@ protected void callSameTypeForRevenge() { } if (bl) continue; } - this.setMobEntityTarget(mobEntity, this.mob.getAttacker()); + this.setMobEntityTarget(mobEntity, this.mob.getLastHurtByMob()); } } - protected void setMobEntityTarget(MobEntity mob, LivingEntity target) { + protected void setMobEntityTarget(Mob mob, LivingEntity target) { mob.setTarget(target); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastSitGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastSitGoal.java index 00b01296a3..c6bd3a4625 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastSitGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastSitGoal.java @@ -1,9 +1,8 @@ package net.sevenstars.middleearth.entity.goals; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.goal.Goal; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.goal.Goal; - import java.util.EnumSet; public class BeastSitGoal extends Goal { @@ -11,27 +10,27 @@ public class BeastSitGoal extends Goal { public BeastSitGoal(AbstractBeastEntity mob) { this.mob = mob; - this.setControls(EnumSet.of(Control.JUMP, Control.MOVE)); + this.setFlags(EnumSet.of(Flag.JUMP, Flag.MOVE)); } @Override - public boolean shouldContinue() { + public boolean canContinueToUse() { return this.mob.isSitting(); } @Override - public boolean canStart() { - if (!this.mob.isTame()) { + public boolean canUse() { + if (!this.mob.isTamed()) { return false; } - if (!this.mob.isOnGround()) { + if (!this.mob.onGround()) { return false; } LivingEntity livingEntity = this.mob.getOwner(); if (livingEntity == null) { return true; } - if (this.mob.squaredDistanceTo(livingEntity) < 144.0 && livingEntity.getAttacker() != null) { + if (this.mob.distanceToSqr(livingEntity) < 144.0 && livingEntity.getLastHurtByMob() != null) { return false; } return this.mob.isSitting(); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastTargetPlayerGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastTargetPlayerGoal.java index 992487404e..e9c9352122 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastTargetPlayerGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastTargetPlayerGoal.java @@ -1,41 +1,41 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.entity.ai.goal.ActiveTargetGoal; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.server.level.ServerLevel; import net.minecraft.world.Difficulty; +import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; +import net.minecraft.world.entity.player.Player; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; import net.sevenstars.middleearth.resources.datas.common.DispositionType; import net.sevenstars.middleearth.resources.persistent_datas.PlayerDataService; -public class BeastTargetPlayerGoal extends ActiveTargetGoal { +public class BeastTargetPlayerGoal extends NearestAttackableTargetGoal { AbstractBeastEntity mob; DispositionType beastDispositionType; public BeastTargetPlayerGoal(AbstractBeastEntity mob, DispositionType beastDispositionType) { - super(mob, PlayerEntity.class, true); + super(mob, Player.class, true); this.mob = mob; this.beastDispositionType = beastDispositionType; } @Override - public boolean canStart() { - return super.canStart() && canTargetMob(); + public boolean canUse() { + return super.canUse() && canTargetMob(); } @Override - public boolean shouldContinue() { - return super.shouldContinue() && canTargetMob(); + public boolean canContinueToUse() { + return super.canContinueToUse() && canTargetMob(); } private boolean canTargetMob(){ - if(this.mob.getWorld() instanceof ServerWorld serverWorld) { - PlayerEntity player = serverWorld.getClosestPlayer(this.targetPredicate, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ());; - if(player == null || mob.getWorld().getDifficulty() == Difficulty.PEACEFUL || mob.isTame() || player == mob.getOwner()){ + if(this.mob.level() instanceof ServerLevel serverWorld) { + Player player = serverWorld.getNearestPlayer(this.targetConditions, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ());; + if(player == null || mob.level().getDifficulty() == Difficulty.PEACEFUL || mob.isTamed() || player == mob.getOwner()){ return false; } if(beastDispositionType != null){ - return PlayerDataService.getPlayerDisposition(player, player.getWorld()) != beastDispositionType; + return PlayerDataService.getPlayerDisposition(player, player.level()) != beastDispositionType; } return true; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastTrackOwnerAttackerGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastTrackOwnerAttackerGoal.java index c34cacd8ea..c9a18a3151 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastTrackOwnerAttackerGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BeastTrackOwnerAttackerGoal.java @@ -1,13 +1,12 @@ package net.sevenstars.middleearth.entity.goals; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.goal.target.TargetGoal; +import net.minecraft.world.entity.ai.targeting.TargetingConditions; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.TargetPredicate; -import net.minecraft.entity.ai.goal.TrackTargetGoal; - import java.util.EnumSet; -public class BeastTrackOwnerAttackerGoal extends TrackTargetGoal { +public class BeastTrackOwnerAttackerGoal extends TargetGoal { private final AbstractBeastEntity mob; private LivingEntity attacker; private int lastAttackedTime; @@ -15,12 +14,12 @@ public class BeastTrackOwnerAttackerGoal extends TrackTargetGoal { public BeastTrackOwnerAttackerGoal(AbstractBeastEntity mob) { super(mob, false); this.mob = mob; - this.setControls(EnumSet.of(Control.TARGET)); + this.setFlags(EnumSet.of(Flag.TARGET)); } @Override - public boolean canStart() { - if (!this.mob.isTame() || this.mob.isSitting()) { + public boolean canUse() { + if (!this.mob.isTamed() || this.mob.isSitting()) { return false; } if(!this.mob.shouldAttackWhenMounted() && this.mob.hasControllingPassenger()) { @@ -30,9 +29,9 @@ public boolean canStart() { if (livingEntity == null) { return false; } - this.attacker = livingEntity.getAttacker(); - int i = livingEntity.getLastAttackedTime(); - return i != this.lastAttackedTime && this.canTrack(this.attacker, TargetPredicate.DEFAULT); + this.attacker = livingEntity.getLastHurtByMob(); + int i = livingEntity.getLastHurtByMobTimestamp(); + return i != this.lastAttackedTime && this.canAttack(this.attacker, TargetingConditions.DEFAULT); } @Override @@ -40,7 +39,7 @@ public void start() { this.mob.setTarget(this.attacker); LivingEntity livingEntity = this.mob.getOwner(); if (livingEntity != null) { - this.lastAttackedTime = livingEntity.getLastAttackedTime(); + this.lastAttackedTime = livingEntity.getLastHurtByMobTimestamp(); } super.start(); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BirdFlightGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BirdFlightGoal.java index c7acd85287..3511865622 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BirdFlightGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BirdFlightGoal.java @@ -1,23 +1,23 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.mob.MobEntity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.goal.Goal; public class BirdFlightGoal extends Goal { - private final MobEntity mob; + private final Mob mob; private LivingEntity target; - public BirdFlightGoal(MobEntity mob) { + public BirdFlightGoal(Mob mob) { this.mob = mob; } @Override - public boolean canStart() { + public boolean canUse() { this.target = this.mob.getTarget(); - if(!this.mob.isOnGround()){ + if(!this.mob.onGround()){ return false; } else if(this.target == null) { return true; @@ -27,12 +27,12 @@ public boolean canStart() { } @Override - public boolean shouldContinue() { - return !this.mob.isOnGround(); + public boolean canContinueToUse() { + return !this.mob.onGround(); } @Override public void start() { - this.mob.setVelocity(this.mob.getVelocity().x * 4, 0.8D, this.mob.getVelocity().z * 4); + this.mob.setDeltaMovement(this.mob.getDeltaMovement().x * 4, 0.8D, this.mob.getDeltaMovement().z * 4); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BowAtEntityGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BowAtEntityGoal.java index 6021948d6a..897e034781 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BowAtEntityGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/BowAtEntityGoal.java @@ -1,65 +1,62 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.TargetPredicate; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.ai.pathing.EntityNavigation; -import net.minecraft.entity.mob.MobEntity; -import net.minecraft.entity.mob.PathAwareEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.predicate.entity.EntityPredicates; -import net.minecraft.server.world.ServerWorld; import org.jetbrains.annotations.Nullable; import java.util.EnumSet; import java.util.function.Predicate; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.PathfinderMob; +import net.minecraft.world.entity.ai.goal.Goal; +import net.minecraft.world.entity.ai.navigation.PathNavigation; +import net.minecraft.world.entity.ai.targeting.TargetingConditions; +import net.minecraft.world.entity.player.Player; public class BowAtEntityGoal extends Goal { public static final float DEFAULT_CHANCE = 0.02F; - protected final PathAwareEntity mob; + protected final PathfinderMob mob; @Nullable protected Entity target; protected final float range; private int lookTime; private final boolean lookForward; - private final EntityNavigation navigation; + private final PathNavigation navigation; protected final Class targetType; - protected final TargetPredicate targetPredicate; + protected final TargetingConditions targetPredicate; protected final Predicate targetSelector; - public BowAtEntityGoal(PathAwareEntity mob, Class targetType, float range, Predicate targetSelector) { + public BowAtEntityGoal(PathfinderMob mob, Class targetType, float range, Predicate targetSelector) { this(mob, targetType, range, targetSelector, false); } - public BowAtEntityGoal(PathAwareEntity mob, Class targetType, float range, Predicate targetSelector, boolean lookForward) { + public BowAtEntityGoal(PathfinderMob mob, Class targetType, float range, Predicate targetSelector, boolean lookForward) { this.mob = mob; this.targetType = targetType; this.range = range; this.lookForward = lookForward; this.navigation = mob.getNavigation(); this.targetSelector = targetSelector; - this.setControls(EnumSet.of(Control.LOOK)); - if (targetType == PlayerEntity.class) { - Predicate predicate = EntityPredicates.rides(mob); - this.targetPredicate = TargetPredicate.createNonAttackable().setBaseMaxDistance((double)range).setPredicate((entity, world) -> { - return targetSelector.test(entity); - }); + this.setFlags(EnumSet.of(Flag.LOOK)); + if (targetType == Player.class) { + this.targetPredicate = TargetingConditions.forNonCombat().range((double)range).selector(targetSelector); } else { - this.targetPredicate = TargetPredicate.createNonAttackable().setBaseMaxDistance((double)range); + this.targetPredicate = TargetingConditions.forNonCombat().range((double)range); } } - public boolean canStart() { + public boolean canUse() { if (this.mob.getTarget() != null) { this.target = this.mob.getTarget(); } - ServerWorld serverWorld = getServerWorld(this.mob); - if (this.targetType == PlayerEntity.class) { - this.target = serverWorld.getClosestPlayer(this.targetPredicate, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ()); + if (!(this.mob.level() instanceof ServerLevel serverWorld)) { + return false; + } + if (this.targetType == Player.class) { + this.target = serverWorld.getNearestPlayer(this.targetPredicate, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ()); } else { - this.target = serverWorld.getClosestEntity(this.mob.getWorld().getEntitiesByClass(this.targetType, this.mob.getBoundingBox().expand((double)this.range, 3.0, (double)this.range), (livingEntity) -> { + this.target = serverWorld.getNearestEntity(this.mob.level().getEntitiesOfClass(this.targetType, this.mob.getBoundingBox().inflate((double)this.range, 3.0, (double)this.range), (livingEntity) -> { return true; }), this.targetPredicate, this.mob, this.mob.getX(), this.mob.getEyeY(), this.mob.getZ()); } @@ -68,10 +65,10 @@ public boolean canStart() { } - public boolean shouldContinue() { - if (!this.target.isAlive()) { + public boolean canContinueToUse() { + if (this.target == null || !this.target.isAlive()) { return false; - } else if (this.mob.squaredDistanceTo(this.target) > (double)(this.range * this.range)) { + } else if (this.mob.distanceToSqr(this.target) > (double)(this.range * this.range)) { return false; } else { return this.lookTime > 0; @@ -91,7 +88,7 @@ public void tick() { if (this.target.isAlive()) { this.navigation.stop(); double d = this.lookForward ? this.mob.getEyeY() : this.target.getEyeY(); - this.mob.getLookControl().lookAt(this.target.getX(), d, this.target.getZ()); + this.mob.getLookControl().setLookAt(this.target.getX(), d, this.target.getZ()); --this.lookTime; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/ChargeAttackGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/ChargeAttackGoal.java index 61be340ae9..cd1753fee0 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/ChargeAttackGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/ChargeAttackGoal.java @@ -1,10 +1,10 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.ai.pathing.Path; -import net.minecraft.entity.ai.pathing.PathNode; -import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.goal.Goal; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.pathfinder.Node; +import net.minecraft.world.level.pathfinder.Path; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; import net.sevenstars.middleearth.resources.datas.common.DispositionType; import net.sevenstars.middleearth.resources.persistent_datas.PlayerDataService; @@ -22,14 +22,14 @@ public ChargeAttackGoal(AbstractBeastEntity mob, DispositionType beastDispositio } @Override - public boolean canStart() { - if(this.mob.getTarget() != null && this.mob.getTarget() instanceof PlayerEntity player) { - return PlayerDataService.getPlayerDisposition(player, player.getWorld()) == beastDispositionType; + public boolean canUse() { + if(this.mob.getTarget() != null && this.mob.getTarget() instanceof Player player) { + return PlayerDataService.getPlayerDisposition(player, player.level()) == beastDispositionType; } return this.mob.getChargeTimeout() == 0 && (mob.getTarget() != null) && - this.mob.getRandom().nextInt(ChargeAttackGoal.toGoalTicks(40)) == 0 && + this.mob.getRandom().nextInt(ChargeAttackGoal.reducedTickDelay(40)) == 0 && canNavigateToEntity(this.mob.getTarget()) && this.mob.canCharge(); } @@ -51,12 +51,12 @@ public void tick() { private boolean canNavigateToEntity(LivingEntity entity) { int j; - this.checkCanNavigateCooldown = Goal.toGoalTicks(10 + this.mob.getRandom().nextInt(5)); - Path path = this.mob.getNavigation().findPathTo(entity, 0); + this.checkCanNavigateCooldown = Goal.reducedTickDelay(10 + this.mob.getRandom().nextInt(5)); + Path path = this.mob.getNavigation().createPath(entity, 0); if (path == null) { return false; } - PathNode pathNode = path.getEnd(); + Node pathNode = path.getEndNode(); if (pathNode == null) { return false; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/CustomBowAttackGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/CustomBowAttackGoal.java index 61c2163e98..34d11b3217 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/CustomBowAttackGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/CustomBowAttackGoal.java @@ -1,20 +1,19 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.entity.attribute.EntityAttributes; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.PathfinderMob; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.goal.Goal; +import net.minecraft.world.entity.monster.RangedAttackMob; +import net.minecraft.world.item.BowItem; +import net.minecraft.world.item.ItemStack; import net.sevenstars.middleearth.item.items.weapons.ranged.CustomLongbowWeaponItem; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.RangedAttackMob; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.mob.MobEntity; -import net.minecraft.entity.mob.PathAwareEntity; -import net.minecraft.item.BowItem; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Hand; - import java.util.EnumSet; -public class CustomBowAttackGoal extends Goal { +public class CustomBowAttackGoal extends Goal { private final T actor; private final double speed; private int attackInterval; @@ -31,7 +30,7 @@ public CustomBowAttackGoal(T actor, double speed, int attackInterval, float rang this.speed = speed; this.attackInterval = attackInterval; this.squaredRange = range * range; - this.setControls(EnumSet.of(Control.MOVE, Control.LOOK)); + this.setFlags(EnumSet.of(Flag.MOVE, Flag.LOOK)); } public void setAttackInterval(int attackInterval) { @@ -39,7 +38,7 @@ public void setAttackInterval(int attackInterval) { } @Override - public boolean canStart() { + public boolean canUse() { if (this.actor.getTarget() == null) { return false; } @@ -47,32 +46,32 @@ public boolean canStart() { } protected boolean isHoldingBow() { - ItemStack stack = actor.getStackInHand(Hand.MAIN_HAND); + ItemStack stack = actor.getItemInHand(InteractionHand.MAIN_HAND); return stack.getItem() instanceof BowItem; } @Override - public boolean shouldContinue() { - return (this.canStart() || !this.actor.getNavigation().isIdle()) && this.isHoldingBow(); + public boolean canContinueToUse() { + return (this.canUse() || !this.actor.getNavigation().isDone()) && this.isHoldingBow(); } @Override public void start() { super.start(); - this.actor.setAttacking(true); + this.actor.setAggressive(true); } @Override public void stop() { super.stop(); - this.actor.setAttacking(false); + this.actor.setAggressive(false); this.targetSeeingTicker = 0; this.cooldown = -1; - this.actor.clearActiveItem(); + this.actor.stopUsingItem(); } @Override - public boolean shouldRunEveryTick() { + public boolean requiresUpdateEveryTick() { return true; } @@ -80,8 +79,8 @@ public boolean shouldRunEveryTick() { public void tick() { LivingEntity livingEntity = this.actor.getTarget(); if (livingEntity != null) { - double d = this.actor.squaredDistanceTo(livingEntity.getX(), livingEntity.getY(), livingEntity.getZ()); - boolean bl = this.actor.getVisibilityCache().canSee(livingEntity); + double d = this.actor.distanceToSqr(livingEntity.getX(), livingEntity.getY(), livingEntity.getZ()); + boolean bl = this.actor.getSensing().hasLineOfSight(livingEntity); boolean bl2 = this.targetSeeingTicker > 0; if (bl != bl2) { this.targetSeeingTicker = 0; @@ -98,7 +97,7 @@ public void tick() { ++this.combatTicks; } else { - this.actor.getNavigation().startMovingTo(livingEntity, this.speed); + this.actor.getNavigation().moveTo(livingEntity, this.speed); this.combatTicks = -1; } @@ -122,48 +121,48 @@ public void tick() { } float input = 0.5F; - if (this.actor.hasVehicle() && this.actor.getVehicle() instanceof LivingEntity mount) { - double speed = mount.getAttributeValue(EntityAttributes.MOVEMENT_SPEED); + if (this.actor.isPassenger() && this.actor.getVehicle() instanceof LivingEntity mount) { + double speed = mount.getAttributeValue(Attributes.MOVEMENT_SPEED); input = (float)Math.max(0.15F, Math.min(0.3F, speed * input)); } - this.actor.getMoveControl().strafeTo( + this.actor.getMoveControl().strafe( this.backward ? -input : input, this.movingToLeft ? input : -input ); - Entity var7 = this.actor.getControllingVehicle(); - if (var7 instanceof MobEntity mobEntity) { - mobEntity.lookAtEntity(livingEntity, 30.0F, 30.0F); + Entity var7 = this.actor.getControlledVehicle(); + if (var7 instanceof Mob mobEntity) { + mobEntity.lookAt(livingEntity, 30.0F, 30.0F); } - this.actor.lookAtEntity(livingEntity, 30.0F, 30.0F); + this.actor.lookAt(livingEntity, 30.0F, 30.0F); } else { - this.actor.getLookControl().lookAt(livingEntity, 30.0F, 30.0F); + this.actor.getLookControl().setLookAt(livingEntity, 30.0F, 30.0F); } if (this.actor.isUsingItem()) { if (!bl && this.targetSeeingTicker < -60) { - this.actor.clearActiveItem(); + this.actor.stopUsingItem(); } else if (bl) { - int i = this.actor.getItemUseTime(); - ItemStack itemStack = this.actor.getMainHandStack(); + int i = this.actor.getTicksUsingItem(); + ItemStack itemStack = this.actor.getMainHandItem(); if (i >= 20 && !livingEntity.isInvulnerable()) { if(itemStack.getItem() instanceof CustomLongbowWeaponItem) { if(i >= 30) { - this.actor.shootAt(livingEntity, 2.5f); + this.actor.performRangedAttack(livingEntity, 2.5f); this.cooldown = this.attackInterval; - this.actor.clearActiveItem(); + this.actor.stopUsingItem(); } } else { - this.actor.shootAt(livingEntity, 1.5f); + this.actor.performRangedAttack(livingEntity, 1.5f); this.cooldown = this.attackInterval; - this.actor.clearActiveItem(); + this.actor.stopUsingItem(); } } } } else if (--this.cooldown <= 0 && this.targetSeeingTicker >= -60) { - this.actor.setCurrentHand(Hand.MAIN_HAND); + this.actor.startUsingItem(InteractionHand.MAIN_HAND); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/FastPonceAtTargetGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/FastPonceAtTargetGoal.java index 38d6637b08..0a42394886 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/FastPonceAtTargetGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/FastPonceAtTargetGoal.java @@ -1,57 +1,56 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.ai.goal.PounceAtTargetGoal; -import net.minecraft.entity.mob.MobEntity; -import net.minecraft.util.math.Vec3d; - import java.util.EnumSet; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.goal.Goal; +import net.minecraft.world.entity.ai.goal.LeapAtTargetGoal; +import net.minecraft.world.phys.Vec3; public class FastPonceAtTargetGoal extends Goal { - protected final MobEntity mob; + protected final Mob mob; protected LivingEntity target; protected final float verticalVelocity; protected final float horizontalVelocity; - public FastPonceAtTargetGoal(MobEntity mob, float verticalVelocity, float horizontalVelocity) { + public FastPonceAtTargetGoal(Mob mob, float verticalVelocity, float horizontalVelocity) { this.mob = mob; this.verticalVelocity = verticalVelocity; this.horizontalVelocity = horizontalVelocity; - this.setControls(EnumSet.of(Control.JUMP, Control.MOVE)); + this.setFlags(EnumSet.of(Flag.JUMP, Flag.MOVE)); } @Override - public boolean canStart() { - if (this.mob.hasPassengers()) { + public boolean canUse() { + if (this.mob.isVehicle()) { return false; } this.target = this.mob.getTarget(); if (this.target == null) { return false; } - double d = this.mob.squaredDistanceTo(this.target); + double d = this.mob.distanceToSqr(this.target); if (d < 4.0 || d > 16.0) { return false; } - if (!this.mob.isOnGround()) { + if (!this.mob.onGround()) { return false; } - return this.mob.getRandom().nextInt(PounceAtTargetGoal.toGoalTicks(5)) == 0; + return this.mob.getRandom().nextInt(LeapAtTargetGoal.reducedTickDelay(5)) == 0; } @Override - public boolean shouldContinue() { - return !this.mob.isOnGround(); + public boolean canContinueToUse() { + return !this.mob.onGround(); } @Override public void start() { - Vec3d vec3d = this.mob.getVelocity(); - Vec3d vec3d2 = new Vec3d(this.target.getX() - this.mob.getX(), 0.0, this.target.getZ() - this.mob.getZ()); - if (vec3d2.lengthSquared() > 1.0E-7) { - vec3d2 = vec3d2.multiply(horizontalVelocity).add(vec3d.multiply(0.2));; + Vec3 vec3d = this.mob.getDeltaMovement(); + Vec3 vec3d2 = new Vec3(this.target.getX() - this.mob.getX(), 0.0, this.target.getZ() - this.mob.getZ()); + if (vec3d2.lengthSqr() > 1.0E-7) { + vec3d2 = vec3d2.scale(horizontalVelocity).add(vec3d.scale(0.2));; } - this.mob.setVelocity(vec3d2.x, this.verticalVelocity, vec3d2.z); + this.mob.setDeltaMovement(vec3d2.x, this.verticalVelocity, vec3d2.z); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/FollowDifferentMobGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/FollowDifferentMobGoal.java index 3c1b4aff83..5a2c1c448d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/FollowDifferentMobGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/FollowDifferentMobGoal.java @@ -1,35 +1,33 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.entity.Entity; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.control.LookControl; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.ai.pathing.BirdNavigation; -import net.minecraft.entity.ai.pathing.EntityNavigation; -import net.minecraft.entity.ai.pathing.MobNavigation; -import net.minecraft.entity.ai.pathing.PathNodeType; -import net.minecraft.entity.mob.MobEntity; -import net.minecraft.predicate.entity.EntityPredicates; import org.jetbrains.annotations.Nullable; import java.util.EnumSet; import java.util.List; import java.util.function.Predicate; +import net.minecraft.world.entity.EntitySelector; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.control.LookControl; +import net.minecraft.world.entity.ai.goal.Goal; +import net.minecraft.world.entity.ai.navigation.FlyingPathNavigation; +import net.minecraft.world.entity.ai.navigation.GroundPathNavigation; +import net.minecraft.world.entity.ai.navigation.PathNavigation; +import net.minecraft.world.level.pathfinder.PathType; -public class FollowDifferentMobGoal extends Goal { - private final MobEntity mob; - private final Predicate targetPredicate; +public class FollowDifferentMobGoal extends Goal { + private final Mob mob; + private final Predicate targetPredicate; @Nullable - private MobEntity target; + private Mob target; private final double speed; - private final EntityNavigation navigation; + private final PathNavigation navigation; private int updateCountdownTicks; private final float minDistance; private float oldWaterPathFindingPenalty; private final float maxDistance; private final Class followedClass; - public FollowDifferentMobGoal(MobEntity follower, Class followed, double speed, float minDistance, float maxDistance) { + public FollowDifferentMobGoal(Mob follower, Class followed, double speed, float minDistance, float maxDistance) { this.mob = follower; this.followedClass = followed; this.targetPredicate = target -> target != null && followed != target.getClass(); @@ -37,17 +35,17 @@ public FollowDifferentMobGoal(MobEntity follower, Class followed, double spee this.navigation = follower.getNavigation(); this.minDistance = minDistance; this.maxDistance = maxDistance; - this.setControls(EnumSet.of(Goal.Control.MOVE, Goal.Control.LOOK)); - if (!(follower.getNavigation() instanceof MobNavigation) && !(follower.getNavigation() instanceof BirdNavigation)) { + this.setFlags(EnumSet.of(Goal.Flag.MOVE, Goal.Flag.LOOK)); + if (!(follower.getNavigation() instanceof GroundPathNavigation) && !(follower.getNavigation() instanceof FlyingPathNavigation)) { throw new IllegalArgumentException("Unsupported follower type for FollowMobGoal"); } } @Override - public boolean canStart() { - List list = this.mob.getWorld().getEntitiesByClass(this.followedClass, this.mob.getBoundingBox().expand(this.maxDistance), EntityPredicates.VALID_ENTITY); + public boolean canUse() { + List list = this.mob.level().getEntitiesOfClass(this.followedClass, this.mob.getBoundingBox().inflate(this.maxDistance), EntitySelector.ENTITY_STILL_ALIVE); if (!list.isEmpty()) { - for (MobEntity mobEntity : list) { + for (Mob mobEntity : list) { if (!mobEntity.isInvisible()) { this.target = mobEntity; return true; @@ -59,44 +57,44 @@ public boolean canStart() { } @Override - public boolean shouldContinue() { - return this.target != null && !this.navigation.isIdle() && this.mob.squaredDistanceTo(this.target) > (this.minDistance/2) * (this.minDistance/2); + public boolean canContinueToUse() { + return this.target != null && !this.navigation.isDone() && this.mob.distanceToSqr(this.target) > (this.minDistance/2) * (this.minDistance/2); } @Override public void start() { this.updateCountdownTicks = 0; - this.oldWaterPathFindingPenalty = this.mob.getPathfindingPenalty(PathNodeType.WATER); - this.mob.setPathfindingPenalty(PathNodeType.WATER, 0.0F); + this.oldWaterPathFindingPenalty = this.mob.getPathfindingMalus(PathType.WATER); + this.mob.setPathfindingMalus(PathType.WATER, 0.0F); } @Override public void stop() { this.target = null; this.navigation.stop(); - this.mob.setPathfindingPenalty(PathNodeType.WATER, this.oldWaterPathFindingPenalty); + this.mob.setPathfindingMalus(PathType.WATER, this.oldWaterPathFindingPenalty); } @Override public void tick() { if (this.target != null && !this.mob.isLeashed()) { - this.mob.getLookControl().lookAt(this.target, 10.0F, this.mob.getMaxLookPitchChange()); + this.mob.getLookControl().setLookAt(this.target, 10.0F, this.mob.getMaxHeadXRot()); if (--this.updateCountdownTicks <= 0) { - this.updateCountdownTicks = this.getTickCount(10); + this.updateCountdownTicks = this.adjustedTickDelay(10); double d = this.mob.getX() - this.target.getX(); double e = this.mob.getY() - this.target.getY(); double f = this.mob.getZ() - this.target.getZ(); double g = d * d + e * e + f * f; if (!(g <= this.minDistance * this.minDistance)) { - this.navigation.startMovingTo(this.target, this.speed); + this.navigation.moveTo(this.target, this.speed); } else { this.navigation.stop(); LookControl lookControl = this.target.getLookControl(); if (g <= this.minDistance - || lookControl.getLookX() == this.mob.getX() && lookControl.getLookY() == this.mob.getY() && lookControl.getLookZ() == this.mob.getZ()) { + || lookControl.getWantedX() == this.mob.getX() && lookControl.getWantedY() == this.mob.getY() && lookControl.getWantedZ() == this.mob.getZ()) { double h = this.target.getX() - this.mob.getX(); double i = this.target.getZ() - this.mob.getZ(); - this.navigation.startMovingTo(this.mob.getX() - h, this.mob.getY(), this.mob.getZ() - i, this.speed); + this.navigation.moveTo(this.mob.getX() - h, this.mob.getY(), this.mob.getZ() - i, this.speed); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/NpcCrossBowAttackGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/NpcCrossBowAttackGoal.java index d9562bb614..d97a0798be 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/NpcCrossBowAttackGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/NpcCrossBowAttackGoal.java @@ -1,25 +1,25 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.ChargedProjectilesComponent; -import net.minecraft.entity.CrossbowUser; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.RangedAttackMob; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.projectile.ProjectileUtil; -import net.minecraft.item.CrossbowItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.util.TimeHelper; -import net.minecraft.util.math.intprovider.UniformIntProvider; +import net.minecraft.core.component.DataComponents; +import net.minecraft.util.TimeUtil; +import net.minecraft.util.valueproviders.UniformInt; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.goal.Goal; +import net.minecraft.world.entity.monster.CrossbowAttackMob; +import net.minecraft.world.entity.monster.RangedAttackMob; +import net.minecraft.world.entity.projectile.ProjectileUtil; +import net.minecraft.world.item.CrossbowItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.component.ChargedProjectiles; import net.sevenstars.middleearth.entity.npcs.NpcEntity; import net.sevenstars.middleearth.utils.ItemTagsME; import java.util.EnumSet; -public class NpcCrossBowAttackGoal extends Goal { - public static final UniformIntProvider COOLDOWN_RANGE = TimeHelper.betweenSeconds(1, 2); +public class NpcCrossBowAttackGoal extends Goal { + public static final UniformInt COOLDOWN_RANGE = TimeUtil.rangeOfSeconds(1, 2); private static int USING_ITEM_FLAG = 1; private final T actor; private Stage stage = Stage.UNCHARGED; @@ -34,22 +34,22 @@ public NpcCrossBowAttackGoal(T actor, double speed, float range) { this.actor = actor; this.speed = speed; this.squaredRange = range * range; - this.setControls(EnumSet.of(Goal.Control.MOVE, Goal.Control.LOOK)); + this.setFlags(EnumSet.of(Goal.Flag.MOVE, Goal.Flag.LOOK)); } @Override - public boolean canStart() { + public boolean canUse() { return this.hasAliveTarget() && this.isEntityHoldingCrossbow(); } private boolean isEntityHoldingCrossbow() { - ItemStack itemStack = actor.getMainHandStack(); - return (itemStack.isOf(Items.CROSSBOW) || itemStack.isIn(ItemTagsME.CROSSBOW)); + ItemStack itemStack = actor.getMainHandItem(); + return (itemStack.is(Items.CROSSBOW) || itemStack.is(ItemTagsME.CROSSBOW)); } @Override - public boolean shouldContinue() { - return this.hasAliveTarget() && (this.canStart() || !this.actor.getNavigation().isIdle()) && this.isEntityHoldingCrossbow(); + public boolean canContinueToUse() { + return this.hasAliveTarget() && (this.canUse() || !this.actor.getNavigation().isDone()) && this.isEntityHoldingCrossbow(); } private boolean hasAliveTarget() { @@ -65,18 +65,18 @@ public void start() { @Override public void stop() { super.stop(); - this.actor.setAttacking(false); + this.actor.setAggressive(false); this.actor.setTarget(null); this.seeingTargetTicker = 0; if (this.actor.isUsingItem()) { - this.actor.clearActiveItem(); - this.actor.setCharging(false); - this.actor.getActiveItem().set(DataComponentTypes.CHARGED_PROJECTILES, ChargedProjectilesComponent.DEFAULT); + this.actor.stopUsingItem(); + this.actor.setChargingCrossbow(false); + this.actor.getUseItem().set(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.EMPTY); } } @Override - public boolean shouldRunEveryTick() { + public boolean requiresUpdateEveryTick() { return true; } @@ -84,7 +84,7 @@ public boolean shouldRunEveryTick() { public void tick() { LivingEntity livingEntity = this.actor.getTarget(); if (livingEntity != null) { - boolean canSee = this.actor.getVisibilityCache().canSee(livingEntity); + boolean canSee = this.actor.getSensing().hasLineOfSight(livingEntity); boolean canSeeTargetTicker = this.seeingTargetTicker > 0; if (canSee != canSeeTargetTicker) { @@ -97,45 +97,45 @@ public void tick() { this.seeingTargetTicker--; } - double distance = this.actor.squaredDistanceTo(livingEntity); + double distance = this.actor.distanceToSqr(livingEntity); boolean inRange = (distance > this.squaredRange || this.seeingTargetTicker < 5) && this.chargedTicksLeft == 0; if (inRange) { this.cooldown--; if (this.cooldown <= 0) { - this.actor.getNavigation().startMovingTo(livingEntity, this.isUncharged() ? this.speed : this.speed * 0.5); - this.cooldown = COOLDOWN_RANGE.get(this.actor.getRandom()); + this.actor.getNavigation().moveTo(livingEntity, this.isUncharged() ? this.speed : this.speed * 0.5); + this.cooldown = COOLDOWN_RANGE.sample(this.actor.getRandom()); } } else { this.cooldown = 0; this.actor.getNavigation().stop(); } - this.actor.getLookControl().lookAt(livingEntity, 30.0F, 30.0F); + this.actor.getLookControl().setLookAt(livingEntity, 30.0F, 30.0F); if (this.stage == Stage.UNCHARGED) { if (!inRange) { - this.actor.setCurrentHand(ProjectileUtil.getHandPossiblyHolding(this.actor, Items.CROSSBOW)); + this.actor.startUsingItem(ProjectileUtil.getWeaponHoldingHand(this.actor, Items.CROSSBOW)); this.stage = Stage.CHARGING; - this.actor.setCharging(true); + this.actor.setChargingCrossbow(true); } } else if (this.stage == Stage.CHARGING) { useTicks++; - this.actor.setCharging(true); - ItemStack itemStack = this.actor.getActiveItem(); + this.actor.setChargingCrossbow(true); + ItemStack itemStack = this.actor.getUseItem(); this.actor.setNpcFlag(USING_ITEM_FLAG, true); - if (useTicks >= CrossbowItem.getPullTime(itemStack, this.actor)) { - this.actor.stopUsingItem(); + if (useTicks >= CrossbowItem.getChargeDuration(itemStack, this.actor)) { + this.actor.releaseUsingItem(); this.stage = Stage.CHARGED; this.chargedTicksLeft = 30 + this.actor.getRandom().nextInt(15); - this.actor.setCharging(false); + this.actor.setChargingCrossbow(false); } } else if (this.stage == Stage.CHARGED) { this.chargedTicksLeft--; - this.actor.setCharging(false); + this.actor.setChargingCrossbow(false); this.actor.setNpcFlag(USING_ITEM_FLAG, true); if(this.chargedTicksLeft <= 1) { - this.actor.getMainHandStack().set( - DataComponentTypes.CHARGED_PROJECTILES, - ChargedProjectilesComponent.of(new ItemStack(Items.ARROW)) + this.actor.getMainHandItem().set( + DataComponents.CHARGED_PROJECTILES, + ChargedProjectiles.of(new ItemStack(Items.ARROW)) ); } if (this.chargedTicksLeft == 0) { @@ -143,12 +143,12 @@ public void tick() { } } else if (this.stage == Stage.READY_TO_ATTACK && canSee) { this.actor.shootCrossbowAt(livingEntity); - ItemStack crossbow = this.actor.getMainHandStack(); - crossbow.remove(DataComponentTypes.CHARGED_PROJECTILES); - this.actor.equipStack(EquipmentSlot.MAINHAND, crossbow); + ItemStack crossbow = this.actor.getMainHandItem(); + crossbow.remove(DataComponents.CHARGED_PROJECTILES); + this.actor.setItemSlot(EquipmentSlot.MAINHAND, crossbow); this.stage = Stage.UNCHARGED; this.actor.setNpcFlag(USING_ITEM_FLAG, false); - this.actor.stopUsingItem(); + this.actor.releaseUsingItem(); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/NpcDoorInteractGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/NpcDoorInteractGoal.java index 6d7ec54e49..ebc8975e4c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/NpcDoorInteractGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/NpcDoorInteractGoal.java @@ -1,20 +1,99 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.block.BlockState; -import net.minecraft.entity.ai.goal.LongDoorInteractGoal; -import net.minecraft.entity.mob.MobEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.goal.DoorInteractGoal; +import net.minecraft.world.level.block.DoorBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; +import net.minecraft.world.phys.AABB; import net.sevenstars.middleearth.block.registration.ModBlocks; +import net.sevenstars.middleearth.entity.npcs.NpcEntity; -public class NpcDoorInteractGoal extends LongDoorInteractGoal { - public NpcDoorInteractGoal(MobEntity mob, boolean delayedClose) { - super(mob, delayedClose); +public class NpcDoorInteractGoal extends DoorInteractGoal { + private static final int MAX_OPEN_TICKS = 100; + private static final int RETRY_COOLDOWN_TICKS = 100; + + private int openTicks; + private long retryAfterTick; + private boolean passedDoor; + private AABB doorwayBounds; + + public NpcDoorInteractGoal(Mob mob) { + super(mob); + } + + @Override + public boolean canUse() { + return this.mob.level().getGameTime() >= this.retryAfterTick && super.canUse(); + } + + @Override + public boolean canContinueToUse() { + this.passedDoor |= !super.canContinueToUse(); + boolean insideDoorway = this.isInsideDoorway(); + return this.passedDoor ? insideDoorway : this.openTicks < MAX_OPEN_TICKS || insideDoorway; + } + + @Override + public void start() { + super.start(); + this.openTicks = 0; + this.passedDoor = false; + this.doorwayBounds = this.createDoorwayBounds(); + if (this.mob instanceof NpcEntity npc) { + npc.beginDoorTraversal(); + } + this.setOpen(true); + } + + @Override + public void tick() { + this.openTicks++; + super.tick(); + } + + @Override + public void stop() { + if (!this.isInsideDoorway()) { + this.setOpen(false); + } + if (this.mob instanceof NpcEntity npc) { + npc.endDoorTraversal(); + } + if (this.openTicks >= MAX_OPEN_TICKS) { + this.retryAfterTick = this.mob.level().getGameTime() + RETRY_COOLDOWN_TICKS; + } + this.doorwayBounds = null; + } + + private boolean isInsideDoorway() { + return this.doorwayBounds != null + && this.mob.getBoundingBox().intersects(this.doorwayBounds); + } + + private AABB createDoorwayBounds() { + BlockPos basePos = this.doorPos; + BlockState state = this.mob.level().getBlockState(basePos); + if (state.hasProperty(DoorBlock.HALF) + && state.getValue(DoorBlock.HALF) == DoubleBlockHalf.UPPER) { + basePos = basePos.below(); + } + return new AABB( + basePos.getX() - 0.05D, + basePos.getY() - 0.05D, + basePos.getZ() - 0.05D, + basePos.getX() + 1.05D, + basePos.getY() + 2.05D, + basePos.getZ() + 1.05D + ); } @Override - protected void setDoorOpen(boolean open) { - BlockState blockState = this.mob.getWorld().getBlockState(this.doorPos); - if(blockState.isOf(ModBlocks.TREATED_STEEL_DOOR)) + protected void setOpen(boolean open) { + BlockState blockState = this.mob.level().getBlockState(this.doorPos); + if(blockState.is(ModBlocks.TREATED_STEEL_DOOR)) return; - super.setDoorOpen(open); + super.setOpen(open); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/PanicFireGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/PanicFireGoal.java index 564d92f36e..f907a11b20 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/PanicFireGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/PanicFireGoal.java @@ -1,21 +1,21 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.entity.ai.goal.EscapeSunlightGoal; -import net.minecraft.entity.mob.PathAwareEntity; +import net.minecraft.world.entity.PathfinderMob; +import net.minecraft.world.entity.ai.goal.FleeSunGoal; -public class PanicFireGoal extends EscapeSunlightGoal { - public PanicFireGoal(PathAwareEntity mob, double speed) { +public class PanicFireGoal extends FleeSunGoal { + public PanicFireGoal(PathfinderMob mob, double speed) { super(mob, speed); } @Override - public boolean canStart() { + public boolean canUse() { if (this.mob.getTarget() != null) { return false; } if (!this.mob.isOnFire()) { return false; } - return this.targetShadedPos(); + return this.setWantedPos(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/PounceRetreatGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/PounceRetreatGoal.java index 864fe7ddd6..8a695c3f98 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/PounceRetreatGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/PounceRetreatGoal.java @@ -1,42 +1,41 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.NoPenaltyTargeting; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.ai.pathing.EntityNavigation; -import net.minecraft.entity.ai.pathing.Path; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.entity.mob.HostileEntity; -import net.minecraft.util.math.Vec3d; - import java.util.EnumSet; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.goal.Goal; +import net.minecraft.world.entity.ai.navigation.PathNavigation; +import net.minecraft.world.entity.ai.util.DefaultRandomPos; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.level.pathfinder.Path; +import net.minecraft.world.phys.Vec3; public class PounceRetreatGoal extends Goal { - private final HostileEntity spider; + private final Monster spider; private LivingEntity target; private final float verticalVelocity; private final float horizontalVelocity; - protected final EntityNavigation fleeingEntityNavigation; + protected final PathNavigation fleeingEntityNavigation; private boolean leaping; private Path path; private float healthPercentage; private int timer; - public PounceRetreatGoal(HostileEntity mob, float verticalVelocity, float horizontalVelocity, + public PounceRetreatGoal(Monster mob, float verticalVelocity, float horizontalVelocity, float healthPercentage) { this.spider = mob; this.verticalVelocity = verticalVelocity; this.horizontalVelocity = horizontalVelocity; this.healthPercentage = healthPercentage; this.fleeingEntityNavigation = mob.getNavigation(); - this.setControls(EnumSet.of(Control.JUMP, Control.MOVE)); + this.setFlags(EnumSet.of(Flag.JUMP, Flag.MOVE)); leaping = false; } @Override - public boolean canStart() { - if (this.spider.hasPassengers()) { + public boolean canUse() { + if (this.spider.isVehicle()) { return false; } this.target = this.spider.getTarget(); @@ -44,7 +43,7 @@ public boolean canStart() { return false; } - if(this.spider.hasStatusEffect(StatusEffects.REGENERATION)) { + if(this.spider.hasEffect(MobEffects.REGENERATION)) { return false; } @@ -53,31 +52,31 @@ public boolean canStart() { return false; } - return this.spider.isOnGround(); + return this.spider.onGround(); } @Override public void tick() { super.tick(); if(leaping) { - if(this.spider.isOnGround()) { + if(this.spider.onGround()) { leaping = false; } } else { - Vec3d vec3d = NoPenaltyTargeting.findFrom(this.spider, 28, 12, this.target.getPos()); + Vec3 vec3d = DefaultRandomPos.getPosAway(this.spider, 28, 12, this.target.position()); if (vec3d != null) { - this.path = this.fleeingEntityNavigation.findPathTo(vec3d.x, vec3d.y, vec3d.z, 0); + this.path = this.fleeingEntityNavigation.createPath(vec3d.x, vec3d.y, vec3d.z, 0); if(this.path != null) { - this.fleeingEntityNavigation.startMovingAlong(this.path, 1.05f); + this.fleeingEntityNavigation.moveTo(this.path, 1.05f); } } } timer = Math.max(0, timer - 1); - this.spider.getLookControl().lookAt(this.target.getX(), this.target.getEyeY(), this.target.getZ()); + this.spider.getLookControl().setLookAt(this.target.getX(), this.target.getEyeY(), this.target.getZ()); } @Override - public boolean shouldContinue() { + public boolean canContinueToUse() { double distance = this.spider.distanceTo(this.target); return timer > 0 && distance > 4.5f; } @@ -85,11 +84,11 @@ public boolean shouldContinue() { @Override public void start() { this.spider.getNavigation().stop(); - this.spider.getLookControl().lookAt(this.target.getX(), this.target.getEyeY(), this.target.getZ()); - this.spider.addStatusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 200, 1)); + this.spider.getLookControl().setLookAt(this.target.getX(), this.target.getEyeY(), this.target.getZ()); + this.spider.addEffect(new MobEffectInstance(MobEffects.REGENERATION, 200, 1)); - Vec3d backPounce = new Vec3d(1, 1, 1).multiply(-horizontalVelocity); - this.spider.setVelocity(backPounce.x, this.verticalVelocity, backPounce.z); + Vec3 backPounce = new Vec3(1, 1, 1).scale(-horizontalVelocity); + this.spider.setDeltaMovement(backPounce.x, this.verticalVelocity, backPounce.z); leaping = true; timer = 100; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/ShieldAgainstProjectileGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/ShieldAgainstProjectileGoal.java index 036e84916d..5899ad5556 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/ShieldAgainstProjectileGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/ShieldAgainstProjectileGoal.java @@ -1,38 +1,38 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.ai.pathing.Path; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.entity.mob.PathAwareEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.CrossbowItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.RangedWeaponItem; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.PathfinderMob; +import net.minecraft.world.entity.ai.goal.Goal; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.CrossbowItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ProjectileWeaponItem; +import net.minecraft.world.level.pathfinder.Path; import net.sevenstars.middleearth.entity.goals.interfaces.Shielder; import java.util.EnumSet; public class ShieldAgainstProjectileGoal extends Goal { - private final PathAwareEntity blocker; + private final PathfinderMob blocker; private final Shielder shielder; private LivingEntity target; private Path path; private int minDistance; private int maxDistance; - public ShieldAgainstProjectileGoal(PathAwareEntity mob, Shielder shielder, int minDistance, int maxDistance) { + public ShieldAgainstProjectileGoal(PathfinderMob mob, Shielder shielder, int minDistance, int maxDistance) { this.blocker = mob; this.shielder = shielder; this.minDistance = minDistance; this.maxDistance = maxDistance; - this.setControls(EnumSet.of(Control.JUMP, Control.MOVE)); + this.setFlags(EnumSet.of(Flag.JUMP, Flag.MOVE)); } @Override - public boolean canStart() { - if (this.blocker.hasPassengers()) { + public boolean canUse() { + if (this.blocker.isVehicle()) { return false; } this.target = this.blocker.getTarget(); @@ -40,34 +40,33 @@ public boolean canStart() { return false; } - return shouldContinue(); + return canContinueToUse(); } @Override public void tick() { super.tick(); - this.path = this.blocker.getNavigation().findPathTo(target, 0); if(this.path != null) { - this.blocker.getNavigation().startMovingTo(target, 0.7f); + this.blocker.getNavigation().moveTo(target, 0.7f); } - this.blocker.getLookControl().lookAt(this.target.getX(), this.target.getEyeY(), this.target.getZ()); - this.blocker.addStatusEffect(new StatusEffectInstance(StatusEffects.RESISTANCE, 21, 1)); + this.blocker.getLookControl().setLookAt(this.target.getX(), this.target.getEyeY(), this.target.getZ()); + this.blocker.addEffect(new MobEffectInstance(MobEffects.DAMAGE_RESISTANCE, 21, 1)); } @Override - public boolean shouldContinue() { + public boolean canContinueToUse() { double d = this.blocker.distanceTo(this.target); if (d < this.minDistance || d > this.maxDistance) { return false; } - this.path = this.blocker.getNavigation().findPathTo(target, 0); + this.path = this.blocker.getNavigation().createPath(target, 0); if(path == null) return false; - ItemStack mainStack = target.getMainHandStack(); - if (mainStack.getItem() instanceof RangedWeaponItem) { - if(target instanceof PlayerEntity player) { - return player.getItemUseTime() > 1; + ItemStack mainStack = target.getMainHandItem(); + if (mainStack.getItem() instanceof ProjectileWeaponItem) { + if(target instanceof Player player) { + return player.getTicksUsingItem() > 1; } else if(mainStack.getItem() instanceof CrossbowItem) { if(CrossbowItem.isCharged(mainStack)) { return true; @@ -80,7 +79,7 @@ public boolean shouldContinue() { @Override public void start() { super.start(); - this.blocker.getNavigation().startMovingAlong(this.path, 0.7f); + this.blocker.getNavigation().moveTo(this.path, 0.7f); shielder.blockShield(); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/SmartFleeEntityGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/SmartFleeEntityGoal.java index 938c8ec355..eddaa6913c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/SmartFleeEntityGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/SmartFleeEntityGoal.java @@ -1,26 +1,26 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.goal.FleeEntityGoal; -import net.minecraft.entity.mob.PathAwareEntity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.PathfinderMob; +import net.minecraft.world.entity.ai.goal.AvoidEntityGoal; import net.sevenstars.middleearth.entity.goals.interfaces.Evader; import java.util.function.Predicate; -public class SmartFleeEntityGoal extends FleeEntityGoal { +public class SmartFleeEntityGoal extends AvoidEntityGoal { private Evader evader; - public SmartFleeEntityGoal(PathAwareEntity mob, Evader evader, Class fleeFromType, float distance, double slowSpeed, double fastSpeed) { + public SmartFleeEntityGoal(PathfinderMob mob, Evader evader, Class fleeFromType, float distance, double slowSpeed, double fastSpeed) { super(mob, fleeFromType, distance, slowSpeed, fastSpeed); this.evader = evader; } - public SmartFleeEntityGoal(PathAwareEntity mob, Evader evader, Class fleeFromType, Predicate extraInclusionSelector, float distance, double slowSpeed, double fastSpeed, Predicate inclusionSelector) { + public SmartFleeEntityGoal(PathfinderMob mob, Evader evader, Class fleeFromType, Predicate extraInclusionSelector, float distance, double slowSpeed, double fastSpeed, Predicate inclusionSelector) { super(mob, fleeFromType, extraInclusionSelector, distance, slowSpeed, fastSpeed, inclusionSelector); this.evader = evader; } - public SmartFleeEntityGoal(PathAwareEntity fleeingEntity, Evader evader, Class classToFleeFrom, float fleeDistance, double fleeSlowSpeed, double fleeFastSpeed, Predicate inclusionSelector) { + public SmartFleeEntityGoal(PathfinderMob fleeingEntity, Evader evader, Class classToFleeFrom, float fleeDistance, double fleeSlowSpeed, double fleeFastSpeed, Predicate inclusionSelector) { super(fleeingEntity, classToFleeFrom, fleeDistance, fleeSlowSpeed, fleeFastSpeed, inclusionSelector); this.evader = evader; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/SmartProjectileAttackGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/SmartProjectileAttackGoal.java index 9ceee7057b..d62f118b0b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/SmartProjectileAttackGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/SmartProjectileAttackGoal.java @@ -1,17 +1,17 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.mob.MobEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.util.math.MathHelper; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.goal.Goal; +import net.minecraft.world.entity.player.Player; import net.sevenstars.middleearth.entity.goals.interfaces.CooldownRangedAttackMob; import org.jetbrains.annotations.Nullable; import java.util.EnumSet; public class SmartProjectileAttackGoal extends Goal { - private final MobEntity mob; + private final Mob mob; private final CooldownRangedAttackMob owner; @Nullable private LivingEntity target; @@ -29,19 +29,19 @@ public SmartProjectileAttackGoal(CooldownRangedAttackMob mob, double mobSpeed, i throw new IllegalArgumentException("ProjectileAttackGoal requires Mob implements RangedAttackMob"); } else { this.owner = mob; - this.mob = (MobEntity)mob; + this.mob = (Mob)mob; this.mobSpeed = mobSpeed; this.minIntervalTicks = minIntervalTicks; this.maxIntervalTicks = maxIntervalTicks; this.minShootRange = minShootRange; this.maxShootRange = maxShootRange; this.squaredMaxShootRange = maxShootRange * maxShootRange; - this.setControls(EnumSet.of(Control.MOVE, Control.LOOK)); + this.setFlags(EnumSet.of(Flag.MOVE, Flag.LOOK)); } } @Override - public boolean canStart() { + public boolean canUse() { LivingEntity livingEntity = this.mob.getTarget(); if (livingEntity != null && livingEntity.isAlive()) { this.target = livingEntity; @@ -57,10 +57,10 @@ public boolean isInbound() { } @Override - public boolean shouldContinue() { + public boolean canContinueToUse() { boolean shouldContinue = this.target.isAlive(); shouldContinue &= isInbound(); - if(this.target instanceof PlayerEntity playerEntity) { + if(this.target instanceof Player playerEntity) { shouldContinue &= !(playerEntity.isSpectator() || playerEntity.isCreative()); } return shouldContinue; @@ -69,7 +69,7 @@ public boolean shouldContinue() { @Override public void start() { super.start(); - int cooldown = mob.getRandom().nextBetween(minIntervalTicks, maxIntervalTicks); + int cooldown = mob.getRandom().nextIntBetweenInclusive(minIntervalTicks, maxIntervalTicks); owner.setRangeAttackCooldown(cooldown); } @@ -81,14 +81,14 @@ public void stop() { } @Override - public boolean shouldRunEveryTick() { + public boolean requiresUpdateEveryTick() { return true; } @Override public void tick() { - double d = this.mob.squaredDistanceTo(this.target.getX(), this.target.getY(), this.target.getZ()); - boolean bl = this.mob.getVisibilityCache().canSee(this.target); + double d = this.mob.distanceToSqr(this.target.getX(), this.target.getY(), this.target.getZ()); + boolean bl = this.mob.getSensing().hasLineOfSight(this.target); if (bl) { this.seenTargetTicks++; } else { @@ -98,22 +98,22 @@ public void tick() { if (!(d > this.squaredMaxShootRange) && this.seenTargetTicks >= 5) { this.mob.getNavigation().stop(); } else { - this.mob.getNavigation().startMovingTo(this.target, this.mobSpeed); + this.mob.getNavigation().moveTo(this.target, this.mobSpeed); } - this.mob.getLookControl().lookAt(this.target, 30.0F, 30.0F); + this.mob.getLookControl().setLookAt(this.target, 30.0F, 30.0F); if (--this.updateCountdownTicks == 0) { if (!bl) { return; } float f = (float)Math.sqrt(d) / this.maxShootRange; - float g = MathHelper.clamp(f, 0.1F, 1.0F); - this.owner.shootAt(this.target, g); - this.updateCountdownTicks = MathHelper.floor(f * (this.maxIntervalTicks - this.minIntervalTicks) + this.minIntervalTicks); + float g = Mth.clamp(f, 0.1F, 1.0F); + this.owner.performRangedAttack(this.target, g); + this.updateCountdownTicks = Mth.floor(f * (this.maxIntervalTicks - this.minIntervalTicks) + this.minIntervalTicks); } else if (this.updateCountdownTicks < 0) { - this.updateCountdownTicks = MathHelper.floor( - MathHelper.lerp(Math.sqrt(d) / this.maxShootRange, (double)this.minIntervalTicks, (double)this.maxIntervalTicks) + this.updateCountdownTicks = Mth.floor( + Mth.lerp(Math.sqrt(d) / this.maxShootRange, (double)this.minIntervalTicks, (double)this.maxIntervalTicks) ); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/SpiderPonceAtTargetGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/SpiderPonceAtTargetGoal.java index 6f7a7fbb53..0f842df9fd 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/SpiderPonceAtTargetGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/SpiderPonceAtTargetGoal.java @@ -1,17 +1,17 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.goal.Goal; -import net.minecraft.entity.ai.goal.PounceAtTargetGoal; -import net.minecraft.entity.ai.pathing.Path; -import net.minecraft.entity.mob.HostileEntity; -import net.minecraft.util.math.Vec3d; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.goal.Goal; +import net.minecraft.world.entity.ai.goal.LeapAtTargetGoal; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.level.pathfinder.Path; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.entity.spider.Pouncer; import java.util.EnumSet; public class SpiderPonceAtTargetGoal extends Goal { - private final HostileEntity spider; + private final Monster spider; private LivingEntity target; private final float verticalVelocity; private final float horizontalVelocity; @@ -22,12 +22,13 @@ public class SpiderPonceAtTargetGoal extends Goal { private final int minDistance; private final int maxDistance; private final int moduloTicks; + private boolean reuseInitialPath; - public SpiderPonceAtTargetGoal(HostileEntity mob, Pouncer pouncer, float verticalVelocity, float horizontalVelocity) { + public SpiderPonceAtTargetGoal(Monster mob, Pouncer pouncer, float verticalVelocity, float horizontalVelocity) { this(mob, pouncer, verticalVelocity, horizontalVelocity, 3, 12, 5); } - public SpiderPonceAtTargetGoal(HostileEntity mob, Pouncer pouncer, float verticalVelocity, float horizontalVelocity, + public SpiderPonceAtTargetGoal(Monster mob, Pouncer pouncer, float verticalVelocity, float horizontalVelocity, int minDistance, int maxDistance, int moduloTicks) { this.spider = mob; this.pouncer = pouncer; @@ -36,14 +37,14 @@ public SpiderPonceAtTargetGoal(HostileEntity mob, Pouncer pouncer, float vertica this.minDistance = minDistance; this.maxDistance = maxDistance; this.moduloTicks = moduloTicks; - this.setControls(EnumSet.of(Control.JUMP, Control.MOVE)); + this.setFlags(EnumSet.of(Flag.JUMP, Flag.MOVE)); startPrePounce = false; preparationPounceTimer = 18; } @Override - public boolean canStart() { - if (this.spider.hasPassengers()) { + public boolean canUse() { + if (this.spider.isVehicle()) { return false; } this.target = this.spider.getTarget(); @@ -54,39 +55,43 @@ public boolean canStart() { if (d < this.minDistance || d > this.maxDistance) { return false; } - if (!this.spider.isOnGround()) { + if (!this.spider.onGround()) { return false; } - this.path = this.spider.getNavigation().findPathTo(target, 0); + this.path = this.spider.getNavigation().createPath(target, 0); if(path == null) return false; - int randomInt = this.spider.getRandom().nextInt(PounceAtTargetGoal.toGoalTicks(this.moduloTicks)); + int randomInt = this.spider.getRandom().nextInt(LeapAtTargetGoal.reducedTickDelay(this.moduloTicks)); return this.spider.getRandom().nextInt(2) == 0 && randomInt == 0; } @Override public void tick() { super.tick(); - this.path = this.spider.getNavigation().findPathTo(target, 0); + if (this.reuseInitialPath) { + this.reuseInitialPath = false; + } else { + this.path = this.spider.getNavigation().createPath(target, 0); + } if(this.path != null) { - this.spider.getNavigation().startMovingTo(target, 0.8f); + this.spider.getNavigation().moveTo(target, 0.8f); } - this.spider.getLookControl().lookAt(this.target.getX(), this.target.getEyeY(), this.target.getZ()); + this.spider.getLookControl().setLookAt(this.target.getX(), this.target.getEyeY(), this.target.getZ()); if(startPrePounce) { preparationPounceTimer = Math.max(preparationPounceTimer - 1, 0); if(preparationPounceTimer == 0) { this.spider.getNavigation().stop(); - Vec3d vec3d = this.spider.getVelocity(); - Vec3d vec3d2 = new Vec3d(this.target.getX() - this.spider.getX(), 0.0, this.target.getZ() - this.spider.getZ()); - if (vec3d2.lengthSquared() > 1.0E-7) { - vec3d2 = vec3d2.multiply(horizontalVelocity).add(vec3d.multiply(0.2));; + Vec3 vec3d = this.spider.getDeltaMovement(); + Vec3 vec3d2 = new Vec3(this.target.getX() - this.spider.getX(), 0.0, this.target.getZ() - this.spider.getZ()); + if (vec3d2.lengthSqr() > 1.0E-7) { + vec3d2 = vec3d2.scale(horizontalVelocity).add(vec3d.scale(0.2));; } float verticalVel = this.verticalVelocity; if(target.getY() > this.spider.getY()) { verticalVel += 0.1f; } - this.spider.setVelocity(vec3d2.x, verticalVel, vec3d2.z); + this.spider.setDeltaMovement(vec3d2.x, verticalVel, vec3d2.z); startPrePounce = false; stop(); } @@ -94,7 +99,7 @@ public void tick() { } @Override - public boolean shouldContinue() { + public boolean canContinueToUse() { return startPrePounce; } @@ -102,13 +107,15 @@ public boolean shouldContinue() { public void start() { preparationPounceTimer = 18; startPrePounce = true; - this.spider.getNavigation().startMovingAlong(this.path, 0.8f); + reuseInitialPath = true; + this.spider.getNavigation().moveTo(this.path, 0.8f); this.pouncer.startPounceAnimation(); } @Override public void stop() { super.stop(); + reuseInitialPath = false; this.pouncer.stopPounceAnimation(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/TargetNPCDiplomacyGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/TargetNPCDiplomacyGoal.java index 751ae3e1c2..c0a6c71049 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/TargetNPCDiplomacyGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/TargetNPCDiplomacyGoal.java @@ -1,15 +1,17 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.entity.ai.goal.ActiveTargetGoal; -import net.minecraft.entity.mob.MobEntity; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.Difficulty; +import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; +import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; import net.sevenstars.middleearth.entity.npcs.NpcEntity; import net.sevenstars.middleearth.resources.datas.factions.Faction; import net.sevenstars.middleearth.resources.datas.factions.FactionLookup; -public class TargetNPCDiplomacyGoal extends ActiveTargetGoal { +import java.util.concurrent.atomic.AtomicBoolean; + +public class TargetNPCDiplomacyGoal extends NearestAttackableTargetGoal { + private static final AtomicBoolean DIPLOMACY_ERROR_LOGGED = new AtomicBoolean(); NpcEntity mob; public TargetNPCDiplomacyGoal(NpcEntity mob) { super(mob, NpcEntity.class, true); @@ -17,19 +19,21 @@ public TargetNPCDiplomacyGoal(NpcEntity mob) { } @Override - public boolean canStart() { - if (mob.getWorld().getDifficulty() == Difficulty.PEACEFUL) { + public boolean canUse() { + if (mob.level().getDifficulty() == Difficulty.PEACEFUL) { return false; } else { if(mob.getTarget() instanceof NpcEntity npcEntity) { try { - Faction currentFaction = FactionLookup.getFactionById(mob.getWorld(), mob.getFactionIdentifier()); - if(!currentFaction.isHostileToward(npcEntity.getFactionIdentifier())) return false; + Faction currentFaction = FactionLookup.getFactionById(mob.level(), mob.getFactionIdentifier()); + if(currentFaction != null && !currentFaction.isHostileToward(npcEntity.getFactionIdentifier())) return false; } catch (Exception e) { - e.printStackTrace(); + if (DIPLOMACY_ERROR_LOGGED.compareAndSet(false, true)) { + MiddleEarth.LOGGER.logError("TargetNPCDiplomacyGoal::Failed to evaluate diplomacy", e); + } } } - return super.canStart(); + return super.canUse(); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/TargetPlayerDiplomacyGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/TargetPlayerDiplomacyGoal.java index 904fe0994d..7641cd11f3 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/TargetPlayerDiplomacyGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/TargetPlayerDiplomacyGoal.java @@ -1,37 +1,43 @@ package net.sevenstars.middleearth.entity.goals; -import net.minecraft.entity.ai.goal.ActiveTargetGoal; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.Difficulty; +import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; +import net.minecraft.world.entity.player.Player; +import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.npcs.NpcEntity; import net.sevenstars.middleearth.resources.datas.factions.Faction; import net.sevenstars.middleearth.resources.datas.factions.FactionLookup; import net.sevenstars.middleearth.utils.PlayerUtil; -public class TargetPlayerDiplomacyGoal extends ActiveTargetGoal { +import java.util.concurrent.atomic.AtomicBoolean; + +public class TargetPlayerDiplomacyGoal extends NearestAttackableTargetGoal { + private static final AtomicBoolean DIPLOMACY_ERROR_LOGGED = new AtomicBoolean(); NpcEntity mob; public TargetPlayerDiplomacyGoal(NpcEntity mob) { - super(mob, PlayerEntity.class, true); + super(mob, Player.class, true); this.mob = mob; } @Override - public boolean canStart() { - if (mob.getWorld().getDifficulty() == Difficulty.PEACEFUL) { + public boolean canUse() { + if (mob.level().getDifficulty() == Difficulty.PEACEFUL) { return false; } else { - if(mob.getTarget() instanceof PlayerEntity playerEntity && !playerEntity.isCreative() && !playerEntity.isSpectator()) { + if(mob.getTarget() instanceof Player playerEntity && !playerEntity.isCreative() && !playerEntity.isSpectator()) { try { - Faction currentFaction = FactionLookup.getFactionById(mob.getWorld(), mob.getFactionIdentifier()); + Faction currentFaction = FactionLookup.getFactionById(mob.level(), mob.getFactionIdentifier()); if(currentFaction == null) return true; Faction playerFaction = PlayerUtil.fetchFaction(playerEntity); if(playerFaction != null && !currentFaction.isHostileToward(playerFaction.getId())) return false; } catch (Exception e) { - e.printStackTrace(); + if (DIPLOMACY_ERROR_LOGGED.compareAndSet(false, true)) { + MiddleEarth.LOGGER.logError("TargetPlayerDiplomacyGoal::Failed to evaluate diplomacy", e); + } } } - return super.canStart(); + return super.canUse(); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/TargetPlayerGoal.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/TargetPlayerGoal.java index d2058d27ec..0d63decb5f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/TargetPlayerGoal.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/TargetPlayerGoal.java @@ -1,34 +1,34 @@ package net.sevenstars.middleearth.entity.goals; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; -import net.minecraft.entity.ai.goal.ActiveTargetGoal; -import net.minecraft.entity.mob.MobEntity; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.Difficulty; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; +import net.minecraft.world.entity.player.Player; -public class TargetPlayerGoal extends ActiveTargetGoal { +public class TargetPlayerGoal extends NearestAttackableTargetGoal { AbstractBeastEntity mob; public TargetPlayerGoal(AbstractBeastEntity mob) { - super((MobEntity)mob, PlayerEntity.class, true); + super((Mob)mob, Player.class, true); this.mob = mob; } @Override - public boolean canStart() { - if (mob.getWorld().getDifficulty() == Difficulty.PEACEFUL || mob.isTame()) { - if(mob.getTarget() instanceof PlayerEntity) { + public boolean canUse() { + if (mob.level().getDifficulty() == Difficulty.PEACEFUL || mob.isTamed()) { + if(mob.getTarget() instanceof Player) { mob.setTarget(null); } return false; } - return super.canStart(); + return super.canUse(); } @Override - public boolean shouldContinue() { - if(!mob.isTame()) { - return super.shouldContinue(); + public boolean canContinueToUse() { + if(!mob.isTamed()) { + return super.canContinueToUse(); } return false; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/interfaces/CooldownRangedAttackMob.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/interfaces/CooldownRangedAttackMob.java index e4139b591d..d2700598df 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/interfaces/CooldownRangedAttackMob.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/goals/interfaces/CooldownRangedAttackMob.java @@ -1,6 +1,6 @@ package net.sevenstars.middleearth.entity.goals.interfaces; -import net.minecraft.entity.ai.RangedAttackMob; +import net.minecraft.world.entity.monster.RangedAttackMob; public interface CooldownRangedAttackMob extends RangedAttackMob { int getRangeAttackCooldown(); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/NpcBrain.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/NpcBrain.java index fbdc15e944..a8fe110644 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/NpcBrain.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/NpcBrain.java @@ -6,16 +6,24 @@ import com.google.common.collect.Range; import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Dynamic; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.brain.Activity; -import net.minecraft.entity.ai.brain.Brain; -import net.minecraft.entity.ai.brain.MemoryModuleState; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.sensor.Sensor; -import net.minecraft.entity.ai.brain.sensor.SensorType; -import net.minecraft.entity.ai.brain.task.*; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.GlobalPos; +import net.minecraft.core.GlobalPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.Brain; +import net.minecraft.world.entity.ai.behavior.DoNothing; +import net.minecraft.world.entity.ai.behavior.LookAtTargetSink; +import net.minecraft.world.entity.ai.behavior.MeleeAttack; +import net.minecraft.world.entity.ai.behavior.MoveToTargetSink; +import net.minecraft.world.entity.ai.behavior.RunOne; +import net.minecraft.world.entity.ai.behavior.SetWalkTargetFromAttackTargetIfTargetOutOfReach; +import net.minecraft.world.entity.ai.behavior.StartAttacking; +import net.minecraft.world.entity.ai.behavior.StopAttackingIfTargetInvalid; +import net.minecraft.world.entity.ai.behavior.UpdateActivityFromSchedule; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.MemoryStatus; +import net.minecraft.world.entity.ai.sensing.Sensor; +import net.minecraft.world.entity.ai.sensing.SensorType; +import net.minecraft.world.entity.schedule.Activity; import net.sevenstars.api.entity.ai.brain.MemoryModulesAPI; import net.sevenstars.middleearth.entity.ai.brain.MemoryModulesME; import net.sevenstars.middleearth.entity.ai.brain.SensorsME; @@ -39,15 +47,15 @@ public NpcBrain() { } protected static Brain create(Dynamic dynamic) { - Brain.Profile profile = Brain.createProfile(MEMORY_MODULES, SENSORS); - Brain brain = profile.deserialize(dynamic); + Brain.Provider profile = Brain.provider(MEMORY_MODULES, SENSORS); + Brain brain = profile.makeBrain(dynamic); addCoreActivities(brain); addIdleActivities(brain); brain.setCoreActivities(ImmutableSet.of(Activity.CORE)); brain.setDefaultActivity(Activity.FIGHT); - brain.resetPossibleActivities(); + brain.useDefaultActivity(); return brain; } @@ -66,49 +74,49 @@ public static void setRangedActivities(Brain brain, NpcEntity npcEnti float movementSpeed = npcEntity.getFightingMovementSpeed(); int attackSpeed = npcEntity.getTickAttackSpeedCooldown(); - brain.setTaskList(Activity.FIGHT, ImmutableList.of( - Pair.of(0, UpdateAttackTargetTask.create(NpcBrain::getAttackTarget)), - Pair.of(1, ForgetAttackTargetTask.create(((world, target) -> shouldForgetTarget(world, target, npcEntity)))), + brain.addActivityWithConditions(Activity.FIGHT, ImmutableList.of( + Pair.of(0, StartAttacking.create(NpcBrain::getAttackTarget)), + Pair.of(1, StopAttackingIfTargetInvalid.create(target -> shouldForgetTarget(target, npcEntity))), Pair.of(2, NpcRangedAttackTask.create(attackSpeed)), //Pair.of(2, new NpcMountedApproachTask()), Pair.of(3, NpcRangedApproachTask.create(movementSpeed, 10)) ), ImmutableSet.of( - Pair.of(MemoryModuleType.ATTACK_TARGET, MemoryModuleState.VALUE_PRESENT) + Pair.of(MemoryModuleType.ATTACK_TARGET, MemoryStatus.VALUE_PRESENT) )); } public static void updateActivities(NpcEntity npc) { - Optional optionalTarget = npc.getBrain().getOptionalMemory(MemoryModuleType.ATTACK_TARGET); + Optional optionalTarget = npc.getBrain().getMemoryInternal(MemoryModuleType.ATTACK_TARGET); if(optionalTarget != null && optionalTarget.isPresent()) { - npc.getBrain().resetPossibleActivities(ImmutableList.of(Activity.FIGHT)); + npc.getBrain().setActiveActivityToFirstValid(ImmutableList.of(Activity.FIGHT)); } else { - npc.getBrain().resetPossibleActivities(ImmutableList.of()); + npc.getBrain().setActiveActivityToFirstValid(ImmutableList.of()); } - npc.getBrain().refreshActivities(npc.getWorld().getTimeOfDay(), npc.getWorld().getTime()); + npc.getBrain().updateActivityFromSchedule(npc.level().getDayTime(), npc.level().getGameTime()); } private static void addCoreActivities(Brain brain) { - brain.forget(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE); + brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE); - brain.setTaskList(Activity.CORE, 0, ImmutableList.of( - new MoveToTargetTask(), - new UpdateLookControlTask(45, 90), + brain.addActivity(Activity.CORE, 0, ImmutableList.of( + new MoveToTargetSink(), + new LookAtTargetSink(45, 90), //UpdateAttackTargetTask.create((world, npc) -> npc.getHurtBy()), - UpdateAttackTargetTask.create(NpcBrain::getAttackTarget)) + StartAttacking.create(NpcBrain::getAttackTarget)) ); } private static void addIdleActivities(Brain brain) { - brain.setTaskList(Activity.IDLE, ImmutableList.of( - Pair.of(1, new RandomTask(ImmutableMap.of(MemoryModuleType.HOME, MemoryModuleState.VALUE_PRESENT), + brain.addActivity(Activity.IDLE, ImmutableList.of( + Pair.of(1, new RunOne(ImmutableMap.of(MemoryModuleType.HOME, MemoryStatus.VALUE_PRESENT), ImmutableList.of( - Pair.of(new WaitTask(20, 100), 3) + Pair.of(new DoNothing(20, 100), 3) ))), - Pair.of(2, UpdateAttackTargetTask.create(NpcBrain::getAttackTarget)), - Pair.of(99, ScheduleActivityTask.create()) + Pair.of(2, StartAttacking.create(NpcBrain::getAttackTarget)), + Pair.of(99, UpdateActivityFromSchedule.create()) )); } @@ -116,29 +124,29 @@ private static void addFightActivities(NpcEntity npc, Brain brain) { float movementSpeed = npc.getFightingMovementSpeed(); int attackSpeed = npc.getTickAttackSpeedCooldown(); - brain.setTaskList(Activity.FIGHT, ImmutableList.of( - Pair.of(0, UpdateAttackTargetTask.create(NpcBrain::getAttackTarget)), - Pair.of(1, ForgetAttackTargetTask.create(((world, target) -> shouldForgetTarget(world, target, npc)))), + brain.addActivityWithConditions(Activity.FIGHT, ImmutableList.of( + Pair.of(0, StartAttacking.create(NpcBrain::getAttackTarget)), + Pair.of(1, StopAttackingIfTargetInvalid.create(target -> shouldForgetTarget(target, npc))), Pair.of(2, new NpcMountedApproachTask()), Pair.of(3, new NpcOnGroundApproachTask()), - Pair.of(4, RangedApproachTask.create(movementSpeed)), - Pair.of(5, MeleeAttackTask.create(30)) + Pair.of(4, SetWalkTargetFromAttackTargetIfTargetOutOfReach.create(movementSpeed)), + Pair.of(5, MeleeAttack.create(30)) ), ImmutableSet.of( - Pair.of(MemoryModuleType.ATTACK_TARGET, MemoryModuleState.VALUE_PRESENT) + Pair.of(MemoryModuleType.ATTACK_TARGET, MemoryStatus.VALUE_PRESENT) )); } - private static Optional getAttackTarget(ServerWorld serverWorld, NpcEntity npc) { - return npc.getBrain().getOptionalRegisteredMemory(MemoryModuleType.NEAREST_ATTACKABLE); + private static Optional getAttackTarget(NpcEntity npc) { + return npc.getBrain().getMemory(MemoryModuleType.NEAREST_ATTACKABLE); } - private static boolean shouldForgetTarget(ServerWorld world, LivingEntity target, NpcEntity npc) { - Optional defendingHome = npc.getBrain().getOptionalMemory(MemoryModulesAPI.DEFENDING_HOME); - Optional home = npc.getBrain().getOptionalMemory(MemoryModuleType.HOME); + private static boolean shouldForgetTarget(LivingEntity target, NpcEntity npc) { + Optional defendingHome = npc.getBrain().getMemoryInternal(MemoryModulesAPI.DEFENDING_HOME); + Optional home = npc.getBrain().getMemoryInternal(MemoryModuleType.HOME); if(home != null && home.isPresent() && defendingHome != null && defendingHome.isPresent()) { - return target.getBlockPos().getSquaredDistance(npc.getBlockPos()) > 36; + return target.blockPosition().distSqr(npc.blockPosition()) > 36; } return false; @@ -168,7 +176,7 @@ private static boolean shouldForgetTarget(ServerWorld world, LivingEntity target MemoryModuleType.NEAREST_ATTACKABLE, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, - MemoryModuleType.VISIBLE_MOBS, + MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY ); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/NpcEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/NpcEntity.java index e9eb123923..419be8c96a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/NpcEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/NpcEntity.java @@ -1,60 +1,72 @@ package net.sevenstars.middleearth.entity.npcs; -import com.mojang.serialization.Codec; -import net.minecraft.block.BlockState; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.BlocksAttacksComponent; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.*; -import net.minecraft.entity.ai.goal.*; -import net.minecraft.entity.attribute.DefaultAttributeContainer; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.damage.DamageTypes; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.data.TrackedData; -import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.entity.mob.HostileEntity; -import net.minecraft.entity.mob.MobEntity; -import net.minecraft.entity.mob.PathAwareEntity; -import net.minecraft.entity.passive.AbstractHorseEntity; -import net.minecraft.entity.passive.PassiveEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.PersistentProjectileEntity; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.entity.projectile.ProjectileUtil; -import net.minecraft.item.BowItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.RangedWeaponItem; -import net.minecraft.loot.LootTable; -import net.minecraft.loot.context.LootContextParameters; -import net.minecraft.loot.context.LootContextTypes; -import net.minecraft.loot.context.LootWorldContext; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundEvents; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.text.Text; -import net.minecraft.util.Hand; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.Registries; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtOps; +import net.minecraft.nbt.Tag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.resources.RegistryOps; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; import net.minecraft.world.*; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.damagesource.DamageTypes; +import net.minecraft.world.entity.AnimationState; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntityEvent; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.EquipmentUser; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.PathfinderMob; +import net.minecraft.world.entity.Pose; +import net.minecraft.world.entity.SpawnGroupData; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.goal.FloatGoal; +import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; +import net.minecraft.world.entity.ai.goal.MeleeAttackGoal; +import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; +import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; +import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; +import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; +import net.minecraft.world.entity.ai.navigation.GroundPathNavigation; +import net.minecraft.world.entity.animal.horse.AbstractHorse; +import net.minecraft.world.entity.monster.CrossbowAttackMob; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.entity.projectile.ProjectileUtil; +import net.minecraft.world.item.BowItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.ProjectileWeaponItem; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.ServerLevelAccessor; +import net.minecraft.world.level.storage.loot.LootParams; +import net.minecraft.world.level.storage.loot.LootTable; +import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; +import net.minecraft.world.level.storage.loot.parameters.LootContextParams; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; -import net.sevenstars.middleearth.block.registration.ModBlocks; -import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import net.sevenstars.middleearth.block.special.structureManager.StructureManagerBlockEntity; import net.sevenstars.middleearth.entity.EntityAttributesME; import net.sevenstars.middleearth.entity.TrackedDataHandlerRegistryME; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; -import net.sevenstars.middleearth.entity.beasts.broadhoof.BroadhoofGoatEntity; -import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntity; import net.sevenstars.middleearth.entity.beasts.trolls.TrollEntity; import net.sevenstars.middleearth.entity.beasts.trolls.snow.SnowTrollEntity; import net.sevenstars.middleearth.entity.goals.*; @@ -82,24 +94,28 @@ import net.sevenstars.of_beasts_and_wild_things.entity.snail.SnailEntity; import org.jetbrains.annotations.Nullable; -import java.util.Objects; -import java.util.Optional; - -public class NpcEntity extends PathAwareEntity implements EquipmentHolder, CrossbowUser { +public class NpcEntity extends PathfinderMob implements EquipmentUser, CrossbowAttackMob { public static class KeyStrings { public static final String DATA = "NpcData"; public static final String INITIALIZATION_DATA = "InitializationData"; public static final String TEXTURE_DATA = "TextureData"; public static final String IS_FIGHTING = "IsFighting"; + public static final String DOOR_TRAVERSAL = "DoorTraversal"; } - // [TrackedDatas] - private static final TrackedData NPC_DATA; - private static final TrackedData NPC_INITIALIZATION_DATA; - private static final TrackedData NPC_TEXTURE_DATA; - private static final TrackedData IS_FIGHTING; + private static final float MAX_DOOR_TRAVERSAL_WIDTH = 0.60F; - private static final TrackedData USING_ITEM = DataTracker.registerData(NpcEntity.class, TrackedDataHandlerRegistry.INTEGER); - private static final TrackedData CROSSBOW_CHARGING = DataTracker.registerData(NpcEntity.class, TrackedDataHandlerRegistry.BOOLEAN); + // [TrackedDatas] + private static final EntityDataAccessor NPC_DATA; + private static final EntityDataAccessor NPC_INITIALIZATION_DATA; + private static final EntityDataAccessor NPC_TEXTURE_DATA; + private static final EntityDataAccessor IS_FIGHTING; + + private static final EntityDataAccessor USING_ITEM = SynchedEntityData.defineId(NpcEntity.class, EntityDataSerializers.INT); + private static final EntityDataAccessor CROSSBOW_CHARGING = SynchedEntityData.defineId(NpcEntity.class, EntityDataSerializers.BOOLEAN); + private static final EntityDataAccessor DOOR_TRAVERSAL_DIMENSIONS = + SynchedEntityData.defineId(NpcEntity.class, EntityDataSerializers.BOOLEAN); + private boolean usingDoorTraversalDimensions; + private boolean restoreDoorTraversalDimensions; private final CustomBowAttackGoal bowAttackGoal = new CustomBowAttackGoal<>(this, 1.0, 20, 16.0F); private final NpcCrossBowAttackGoal crossBowAttackGoal = new NpcCrossBowAttackGoal<>(this, 1.0, 11.0F); @@ -107,13 +123,13 @@ public static class KeyStrings { @Override public void stop() { super.stop(); - NpcEntity.this.setAttacking(false); + NpcEntity.this.setAggressive(false); } @Override public void start() { super.start(); - NpcEntity.this.setAttacking(true); + NpcEntity.this.setAggressive(true); } }; @@ -123,24 +139,75 @@ public void start() { public final AnimationState attackState = new AnimationState(); public final AnimationState swingState = new AnimationState(); - public NpcEntity(EntityType entityType, World world) { + public NpcEntity(EntityType entityType, Level world) { super(entityType, world); this.updateAttackType(); - this.navigation.setCanOpenDoors(true); + if (this.navigation instanceof GroundPathNavigation groundNavigation) { + groundNavigation.setCanOpenDoors(true); + groundNavigation.setCanPassDoors(true); + } + } + + public void beginDoorTraversal() { + this.restoreDoorTraversalDimensions = false; + if (!this.usingDoorTraversalDimensions) { + this.setDoorTraversalDimensions(true); + } + } + + public void endDoorTraversal() { + this.restoreDoorTraversalDimensions = true; + this.tryRestoreDoorTraversalDimensions(); + } + + private void tryRestoreDoorTraversalDimensions() { + if (this.level().isClientSide + || !this.usingDoorTraversalDimensions + || !this.restoreDoorTraversalDimensions) { + return; + } + EntityDimensions normalDimensions = super.getDefaultDimensions(this.getPose()).scale(this.getScale()); + if (this.level().noBlockCollision( + this, + normalDimensions.makeBoundingBox(this.position()) + )) { + this.restoreDoorTraversalDimensions = false; + this.setDoorTraversalDimensions(false); + } + } + + private void setDoorTraversalDimensions(boolean usingDoorTraversalDimensions) { + if (this.usingDoorTraversalDimensions == usingDoorTraversalDimensions) { + return; + } + this.usingDoorTraversalDimensions = usingDoorTraversalDimensions; + this.entityData.set(DOOR_TRAVERSAL_DIMENSIONS, usingDoorTraversalDimensions); + this.refreshDimensions(); + } + + @Override + protected EntityDimensions getDefaultDimensions(Pose pose) { + EntityDimensions dimensions = super.getDefaultDimensions(pose); + if (!this.usingDoorTraversalDimensions) { + return dimensions; + } + float scaledWidth = dimensions.width() * Math.max(this.getScale(), 0.001F); + float widthScale = Math.min(1.0F, MAX_DOOR_TRAVERSAL_WIDTH / scaledWidth); + return dimensions.scale(widthScale, 1.0F); } @Nullable - public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, EntityData entityData) { + public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, SpawnGroupData entityData) { this.saveSpawnReason(spawnReason); - return super.initialize(world, difficulty, spawnReason, entityData); + return super.finalizeSpawn(world, difficulty, spawnReason, entityData); } // [IsFighting] public void setFighting(boolean state){ - this.dataTracker.set(IS_FIGHTING, state); + this.entityData.set(IS_FIGHTING, state); } public boolean getFighting(){ - return this.dataTracker.get(IS_FIGHTING); + return this.entityData.get(IS_FIGHTING); } // [IsBlocking] // TODO public void setBlocking(boolean state){ @@ -151,10 +218,10 @@ public boolean getBlocking(){ } // [NpcTextureData] public void saveNpcTextureData(NpcTextureData npcTextureData) { - this.dataTracker.set(NPC_TEXTURE_DATA, npcTextureData); + this.entityData.set(NPC_TEXTURE_DATA, npcTextureData); } public NpcTextureData retrieveNpcTextureData() { - return this.dataTracker.get(NPC_TEXTURE_DATA); + return this.entityData.get(NPC_TEXTURE_DATA); } public boolean hasTextureData(){ return retrieveNpcTextureData().get(NpcRenderedPart.BODY) != null; @@ -164,10 +231,10 @@ public boolean shouldRefreshVisuals() { } // [NpcInitializationData] public void saveNpcInitializationData(NpcInitializationData npcInitializationData) { - this.dataTracker.set(NPC_INITIALIZATION_DATA, npcInitializationData); + this.entityData.set(NPC_INITIALIZATION_DATA, npcInitializationData); } public NpcInitializationData retrieveNpcInitializationData() { - return this.dataTracker.get(NPC_INITIALIZATION_DATA); + return this.entityData.get(NPC_INITIALIZATION_DATA); } public void prepare() { NpcInitializationData npcInitializationData = retrieveNpcInitializationData(); @@ -177,25 +244,25 @@ public void prepare() { } public void resetInitializationData() { - this.dataTracker.set(NPC_INITIALIZATION_DATA, new NpcInitializationData()); + this.entityData.set(NPC_INITIALIZATION_DATA, new NpcInitializationData()); } // [NpcTypeIdentifier] - public void prepareNpcIdentifier(Identifier npcTypeIdentifier){ + public void prepareNpcIdentifier(ResourceLocation npcTypeIdentifier){ NpcInitializationData newNpcInitializationData = this.retrieveNpcInitializationData().withType(npcTypeIdentifier); this.saveNpcInitializationData(newNpcInitializationData); } // [NpcData] public void saveNpcData(NpcData npcData) { - this.dataTracker.set(NPC_DATA, npcData); + this.entityData.set(NPC_DATA, npcData); } public NpcData retrieveNpcData() { - return this.dataTracker.get(NPC_DATA); + return this.entityData.get(NPC_DATA); } // [NpcType] public NpcType getNpcType(){ return retrieveNpcData().getNpcType(); } - public void saveNpcType(RegistryEntry npcType){ + public void saveNpcType(Holder npcType){ NpcData newNpcData = this.retrieveNpcData().withType(npcType); this.saveNpcData(newNpcData); } @@ -215,82 +282,105 @@ public void saveCategory(EntityCategories category) { this.saveNpcData(newNpcData); } // [SpawnReason] - private void saveSpawnReason(SpawnReason spawnReason) { + private void saveSpawnReason(MobSpawnType spawnReason) { NpcData newNpcData = this.retrieveNpcData().withSpawnReason(spawnReason); this.saveNpcData(newNpcData); } - public SpawnReason getSpawnReason() { + public MobSpawnType getSpawnReason() { return this.retrieveNpcData().getSpawnReason(); } // [StructureManager] public void assignStructureManager(StructureManagerBlockEntity blockEntity){ - NpcData newNpcData = this.retrieveNpcData().withStructureManagerPos(blockEntity.getPos()); + assignStructureManager(blockEntity.getBlockPos()); + } + + public void assignStructureManager(BlockPos managerPos) { + NpcData newNpcData = this.retrieveNpcData().withStructureManagerPos(managerPos); this.saveNpcData(newNpcData); } - public static DefaultAttributeContainer.Builder setAttributes() { - return MobEntity.createMobAttributes() - .add(EntityAttributes.FOLLOW_RANGE, 32.0) - .add(EntityAttributes.ATTACK_DAMAGE, 1.0); + public void clearStructureManager() { + NpcData newNpcData = this.retrieveNpcData().withoutStructureManagerPos(); + this.saveNpcData(newNpcData); } - protected void initGoals() { - this.goalSelector.add(1, new SwimGoal(this)); - this.goalSelector.add(5, new WanderAroundFarGoal(this, 0.8)); - this.goalSelector.add(6, new LookAtEntityGoal(this, PlayerEntity.class, 8.0F)); - this.goalSelector.add(6, new LookAroundGoal(this)); - this.targetSelector.add(1, new RevengeGoal(this)); - this.targetSelector.add(3, new TargetPlayerDiplomacyGoal(this)); - this.targetSelector.add(4, new NpcDoorInteractGoal(this, true)); - this.targetSelector.add(5, new TargetNPCDiplomacyGoal(this)); - this.targetSelector.add(6, new ActiveTargetGoal<>(this, SnowTrollEntity.class, true)); - this.targetSelector.add(7, new ActiveTargetGoal<>(this, SpawnOfShelobEntity.class, true)); - this.targetSelector.add(8, new ActiveTargetGoal<>(this, ShelobiteScuttlerEntity.class, true)); - this.targetSelector.add(9, new ActiveTargetGoal<>(this, ShelobiteLarvaEntity.class, true)); - this.targetSelector.add(10, new ActiveTargetGoal<>(this, AbstractHorseEntity.class, true)); + public static AttributeSupplier.Builder setAttributes() { + return Mob.createMobAttributes() + .add(Attributes.FOLLOW_RANGE, 32.0) + .add(Attributes.ATTACK_DAMAGE, 1.0); } - @Override - protected void initDataTracker(DataTracker.Builder builder) { - super.initDataTracker(builder); - builder.add(NPC_INITIALIZATION_DATA, new NpcInitializationData()); - builder.add(NPC_DATA, new NpcData()); - builder.add(NPC_TEXTURE_DATA, new NpcTextureData()); - builder.add(IS_FIGHTING, false); - builder.add(CROSSBOW_CHARGING, false); - builder.add(USING_ITEM, 0); + protected void registerGoals() { + this.goalSelector.addGoal(1, new FloatGoal(this)); + this.goalSelector.addGoal(3, new NpcDoorInteractGoal(this)); + this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 0.8)); + this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 8.0F)); + this.goalSelector.addGoal(6, new RandomLookAroundGoal(this)); + this.targetSelector.addGoal(1, new HurtByTargetGoal(this)); + this.targetSelector.addGoal(3, new TargetPlayerDiplomacyGoal(this)); + this.targetSelector.addGoal(5, new TargetNPCDiplomacyGoal(this)); + this.targetSelector.addGoal(6, new NearestAttackableTargetGoal<>(this, SnowTrollEntity.class, true)); + this.targetSelector.addGoal(7, new NearestAttackableTargetGoal<>(this, SpawnOfShelobEntity.class, true)); + this.targetSelector.addGoal(8, new NearestAttackableTargetGoal<>(this, ShelobiteScuttlerEntity.class, true)); + this.targetSelector.addGoal(9, new NearestAttackableTargetGoal<>(this, ShelobiteLarvaEntity.class, true)); + this.targetSelector.addGoal(10, new NearestAttackableTargetGoal<>(this, AbstractHorse.class, true)); } @Override - public void writeData(WriteView view) { - super.writeData(view); - writeCustomData(view); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(NPC_INITIALIZATION_DATA, new NpcInitializationData()); + builder.define(NPC_DATA, new NpcData()); + builder.define(NPC_TEXTURE_DATA, new NpcTextureData()); + builder.define(IS_FIGHTING, false); + builder.define(CROSSBOW_CHARGING, false); + builder.define(USING_ITEM, 0); + builder.define(DOOR_TRAVERSAL_DIMENSIONS, false); } @Override - public void writeCustomData(WriteView view) { - super.writeCustomData(view); - view.put(KeyStrings.DATA, NpcData.CODEC, this.retrieveNpcData()); - view.put(KeyStrings.INITIALIZATION_DATA, NpcInitializationData.CODEC, this.retrieveNpcInitializationData()); - view.put(KeyStrings.TEXTURE_DATA, NpcTextureData.CODEC, this.retrieveNpcTextureData()); - view.put(KeyStrings.IS_FIGHTING, Codec.BOOL, this.getFighting()); + public void onSyncedDataUpdated(EntityDataAccessor data) { + if (DOOR_TRAVERSAL_DIMENSIONS.equals(data)) { + boolean syncedTraversal = this.entityData.get(DOOR_TRAVERSAL_DIMENSIONS); + if (this.usingDoorTraversalDimensions != syncedTraversal) { + this.usingDoorTraversalDimensions = syncedTraversal; + this.refreshDimensions(); + } + } + super.onSyncedDataUpdated(data); } @Override - public void readData(ReadView view) { - super.readData(view); - readCustomData(view); + public void addAdditionalSaveData(CompoundTag view) { + super.addAdditionalSaveData(view); + RegistryOps ops = RegistryOps.create(NbtOps.INSTANCE, this.level().registryAccess()); + NpcData.CODEC.encodeStart(ops, this.retrieveNpcData()) + .result().ifPresent(tag -> view.put(KeyStrings.DATA, tag)); + NpcInitializationData.CODEC.encodeStart(ops, this.retrieveNpcInitializationData()) + .result().ifPresent(tag -> view.put(KeyStrings.INITIALIZATION_DATA, tag)); + NpcTextureData.CODEC.encodeStart(ops, this.retrieveNpcTextureData()) + .result().ifPresent(tag -> view.put(KeyStrings.TEXTURE_DATA, tag)); + view.putBoolean(KeyStrings.IS_FIGHTING, this.getFighting()); + view.putBoolean(KeyStrings.DOOR_TRAVERSAL, this.usingDoorTraversalDimensions); } @Override - public void readCustomData(ReadView view) { - super.readCustomData(view); - NpcData foundNpcData = view.read(KeyStrings.DATA, NpcData.CODEC).orElse(new NpcData()); - NpcInitializationData foundNpcInitializationData = view.read(KeyStrings.INITIALIZATION_DATA, NpcInitializationData.CODEC).orElse(new NpcInitializationData()); - NpcTextureData foundNpcTextureData = view.read(KeyStrings.TEXTURE_DATA, NpcTextureData.CODEC).orElse(new NpcTextureData()); - boolean isFighting = view.read(KeyStrings.IS_FIGHTING, Codec.BOOL).orElse(false); - - String npcDataId = view.read("NpcDataId", Codec.STRING).orElse(null); + public void readAdditionalSaveData(CompoundTag view) { + super.readAdditionalSaveData(view); + RegistryOps ops = RegistryOps.create(NbtOps.INSTANCE, this.level().registryAccess()); + NpcData foundNpcData = view.contains(KeyStrings.DATA) + ? NpcData.CODEC.parse(ops, view.get(KeyStrings.DATA)).result().orElse(new NpcData()) + : new NpcData(); + NpcInitializationData foundNpcInitializationData = view.contains(KeyStrings.INITIALIZATION_DATA) + ? NpcInitializationData.CODEC.parse(ops, view.get(KeyStrings.INITIALIZATION_DATA)).result().orElse(new NpcInitializationData()) + : new NpcInitializationData(); + NpcTextureData foundNpcTextureData = view.contains(KeyStrings.TEXTURE_DATA) + ? NpcTextureData.CODEC.parse(ops, view.get(KeyStrings.TEXTURE_DATA)).result().orElse(new NpcTextureData()) + : new NpcTextureData(); + boolean isFighting = view.getBoolean(KeyStrings.IS_FIGHTING); + boolean doorTraversal = view.getBoolean(KeyStrings.DOOR_TRAVERSAL); + + String npcDataId = view.contains("NpcDataId", Tag.TAG_STRING) ? view.getString("NpcDataId") : null; if(npcDataId != null){ foundNpcInitializationData = foundNpcInitializationData.withType(MiddleEarth.fetchId(npcDataId)); foundNpcData = new NpcData(); @@ -298,10 +388,12 @@ public void readCustomData(ReadView view) { isFighting = false; } - this.dataTracker.set(NPC_DATA, foundNpcData); - this.dataTracker.set(NPC_INITIALIZATION_DATA, foundNpcInitializationData); - this.dataTracker.set(NPC_TEXTURE_DATA, foundNpcTextureData); - this.dataTracker.set(IS_FIGHTING, isFighting); + this.entityData.set(NPC_DATA, foundNpcData); + this.entityData.set(NPC_INITIALIZATION_DATA, foundNpcInitializationData); + this.entityData.set(NPC_TEXTURE_DATA, foundNpcTextureData); + this.entityData.set(IS_FIGHTING, isFighting); + this.restoreDoorTraversalDimensions = doorTraversal; + this.setDoorTraversalDimensions(doorTraversal); foundNpcInitializationData.tryToInitialize(this); @@ -309,55 +401,46 @@ public void readCustomData(ReadView view) { } @Override - public boolean canUseRangedWeapon(RangedWeaponItem weapon) { + public boolean canFireProjectileWeapon(ProjectileWeaponItem weapon) { return true; } @Override - public @Nullable ItemStack getPickBlockStack() { + public @Nullable ItemStack getPickResult() { if(getNpcType() == null) return ItemStack.EMPTY; - return NpcSpawnEggHelper.getSpawnEgg(getWorld(), getNpcType().getId()); + return NpcSpawnEggHelper.getSpawnEgg(level(), getNpcType().getId()); } public void updateAttackType() { - if (this.getWorld() != null && !this.getWorld().isClient) { - this.goalSelector.remove(this.meleeAttackGoal); - this.goalSelector.remove(this.bowAttackGoal); - ItemStack itemStack = this.getMainHandStack(); - if (itemStack.isOf(Items.BOW) || itemStack.isIn(ItemTagsME.BOW)) { + if (this.level() != null && !this.level().isClientSide) { + this.goalSelector.removeGoal(this.meleeAttackGoal); + this.goalSelector.removeGoal(this.bowAttackGoal); + this.goalSelector.removeGoal(this.crossBowAttackGoal); + ItemStack itemStack = this.getMainHandItem(); + if (itemStack.is(Items.BOW) || itemStack.is(ItemTagsME.BOW)) { int i = 30; - if (this.getWorld().getDifficulty() != Difficulty.HARD) { + if (this.level().getDifficulty() != Difficulty.HARD) { i = 20; } this.bowAttackGoal.setAttackInterval(i); - this.goalSelector.add(4, this.bowAttackGoal); - } if (itemStack.isOf(Items.CROSSBOW) || itemStack.isIn(ItemTagsME.CROSSBOW)) { - this.goalSelector.add(4, this.crossBowAttackGoal); + this.goalSelector.addGoal(4, this.bowAttackGoal); + } else if (itemStack.is(Items.CROSSBOW) || itemStack.is(ItemTagsME.CROSSBOW)) { + this.goalSelector.addGoal(4, this.crossBowAttackGoal); } else { - this.goalSelector.add(4, this.meleeAttackGoal); + this.goalSelector.addGoal(4, this.meleeAttackGoal); } } } public void updateTargetGoals() { - //if (this.getWorld() != null && !this.getWorld().isClient) { - // if(getFaction().getDisposition() == DispositionType.EVIL) { - // this.targetSelector.add(10, new ActiveTargetGoal<>(this, BroadhoofGoatEntity.class, true)); - // this.targetSelector.add(10, new ActiveTargetGoal<>(this, GreatHornEntity.class, true)); - // } else { - // this.targetSelector.add(5, new ActiveTargetGoal<>(this, CaveTrollEntity.class, true)); - // this.targetSelector.add(5, new ActiveTargetGoal<>(this, StoneTrollEntity.class, true)); - // this.targetSelector.add(6, new ActiveTargetGoal<>(this, WargEntity.class, true)); - // } - //} } //region [DATA TRANSFER] // GETTERS - public Identifier getNpcTypeIdentifier(){ + public ResourceLocation getNpcTypeIdentifier(){ return retrieveNpcData().getNpcTypeId(); } - public Identifier getFactionIdentifier(){ + public ResourceLocation getFactionIdentifier(){ Faction faction = getFaction(); if(faction == null) return null; return faction.getId(); @@ -368,16 +451,18 @@ public BlockPos getStructureManagerHostPos() { //endregion public void tryToInitializeData(){ - if(Objects.equals(getBlockPos(), new BlockPos(0, 0, 0))) // 0,0,0 is what's used for commands, needs to be delayed + if(blockPosition().equals(BlockPos.ZERO)) // 0,0,0 is what's used for commands, needs to be delayed + return; + if(getNpcType() != null && hasTextureData()) return; this.prepare(); - World world = getWorld(); - if(world.isClient) + Level world = level(); + if(world.isClientSide) return; - if(world instanceof ServerWorld serverWorld){ + if(world instanceof ServerLevel serverWorld){ if(NpcEntityInitializer.shouldInitialize(serverWorld, this)){ NpcEntityInitializer.initializeNpcEntity(serverWorld, this); } @@ -385,15 +470,15 @@ public void tryToInitializeData(){ } @Override - public boolean isInvulnerableTo(ServerWorld world, DamageSource source) { - if (source.isOf(DamageTypes.IN_WALL) && this.hasVehicle()) { + public boolean isInvulnerableTo(DamageSource source) { + if (source.is(DamageTypes.IN_WALL) && this.isPassenger()) { return true; } - return super.isInvulnerableTo(world, source); + return super.isInvulnerableTo(source); } @Override - protected void mobTick(ServerWorld world) { + protected void customServerAiStep() { tryToInitializeData(); //CombatArchetypeRuntimeData runtimeData = getCombatRuntimeData(); // if(runtimeData != null) @@ -406,60 +491,43 @@ protected void mobTick(ServerWorld world) { profiler.push("npcActivityUpdate"); NpcBrain.updateActivities(this); profiler.pop();*/ - super.mobTick(world); + super.customServerAiStep(); - if(hasVehicle()){ - rotate(getVehicle().getYaw(), getVehicle().getPitch()); + if(isPassenger()){ + this.setRot(getVehicle().getYRot(), getVehicle().getXRot()); } } @Override - protected Vec3d getPassengerAttachmentPos(Entity passenger, EntityDimensions dimensions, float scaleFactor) { - Vec3d pos = super.getPassengerAttachmentPos(passenger, dimensions, scaleFactor); - - Vec3d offset = new Vec3d( - 0.0, - -0.3 * scaleFactor, - -0.25 * scaleFactor - ); - - return pos.add(rotatePoint(offset, this.getYaw())); - } - - private static Vec3d rotatePoint(Vec3d point, float yaw) { - return point.rotateY(-yaw * ((float)Math.PI / 180F)); + protected Vec3 getPassengerAttachmentPoint(Entity passenger, EntityDimensions dimensions, float scaleFactor) { + Vec3 pos = super.getPassengerAttachmentPoint(passenger, dimensions, scaleFactor); + float yaw = this.getYRot() * Mth.DEG_TO_RAD; + double backwards = -0.25 * scaleFactor; + return pos.add(-backwards * Mth.sin(yaw), -0.3 * scaleFactor, backwards * Mth.cos(yaw)); } @Override public boolean isUsingItem() { boolean value = super.isUsingItem(); if(!value) { - return this.dataTracker.get(USING_ITEM) > 0; + return this.entityData.get(USING_ITEM) > 0; } return value; } public void setNpcFlag(int mask, boolean value) { - setLivingFlag(mask, value); + setLivingEntityFlag(mask, value); if(value) { - int i = this.dataTracker.get(USING_ITEM) + 1; - this.dataTracker.set(USING_ITEM, i); + int i = this.entityData.get(USING_ITEM) + 1; + this.entityData.set(USING_ITEM, i); } else { - this.dataTracker.set(USING_ITEM, 0); + this.entityData.set(USING_ITEM, 0); } } - /*protected Brain deserializeBrain(Dynamic dynamic) { - return NpcBrain.create(dynamic); - } - - public Brain getBrain() { - return (Brain) super.getBrain(); - }*/ - public float getFightingMovementSpeed(){ - double currentSpeed = this.getAttributeValue(EntityAttributes.MOVEMENT_SPEED); + double currentSpeed = this.getAttributeValue(Attributes.MOVEMENT_SPEED); return (float) (currentSpeed); } @@ -467,17 +535,18 @@ public boolean isFighting() { boolean isFighting = getFighting(); this.setSprinting(isFighting); - if(this.hasVehicle() && getVehicle() instanceof AbstractHorseEntity abstractHorseEntity){ + if(this.isPassenger() && getVehicle() instanceof AbstractHorse abstractHorseEntity){ abstractHorseEntity.setSprinting(isFighting); } return isFighting; } @Override - public void tickMovement() { - super.tickMovement(); + public void aiStep() { + super.aiStep(); + this.tryRestoreDoorTraversalDimensions(); - if(!this.getWorld().isClient) { + if(!this.level().isClientSide) { } else { setupAnimationStates(); @@ -486,55 +555,51 @@ public void tickMovement() { } private void setupAnimationStates() { - if(this.forwardSpeed > 0) { - this.walkingState.startIfNotRunning(this.age); + if(this.zza > 0) { + this.walkingState.startIfStopped(this.tickCount); } else { - this.idleState.startIfNotRunning(this.age); + this.idleState.startIfStopped(this.tickCount); } - int bowPullProgress = this.getItemUseTime(); + int bowPullProgress = this.getTicksUsingItem(); if(bowPullProgress > 0) { - this.aimingState.startIfNotRunning(this.age); + this.aimingState.startIfStopped(this.tickCount); } } @Override - public boolean shouldControlVehicles() { + public boolean canControlVehicle() { return true; } @Override protected boolean couldAcceptPassenger() { - return !this.hasVehicle(); + return !this.isPassenger(); } @Override - protected void initEquipment(Random random, LocalDifficulty localDifficulty) { + protected void populateDefaultEquipmentSlots(RandomSource random, DifficultyInstance localDifficulty) { // Overrides vanilla init equipment (gold sets???) } @Override - public void onDeath(DamageSource source) { + public void die(DamageSource source) { if(getVehicle() != null && getVehicle() instanceof LivingEntity vehicleEntity && vehicleEntity.getControllingPassenger() == this){ - vehicleEntity.equipStack(EquipmentSlot.SADDLE, Items.AIR.getDefaultStack()); - vehicleEntity.equipStack(EquipmentSlot.BODY, Items.AIR.getDefaultStack()); - vehicleEntity.removeAllPassengers(); - if(vehicleEntity instanceof AbstractHorseEntity abstractHorseEntity){ - abstractHorseEntity.setTame(false); - abstractHorseEntity.resetLoveTicks(); + vehicleEntity.setItemSlot(EquipmentSlot.BODY, Items.AIR.getDefaultInstance()); + vehicleEntity.ejectPassengers(); + if(vehicleEntity instanceof AbstractHorse abstractHorseEntity){ + abstractHorseEntity.getSlot(AbstractHorse.EQUIPMENT_SLOT_OFFSET).set(ItemStack.EMPTY); + abstractHorseEntity.setTamed(false); + abstractHorseEntity.resetLove(); abstractHorseEntity.setSprinting(false); - abstractHorseEntity.setOwner(null); + abstractHorseEntity.setOwnerUUID(null); } if(vehicleEntity instanceof AbstractBeastEntity abstractBeastEntity){ abstractBeastEntity.resetTameness(); } } - BlockPos structureManagerPos = getStructureManagerHostPos(); - if(structureManagerPos != null){ - StructureManagerBlockEntity.triggerDeathSignal(structureManagerPos, this); - } - super.onDeath(source); + super.die(source); } private boolean canDropLoot(DamageSource damageSource, boolean causedByPlayer){ @@ -544,15 +609,15 @@ private boolean canDropLoot(DamageSource damageSource, boolean causedByPlayer){ if(damageSource == null) return canDropLoot; - if(damageSource.getAttacker() instanceof PlayerEntity player){ - PlayerData data = StateSaverAndLoader.getPlayerState(player); + if(damageSource.getEntity() instanceof Player player){ + PlayerData data = StateSaverAndLoader.getPlayerStateReadOnly(player); if(data == null) canDropLoot = true; else if(data.getFaction() == null) canDropLoot = true; else{ try{ - Faction faction = FactionLookup.getFactionById(getWorld(), data.getFaction()); + Faction faction = FactionLookup.getFactionById(level(), data.getFaction()); if(faction.isHostileToward(this.getFactionIdentifier())) canDropLoot = true; } catch (FactionIdentifierException e){ @@ -564,52 +629,55 @@ else if(data.getFaction() == null) return canDropLoot; } - protected void drop(ServerWorld world, DamageSource damageSource) { - if(!canDropLoot(damageSource, damageSource.getAttacker() != null && damageSource.getAttacker().isPlayer())) + @Override + protected void dropAllDeathLoot(ServerLevel world, DamageSource damageSource) { + if(!canDropLoot(damageSource, damageSource.getEntity() instanceof Player)) return; - super.drop(world, damageSource); + super.dropAllDeathLoot(world, damageSource); } - protected int getExperienceToDrop(ServerWorld world) { + @Override + protected int getBaseExperienceReward() { LootData lootData = retrieveLootData(); - if(lootData == null) + if(lootData == null || !(level() instanceof ServerLevel world)) return 1; return lootData.getExperience(world); } @Override - protected void dropLoot(ServerWorld world, DamageSource damageSource, boolean causedByPlayer) { - RegistryKey lootTableRegistryKey = RegistryKey.of(RegistryKeys.LOOT_TABLE, getNpcType().getId().withPrefixedPath("entities/")); - LootTable lootTable = world.getServer().getReloadableRegistries().getLootTable(lootTableRegistryKey); + protected void dropFromLootTable(DamageSource damageSource, boolean causedByPlayer) { + if (!(level() instanceof ServerLevel world) || getNpcType() == null) { + return; + } + ResourceKey lootTableRegistryKey = ResourceKey.create(Registries.LOOT_TABLE, getNpcType().getId().withPrefix("entities/")); + LootTable lootTable = world.getServer().reloadableRegistries().getLootTable(lootTableRegistryKey); if (lootTable != null) { - LootWorldContext.Builder builder = (new LootWorldContext.Builder(world)).add(LootContextParameters.THIS_ENTITY, this) - .add(LootContextParameters.ORIGIN, this.getPos()) - .add(LootContextParameters.DAMAGE_SOURCE, damageSource) - .addOptional(LootContextParameters.ATTACKING_ENTITY, damageSource.getAttacker()) - .addOptional(LootContextParameters.DIRECT_ATTACKING_ENTITY, damageSource.getSource()); - PlayerEntity playerEntity = this.getAttackingPlayer(); + LootParams.Builder builder = (new LootParams.Builder(world)).withParameter(LootContextParams.THIS_ENTITY, this) + .withParameter(LootContextParams.ORIGIN, this.position()) + .withParameter(LootContextParams.DAMAGE_SOURCE, damageSource) + .withOptionalParameter(LootContextParams.ATTACKING_ENTITY, damageSource.getEntity()) + .withOptionalParameter(LootContextParams.DIRECT_ATTACKING_ENTITY, damageSource.getDirectEntity()); + Player playerEntity = causedByPlayer ? this.lastHurtByPlayer : null; if (playerEntity != null) { - builder = builder.add(LootContextParameters.LAST_DAMAGE_PLAYER, playerEntity).luck(playerEntity.getLuck()); + builder = builder.withParameter(LootContextParams.LAST_DAMAGE_PLAYER, playerEntity).withLuck(playerEntity.getLuck()); } - LootWorldContext lootWorldContext = builder.build(LootContextTypes.ENTITY); - lootTable.generateLoot(lootWorldContext, this.getLootTableSeed(), (stack) -> this.dropStack(world, stack)); + LootParams lootWorldContext = builder.create(LootContextParamSets.ENTITY); + lootTable.getRandomItems(lootWorldContext, this.getLootTableSeed(), this::spawnAtLocation); } } @Override - public boolean isPersistent() { + public boolean isPersistenceRequired() { BlockPos structureManagerPos = getStructureManagerHostPos(); - if(structureManagerPos == null) - return super.isPersistent(); - if(getWorld().getBlockEntity(structureManagerPos) instanceof StructureManagerBlockEntity structureManagerBlockEntity) + if(structureManagerPos != null) return true; - return super.isPersistent(); + return super.isPersistenceRequired(); } @Override - public void setCustomName(@Nullable Text name) { + public void setCustomName(@Nullable Component name) { super.setCustomName(name); } @@ -617,23 +685,23 @@ protected Faction getFaction(){ NpcData data = retrieveNpcData(); if(data == null) return null; - Identifier factionId = data.getFaction(); + ResourceLocation factionId = data.getFaction(); if(factionId == null) return null; try { - return FactionLookup.getFactionById(getWorld(), factionId); + return FactionLookup.getFactionById(level(), factionId); } catch (FactionIdentifierException e) { return null; } } @Override - public boolean isInAttackRange(LivingEntity entity) { + public boolean isWithinMeleeAttackRange(LivingEntity entity) { float reach = 1.75f; - try{ - Optional damageOpt = Optional.of(this.getAttributeValue(EntityAttributes.ENTITY_INTERACTION_RANGE)); - reach = damageOpt.get().floatValue(); - } catch (Exception ignored){} + AttributeInstance interactionRange = this.getAttribute(Attributes.ENTITY_INTERACTION_RANGE); + if (interactionRange != null) { + reach = (float)interactionRange.getValue(); + } if(this.getVehicle() != null || entity.getVehicle() != null) { reach += 0.5f; @@ -643,40 +711,39 @@ public boolean isInAttackRange(LivingEntity entity) { } @Override - public boolean tryAttack(ServerWorld world, Entity target) { - this.getWorld().sendEntityStatus(this, EntityStatuses.PLAY_ATTACK_SOUND); + public boolean doHurtTarget(Entity target) { + if (!(this.level() instanceof ServerLevel world)) { + return false; + } + this.level().broadcastEntityEvent(this, EntityEvent.START_ATTACKING); boolean targetDamaged; - float damage = 1.0f; - try{ - Optional damageOpt = Optional.of(this.getAttributeValue(EntityAttributes.ATTACK_DAMAGE)); - damage = damageOpt.get().floatValue(); - } catch (Exception ignored){} - ItemStack itemStack = this.getWeaponStack(); - DamageSource damageSource = Optional.ofNullable(itemStack.getItem().getDamageSource(this)).orElse(this.getDamageSources().mobAttack(this)); + float damage = (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE); + ItemStack itemStack = this.getWeaponItem(); + DamageSource damageSource = this.damageSources().mobAttack(this); - var enchantmentDamage = EnchantmentHelper.getDamage(world, itemStack, target, damageSource, damage); - var bonusDamage = itemStack.getItem().getBonusAttackDamage(target, enchantmentDamage, damageSource); - var finalDamage = damage + bonusDamage; + var enchantmentDamage = EnchantmentHelper.modifyDamage(world, itemStack, target, damageSource, damage); + var bonusDamage = itemStack.getItem().getAttackDamageBonus(target, enchantmentDamage, damageSource); + var finalDamage = enchantmentDamage + bonusDamage; - if(hasVehicle() && getVehicle() instanceof AbstractBeastEntity mountEntity){ - mountEntity.tryAttack((ServerWorld) target.getWorld(), target); + if(isPassenger() && getVehicle() instanceof AbstractBeastEntity mountEntity){ + mountEntity.doHurtTarget(target); } - targetDamaged = target.damage(world, damageSource, finalDamage); + targetDamaged = target.hurt(damageSource, finalDamage); if (targetDamaged) { - LivingEntity livingEntity; - float g = this.getAttackKnockbackAgainst(target, damageSource); - if (g > 0.0f && target instanceof LivingEntity) { - livingEntity = (LivingEntity)target; - livingEntity.takeKnockback(g * 0.5f, MathHelper.sin(this.getYaw() * ((float)Math.PI / 180)), -MathHelper.cos(this.getYaw() * ((float)Math.PI / 180))); - this.setVelocity(this.getVelocity().multiply(0.6, 1.0, 0.6)); + float g = this.getKnockback(target, damageSource); + if (g > 0.0f && target instanceof LivingEntity livingEntity) { + livingEntity.knockback(g * 0.5f, Mth.sin(this.getYRot() * ((float)Math.PI / 180)), -Mth.cos(this.getYRot() * ((float)Math.PI / 180))); + this.setDeltaMovement(this.getDeltaMovement().multiply(0.6, 1.0, 0.6)); } - if (target instanceof LivingEntity) { - livingEntity = (LivingEntity)target; - itemStack.postHit(livingEntity, this); + if (target instanceof LivingEntity livingEntity) { + var item = itemStack.getItem(); + if (item.hurtEnemy(itemStack, livingEntity, this)) { + item.postHurtEnemy(itemStack, livingEntity, this); + } } - EnchantmentHelper.onTargetDamaged(world, target, damageSource); - this.onAttacking(target); + EnchantmentHelper.doPostAttackEffects(world, target, damageSource); + this.setLastHurtMob(target); this.playAttackSound(); } @@ -684,52 +751,50 @@ public boolean tryAttack(ServerWorld world, Entity target) { } @Override - public void tickRiding() { - super.tickRiding(); - Entity entity = this.getControllingVehicle(); - if (entity instanceof PathAwareEntity pathAwareEntity) { - this.bodyYaw = pathAwareEntity.bodyYaw; + public void rideTick() { + super.rideTick(); + Entity entity = this.getControlledVehicle(); + if (entity instanceof PathfinderMob pathAwareEntity) { + this.yBodyRot = pathAwareEntity.yBodyRot; } } @Override - protected Text getDefaultName() { + protected Component getTypeName() { if(this.getNpcTypeIdentifier() == null) { - return Text.translatable("npc_type."+ MiddleEarth.MOD_ID +".npc"); + return Component.translatable("npc_type."+ MiddleEarth.MOD_ID +".npc"); } - return Text.translatable(this.getNpcTypeIdentifier().toTranslationKey("npc_type")); + return Component.translatable(this.getNpcTypeIdentifier().toLanguageKey("npc_type")); } @Override - protected void takeShieldHit(ServerWorld world, LivingEntity attacker) { - super.takeShieldHit(world, attacker); - ItemStack itemStack = this.getBlockingItem(); - BlocksAttacksComponent blocksAttacksComponent = itemStack != null ? itemStack.get(DataComponentTypes.BLOCKS_ATTACKS) : null; - float f = attacker.getWeaponDisableBlockingForSeconds(); - if (f > 0.0f && blocksAttacksComponent != null) { - blocksAttacksComponent.applyShieldCooldown(world, this, f, itemStack); + protected void blockUsingShield(LivingEntity attacker) { + super.blockUsingShield(attacker); + if (attacker.canDisableShield()) { + this.stopUsingItem(); + this.level().broadcastEntityEvent(this, (byte)30); } } @Override - public boolean canTarget(LivingEntity target) { - return shouldTarget(this, target) && super.canTarget(target); + public boolean canAttack(LivingEntity target) { + return shouldTarget(this, target) && super.canAttack(target); } public static boolean shouldTarget(NpcEntity npcEntity, LivingEntity target){ // TODO : datadriven - if(target instanceof SnailEntity || target instanceof HostileEntity || target instanceof SnowTrollEntity || target instanceof Pouncer) + if(target instanceof SnailEntity || target instanceof Monster || target instanceof SnowTrollEntity || target instanceof Pouncer) return true; - if(!npcEntity.isInSameTeam(target)){ + if(!npcEntity.isAlliedTo(target)){ return true; } return false; } public int getTickAttackSpeedCooldown(){ - if(!this.getAttributes().hasAttribute(EntityAttributes.ATTACK_SPEED)) + if(!this.getAttributes().hasAttribute(Attributes.ATTACK_SPEED)) return 1; - return (int)this.getAttributes().getValue(EntityAttributes.ATTACK_SPEED); + return (int)this.getAttributes().getValue(Attributes.ATTACK_SPEED); } @Override @@ -738,7 +803,7 @@ public boolean canBeLeashed() { } @Override - protected void dropEquipment(ServerWorld world, DamageSource source, boolean causedByPlayer) { + protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) { // No drop allowed } @@ -763,34 +828,35 @@ public boolean isInAttackRange(LivingEntity entity) { return runtimeData.getCombatArchetypeData().isInOptimalRange(this, entity.getBlockPos()); }*/ - protected PersistentProjectileEntity createArrowProjectile(ItemStack arrow, float damageModifier, @Nullable ItemStack shotFrom) { - return ProjectileUtil.createArrowProjectile(this, arrow, damageModifier, shotFrom); + protected AbstractArrow createArrowProjectile(ItemStack arrow, float damageModifier, @Nullable ItemStack shotFrom) { + ItemStack ammunition = arrow.isEmpty() ? Items.ARROW.getDefaultInstance() : arrow; + return ProjectileUtil.getMobArrow(this, ammunition, damageModifier, shotFrom); } public boolean isAiming() { - int i = this.getItemUseTime(); + int i = this.getTicksUsingItem(); return i > 0; } public void aim() { - var currentItem = getActiveItem(); + var currentItem = getUseItem(); if(currentItem.isEmpty()){ - clearActiveItem(); - setCurrentHand(Hand.MAIN_HAND); + stopUsingItem(); + startUsingItem(InteractionHand.MAIN_HAND); } } public void stopAiming() { - var currentItem = getActiveItem(); + var currentItem = getUseItem(); if(currentItem.isEmpty()){ - this.clearActiveItem(); + this.stopUsingItem(); return; } - this.clearActiveItem(); + this.stopUsingItem(); } public boolean isReadyToShoot() { - return getMainHandStack() != null; + return !getMainHandItem().isEmpty(); //int i = this.getItemUseTime(); //if (i >= 20) { // return true; @@ -802,17 +868,16 @@ private void shootAt(LivingEntity target, float pullProgress, float powerModifie if (!isReadyToShoot()) return; - ItemStack weapon = this.getMainHandStack(); - ItemStack projectileStack = this.getProjectileType(weapon); - if(projectileStack.isEmpty()) projectileStack = new ItemStack(Items.ARROW, 1); + ItemStack weapon = this.getMainHandItem(); + ItemStack projectileStack = this.getProjectile(weapon); - PersistentProjectileEntity projectile = this.createArrowProjectile(projectileStack, pullProgress, weapon); + AbstractArrow projectile = this.createArrowProjectile(projectileStack, pullProgress, weapon); double distanceX = target.getX() - this.getX(); double distanceZ = target.getZ() - this.getZ(); double horizontalDistance = Math.sqrt(distanceX * distanceX + distanceZ * distanceZ); - double distanceY = target.getBodyY(0.3F) - projectile.getY(); + double distanceY = target.getY(0.3F) - projectile.getY(); float scale = this.getScale(); float velocity = 1.6F * powerModifier; @@ -820,21 +885,18 @@ private void shootAt(LivingEntity target, float pullProgress, float powerModifie // Reduce the vanilla arc compensation for larger entities and faster arrows. double arcCompensation = horizontalDistance * (0.2F / (scale * powerModifier)); - if (this.getWorld() instanceof ServerWorld serverWorld) { - ProjectileEntity.spawnWithVelocity( - projectile, - serverWorld, - projectileStack, + if (this.level() instanceof ServerLevel serverWorld) { + projectile.shoot( distanceX, distanceY + arcCompensation, distanceZ, velocity, - (float) (14 - serverWorld.getDifficulty().getId() * 4) - ); + (float) (14 - serverWorld.getDifficulty().getId() * 4)); + serverWorld.addFreshEntity(projectile); } this.playSound( - SoundEvents.ENTITY_ARROW_SHOOT, + SoundEvents.ARROW_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F) ); @@ -843,15 +905,15 @@ private void shootAt(LivingEntity target, float pullProgress, float powerModifie } @Override - public void shootAt(LivingEntity target, float pullProgress) { + public void performRangedAttack(LivingEntity target, float pullProgress) { this.shootAt(target, 1, pullProgress); } public void shootAt(LivingEntity livingEntity) { try{ - this.shootAt(livingEntity, BowItem.getPullProgress(getItemUseTime()), 2f); + this.shootAt(livingEntity, BowItem.getPowerForTime(getTicksUsingItem()), 2f); } catch (IllegalArgumentException e){ - this.shootAt(livingEntity, CustomLongbowWeaponItem.getPullProgressLongbow(getItemUseTime()), 3f); + this.shootAt(livingEntity, CustomLongbowWeaponItem.getPullProgressLongbow(getTicksUsingItem()), 3f); } } public void shootCrossbowAt(LivingEntity target) { @@ -859,34 +921,34 @@ public void shootCrossbowAt(LivingEntity target) { } public boolean isCharging() { - return this.dataTracker.get(CROSSBOW_CHARGING); + return this.entityData.get(CROSSBOW_CHARGING); } @Override - public void setCharging(boolean charging) { - this.dataTracker.set(CROSSBOW_CHARGING, charging); + public void setChargingCrossbow(boolean charging) { + this.entityData.set(CROSSBOW_CHARGING, charging); } @Override - public void postShoot() { - this.dataTracker.set(CROSSBOW_CHARGING, false); + public void onCrossbowAttackPerformed() { + this.entityData.set(CROSSBOW_CHARGING, false); } @Override - protected boolean isInSameTeam(Entity other) { + public boolean isAlliedTo(Entity other) { if(other instanceof NpcEntity npc){ return !isHostileToward(npc); } - else if(other instanceof PlayerEntity player){ + else if(other instanceof Player player){ return !isHostileTowardPlayer(player); } return !isHostileToward(other); } - private boolean isHostileTowardPlayer(PlayerEntity player) { - if(player.getWorld().isClient || !player.canTakeDamage()) + private boolean isHostileTowardPlayer(Player player) { + if(player.level().isClientSide || !player.canBeSeenAsEnemy()) return false; - PlayerData playerData = StateSaverAndLoader.getPlayerState(player); + PlayerData playerData = StateSaverAndLoader.getPlayerStateReadOnly(player); if(playerData == null || playerData.getFaction() == null) return true; Faction ownFaction = getFaction(); @@ -898,10 +960,10 @@ private boolean isHostileTowardPlayer(PlayerEntity player) { } private boolean isHostileToward(Entity other) { - if(other instanceof SnailEntity || other instanceof HostileEntity || other instanceof TrollEntity || other instanceof Pouncer) + if(other instanceof SnailEntity || other instanceof Monster || other instanceof TrollEntity || other instanceof Pouncer) return true; - if(!other.hasPassengers()) + if(!other.isVehicle()) return false; if(other.getControllingPassenger() instanceof NpcEntity npc && isHostileToward(npc)) { @@ -914,7 +976,7 @@ private boolean isHostileToward(NpcEntity npc) { Faction ownFaction = getFaction(); if(ownFaction == null) return true; - Identifier otherNpcFaction = npc.getFactionIdentifier(); + ResourceLocation otherNpcFaction = npc.getFactionIdentifier(); if(otherNpcFaction == null) return true; if(ownFaction.isHostileToward(otherNpcFaction)) @@ -922,14 +984,14 @@ private boolean isHostileToward(NpcEntity npc) { return false; } - public static boolean canSpawn(EntityType type, ServerWorldAccess serverWorldAccess, SpawnReason spawnReason, BlockPos blockPos, Random random) { + public static boolean canSpawn(EntityType type, ServerLevelAccessor serverWorldAccess, MobSpawnType spawnReason, BlockPos blockPos, RandomSource random) { return SpawnUtil.canSpawn(blockPos, serverWorldAccess, spawnReason); } static { - NPC_DATA = DataTracker.registerData(NpcEntity.class, TrackedDataHandlerRegistryME.NPC_DATA); - NPC_INITIALIZATION_DATA = DataTracker.registerData(NpcEntity.class, TrackedDataHandlerRegistryME.NPC_INITIALIZATION_DATA); - NPC_TEXTURE_DATA = DataTracker.registerData(NpcEntity.class, TrackedDataHandlerRegistryME.NPC_TEXTURE_DATA); - IS_FIGHTING = DataTracker.registerData(NpcEntity.class, TrackedDataHandlerRegistry.BOOLEAN); + NPC_DATA = SynchedEntityData.defineId(NpcEntity.class, TrackedDataHandlerRegistryME.NPC_DATA); + NPC_INITIALIZATION_DATA = SynchedEntityData.defineId(NpcEntity.class, TrackedDataHandlerRegistryME.NPC_INITIALIZATION_DATA); + NPC_TEXTURE_DATA = SynchedEntityData.defineId(NpcEntity.class, TrackedDataHandlerRegistryME.NPC_TEXTURE_DATA); + IS_FIGHTING = SynchedEntityData.defineId(NpcEntity.class, EntityDataSerializers.BOOLEAN); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/NpcTaskListProvider.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/NpcTaskListProvider.java index a8db7979b0..2fdbe3e4e7 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/NpcTaskListProvider.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/NpcTaskListProvider.java @@ -4,43 +4,54 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.mojang.datafixers.util.Pair; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.SpawnGroup; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.task.*; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.MobCategory; +import net.minecraft.world.entity.ai.behavior.BehaviorControl; +import net.minecraft.world.entity.ai.behavior.DoNothing; +import net.minecraft.world.entity.ai.behavior.GateBehavior; +import net.minecraft.world.entity.ai.behavior.InteractWith; +import net.minecraft.world.entity.ai.behavior.JumpOnBed; +import net.minecraft.world.entity.ai.behavior.RunOne; +import net.minecraft.world.entity.ai.behavior.SetEntityLookTarget; +import net.minecraft.world.entity.ai.behavior.SetLookAndInteract; +import net.minecraft.world.entity.ai.behavior.SetWalkTargetFromLookTarget; +import net.minecraft.world.entity.ai.behavior.TradeWithVillager; +import net.minecraft.world.entity.ai.behavior.UpdateActivityFromSchedule; +import net.minecraft.world.entity.ai.behavior.VillageBoundRandomStroll; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; import net.sevenstars.middleearth.entity.EntitiesME; public class NpcTaskListProvider { private static final float WALKING_SPEED = 0.4F; - public static ImmutableList>> createIdleTasks(float speed) { + public static ImmutableList>> createIdleTasks(float speed) { return ImmutableList.of( - Pair.of(2, new RandomTask( + Pair.of(2, new RunOne( ImmutableList.of( - Pair.of(FindEntityTask.create(EntitiesME.NPC, 8, MemoryModuleType.INTERACTION_TARGET, speed, 2), 2), - Pair.of(GoToPointOfInterestTask.create(speed), 1), - Pair.of(GoToLookTargetTask.create(speed, 2), 1), - Pair.of(new JumpInBedTask(speed), 1), - Pair.of(new WaitTask(30, 60), 1)))), - Pair.of(3, FindInteractionTargetTask.create(EntityType.PLAYER, 4)), - Pair.of(3, new CompositeTask(ImmutableMap.of(), ImmutableSet.of(MemoryModuleType.INTERACTION_TARGET), CompositeTask.Order.ORDERED, CompositeTask.RunMode.RUN_ONE, - ImmutableList.of(Pair.of(new GatherItemsVillagerTask(), 1)))), - Pair.of(99, ScheduleActivityTask.create())); + Pair.of(InteractWith.of(EntitiesME.NPC, 8, MemoryModuleType.INTERACTION_TARGET, speed, 2), 2), + Pair.of(VillageBoundRandomStroll.create(speed), 1), + Pair.of(SetWalkTargetFromLookTarget.create(speed, 2), 1), + Pair.of(new JumpOnBed(speed), 1), + Pair.of(new DoNothing(30, 60), 1)))), + Pair.of(3, SetLookAndInteract.create(EntityType.PLAYER, 4)), + Pair.of(3, new GateBehavior(ImmutableMap.of(), ImmutableSet.of(MemoryModuleType.INTERACTION_TARGET), GateBehavior.OrderPolicy.ORDERED, GateBehavior.RunningPolicy.RUN_ONE, + ImmutableList.of(Pair.of(new TradeWithVillager(), 1)))), + Pair.of(99, UpdateActivityFromSchedule.create())); } - private static Pair> createFreeFollowTask() { - return Pair.of(5, new RandomTask(ImmutableList.of( - Pair.of(LookAtMobTask.create(EntityType.CAT, 8.0F), 8), - Pair.of(LookAtMobTask.create(EntityType.VILLAGER, 8.0F), 2), - Pair.of(LookAtMobTask.create(EntityType.PLAYER, 8.0F), 2), - Pair.of(LookAtMobTask.create(SpawnGroup.CREATURE, 8.0F), 1), - Pair.of(LookAtMobTask.create(SpawnGroup.WATER_CREATURE, 8.0F), 1), - Pair.of(LookAtMobTask.create(SpawnGroup.AXOLOTLS, 8.0F), 1), - Pair.of(LookAtMobTask.create(SpawnGroup.UNDERGROUND_WATER_CREATURE, 8.0F), 1), - Pair.of(LookAtMobTask.create(SpawnGroup.WATER_AMBIENT, 8.0F), 1), - Pair.of(LookAtMobTask.create(SpawnGroup.MONSTER, 8.0F), 1), - Pair.of(new WaitTask(30, 60), 2)))); + private static Pair> createFreeFollowTask() { + return Pair.of(5, new RunOne(ImmutableList.of( + Pair.of(SetEntityLookTarget.create(EntityType.CAT, 8.0F), 8), + Pair.of(SetEntityLookTarget.create(EntityType.VILLAGER, 8.0F), 2), + Pair.of(SetEntityLookTarget.create(EntityType.PLAYER, 8.0F), 2), + Pair.of(SetEntityLookTarget.create(MobCategory.CREATURE, 8.0F), 1), + Pair.of(SetEntityLookTarget.create(MobCategory.WATER_CREATURE, 8.0F), 1), + Pair.of(SetEntityLookTarget.create(MobCategory.AXOLOTLS, 8.0F), 1), + Pair.of(SetEntityLookTarget.create(MobCategory.UNDERGROUND_WATER_CREATURE, 8.0F), 1), + Pair.of(SetEntityLookTarget.create(MobCategory.WATER_AMBIENT, 8.0F), 1), + Pair.of(SetEntityLookTarget.create(MobCategory.MONSTER, 8.0F), 1), + Pair.of(new DoNothing(30, 60), 2)))); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/data/NpcData.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/data/NpcData.java index 2bd148bd0b..279a829b01 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/data/NpcData.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/data/NpcData.java @@ -2,16 +2,16 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.entity.SpawnReason; -import net.minecraft.network.RegistryByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.registry.Registry; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.core.Registry; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.registries.DynamicRegistriesME; import net.sevenstars.middleearth.resources.datas.common.EntityCategories; import net.sevenstars.middleearth.resources.datas.npc_types.NpcType; @@ -20,11 +20,11 @@ public class NpcData { public static final Codec CODEC; - public static final PacketCodec PACKET_CODEC; + public static final StreamCodec PACKET_CODEC; - private RegistryEntry type; + private Holder type; private EntityCategories category; - private final SpawnReason spawnReason; + private final MobSpawnType spawnReason; private final Optional structureManagerPos; static { @@ -35,22 +35,22 @@ public class NpcData { BlockPos.CODEC.optionalFieldOf("StructureManagerPos").forGetter((data) -> data.structureManagerPos) ).apply(instance, NpcData::new)); - PACKET_CODEC = PacketCodec.tuple( - PacketCodecs.optional(PacketCodecs.registryEntry(DynamicRegistriesME.NPC_TYPE)), NpcData::getOptionalType, - PacketCodecs.optional(PacketCodecs.STRING), NpcData::getOptionalCategory, - PacketCodecs.optional(PacketCodecs.STRING), NpcData::getOptionalSpawnReason, - PacketCodecs.optional(BlockPos.PACKET_CODEC), NpcData::getOptionalStructureManagerPos, + PACKET_CODEC = StreamCodec.composite( + ByteBufCodecs.optional(ByteBufCodecs.holderRegistry(DynamicRegistriesME.NPC_TYPE)), NpcData::getOptionalType, + ByteBufCodecs.optional(ByteBufCodecs.STRING_UTF8), NpcData::getOptionalCategory, + ByteBufCodecs.optional(ByteBufCodecs.STRING_UTF8), NpcData::getOptionalSpawnReason, + ByteBufCodecs.optional(BlockPos.STREAM_CODEC), NpcData::getOptionalStructureManagerPos, NpcData::new); } - public NpcData(Optional> type, Optional category, Optional spawnReason, Optional structureManagerPos) { + public NpcData(Optional> type, Optional category, Optional spawnReason, Optional structureManagerPos) { this.type = type.orElse(null); this.category = category.map(value -> parseEnum(EntityCategories.class, value)).orElse(null); - this.spawnReason = spawnReason.map(value -> parseEnum(SpawnReason.class, value)).orElse(null); + this.spawnReason = spawnReason.map(value -> parseEnum(MobSpawnType.class, value)).orElse(null); this.structureManagerPos = structureManagerPos == null || structureManagerPos.isEmpty() ? Optional.empty() : structureManagerPos; } - public NpcData(RegistryEntry type, EntityCategories category, SpawnReason spawnReason, Optional structureManagerPos) { + public NpcData(Holder type, EntityCategories category, MobSpawnType spawnReason, Optional structureManagerPos) { this.type = type; this.category = category; this.spawnReason = spawnReason; @@ -65,7 +65,7 @@ public NpcData() { } // [BUILDERS] - public NpcData withType(RegistryEntry type) { + public NpcData withType(Holder type) { return new NpcData(type, category, spawnReason, structureManagerPos); } @@ -73,34 +73,39 @@ public NpcData withCategory(EntityCategories category) { return new NpcData(this.type, category, this.spawnReason, this.structureManagerPos); } - public NpcData withSpawnReason(SpawnReason spawnReason) { + public NpcData withSpawnReason(MobSpawnType spawnReason) { return new NpcData(this.type, this.category, spawnReason, this.structureManagerPos); } public NpcData withStructureManagerPos(BlockPos structureManagerPos) { return new NpcData(this.type, this.category, this.spawnReason, Optional.of(structureManagerPos)); } - public NpcData withType(World world, Identifier npcDataIdentifier) { + + public NpcData withoutStructureManagerPos() { + return new NpcData(this.type, this.category, this.spawnReason, Optional.empty()); + } + + public NpcData withType(Level world, ResourceLocation npcDataIdentifier) { if(npcDataIdentifier == null || world == null) return this; - Registry registry = world.getRegistryManager().getOrThrow(DynamicRegistriesME.NPC_TYPE); + Registry registry = world.registryAccess().registryOrThrow(DynamicRegistriesME.NPC_TYPE); NpcType npcType = registry.get(npcDataIdentifier); if(npcType == null) return this; - return this.withType(registry.getEntry(npcType)); + return this.withType(registry.wrapAsHolder(npcType)); } - public Identifier getNpcTypeId() { + public ResourceLocation getNpcTypeId() { if(type == null){ return null; } - return type.getKey() - .map(RegistryKey::getValue) + return type.unwrapKey() + .map(ResourceKey::location) .orElse(null); } - public Identifier getFaction() { + public ResourceLocation getFaction() { if(type == null) return null; return type.value().getFactionIdentifier(); @@ -111,7 +116,7 @@ public EntityCategories getCategory() { return category; } - public SpawnReason getSpawnReason() { + public MobSpawnType getSpawnReason() { return spawnReason; } @@ -121,7 +126,7 @@ public NpcType getNpcType() { return type.value(); } - private Optional> getOptionalType() { + private Optional> getOptionalType() { return type != null ? Optional.of(type) : Optional.empty(); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/data/NpcInitializationData.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/data/NpcInitializationData.java index 3e3b06a22e..4b863eb4ce 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/data/NpcInitializationData.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/data/NpcInitializationData.java @@ -2,14 +2,13 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.network.RegistryByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.registry.Registry; -import net.minecraft.registry.RegistryKey; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.util.Identifier; -import net.minecraft.world.World; +import net.minecraft.core.Holder; +import net.minecraft.core.Registry; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.npcs.NpcEntity; import net.sevenstars.middleearth.registries.DynamicRegistriesME; @@ -22,9 +21,9 @@ public class NpcInitializationData { public static final Codec CODEC; - public static final PacketCodec PACKET_CODEC; + public static final StreamCodec PACKET_CODEC; - private Identifier type; + private ResourceLocation type; private Boolean isRandom; static { @@ -33,9 +32,9 @@ public class NpcInitializationData { Codec.BOOL.optionalFieldOf("IsRandom").forGetter(NpcInitializationData::getOptionalRandom) ).apply(instance, NpcInitializationData::new)); - PACKET_CODEC = PacketCodec.tuple( - PacketCodecs.optional(PacketCodecs.STRING), NpcInitializationData::getOptionalType, - PacketCodecs.optional(PacketCodecs.BOOLEAN), NpcInitializationData::getOptionalRandom, + PACKET_CODEC = StreamCodec.composite( + ByteBufCodecs.optional(ByteBufCodecs.STRING_UTF8), NpcInitializationData::getOptionalType, + ByteBufCodecs.optional(ByteBufCodecs.BOOL), NpcInitializationData::getOptionalRandom, NpcInitializationData::new); } @@ -45,7 +44,7 @@ public NpcInitializationData(Optional type, Optional isRandom) this.isRandom = isRandom == null || isRandom.isEmpty() || isRandom.get() == false ? null : isRandom.get(); } - public NpcInitializationData(Identifier type, Boolean isRandom) { + public NpcInitializationData(ResourceLocation type, Boolean isRandom) { this.type = type; this.isRandom = isRandom; } @@ -55,7 +54,7 @@ public NpcInitializationData() { this.isRandom = null; } - public NpcInitializationData withType(Identifier newType) { + public NpcInitializationData withType(ResourceLocation newType) { return new NpcInitializationData(newType, this.isRandom); } @@ -71,25 +70,27 @@ private Optional getOptionalRandom() { public boolean tryToInitialize(NpcEntity entity) { - World world = entity.getWorld(); + Level world = entity.level(); if(world == null) return false; if(isRandom != null && isRandom){ - Registry registry = world.getRegistryManager().getOrThrow(DynamicRegistriesME.NPC_TYPE); - List> entryList = registry.streamKeys().toList(); + Registry registry = world.registryAccess().registryOrThrow(DynamicRegistriesME.NPC_TYPE); + List entryList = registry.keySet().stream().toList(); + if (entryList.isEmpty()) { + return false; + } Random random = new Random(); - RegistryKey randomKey = entryList.get(random.nextInt(entryList.size())); - this.type = randomKey.getValue(); + this.type = entryList.get(random.nextInt(entryList.size())); this.isRandom = false; } if(type != null){ - Registry registry = world.getRegistryManager().getOrThrow(DynamicRegistriesME.NPC_TYPE); + Registry registry = world.registryAccess().registryOrThrow(DynamicRegistriesME.NPC_TYPE); NpcType npcType = registry.get(type); if(npcType == null) return false; - RegistryEntry entry = registry.getEntry(npcType); + Holder entry = registry.wrapAsHolder(npcType); this.type = null; EntityCategories category = null; if(!npcType.hasCategory(world, category)) diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/data/NpcTextureData.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/data/NpcTextureData.java index 0e0f594d3a..21a3a70003 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/data/NpcTextureData.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/data/NpcTextureData.java @@ -2,83 +2,88 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.network.RegistryByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.util.Identifier; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.npcs.renderer.NpcRenderedPart; import net.sevenstars.middleearth.resources.datas.texture_presets.SimplifiedTexturePreset; public class NpcTextureData { - private Identifier simplifiedSkin; - private Identifier simplifiedEar; - private Identifier simplifiedFeet; - private Identifier simplifiedHair; - private Identifier simplifiedNose; - - private Identifier bodyTexture; - private Identifier feetTexture; - private Identifier headTexture; - private Identifier earTexture; - private Identifier noseTexture; - private Identifier eyeTexture; - private Identifier eyeEmissiveTexture; - private Identifier eyebrowTexture; - private Identifier scarTexture; - private Identifier beardTexture; - private Identifier beardAddonTexture; - private Identifier hairTexture; - private Identifier hairAddonTexture; - private Identifier clothingBaseTexture; - private Identifier clothingOverTexture; - private Identifier clothingExtraTexture; + private ResourceLocation simplifiedSkin; + private ResourceLocation simplifiedEar; + private ResourceLocation simplifiedFeet; + private ResourceLocation simplifiedHair; + private ResourceLocation simplifiedNose; + + private ResourceLocation bodyTexture; + private ResourceLocation feetTexture; + private ResourceLocation headTexture; + private ResourceLocation earTexture; + private ResourceLocation noseTexture; + private ResourceLocation eyeTexture; + private ResourceLocation eyeEmissiveTexture; + private ResourceLocation eyebrowTexture; + private ResourceLocation scarTexture; + private ResourceLocation beardTexture; + private ResourceLocation beardAddonTexture; + private ResourceLocation hairTexture; + private ResourceLocation hairAddonTexture; + private ResourceLocation clothingBaseTexture; + private ResourceLocation clothingOverTexture; + private ResourceLocation clothingExtraTexture; private Boolean eyeIsEmissive; public static final Codec CODEC = RecordCodecBuilder.create((instance) -> instance.group( - NbtCompound.CODEC.fieldOf("dynamic").forGetter(NpcTextureData::writeDynamic), - NbtCompound.CODEC.fieldOf("simplified").forGetter(NpcTextureData::writeSimplified) + CompoundTag.CODEC.fieldOf("dynamic").forGetter(NpcTextureData::writeDynamic), + CompoundTag.CODEC.fieldOf("simplified").forGetter(NpcTextureData::writeSimplified) ).apply(instance, NpcTextureData::new)); - public static final PacketCodec PACKET_CODEC; + public static final StreamCodec PACKET_CODEC; - public NpcTextureData(NbtCompound dynamic, NbtCompound simplified) + public NpcTextureData(CompoundTag dynamic, CompoundTag simplified) { - this.simplifiedSkin = MiddleEarth.fetchId(simplified.getString("skin", null)); - this.simplifiedEar = MiddleEarth.fetchId(simplified.getString("ear", null)); - this.simplifiedFeet = MiddleEarth.fetchId(simplified.getString("feet", null)); - this.simplifiedHair = MiddleEarth.fetchId(simplified.getString("hair", null)); - this.simplifiedNose = MiddleEarth.fetchId(simplified.getString("nose", null)); + this.simplifiedSkin = MiddleEarth.fetchId(getString(simplified, "skin")); + this.simplifiedEar = MiddleEarth.fetchId(getString(simplified, "ear")); + this.simplifiedFeet = MiddleEarth.fetchId(getString(simplified, "feet")); + this.simplifiedHair = MiddleEarth.fetchId(getString(simplified, "hair")); + this.simplifiedNose = MiddleEarth.fetchId(getString(simplified, "nose")); - this.bodyTexture = MiddleEarth.fetchId(dynamic.getString(NpcRenderedPart.BODY.getField(), null)); - this.headTexture = MiddleEarth.fetchId(dynamic.getString(NpcRenderedPart.HEAD.getField(), null)); - this.feetTexture = MiddleEarth.fetchId(dynamic.getString(NpcRenderedPart.FEET.getField(), null)); + this.bodyTexture = MiddleEarth.fetchId(getString(dynamic, NpcRenderedPart.BODY.getField())); + this.headTexture = MiddleEarth.fetchId(getString(dynamic, NpcRenderedPart.HEAD.getField())); + this.feetTexture = MiddleEarth.fetchId(getString(dynamic, NpcRenderedPart.FEET.getField())); - this.earTexture = MiddleEarth.fetchId(dynamic.getString(NpcRenderedPart.EAR.getField(), null)); - this.noseTexture = MiddleEarth.fetchId(dynamic.getString(NpcRenderedPart.NOSE.getField(), null)); + this.earTexture = MiddleEarth.fetchId(getString(dynamic, NpcRenderedPart.EAR.getField())); + this.noseTexture = MiddleEarth.fetchId(getString(dynamic, NpcRenderedPart.NOSE.getField())); - this.scarTexture = MiddleEarth.fetchId(dynamic.getString(NpcRenderedPart.SCAR.getField(), null)); - this.eyeTexture = MiddleEarth.fetchId(dynamic.getString(NpcRenderedPart.EYE.getField(), null)); - this.eyeEmissiveTexture = MiddleEarth.fetchId(dynamic.getString(NpcRenderedPart.EYE_EMISSIVE.getField(), null)); - this.eyeIsEmissive = dynamic.getBoolean(NpcRenderedPart.EYE_EMISSIVE_TOGGLE.getField(), false); + this.scarTexture = MiddleEarth.fetchId(getString(dynamic, NpcRenderedPart.SCAR.getField())); + this.eyeTexture = MiddleEarth.fetchId(getString(dynamic, NpcRenderedPart.EYE.getField())); + this.eyeEmissiveTexture = MiddleEarth.fetchId(getString(dynamic, NpcRenderedPart.EYE_EMISSIVE.getField())); + this.eyeIsEmissive = dynamic.getBoolean(NpcRenderedPart.EYE_EMISSIVE_TOGGLE.getField()); - this.hairTexture = MiddleEarth.fetchId(dynamic.getString(NpcRenderedPart.HAIR.getField(), null)); - this.hairAddonTexture = MiddleEarth.fetchId(dynamic.getString(NpcRenderedPart.HAIR_ADDON.getField(), null)); + this.hairTexture = MiddleEarth.fetchId(getString(dynamic, NpcRenderedPart.HAIR.getField())); + this.hairAddonTexture = MiddleEarth.fetchId(getString(dynamic, NpcRenderedPart.HAIR_ADDON.getField())); - this.eyebrowTexture = MiddleEarth.fetchId(dynamic.getString(NpcRenderedPart.EYEBROW.getField(), null)); + this.eyebrowTexture = MiddleEarth.fetchId(getString(dynamic, NpcRenderedPart.EYEBROW.getField())); - this.beardTexture = MiddleEarth.fetchId(dynamic.getString(NpcRenderedPart.BEARD.getField(), null)); - this.beardAddonTexture = MiddleEarth.fetchId(dynamic.getString(NpcRenderedPart.BEARD_ADDON.getField(), null)); + this.beardTexture = MiddleEarth.fetchId(getString(dynamic, NpcRenderedPart.BEARD.getField())); + this.beardAddonTexture = MiddleEarth.fetchId(getString(dynamic, NpcRenderedPart.BEARD_ADDON.getField())); - this.clothingBaseTexture = MiddleEarth.fetchId(dynamic.getString(NpcRenderedPart.CLOTHING_BASE.getField(), null)); - this.clothingOverTexture = MiddleEarth.fetchId(dynamic.getString(NpcRenderedPart.CLOTHING_OVER.getField(), null)); - this.clothingExtraTexture = MiddleEarth.fetchId(dynamic.getString(NpcRenderedPart.CLOTHING_EXTRA.getField(), null)); + this.clothingBaseTexture = MiddleEarth.fetchId(getString(dynamic, NpcRenderedPart.CLOTHING_BASE.getField())); + this.clothingOverTexture = MiddleEarth.fetchId(getString(dynamic, NpcRenderedPart.CLOTHING_OVER.getField())); + this.clothingExtraTexture = MiddleEarth.fetchId(getString(dynamic, NpcRenderedPart.CLOTHING_EXTRA.getField())); } - private NbtCompound writeSimplified() { - NbtCompound nbt = new NbtCompound(); + private static String getString(CompoundTag tag, String key) { + return tag.contains(key, Tag.TAG_STRING) ? tag.getString(key) : null; + } + + private CompoundTag writeSimplified() { + CompoundTag nbt = new CompoundTag(); if(simplifiedSkin != null) nbt.putString("skin", simplifiedSkin.toString()); if(simplifiedEar != null) @@ -92,8 +97,8 @@ private NbtCompound writeSimplified() { return nbt; } - private NbtCompound writeDynamic() { - NbtCompound nbt = new NbtCompound(); + private CompoundTag writeDynamic() { + CompoundTag nbt = new CompoundTag(); if(bodyTexture != null) nbt.putString(NpcRenderedPart.BODY.getField(), bodyTexture.toString()); if(headTexture != null) @@ -154,70 +159,70 @@ public void withSimplifiedPreset(SimplifiedTexturePreset preset) { this.simplifiedNose = preset.nose; } - public NpcTextureData withSkinTexture(Identifier texture){ + public NpcTextureData withSkinTexture(ResourceLocation texture){ this.bodyTexture = texture; return this; } - public NpcTextureData withHeadTexture(Identifier texture){ + public NpcTextureData withHeadTexture(ResourceLocation texture){ this.headTexture = texture; return this; } - public NpcTextureData withFeetTexture(Identifier texture){ + public NpcTextureData withFeetTexture(ResourceLocation texture){ this.feetTexture = texture; return this; } - public NpcTextureData withScarTexture(Identifier texture){ + public NpcTextureData withScarTexture(ResourceLocation texture){ this.scarTexture = texture; return this; } - public NpcTextureData withEarTexture(Identifier texture){ + public NpcTextureData withEarTexture(ResourceLocation texture){ this.earTexture = texture; return this; } - public NpcTextureData withNoseTexture(Identifier texture){ + public NpcTextureData withNoseTexture(ResourceLocation texture){ this.noseTexture = texture; return this; } - public NpcTextureData withEyeTexture(Identifier eyeTexture, Identifier eyeEmissiveTexture, Boolean isEmissive){ + public NpcTextureData withEyeTexture(ResourceLocation eyeTexture, ResourceLocation eyeEmissiveTexture, Boolean isEmissive){ this.eyeTexture = eyeTexture; this.eyeEmissiveTexture = eyeEmissiveTexture; this.eyeIsEmissive = isEmissive; return this; } - public NpcTextureData withHairTexture(Identifier texture){ + public NpcTextureData withHairTexture(ResourceLocation texture){ this.hairTexture = texture; return this; } - public NpcTextureData withHairAddonTexture(Identifier texture){ + public NpcTextureData withHairAddonTexture(ResourceLocation texture){ this.hairAddonTexture = texture; return this; } - public NpcTextureData withEyebrowTexture(Identifier texture){ + public NpcTextureData withEyebrowTexture(ResourceLocation texture){ this.eyebrowTexture = texture; return this; } - public NpcTextureData withBeardTexture(Identifier texture){ + public NpcTextureData withBeardTexture(ResourceLocation texture){ this.beardTexture = texture; return this; } - public NpcTextureData withBeardAddonTexture(Identifier texture){ + public NpcTextureData withBeardAddonTexture(ResourceLocation texture){ this.beardAddonTexture = texture; return this; } - public NpcTextureData withClothingTexture(Identifier textureBase, Identifier textureOver, Identifier textureExtra){ + public NpcTextureData withClothingTexture(ResourceLocation textureBase, ResourceLocation textureOver, ResourceLocation textureExtra){ this.clothingBaseTexture = textureBase; this.clothingOverTexture = textureOver; this.clothingExtraTexture = textureExtra; return this; } - public Identifier get(NpcRenderedPart part){ + public ResourceLocation get(NpcRenderedPart part){ return switch (part){ case BODY -> bodyTexture; case HEAD -> headTexture; @@ -243,9 +248,9 @@ public Boolean isEyeEmissive() { return this.eyeIsEmissive; } static { - PACKET_CODEC = PacketCodec.tuple( - PacketCodecs.NBT_COMPOUND, NpcTextureData::writeDynamic, - PacketCodecs.NBT_COMPOUND, NpcTextureData::writeSimplified, + PACKET_CODEC = StreamCodec.composite( + ByteBufCodecs.COMPOUND_TAG, NpcTextureData::writeDynamic, + ByteBufCodecs.COMPOUND_TAG, NpcTextureData::writeSimplified, NpcTextureData::new); } @@ -253,23 +258,23 @@ public boolean needToBeRefreshed() { return get(NpcRenderedPart.BODY) == null; } - public Identifier getSimplifiedSkin() { + public ResourceLocation getSimplifiedSkin() { return this.simplifiedSkin; } - public Identifier getSimplifiedEar() { + public ResourceLocation getSimplifiedEar() { return this.simplifiedEar; } - public Identifier getSimplifiedFeet() { + public ResourceLocation getSimplifiedFeet() { return this.simplifiedFeet; } - public Identifier getSimplifiedHair() { + public ResourceLocation getSimplifiedHair() { return this.simplifiedHair; } - public Identifier getSimplifiedNose() { + public ResourceLocation getSimplifiedNose() { return this.simplifiedNose; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcEntityBuilder.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcEntityBuilder.java index ab129cac49..7765d1672d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcEntityBuilder.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcEntityBuilder.java @@ -1,8 +1,8 @@ package net.sevenstars.middleearth.entity.npcs.initializer; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.entity.EntitiesME; import net.sevenstars.middleearth.entity.npcs.NpcEntity; import net.sevenstars.middleearth.resources.datas.npc_types.NpcTypeLookup; @@ -10,16 +10,16 @@ public class NpcEntityBuilder { NpcEntity entity; - World world; + Level world; - public NpcEntityBuilder(World world, @Nullable BlockPos pos){ + public NpcEntityBuilder(Level world, @Nullable BlockPos pos){ this.world = world; this.entity = new NpcEntity(EntitiesME.NPC, this.world); if(pos != null) - this.entity.setPosition(pos.toCenterPos()); + this.entity.setPos(pos.getCenter()); } - public NpcEntityBuilder withNpcType(Identifier identifier) { + public NpcEntityBuilder withNpcType(ResourceLocation identifier) { this.entity.prepareNpcIdentifier(identifier); return this; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcEntityInitializer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcEntityInitializer.java index aad679a1da..00e81a267f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcEntityInitializer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcEntityInitializer.java @@ -1,25 +1,15 @@ package net.sevenstars.middleearth.entity.npcs.initializer; -import net.minecraft.block.BedBlock; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EquipmentHolder; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.SpawnReason; -import net.minecraft.entity.passive.AbstractHorseEntity; -import net.minecraft.entity.passive.HorseEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.registry.DynamicRegistryManager; -import net.minecraft.registry.Registry; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.structure.StructureStart; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.gen.structure.Structure; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.block.BedBlock; +import net.minecraft.world.level.levelgen.structure.Structure; +import net.minecraft.world.level.levelgen.structure.StructureStart; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.beasts.AbstractBeastEntity; import net.sevenstars.middleearth.entity.npcs.NpcEntity; @@ -29,15 +19,16 @@ import net.sevenstars.middleearth.resources.datas.npc_types.NpcType; import java.util.List; -import java.util.Optional; public class NpcEntityInitializer { - public static void initializeNpcEntity(ServerWorld serverWorld, NpcEntity npcEntity){ + public static final ResourceLocation RANDOM = MiddleEarth.of("full_random"); + + public static void initializeNpcEntity(ServerLevel serverWorld, NpcEntity npcEntity){ initializeForServer(serverWorld, npcEntity); } - private static void initializeForServer(ServerWorld serverWorld, NpcEntity npcEntity){ - Identifier npcTypeId = npcEntity.getNpcTypeIdentifier(); + private static void initializeForServer(ServerLevel serverWorld, NpcEntity npcEntity){ + ResourceLocation npcTypeId = npcEntity.getNpcTypeIdentifier(); if(!NpcEntityInitializerUtil.characterIdentifierExist(serverWorld, npcTypeId)) { BiomeEventData.ContextualizedBiomeData contextualizedBiomeData = null; @@ -63,15 +54,15 @@ private static void initializeForServer(ServerWorld serverWorld, NpcEntity npcEn npcEntity.updateTargetGoals(); } - private static BiomeEventData.ContextualizedBiomeData findContextualizedNpcData(ServerWorld world, NpcEntity npcEntity) { - BlockPos blockPos = npcEntity.getBlockPos(); - RegistryEntry biome = world.getBiome(blockPos); - Registry structureRegistry = world.getRegistryManager().getOrThrow(RegistryKeys.STRUCTURE); - List structureStarts = world.getStructureAccessor().getStructureStarts(world.getChunk(blockPos).getPos(), s -> true); + private static BiomeEventData.ContextualizedBiomeData findContextualizedNpcData(ServerLevel world, NpcEntity npcEntity) { + BlockPos blockPos = npcEntity.blockPosition(); + Holder biome = world.getBiome(blockPos); + Registry structureRegistry = world.registryAccess().registryOrThrow(Registries.STRUCTURE); + List structureStarts = world.structureManager().startsForStructure(world.getChunk(blockPos).getPos(), s -> true); for (StructureStart structureStart : structureStarts) { Structure structure = structureStart.getStructure(); - Identifier structureId = structureRegistry.getId(structure); + ResourceLocation structureId = structureRegistry.getKey(structure); BiomeEventData.ContextualizedBiomeData contextualizedBiomeData = BiomeEventDataLookup.findNpcDataForStructure(world, structureId, npcEntity); if(contextualizedBiomeData != null){ return contextualizedBiomeData; @@ -81,17 +72,25 @@ private static BiomeEventData.ContextualizedBiomeData findContextualizedNpcData( return BiomeEventDataLookup.findNpcDataForBiome(world, biome, npcEntity); } - public static boolean shouldInitialize(ServerWorld serverWorld, NpcEntity npcEntity){ - Identifier currentNpcDataId = npcEntity.getNpcTypeIdentifier(); + + public static boolean shouldInitialize(ServerLevel serverWorld, NpcEntity npcEntity){ + ResourceLocation currentNpcDataId = npcEntity.getNpcTypeIdentifier(); if(currentNpcDataId == null) return true; - DynamicRegistryManager registryManager = serverWorld.getRegistryManager(); - Optional> optionalEntry = registryManager.getOptional(DynamicRegistriesME.NPC_TYPE).get().getEntry(currentNpcDataId); - - if(!npcEntity.hasTextureData()) return true; - return optionalEntry.isEmpty(); + Registry registry = serverWorld.registryAccess().registryOrThrow(DynamicRegistriesME.NPC_TYPE); + return !registry.containsKey(currentNpcDataId); + } + + public static boolean assignBedToNpc(NpcEntity npcEntity, BedBlock bedBlock){ + return true; + } + + public static void initializeNpcForCurrentData(NpcEntity npcEntity, ServerLevel serverWorld) { + boolean shouldRefreshVisuals = npcEntity.shouldRefreshVisuals(); + if(shouldRefreshVisuals) + NpcGenerator.generateCharacterTextures(serverWorld, npcEntity); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcEntityInitializerClient.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcEntityInitializerClient.java index dc5b704e57..31961e4d92 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcEntityInitializerClient.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcEntityInitializerClient.java @@ -1,16 +1,15 @@ package net.sevenstars.middleearth.entity.npcs.initializer; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.util.Identifier; -import net.minecraft.world.World; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.entity.npcs.NpcEntity; public class NpcEntityInitializerClient { - public static void initializeNpcEntity(ClientWorld clientWorld, NpcEntity npcEntity){ + public static void initializeNpcEntity(ClientLevel clientWorld, NpcEntity npcEntity){ initializeForClient(clientWorld, npcEntity); } - private static void initializeForClient(World clientWorld, NpcEntity npcEntity) { + private static void initializeForClient(Level clientWorld, NpcEntity npcEntity) { if(NpcEntityInitializerUtil.characterIdentifierExist(clientWorld, npcEntity.getNpcTypeIdentifier())){ NpcGenerator.generateCharacterTextures(clientWorld, npcEntity); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcEntityInitializerUtil.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcEntityInitializerUtil.java index 13a4a0637c..6bcdb58df6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcEntityInitializerUtil.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcEntityInitializerUtil.java @@ -1,17 +1,14 @@ package net.sevenstars.middleearth.entity.npcs.initializer; -import net.minecraft.registry.DynamicRegistryManager; -import net.minecraft.util.Identifier; -import net.minecraft.world.World; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.registries.DynamicRegistriesME; import net.sevenstars.middleearth.resources.datas.npc_types.NpcType; public class NpcEntityInitializerUtil { - public static boolean characterIdentifierExist(World world, Identifier typeId){ + public static boolean characterIdentifierExist(Level world, ResourceLocation typeId){ if(typeId == null) return false; - DynamicRegistryManager registryManager = world.getRegistryManager(); - NpcType type = registryManager.getOrThrow(DynamicRegistriesME.NPC_TYPE).get(typeId); - return type != null; + return world.registryAccess().registryOrThrow(DynamicRegistriesME.NPC_TYPE).containsKey(typeId); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcGenerator.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcGenerator.java index ec43a4ad21..d28bb4afde 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcGenerator.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcGenerator.java @@ -1,10 +1,10 @@ package net.sevenstars.middleearth.entity.npcs.initializer; -import net.minecraft.registry.DynamicRegistryManager; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.Identifier; -import net.minecraft.world.World; +import net.minecraft.core.Holder; +import net.minecraft.core.RegistryAccess; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.npcs.NpcEntity; import net.sevenstars.middleearth.entity.npcs.data.NpcTextureData; @@ -21,10 +21,10 @@ import java.util.Optional; public class NpcGenerator { - public static void generateCharacterTextures(World world, NpcEntity npcEntity) { + public static void generateCharacterTextures(Level world, NpcEntity npcEntity) { // Get npc data String currentStep = "Fetching datas"; - Identifier currentNpcTypeId = npcEntity.getNpcTypeIdentifier(); + ResourceLocation currentNpcTypeId = npcEntity.getNpcTypeIdentifier(); try{ currentStep = "Aligning data with npc entity..."; @@ -49,7 +49,7 @@ public static void generateCharacterTextures(World world, NpcEntity npcEntity) { currentStep = "Generating eyes..."; entityTextureData = generateEyeTextureData(entityTextureData, identity, currentNpcType.getNpcTextureData(world).haveEmissiveEyes(identity)); currentStep = "Generating hair..."; - entityTextureData = generateHairTextureData(entityTextureData, identity, world.getRegistryManager()); + entityTextureData = generateHairTextureData(entityTextureData, identity, world.registryAccess()); currentStep = "Generating clothing..."; entityTextureData = generateClothingTextureData(entityTextureData, identity); npcEntity.saveNpcTextureData(entityTextureData); @@ -64,7 +64,7 @@ public static void generateCharacterTextures(World world, NpcEntity npcEntity) { } private static void spawnMount(NpcEntity entity) { - if(entity.getWorld() instanceof ServerWorld serverWorld) + if(entity.level() instanceof ServerLevel serverWorld) { NpcType type = entity.getNpcType(); if(type == null || !type.hasMount()) @@ -75,13 +75,13 @@ private static void spawnMount(NpcEntity entity) { } public static NpcTextureData generateSkinTextureData(NpcTextureData npcTextureData, TexturePresetDataPool.Identity textureIdentity) { - Identifier materialId = TexturePresetDataPool.getRawMaterial(textureIdentity, CharacterMaterialTypes.SKIN); - Identifier bodyPatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.BODY); - Identifier headPatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.HEAD); - Identifier feetPatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.FEET); - Identifier earPatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.EAR); - Identifier nosePatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.NOSE); - Identifier scarPatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.SCAR); + ResourceLocation materialId = TexturePresetDataPool.getRawMaterial(textureIdentity, CharacterMaterialTypes.SKIN); + ResourceLocation bodyPatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.BODY); + ResourceLocation headPatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.HEAD); + ResourceLocation feetPatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.FEET); + ResourceLocation earPatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.EAR); + ResourceLocation nosePatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.NOSE); + ResourceLocation scarPatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.SCAR); npcTextureData = npcTextureData.withSkinTexture(TexturePresetDataPool.buildId(bodyPatternId, materialId)); npcTextureData = npcTextureData.withHeadTexture(TexturePresetDataPool.buildId(headPatternId, materialId)); @@ -104,20 +104,20 @@ public static NpcTextureData generateSkinTextureData(NpcTextureData npcTextureDa } public static NpcTextureData generateEyeTextureData(NpcTextureData npcTextureData, TexturePresetDataPool.Identity textureIdentity, boolean haveEmissiveEyes) { - Identifier materialId = TexturePresetDataPool.getRawMaterial(textureIdentity, CharacterMaterialTypes.EYE); - Identifier patternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.EYE); + ResourceLocation materialId = TexturePresetDataPool.getRawMaterial(textureIdentity, CharacterMaterialTypes.EYE); + ResourceLocation patternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.EYE); - npcTextureData = npcTextureData.withEyeTexture(TexturePresetDataPool.buildId(patternId, materialId), TexturePresetDataPool.buildId(Identifier.of(patternId.getPath() + "_emissive"), materialId), haveEmissiveEyes); + npcTextureData = npcTextureData.withEyeTexture(TexturePresetDataPool.buildId(patternId, materialId), TexturePresetDataPool.buildId(ResourceLocation.parse(patternId.getPath() + "_emissive"), materialId), haveEmissiveEyes); return npcTextureData; } - public static NpcTextureData generateHairTextureData(NpcTextureData npcTextureData, TexturePresetDataPool.Identity textureIdentity, DynamicRegistryManager manager) { - Identifier globalHairMaterialId = TexturePresetDataPool.getRawMaterial(textureIdentity, CharacterMaterialTypes.HAIR); + public static NpcTextureData generateHairTextureData(NpcTextureData npcTextureData, TexturePresetDataPool.Identity textureIdentity, RegistryAccess manager) { + ResourceLocation globalHairMaterialId = TexturePresetDataPool.getRawMaterial(textureIdentity, CharacterMaterialTypes.HAIR); // Hair - Identifier hairPatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.HAIR); - Optional> foundHairPattern = CharacterPatternsRegistryME.get(manager, CharacterPatternTypes.HAIR, hairPatternId); + ResourceLocation hairPatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.HAIR); + Optional> foundHairPattern = CharacterPatternsRegistryME.get(manager, CharacterPatternTypes.HAIR, hairPatternId); if(foundHairPattern.isPresent() && foundHairPattern.get().value() instanceof CharacterTexturePattern pattern){ npcTextureData = npcTextureData.withHairTexture(TexturePresetDataPool.buildId(hairPatternId, globalHairMaterialId)); if(pattern.hasAddonRawValue()){ @@ -125,14 +125,14 @@ public static NpcTextureData generateHairTextureData(NpcTextureData npcTextureDa } } // Eyebrow - Identifier eyebrowPatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.EYEBROW); - Optional> foundEyebrowPattern = CharacterPatternsRegistryME.get(manager, CharacterPatternTypes.EYEBROW, eyebrowPatternId); + ResourceLocation eyebrowPatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.EYEBROW); + Optional> foundEyebrowPattern = CharacterPatternsRegistryME.get(manager, CharacterPatternTypes.EYEBROW, eyebrowPatternId); if(foundEyebrowPattern.isPresent()){ npcTextureData = npcTextureData.withEyebrowTexture(TexturePresetDataPool.buildId(eyebrowPatternId, globalHairMaterialId)); } // Beard - Identifier beardPatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.BEARD); - Optional> foundBeardPattern = CharacterPatternsRegistryME.get(manager, CharacterPatternTypes.BEARD, beardPatternId); + ResourceLocation beardPatternId = TexturePresetDataPool.getRawPattern(textureIdentity, CharacterPatternTypes.BEARD); + Optional> foundBeardPattern = CharacterPatternsRegistryME.get(manager, CharacterPatternTypes.BEARD, beardPatternId); if(foundBeardPattern.isPresent() && foundBeardPattern.get().value() instanceof CharacterTexturePattern pattern){ npcTextureData = npcTextureData.withBeardTexture(TexturePresetDataPool.buildId(beardPatternId, globalHairMaterialId)); if(pattern.hasAddonRawValue()){ diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcSpawnEggHelper.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcSpawnEggHelper.java index 97f1b2f1d9..72ee90123b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcSpawnEggHelper.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/initializer/NpcSpawnEggHelper.java @@ -1,19 +1,17 @@ package net.sevenstars.middleearth.entity.npcs.initializer; -import net.minecraft.client.MinecraftClient; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.CustomModelDataComponent; -import net.minecraft.component.type.NbtComponent; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtElement; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponents; +import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtOps; -import net.minecraft.registry.DynamicRegistryManager; -import net.minecraft.registry.RegistryOps; -import net.minecraft.registry.RegistryWrapper; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.minecraft.world.World; +import net.minecraft.nbt.Tag; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.RegistryOps; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.CustomData; +import net.minecraft.world.item.component.CustomModelData; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.npcs.NpcEntity; import net.sevenstars.middleearth.entity.npcs.data.NpcInitializationData; @@ -24,53 +22,51 @@ import net.sevenstars.middleearth.registries.DynamicRegistriesME; import net.sevenstars.middleearth.resources.datas.npc_types.NpcType; -import java.util.List; - public class NpcSpawnEggHelper { - public static ItemStack getSpawnEgg(NpcType npcType, RegistryWrapper.WrapperLookup wrapper) { + public static ItemStack getSpawnEgg(NpcType npcType, HolderLookup.Provider wrapper) { if(npcType == null) return ItemStack.EMPTY; return buildItemStackBasedOnNpcData(npcType, wrapper); } - public static ItemStack getSpawnEgg(World world, Identifier identifier) { - NpcType npcType = world.getRegistryManager().getOrThrow(DynamicRegistriesME.NPC_TYPE).get(identifier); - RegistryWrapper.WrapperLookup wrapperLookup = world.getRegistryManager(); + public static ItemStack getSpawnEgg(Level world, ResourceLocation identifier) { + NpcType npcType = world.registryAccess().registryOrThrow(DynamicRegistriesME.NPC_TYPE).get(identifier); + HolderLookup.Provider wrapperLookup = world.registryAccess(); return buildItemStackBasedOnNpcData(npcType, wrapperLookup); } - private static ItemStack buildItemStackBasedOnNpcData(NpcType npcType, RegistryWrapper.WrapperLookup wrapper) { + private static ItemStack buildItemStackBasedOnNpcData(NpcType npcType, HolderLookup.Provider wrapper) { if(npcType == null) return ItemStack.EMPTY; - Identifier itemId = MiddleEarth.append(npcType.getId(), "_spawn_egg"); + ResourceLocation itemId = MiddleEarth.append(npcType.getId(), "_spawn_egg"); ItemStack itemStack = new ItemStack(EggItemsME.NPC_SPAWN_EGG); - NbtCompound compoundData = new NbtCompound(); + CompoundTag compoundData = new CompoundTag(); compoundData.putString("id", MiddleEarth.of("npc").toString()); NpcInitializationData npcInitializationData = new NpcInitializationData(npcType.getId(), false); - RegistryOps ops = RegistryOps.of( + RegistryOps ops = RegistryOps.create( NbtOps.INSTANCE, wrapper ); - NbtElement element = NpcInitializationData.CODEC + Tag element = NpcInitializationData.CODEC .encodeStart(ops, npcInitializationData) .getOrThrow(); compoundData.put(NpcEntity.KeyStrings.INITIALIZATION_DATA, element); - itemStack.set(DataComponentTypes.ENTITY_DATA, NbtComponent.of(compoundData)); + itemStack.set(DataComponents.ENTITY_DATA, CustomData.of(compoundData)); itemStack.set(DataComponentTypesME.FACTION_DATA, new FactionDataComponent(npcType.getFactionIdentifier())); itemStack.set(DataComponentTypesME.RACE_DATA, new RaceDataComponent(npcType.getRace())); - itemStack.set(DataComponentTypes.ITEM_NAME, Text.translatable(itemId.toTranslationKey("item"))); - itemStack.set(DataComponentTypes.CUSTOM_MODEL_DATA, new CustomModelDataComponent( - List.of(), - List.of(), - List.of(npcType.getId().getPath().replaceAll("\\.", "_") + "_spawn_egg"), - List.of())); + itemStack.set(DataComponents.ITEM_NAME, Component.translatable(itemId.toLanguageKey("item"))); + itemStack.set(DataComponents.CUSTOM_MODEL_DATA, new CustomModelData(getCustomModelData(npcType.getId()))); return itemStack; } + + public static int getCustomModelData(ResourceLocation npcTypeId) { + return (npcTypeId.toString().hashCode() & 0x007fffff) + 1; + } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/NpcEntityModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/NpcEntityModel.java index 1944da62d1..1053abc42e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/NpcEntityModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/NpcEntityModel.java @@ -1,16 +1,20 @@ package net.sevenstars.middleearth.entity.npcs.renderer; import net.minecraft.client.model.*; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Arm; -import net.minecraft.util.Util; -import net.minecraft.util.math.random.Random; - +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.world.entity.HumanoidArm; +import net.sevenstars.middleearth.entity.npcs.NpcEntity; +import com.mojang.blaze3d.vertex.PoseStack; import java.util.List; -public class NpcEntityModel extends BipedEntityModel { +public class NpcEntityModel extends HumanoidModel { private static final String LEFT_SLEEVE = "left_sleeve"; private static final String RIGHT_SLEEVE = "right_sleeve"; private static final String LEFT_PANTS = "left_pants"; @@ -23,7 +27,7 @@ public class NpcEntityModel extends BipedEntityModel { public final ModelPart jacket; public NpcEntityModel(ModelPart modelPart) { - super(modelPart, RenderLayer::getEntityTranslucent); + super(modelPart, RenderType::entityTranslucent); this.leftSleeve = this.leftArm.getChild("left_sleeve"); this.rightSleeve = this.rightArm.getChild("right_sleeve"); this.leftPants = this.leftLeg.getChild("left_pants"); @@ -32,32 +36,37 @@ public NpcEntityModel(ModelPart modelPart) { this.parts = List.of(this.head, this.body, this.leftArm, this.rightArm, this.leftLeg, this.rightLeg); } - public static TexturedModelData getTexturedModelData(Dilation dilation) { - ModelData modelData = BipedEntityModel.getModelData(dilation, 0.0F); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData modelPartData2; - ModelPartData modelPartData3; + public static LayerDefinition getTexturedModelData(CubeDeformation dilation) { + MeshDefinition modelData = HumanoidModel.createMesh(dilation, 0.0F); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition modelPartData2; + PartDefinition modelPartData3; - modelPartData2 = modelPartData.addChild("left_arm", ModelPartBuilder.create().uv(32, 48).cuboid(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, dilation), ModelTransform.origin(5.0F, 2.0F, 0.0F)); + modelPartData2 = modelPartData.addOrReplaceChild("left_arm", CubeListBuilder.create().texOffs(32, 48).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, dilation), PartPose.offset(5.0F, 2.0F, 0.0F)); modelPartData3 = modelPartData.getChild("right_arm"); - modelPartData2.addChild(LEFT_SLEEVE, ModelPartBuilder.create().uv(48, 48).cuboid(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, dilation.add(0.25F)), ModelTransform.NONE); - modelPartData3.addChild(RIGHT_SLEEVE, ModelPartBuilder.create().uv(40, 32).cuboid(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, dilation.add(0.25F)), ModelTransform.NONE); + modelPartData2.addOrReplaceChild(LEFT_SLEEVE, CubeListBuilder.create().texOffs(48, 48).addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, dilation.extend(0.25F)), PartPose.ZERO); + modelPartData3.addOrReplaceChild(RIGHT_SLEEVE, CubeListBuilder.create().texOffs(40, 32).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, dilation.extend(0.25F)), PartPose.ZERO); - modelPartData2 = modelPartData.addChild("left_leg", ModelPartBuilder.create().uv(16, 48).cuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, dilation), ModelTransform.origin(1.9F, 12.0F, 0.0F)); + modelPartData2 = modelPartData.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(16, 48).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, dilation), PartPose.offset(1.9F, 12.0F, 0.0F)); modelPartData3 = modelPartData.getChild("right_leg"); - modelPartData2.addChild(LEFT_PANTS, ModelPartBuilder.create().uv(0, 48).cuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, dilation.add(0.25F)), ModelTransform.NONE); - modelPartData3.addChild(RIGHT_PANTS, ModelPartBuilder.create().uv(0, 32).cuboid(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, dilation.add(0.25F)), ModelTransform.NONE); - ModelPartData modelPartData4 = modelPartData.getChild("body"); - modelPartData4.addChild("jacket", ModelPartBuilder.create().uv(16, 32).cuboid(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, dilation.add(0.25F)), ModelTransform.NONE); - return TexturedModelData.of(modelData, 64, 64); + modelPartData2.addOrReplaceChild(LEFT_PANTS, CubeListBuilder.create().texOffs(0, 48).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, dilation.extend(0.25F)), PartPose.ZERO); + modelPartData3.addOrReplaceChild(RIGHT_PANTS, CubeListBuilder.create().texOffs(0, 32).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, dilation.extend(0.25F)), PartPose.ZERO); + PartDefinition modelPartData4 = modelPartData.getChild("body"); + modelPartData4.addOrReplaceChild("jacket", CubeListBuilder.create().texOffs(16, 32).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, dilation.extend(0.25F)), PartPose.ZERO); + return LayerDefinition.create(modelData, 64, 64); } - public void setAngles(NpcEntityRenderState renderState) { - super.setAngles(renderState); + public void setupAnim(NpcEntity entity, float limbSwing, float limbSwingAmount, + float ageInTicks, float netHeadYaw, float headPitch) { + this.leftArmPose = NpcEntityRenderer.getArmPose( + entity, entity.getOffhandItem(), net.minecraft.world.InteractionHand.OFF_HAND); + this.rightArmPose = NpcEntityRenderer.getArmPose( + entity, entity.getMainHandItem(), net.minecraft.world.InteractionHand.MAIN_HAND); + super.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); } - public void setVisible(boolean visible) { - super.setVisible(visible); + public void setAllVisible(boolean visible) { + super.setAllVisible(visible); this.leftSleeve.visible = visible; this.rightSleeve.visible = visible; this.leftPants.visible = visible; @@ -65,7 +74,7 @@ public void setVisible(boolean visible) { this.jacket.visible = visible; } - public void setArmAngle(Arm arm, MatrixStack matrices) { - super.setArmAngle(arm, matrices); + public void translateToHand(HumanoidArm arm, PoseStack matrices) { + super.translateToHand(arm, matrices); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/NpcEntityRenderState.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/NpcEntityRenderState.java deleted file mode 100644 index 7a98f91416..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/NpcEntityRenderState.java +++ /dev/null @@ -1,78 +0,0 @@ -package net.sevenstars.middleearth.entity.npcs.renderer; - -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.entity.AnimationState; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Identifier; - -public class NpcEntityRenderState extends BipedEntityRenderState { - public float widthScale; - - public AnimationState aimingState = new AnimationState(); - - public Identifier simplifiedSkinId; - public Identifier simplifiedEarId; - public Identifier simplifiedNoseId; - public Identifier simplifiedHairAddonId; - public Identifier simplifiedFeetId; - - public Identifier skinId; - public Identifier feetId; - public Identifier headId; - public Identifier earId; - public Identifier noseId; - public Identifier eyesId; - public Identifier eyesEmissiveId; - public Identifier eyebrowId; - public Identifier scarId; - public Identifier beardId; - public Identifier beardAddonId; - public Identifier hairId; - public Identifier hairAddonId; - public Identifier clothingBase; - public Identifier clothingOver; - public Identifier clothingExtra; - - public boolean haveEmissiveEyes; - public boolean blinking; - - public boolean canShowFeet; - public boolean canShowEars; - public boolean canShowBeard; - public boolean canShowHair; - public float LOD = 0; - - public NpcEntityRenderState() { - this.simplifiedSkinId = null; - this.simplifiedNoseId = null; - this.simplifiedEarId = null; - this.simplifiedHairAddonId = null; - this.simplifiedFeetId = null; - - this.widthScale = 1.0f; - this.skinId = null; - this.headId = null; - this.earId = null; - this.noseId = null; - this.eyesId = null; - this.eyesEmissiveId = null; - this.eyebrowId = null; - this.scarId = null; - this.beardId = null; - this.beardAddonId = null; - this.hairId = null; - this.hairAddonId = null; - - this.clothingBase = null; - this.clothingOver = null; - this.clothingExtra = null; - - this.haveEmissiveEyes = false; - this.blinking = false; - - this.canShowFeet = false; - this.canShowEars = true; - this.canShowBeard = true; - this.canShowHair = true; - } -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/NpcEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/NpcEntityRenderer.java index cf9af481bd..63e7b5a257 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/NpcEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/NpcEntityRenderer.java @@ -1,33 +1,37 @@ package net.sevenstars.middleearth.entity.npcs.renderer; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.*; -import net.minecraft.client.render.entity.BipedEntityRenderer; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.feature.ArmorFeatureRenderer; -import net.minecraft.client.render.entity.feature.ElytraFeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.HeadFeatureRenderer; -import net.minecraft.client.render.entity.model.ArmorEntityModel; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.render.entity.model.EntityModelLayers; -import net.minecraft.client.texture.SpriteAtlasTexture; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.EntityPose; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.item.CrossbowItem; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.consume.UseAction; -import net.minecraft.util.Hand; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3d; -import net.sevenstars.middleearth.MiddleEarth; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.Camera; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.HumanoidArmorModel; +import net.minecraft.client.model.HumanoidModel; +import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.renderer.ItemInHandRenderer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.HumanoidMobRenderer; +import net.minecraft.client.renderer.entity.LivingEntityRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.CustomHeadLayer; +import net.minecraft.client.renderer.entity.layers.ElytraLayer; +import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; +import net.minecraft.client.renderer.entity.layers.ItemInHandLayer; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.resources.model.ModelManager; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.item.CrossbowItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.UseAnim; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.client.ModTexturedRenderLayers; import net.sevenstars.middleearth.client.RenderUtil; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache.NpcPrefix; import net.sevenstars.middleearth.config.ModClientConfigs; import net.sevenstars.middleearth.entity.EntityModelLayersME; import net.sevenstars.middleearth.entity.npcs.NpcEntity; @@ -36,303 +40,249 @@ import net.sevenstars.middleearth.entity.npcs.renderer.features.feet.FeetFeatureRenderer; import net.sevenstars.middleearth.entity.npcs.renderer.features.hair.HairFeatureRenderer; import net.sevenstars.middleearth.entity.npcs.renderer.features.nose.NoseFeatureRenderer; -import net.sevenstars.middleearth.item.DataComponentTypesME; import net.sevenstars.middleearth.registries.AtlasesME; import net.sevenstars.middleearth.registries.CharacterClothesRegistryME; import net.sevenstars.middleearth.utils.ItemTagsME; import org.jetbrains.annotations.Nullable; -public class NpcEntityRenderer extends BipedEntityRenderer { - private final SpriteAtlasTexture characterTextureAtlas; - - public final static int HURT_COLOR = 0xff7e75; - - public final static int LIGHT_LEVEL_EMISSIVE_EYES = 8; - public final static int BLINKING_INTERVAL = 80; - public final static int BLINKING_DURATION = 3; - - - public NpcEntityRenderer(EntityRendererFactory.Context context) { - super(context, new NpcEntityModel(context.getPart(EntityModelLayersME.NPC)), 0.7f); - - this.features.removeIf(x -> x.getClass() == ElytraFeatureRenderer.class); - this.features.removeIf(x -> x.getClass() == HeadFeatureRenderer.class); - - this.addFeature(new ArmorFeatureRenderer<>(this, new ArmorEntityModel<>(context.getPart(EntityModelLayers.PLAYER_INNER_ARMOR)), new ArmorEntityModel<>(context.getPart(EntityModelLayers.PLAYER_OUTER_ARMOR)), context.getEquipmentRenderer())); - this.addFeature(new HairFeatureRenderer(this, context.getEntityModels())); - this.addFeature(new EarFeatureRenderer(this, context.getEntityModels())); - this.addFeature(new NoseFeatureRenderer(this, context.getEntityModels())); - this.addFeature(new FeetFeatureRenderer(this, context.getEntityModels())); - - characterTextureAtlas = AtlasesME.getAtlasFromPath(ModTexturedRenderLayers.CHARACTER_ATLAS_TEXTURES); - - this.shadowRadius = 0.5f; +public class NpcEntityRenderer extends HumanoidMobRenderer { + public static final int LIGHT_LEVEL_EMISSIVE_EYES = 8; + public static final int BLINKING_INTERVAL = 80; + public static final int BLINKING_DURATION = 3; + private static final ResourceLocation EMPTY_TEXTURE = + ResourceLocation.withDefaultNamespace("textures/misc/white.png"); + + public NpcEntityRenderer(EntityRendererProvider.Context context) { + super(context, new NpcEntityModel(context.bakeLayer(EntityModelLayersME.NPC)), 0.7F); + this.layers.removeIf(layer -> layer.getClass() == ElytraLayer.class + || layer.getClass() == CustomHeadLayer.class + || layer.getClass() == ItemInHandLayer.class); + this.addLayer(new LodItemInHandLayer(this, context.getItemInHandRenderer())); + this.addLayer(new SkinLayer(this)); + this.addLayer(new LodHumanoidArmorLayer( + this, + new HumanoidArmorModel<>(context.bakeLayer(ModelLayers.PLAYER_INNER_ARMOR)), + new HumanoidArmorModel<>(context.bakeLayer(ModelLayers.PLAYER_OUTER_ARMOR)), + context.getModelManager())); + this.addLayer(new HairFeatureRenderer(this, context.getModelSet())); + this.addLayer(new EarFeatureRenderer(this, context.getModelSet())); + this.addLayer(new NoseFeatureRenderer(this, context.getModelSet())); + this.addLayer(new FeetFeatureRenderer(this, context.getModelSet())); + this.shadowRadius = 0.5F; } - // region [RenderState] - @Override - public NpcEntityRenderState createRenderState() { - return new NpcEntityRenderState(); - } - - public static float getLOD(Vec3d entityPos) { - MinecraftClient client = MinecraftClient.getInstance(); - Camera camera = client.gameRenderer.getCamera(); - return (float)camera.getPos().distanceTo(entityPos); - // Keep in case it's needed - /*int currentFov = client.options.getFov().getValue(); - double fovRatio = currentFov / 90.0; - return (float) (distance * fovRatio);*/ + public static float getLOD(Vec3 entityPos) { + Camera camera = Minecraft.getInstance().gameRenderer.getMainCamera(); + return (float)camera.getPosition().distanceTo(entityPos); } @Override - @Environment(EnvType.CLIENT) - public void updateRenderState(NpcEntity npcEntity, NpcEntityRenderState npcEntityRenderState, float tickDelta) { - if(!npcEntity.getWorld().isClient) + public void render(NpcEntity entity, float entityYaw, float partialTick, PoseStack matrices, + MultiBufferSource buffers, int light) { + NpcTextureData data = entity.retrieveNpcTextureData(); + boolean simplified = ModClientConfigs.ENABLE_SIMPLIFIED_CHARACTER_RENDERING + && data.getSimplifiedSkin() != null; + if (!simplified && (data.get(NpcRenderedPart.BODY) == null + || data.get(NpcRenderedPart.HEAD) == null + || data.get(NpcRenderedPart.EYE) == null)) { return; - - npcEntityRenderState.aimingState = npcEntity.aimingState; - - super.updateRenderState(npcEntity, npcEntityRenderState, tickDelta); - NpcTextureData npcTextureData = npcEntity.retrieveNpcTextureData(); - float currentLightLevel = npcEntity.getWorld().getLightLevel(npcEntity.getBlockPos()); - - npcEntityRenderState.pose = npcEntity.getPose(); - - npcEntityRenderState.leftArmPose = getArmPose(npcEntity, npcEntity.getStackInHand(Hand.OFF_HAND), Hand.OFF_HAND); - npcEntityRenderState.rightArmPose = getArmPose(npcEntity, npcEntity.getStackInHand(Hand.MAIN_HAND), Hand.MAIN_HAND); - - npcEntityRenderState.widthScale = npcEntity.getWidthScale(); - - npcEntityRenderState.simplifiedSkinId = npcTextureData.getSimplifiedSkin(); - npcEntityRenderState.simplifiedEarId = npcTextureData.getSimplifiedEar(); - npcEntityRenderState.simplifiedFeetId = npcTextureData.getSimplifiedFeet(); - npcEntityRenderState.simplifiedHairAddonId = npcTextureData.getSimplifiedHair(); - npcEntityRenderState.simplifiedNoseId = npcTextureData.getSimplifiedNose(); - - if(!ModClientConfigs.ENABLE_SIMPLIFIED_CHARACTER_RENDERING || npcEntityRenderState.simplifiedSkinId == null){ - npcEntityRenderState.skinId = npcTextureData.get(NpcRenderedPart.BODY); - npcEntityRenderState.feetId = npcTextureData.get(NpcRenderedPart.FEET); - npcEntityRenderState.headId = npcTextureData.get(NpcRenderedPart.HEAD); - npcEntityRenderState.earId = npcTextureData.get(NpcRenderedPart.EAR); - npcEntityRenderState.noseId = npcTextureData.get(NpcRenderedPart.NOSE); - npcEntityRenderState.eyesId = npcTextureData.get(NpcRenderedPart.EYE); - npcEntityRenderState.eyesEmissiveId = npcTextureData.get(NpcRenderedPart.EYE_EMISSIVE); - npcEntityRenderState.haveEmissiveEyes = npcTextureData.isEyeEmissive() && currentLightLevel <= LIGHT_LEVEL_EMISSIVE_EYES; - npcEntityRenderState.eyebrowId = npcTextureData.get(NpcRenderedPart.EYEBROW); - npcEntityRenderState.scarId = npcTextureData.get(NpcRenderedPart.SCAR); - npcEntityRenderState.beardId = npcTextureData.get(NpcRenderedPart.BEARD); - npcEntityRenderState.beardAddonId = npcTextureData.get(NpcRenderedPart.BEARD_ADDON); - npcEntityRenderState.hairId = npcTextureData.get(NpcRenderedPart.HAIR); - npcEntityRenderState.hairAddonId = npcTextureData.get(NpcRenderedPart.HAIR_ADDON); - - npcEntityRenderState.clothingBase = npcTextureData.get(NpcRenderedPart.CLOTHING_BASE); - npcEntityRenderState.clothingOver = npcTextureData.get(NpcRenderedPart.CLOTHING_OVER); - npcEntityRenderState.clothingExtra = npcTextureData.get(NpcRenderedPart.CLOTHING_EXTRA); - - long age = npcEntity.age; - npcEntityRenderState.blinking = (0 + age) % BLINKING_INTERVAL >= BLINKING_INTERVAL - BLINKING_DURATION; } - ItemStack currentHelmet = npcEntity.getEquippedStack(EquipmentSlot.HEAD); - if(currentHelmet == null || currentHelmet.isEmpty()){ - npcEntityRenderState.canShowBeard = true; - npcEntityRenderState.canShowHair = true; - npcEntityRenderState.canShowEars = true; - } else { - var hasAttachment = currentHelmet.get(DataComponentTypesME.HELMET_ATTACHMENT_DATA); - boolean hasHoodDown = hasAttachment == null || hasAttachment.down(); - npcEntityRenderState.canShowEars = currentHelmet.isIn(ItemTagsME.CHARACTER_HELMET_SHOW_EARS) && hasHoodDown; - npcEntityRenderState.canShowBeard = !currentHelmet.isIn(ItemTagsME.CHARACTER_HELMET_HIDE_BEARD); - npcEntityRenderState.canShowHair = !currentHelmet.isIn(ItemTagsME.CHARACTER_HELMET_HIDE_HAIR) && hasHoodDown; + this.model.setAllVisible(false); + if (entity.isPassenger()) { + matrices.pushPose(); + matrices.translate(0.0F, -0.5F, 0.0F); + super.render(entity, entityYaw, partialTick, matrices, buffers, light); + matrices.popPose(); + } else { + super.render(entity, entityYaw, partialTick, matrices, buffers, light); } - ItemStack currentShoes = npcEntity.getEquippedStack(EquipmentSlot.FEET); - npcEntityRenderState.canShowFeet = currentShoes == null || currentShoes.isEmpty(); - npcEntityRenderState.LOD = getLOD(npcEntity.getPos()); } - // endregion - // region [Layered Texture Renderer] - @Nullable @Override - protected RenderLayer getRenderLayer(NpcEntityRenderState state, boolean showBody, boolean translucent, boolean showOutline) { - Identifier identifier = this.getTexture(state); - if (translucent) { - return RenderLayer.getEntityTranslucent(identifier); - } else if (showBody) { - return this.model.getLayer(identifier); - } else { - return showOutline ? RenderLayer.getOutline(identifier) : null; - } + protected void scale(NpcEntity entity, PoseStack matrices, float partialTick) { + float widthScale = entity.getWidthScale(); + matrices.scale(widthScale, 1.0F, widthScale); } @Override - public void render(NpcEntityRenderState state, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) { - boolean simplified = ModClientConfigs.ENABLE_SIMPLIFIED_CHARACTER_RENDERING && state.simplifiedSkinId != null; - - if(!simplified && (state.skinId == null || state.headId == null || state.eyesId == null)) - return; - + public ResourceLocation getTextureLocation(NpcEntity entity) { + return EMPTY_TEXTURE; + } - matrices.push(); - if (state.isInPose(EntityPose.SLEEPING)) { - Direction direction = state.sleepingDirection; - if (direction != null) { - float f = state.standingEyeHeight - 0.1F; - matrices.translate((float)(-direction.getOffsetX()) * f, 0.0F, (float)(-direction.getOffsetZ()) * f); - } - } - else if (state.hasVehicle) { - matrices.translate(0, -0.5F, 0); + @Nullable + @Override + protected RenderType getRenderType(NpcEntity entity, boolean bodyVisible, + boolean translucent, boolean glowing) { + if (bodyVisible || !glowing) { + return null; } + this.model.setAllVisible(true); + return RenderType.outline(EMPTY_TEXTURE); + } - float g = state.baseScale; - float widthScale = state.widthScale; - - matrices.scale(g * widthScale, g, g * widthScale); - this.setupTransforms(state, matrices, state.bodyYaw, g); - matrices.scale(-widthScale, -1.0f, widthScale); - this.scale(state, matrices); - matrices.translate(0.0f, -1.501f, 0.0f); - - this.model.setAngles(state); - int overlay = state.hurt ? getOverlay(state, this.getAnimationCounter(state)) : OverlayTexture.DEFAULT_UV; - - if(simplified){ - VertexConsumer vertexConsumer = vertexConsumers.getBuffer(ModTexturedRenderLayers.getCharacterTexturesRenderLayer()); - renderTexture(matrices, vertexConsumer, state.simplifiedSkinId, light, overlay, false); - } else { - renderComplexVersion(matrices, vertexConsumers, light, overlay, state); + public static HumanoidModel.ArmPose getArmPose(NpcEntity npc, ItemStack stack, InteractionHand hand) { + if (npc.isAiming()) { + return HumanoidModel.ArmPose.BOW_AND_ARROW; } - - if (this.shouldRenderFeatures(state) && state.LOD < ModClientConfigs.LOD_NPC_ARMOR_DISTANCE) { - for (FeatureRenderer feature : this.features) { - if (feature instanceof EarFeatureRenderer) - if ((state.simplifiedEarId == null && state.earId == null) || state.LOD > ModClientConfigs.LOD_NPC_FEATURES_DISTANCE) - continue; - if (feature instanceof NoseFeatureRenderer) - if ((state.simplifiedNoseId == null && state.noseId == null) || state.LOD > ModClientConfigs.LOD_NPC_FEATURES_DISTANCE) - continue; - if (feature instanceof HairFeatureRenderer) - if ((state.simplifiedHairAddonId == null && state.hairAddonId == null && state.beardAddonId == null) - || state.LOD > ModClientConfigs.LOD_NPC_FEATURES_DISTANCE) - continue; - if(feature instanceof FeetFeatureRenderer) - if((state.simplifiedFeetId == null && state.feetId == null) || state.LOD > ModClientConfigs.LOD_NPC_FEATURES_DISTANCE) - continue; - feature.render(matrices, vertexConsumers, light, state, state.relativeHeadYaw, state.pitch); + if (stack.isEmpty()) { + return HumanoidModel.ArmPose.EMPTY; + } + if (!npc.swinging && (stack.is(Items.CROSSBOW) || stack.is(ItemTagsME.CROSSBOW))) { + if (CrossbowItem.isCharged(stack)) { + return HumanoidModel.ArmPose.CROSSBOW_HOLD; + } + if (npc.isCharging()) { + return HumanoidModel.ArmPose.CROSSBOW_CHARGE; } } - - matrices.pop(); - - if ((state).displayName != null) { - this.renderLabelIfPresent(state, (state).displayName, matrices, vertexConsumers, light); + if (npc.getUsedItemHand() == hand && npc.getUseItemRemainingTicks() > 0) { + UseAnim useAnimation = stack.getUseAnimation(); + if (useAnimation == UseAnim.BLOCK || npc.isBlocking()) return HumanoidModel.ArmPose.BLOCK; + if (useAnimation == UseAnim.BOW) return HumanoidModel.ArmPose.BOW_AND_ARROW; + if (useAnimation == UseAnim.SPEAR) return HumanoidModel.ArmPose.THROW_SPEAR; + if (useAnimation == UseAnim.CROSSBOW) return HumanoidModel.ArmPose.CROSSBOW_CHARGE; + if (useAnimation == UseAnim.SPYGLASS) return HumanoidModel.ArmPose.SPYGLASS; + if (useAnimation == UseAnim.TOOT_HORN) return HumanoidModel.ArmPose.TOOT_HORN; + if (useAnimation == UseAnim.BRUSH) return HumanoidModel.ArmPose.BRUSH; } + return HumanoidModel.ArmPose.ITEM; } - private void renderComplexVersion(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, NpcEntityRenderState state) { - VertexConsumer vertexConsumer = vertexConsumers.getBuffer(ModTexturedRenderLayers.getCharacterTexturesRenderLayer()); - - // Will always be shown - renderTexture(matrices, vertexConsumer, MiddleEarth.ofPrefix(state.skinId, AtlasesME.SKIN_PREFIX), light, overlay, false); - - renderTexture(matrices, vertexConsumer, MiddleEarth.ofPrefix(state.headId, AtlasesME.SKIN_PREFIX), light, overlay, false); + private static boolean shouldRenderEquipment(NpcEntity entity) { + return getLOD(entity.position()) < ModClientConfigs.LOD_NPC_ARMOR_DISTANCE; + } - if(!state.blinking){ - renderTexture(matrices, vertexConsumer, MiddleEarth.ofPrefix(state.eyesId, AtlasesME.EYE_PREFIX), light, overlay, false); + private static final class LodItemInHandLayer extends ItemInHandLayer { + private LodItemInHandLayer(RenderLayerParent parent, + ItemInHandRenderer itemInHandRenderer) { + super(parent, itemInHandRenderer); } - // Optionally shown, only if the value is present - if(state.eyebrowId != null) - renderTexture(matrices, vertexConsumer, MiddleEarth.ofPrefix(state.eyebrowId, AtlasesME.HAIR_PREFIX), light, overlay, false); - - if(state.scarId != null) - renderTexture(matrices, vertexConsumer, MiddleEarth.ofPrefix(state.scarId, AtlasesME.SKIN_PREFIX), light, overlay, false); - - if(state.beardId != null) - renderTexture(matrices, vertexConsumer, MiddleEarth.ofPrefix(state.beardId, AtlasesME.HAIR_PREFIX), light, overlay, false); - if(state.clothingBase == null && state.clothingOver == null && state.clothingExtra == null){ - renderTexture(matrices, vertexConsumer, MiddleEarth.ofPrefix(CharacterClothesRegistryME.Base.THONG_BROWN, AtlasesME.CLOTHES_BASE_PREFIX), light, overlay, false); + @Override + public void render(PoseStack matrices, MultiBufferSource buffers, int light, NpcEntity entity, + float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, + float netHeadYaw, float headPitch) { + if (shouldRenderEquipment(entity)) { + super.render(matrices, buffers, light, entity, limbSwing, limbSwingAmount, partialTick, + ageInTicks, netHeadYaw, headPitch); + } } - else { - if(state.clothingBase != null) - renderTexture(matrices, vertexConsumer, MiddleEarth.ofPrefix(state.clothingBase, AtlasesME.CLOTHES_BASE_PREFIX), light, overlay, false); - - if(state.clothingOver != null) - renderTexture(matrices, vertexConsumer, MiddleEarth.ofPrefix(state.clothingOver, AtlasesME.CLOTHES_OVER_PREFIX), light, overlay, false); + } - if(state.clothingExtra != null) - renderTexture(matrices, vertexConsumer, MiddleEarth.ofPrefix(state.clothingExtra, AtlasesME.CLOTHES_EXTRA_PREFIX), light, overlay, false); + private static final class LodHumanoidArmorLayer + extends HumanoidArmorLayer> { + private LodHumanoidArmorLayer(RenderLayerParent parent, + HumanoidArmorModel innerModel, + HumanoidArmorModel outerModel, + ModelManager modelManager) { + super(parent, innerModel, outerModel, modelManager); } - if(state.hairId != null) - renderTexture(matrices, vertexConsumer, MiddleEarth.ofPrefix(state.hairId, AtlasesME.HAIR_PREFIX), light, overlay, false); - - if(!state.blinking && state.haveEmissiveEyes){ - VertexConsumer vertexConsumerEmissive = vertexConsumers.getBuffer(ModTexturedRenderLayers.getCharacterTexturesEmissiveRenderLayer()); - renderTexture(matrices, vertexConsumerEmissive, MiddleEarth.ofPrefix(state.eyesEmissiveId, AtlasesME.EYE_PREFIX), light, overlay, true); + @Override + public void render(PoseStack matrices, MultiBufferSource buffers, int light, NpcEntity entity, + float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, + float netHeadYaw, float headPitch) { + if (shouldRenderEquipment(entity)) { + super.render(matrices, buffers, light, entity, limbSwing, limbSwingAmount, partialTick, + ageInTicks, netHeadYaw, headPitch); + } } } - private void renderTexture(MatrixStack matrices, VertexConsumer vertexConsumer, Identifier textureId, int light, int overlay, boolean isEmissive){ - RenderUtil.renderAtlasTexture(characterTextureAtlas, model, matrices, vertexConsumer, textureId, light, overlay); - } - - @Override - protected int getMixColor(NpcEntityRenderState state) { - if(state.hurt) - return HURT_COLOR; - return super.getMixColor(state); - } + private static final class SkinLayer extends RenderLayer { + private final TextureAtlas atlas; - @Override - public Identifier getTexture(NpcEntityRenderState state) { - // Made custom in the render method - return null; - } - - private BipedEntityModel.ArmPose getArmPose(NpcEntity npc, ItemStack stack, Hand hand) { - if(npc.isAiming()){ - return BipedEntityModel.ArmPose.BOW_AND_ARROW; + private SkinLayer(RenderLayerParent parent) { + super(parent); + this.atlas = AtlasesME.getAtlasFromPath(ModTexturedRenderLayers.CHARACTER_ATLAS_TEXTURES); } - if (stack.isEmpty()) { - return BipedEntityModel.ArmPose.EMPTY; - } - if (!npc.handSwinging && (stack.isOf(Items.CROSSBOW) || stack.isIn(ItemTagsME.CROSSBOW))) { - if(CrossbowItem.isCharged(stack)) { - return BipedEntityModel.ArmPose.CROSSBOW_HOLD; - } - else if(npc.isCharging()) { - return BipedEntityModel.ArmPose.CROSSBOW_CHARGE; + @Override + public void render(PoseStack matrices, MultiBufferSource buffers, int light, NpcEntity entity, + float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, + float netHeadYaw, float headPitch) { + if (entity.isInvisible()) { + return; } - } - if (npc.getActiveHand() == hand && npc.getItemUseTimeLeft() > 0) { - UseAction useAction = stack.getUseAction(); - if (useAction == UseAction.BLOCK || npc.isBlocking()) { - return BipedEntityModel.ArmPose.BLOCK; - } - if (useAction == UseAction.BOW) { - return BipedEntityModel.ArmPose.BOW_AND_ARROW; + NpcTextureData data = entity.retrieveNpcTextureData(); + boolean simplified = ModClientConfigs.ENABLE_SIMPLIFIED_CHARACTER_RENDERING + && data.getSimplifiedSkin() != null; + if (!simplified && (data.get(NpcRenderedPart.BODY) == null + || data.get(NpcRenderedPart.HEAD) == null + || data.get(NpcRenderedPart.EYE) == null)) { + return; } - if (useAction == UseAction.SPEAR) { - return BipedEntityModel.ArmPose.THROW_SPEAR; + + NpcEntityModel model = this.getParentModel(); + model.setAllVisible(true); + int overlay = LivingEntityRenderer.getOverlayCoords(entity, 0.0F); + VertexConsumer vertices = buffers.getBuffer(ModTexturedRenderLayers.getCharacterTexturesRenderLayer()); + if (simplified) { + render(model, this.atlas, matrices, vertices, data.getSimplifiedSkin(), light, overlay); + return; } - if (useAction == UseAction.CROSSBOW) { - return BipedEntityModel.ArmPose.CROSSBOW_CHARGE; + + render(model, this.atlas, matrices, vertices, + RenderResourceCache.npcTexture(data.get(NpcRenderedPart.BODY), NpcPrefix.SKIN), light, overlay); + render(model, this.atlas, matrices, vertices, + RenderResourceCache.npcTexture(data.get(NpcRenderedPart.HEAD), NpcPrefix.SKIN), light, overlay); + + boolean blinking = entity.tickCount % BLINKING_INTERVAL >= BLINKING_INTERVAL - BLINKING_DURATION; + if (!blinking) { + render(model, this.atlas, matrices, vertices, + RenderResourceCache.npcTexture(data.get(NpcRenderedPart.EYE), NpcPrefix.EYE), light, overlay); } - if (useAction == UseAction.SPYGLASS) { - return BipedEntityModel.ArmPose.SPYGLASS; + renderOptional(model, this.atlas, matrices, vertices, + data.get(NpcRenderedPart.EYEBROW), NpcPrefix.HAIR, light, overlay); + renderOptional(model, this.atlas, matrices, vertices, + data.get(NpcRenderedPart.SCAR), NpcPrefix.SKIN, light, overlay); + renderOptional(model, this.atlas, matrices, vertices, + data.get(NpcRenderedPart.BEARD), NpcPrefix.HAIR, light, overlay); + + ResourceLocation clothingBase = data.get(NpcRenderedPart.CLOTHING_BASE); + ResourceLocation clothingOver = data.get(NpcRenderedPart.CLOTHING_OVER); + ResourceLocation clothingExtra = data.get(NpcRenderedPart.CLOTHING_EXTRA); + if (clothingBase == null && clothingOver == null && clothingExtra == null) { + render(model, this.atlas, matrices, vertices, + RenderResourceCache.npcTexture( + CharacterClothesRegistryME.Base.THONG_BROWN, NpcPrefix.CLOTHES_BASE), + light, overlay); + } else { + renderOptional(model, this.atlas, matrices, vertices, + clothingBase, NpcPrefix.CLOTHES_BASE, light, overlay); + renderOptional(model, this.atlas, matrices, vertices, + clothingOver, NpcPrefix.CLOTHES_OVER, light, overlay); + renderOptional(model, this.atlas, matrices, vertices, + clothingExtra, NpcPrefix.CLOTHES_EXTRA, light, overlay); } - if (useAction == UseAction.TOOT_HORN) { - return BipedEntityModel.ArmPose.TOOT_HORN; + renderOptional(model, this.atlas, matrices, vertices, + data.get(NpcRenderedPart.HAIR), NpcPrefix.HAIR, light, overlay); + + if (!blinking && data.isEyeEmissive() + && entity.level().getMaxLocalRawBrightness(entity.blockPosition()) <= LIGHT_LEVEL_EMISSIVE_EYES) { + ResourceLocation emissive = data.get(NpcRenderedPart.EYE_EMISSIVE); + if (emissive != null) { + VertexConsumer emissiveVertices = + buffers.getBuffer(ModTexturedRenderLayers.getCharacterTexturesEmissiveRenderLayer()); + render(model, this.atlas, matrices, emissiveVertices, + RenderResourceCache.npcTexture(emissive, NpcPrefix.EYE), light, overlay); + } } - if (useAction == UseAction.BRUSH) { - return BipedEntityModel.ArmPose.BRUSH; + } + + private static void renderOptional(NpcEntityModel model, TextureAtlas atlas, PoseStack matrices, + VertexConsumer vertices, ResourceLocation id, NpcPrefix prefix, + int light, int overlay) { + if (id != null) { + render(model, atlas, matrices, vertices, + RenderResourceCache.npcTexture(id, prefix), light, overlay); } } - return BipedEntityModel.ArmPose.ITEM; + + private static void render(NpcEntityModel model, TextureAtlas atlas, PoseStack matrices, + VertexConsumer vertices, ResourceLocation id, int light, int overlay) { + RenderUtil.renderAtlasTexture(atlas, model, matrices, vertices, id, light, overlay); + } } - // endregion } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/NpcRenderCompatibility.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/NpcRenderCompatibility.java new file mode 100644 index 0000000000..ebf8df7247 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/NpcRenderCompatibility.java @@ -0,0 +1,35 @@ +package net.sevenstars.middleearth.entity.npcs.renderer; + +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.InterModComms; +import net.neoforged.fml.ModList; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.fml.event.lifecycle.InterModEnqueueEvent; +import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.middleearth.entity.EntitiesME; + +@EventBusSubscriber( + modid = MiddleEarth.NEOFORGE_MOD_ID, + value = Dist.CLIENT +) +public final class NpcRenderCompatibility { + private static final String ACCELERATED_RENDERING_MOD_ID = "acceleratedrendering"; + private static final String ENTITY_TYPE_BLACKLIST_MESSAGE = "entity_type_blacklist"; + + private NpcRenderCompatibility() { + } + + @SubscribeEvent + public static void enqueueInterModCompatibility(InterModEnqueueEvent event) { + if (!ModList.get().isLoaded(ACCELERATED_RENDERING_MOD_ID)) { + return; + } + + InterModComms.sendTo( + ACCELERATED_RENDERING_MOD_ID, + ENTITY_TYPE_BLACKLIST_MESSAGE, + () -> EntitiesME.NPC + ); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/ear/EarFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/ear/EarFeatureRenderer.java index 95f05a3044..c2b9fac434 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/ear/EarFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/ear/EarFeatureRenderer.java @@ -1,65 +1,60 @@ package net.sevenstars.middleearth.entity.npcs.renderer.features.ear; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.entity.state.LivingEntityRenderState; -import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; -import net.sevenstars.middleearth.MiddleEarth; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.LivingEntityRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.EquipmentSlot; import net.sevenstars.middleearth.client.ModTexturedRenderLayers; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache.NpcPrefix; import net.sevenstars.middleearth.config.ModClientConfigs; import net.sevenstars.middleearth.entity.EntityModelLayersME; +import net.sevenstars.middleearth.entity.npcs.NpcEntity; import net.sevenstars.middleearth.entity.npcs.renderer.NpcEntityModel; -import net.sevenstars.middleearth.entity.npcs.renderer.NpcEntityRenderState; +import net.sevenstars.middleearth.entity.npcs.renderer.NpcEntityRenderer; +import net.sevenstars.middleearth.entity.npcs.renderer.NpcRenderedPart; +import net.sevenstars.middleearth.item.DataComponentTypesME; import net.sevenstars.middleearth.registries.AtlasesME; +import net.sevenstars.middleearth.utils.ItemTagsME; -@Environment(EnvType.CLIENT) -public class EarFeatureRenderer extends FeatureRenderer { +public class EarFeatureRenderer extends RenderLayer { private final EarModel earModel; - private final SpriteAtlasTexture characterTexturesAtlas; + private final TextureAtlas atlas; - public EarFeatureRenderer(FeatureRendererContext context, LoadedEntityModels loader) { - super(context); - this.earModel = new EarModel(loader.getModelPart(EntityModelLayersME.NPC_ENTITY_EAR)); - characterTexturesAtlas = AtlasesME.getAtlasFromPath(ModTexturedRenderLayers.CHARACTER_ATLAS_TEXTURES); + public EarFeatureRenderer(RenderLayerParent parent, EntityModelSet modelSet) { + super(parent); + this.earModel = new EarModel(modelSet.bakeLayer(EntityModelLayersME.NPC_ENTITY_EAR)); + this.atlas = AtlasesME.getAtlasFromPath(ModTexturedRenderLayers.CHARACTER_ATLAS_TEXTURES); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, NpcEntityRenderState state, float limbAngle, float limbDistance) { - boolean isSimplified = ModClientConfigs.ENABLE_SIMPLIFIED_CHARACTER_RENDERING && state.simplifiedSkinId != null; - Identifier earId = (isSimplified) ? state.simplifiedEarId : MiddleEarth.ofPrefix(state.earId, AtlasesME.SKIN_PREFIX); - - earModel.setAngles(state); - - if(!state.canShowEars) - return; - - VertexConsumer vertexConsumer = vertexConsumers.getBuffer(ModTexturedRenderLayers.getCharacterTexturesRenderLayer()); - - int overlay = state.hurt ? getOverlay(state, 0f) : OverlayTexture.DEFAULT_UV; - if(earId != null){ - Sprite sprite = characterTexturesAtlas.getSprite(earId); - renderModel(sprite, matrices, vertexConsumer, light, overlay); - } - } - - public static int getOverlay(LivingEntityRenderState state, float whiteOverlayProgress) { - return OverlayTexture.packUv(OverlayTexture.getU(whiteOverlayProgress), OverlayTexture.getV(state.hurt)); - } - - private void renderModel(Sprite sprite, MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay){ - if(sprite != null){ - VertexConsumer newLayerVertexConsumer = sprite.getTextureSpecificVertexConsumer(vertexConsumer); - earModel.render(matrices, newLayerVertexConsumer, light, overlay); - } + public void render(PoseStack matrices, MultiBufferSource buffers, int light, NpcEntity entity, + float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, + float netHeadYaw, float headPitch) { + if (entity.isInvisible()) return; + if (NpcEntityRenderer.getLOD(entity.position()) > ModClientConfigs.LOD_NPC_FEATURES_DISTANCE) return; + var helmet = entity.getItemBySlot(EquipmentSlot.HEAD); + var attachment = helmet.get(DataComponentTypesME.HELMET_ATTACHMENT_DATA); + if (!helmet.isEmpty() + && !(helmet.is(ItemTagsME.CHARACTER_HELMET_SHOW_EARS) + && (attachment == null || attachment.down()))) return; + + var data = entity.retrieveNpcTextureData(); + boolean simplified = ModClientConfigs.ENABLE_SIMPLIFIED_CHARACTER_RENDERING + && data.getSimplifiedSkin() != null; + ResourceLocation raw = simplified ? data.getSimplifiedEar() : data.get(NpcRenderedPart.EAR); + ResourceLocation id = simplified ? raw : RenderResourceCache.npcTexture(raw, NpcPrefix.SKIN); + if (id == null) return; + + this.earModel.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); + VertexConsumer vertices = this.atlas.getSprite(id).wrap( + buffers.getBuffer(ModTexturedRenderLayers.getCharacterTexturesRenderLayer())); + this.earModel.renderToBuffer(matrices, vertices, light, LivingEntityRenderer.getOverlayCoords(entity, 0.0F)); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/ear/EarModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/ear/EarModel.java index b363632949..af327057fc 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/ear/EarModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/ear/EarModel.java @@ -1,59 +1,70 @@ package net.sevenstars.middleearth.entity.npcs.renderer.features.ear; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.BipedEntityModel; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.util.math.MathHelper; -import net.sevenstars.middleearth.entity.npcs.renderer.NpcEntityRenderState; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.util.Mth; +import net.sevenstars.middleearth.entity.npcs.NpcEntity; -public class EarModel extends EntityModel { +public class EarModel extends HierarchicalModel { + private final ModelPart root; public final ModelPart ears; public final ModelPart planeFlatLeft; public final ModelPart planeFlatRight; public EarModel(ModelPart modelPart) { - super(modelPart); - + this.root = modelPart; this.ears = modelPart.getChild("ears"); - this.planeFlatLeft = this.ears.getChild("ear_left"); this.planeFlatRight = this.ears.getChild("ear_right"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData root = modelData.getRoot(); - - ModelPartData ears = root.addChild("ears", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - - ears.addChild("ear_right", - ModelPartBuilder.create().uv(0, 6).cuboid(3.5F, -8.0F, 2F, 7.0F, 6.0F, 0.0F, Dilation.NONE), - ModelTransform.NONE); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ears.addChild("ear_left", - ModelPartBuilder.create().uv(0, 6).cuboid(3.5F, -8.0F, -2F, 7.0F, 6.0F, 0.0F, Dilation.NONE), - ModelTransform.NONE); + PartDefinition ears = modelPartData.addOrReplaceChild( + "ears", CubeListBuilder.create(), PartPose.ZERO); + ears.addOrReplaceChild( + "ear_right", + CubeListBuilder.create().texOffs(0, 6) + .addBox(3.5F, -8.0F, 2.0F, 7.0F, 6.0F, 0.0F, CubeDeformation.NONE), + PartPose.ZERO); + ears.addOrReplaceChild( + "ear_left", + CubeListBuilder.create().texOffs(0, 6) + .addBox(3.5F, -8.0F, -2.0F, 7.0F, 6.0F, 0.0F, CubeDeformation.NONE), + PartPose.ZERO); - return TexturedModelData.of(modelData, 16, 16); + return LayerDefinition.create(modelData, 16, 16); } @Override - public void setAngles(NpcEntityRenderState state) { - super.setAngles(state); - - // Taken from BipedEntityModel.class - float f = state.leaningPitch; - boolean bl = state.isGliding; - this.ears.pitch = state.pitch * 0.017453292F; - this.ears.yaw = state.relativeHeadYaw * 0.017453292F; - - if (bl) { - this.ears.pitch = -0.7853982F; - } else if (f > 0.0F) { - this.ears.pitch = MathHelper.lerpAngleRadians(f, this.ears.pitch, -0.7853982F); + public void setupAnim(NpcEntity entity, float limbSwing, float limbSwingAmount, + float ageInTicks, float netHeadYaw, float headPitch) { + this.ears.resetPose(); + this.planeFlatLeft.resetPose(); + this.planeFlatRight.resetPose(); + float swimAmount = entity.getSwimAmount(0.0F); + this.ears.xRot = headPitch * Mth.DEG_TO_RAD; + this.ears.yRot = netHeadYaw * Mth.DEG_TO_RAD; + if (entity.isFallFlying()) { + this.ears.xRot = -0.7853982f; + } else if (swimAmount > 0.0f) { + this.ears.xRot = ModelUtils.rotlerpRad(this.ears.xRot, -0.7853982f, swimAmount); } - this.planeFlatLeft.yaw = (float)Math.toRadians(-20); - this.planeFlatRight.yaw = (float)Math.toRadians(-160); + this.planeFlatLeft.yRot = (float)Math.toRadians(-20); + this.planeFlatRight.yRot = (float)Math.toRadians(-160); + } + + @Override + public ModelPart root() { + return this.root; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/feet/FeetFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/feet/FeetFeatureRenderer.java index f53c7e8545..dbf134c43d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/feet/FeetFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/feet/FeetFeatureRenderer.java @@ -1,66 +1,54 @@ package net.sevenstars.middleearth.entity.npcs.renderer.features.feet; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.entity.state.LivingEntityRenderState; -import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; -import net.sevenstars.middleearth.MiddleEarth; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.LivingEntityRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.EquipmentSlot; import net.sevenstars.middleearth.client.ModTexturedRenderLayers; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache.NpcPrefix; import net.sevenstars.middleearth.config.ModClientConfigs; import net.sevenstars.middleearth.entity.EntityModelLayersME; +import net.sevenstars.middleearth.entity.npcs.NpcEntity; import net.sevenstars.middleearth.entity.npcs.renderer.NpcEntityModel; -import net.sevenstars.middleearth.entity.npcs.renderer.NpcEntityRenderState; +import net.sevenstars.middleearth.entity.npcs.renderer.NpcEntityRenderer; +import net.sevenstars.middleearth.entity.npcs.renderer.NpcRenderedPart; import net.sevenstars.middleearth.registries.AtlasesME; -@Environment(EnvType.CLIENT) -public class FeetFeatureRenderer extends FeatureRenderer { - private final EntityModel feetModel; - private final SpriteAtlasTexture characterTexturesAtlas; +public class FeetFeatureRenderer extends RenderLayer { + private final EntityModel feetModel; + private final TextureAtlas atlas; - public FeetFeatureRenderer(FeatureRendererContext context, LoadedEntityModels loader) { - super(context); - this.feetModel = new FeetModel(loader.getModelPart(EntityModelLayersME.NPC_ENTITY_FEET)); - characterTexturesAtlas = AtlasesME.getAtlasFromPath(ModTexturedRenderLayers.CHARACTER_ATLAS_TEXTURES); + public FeetFeatureRenderer(RenderLayerParent parent, EntityModelSet modelSet) { + super(parent); + this.feetModel = new FeetModel(modelSet.bakeLayer(EntityModelLayersME.NPC_ENTITY_FEET)); + this.atlas = AtlasesME.getAtlasFromPath(ModTexturedRenderLayers.CHARACTER_ATLAS_TEXTURES); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, NpcEntityRenderState state, float limbAngle, float limbDistance) { - boolean isSimplified = ModClientConfigs.ENABLE_SIMPLIFIED_CHARACTER_RENDERING && state.simplifiedSkinId != null; - Identifier feetId = (isSimplified) ? state.simplifiedFeetId : MiddleEarth.ofPrefix(state.feetId, AtlasesME.SKIN_PREFIX); - - feetModel.setAngles(state); - - if(!state.canShowFeet) - return; - - VertexConsumer vertexConsumer = vertexConsumers.getBuffer(ModTexturedRenderLayers.getCharacterTexturesRenderLayer()); - - int overlay = state.hurt ? getOverlay(state, 0f) : OverlayTexture.DEFAULT_UV; - - if(feetId != null){ - Sprite sprite = characterTexturesAtlas.getSprite(feetId); - renderModel(sprite, matrices, vertexConsumer, light, overlay); - } - } - - public static int getOverlay(LivingEntityRenderState state, float whiteOverlayProgress) { - return OverlayTexture.packUv(OverlayTexture.getU(whiteOverlayProgress), OverlayTexture.getV(state.hurt)); - } - - private void renderModel(Sprite sprite, MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay){ - if(sprite != null){ - VertexConsumer newLayerVertexConsumer = sprite.getTextureSpecificVertexConsumer(vertexConsumer); - feetModel.render(matrices, newLayerVertexConsumer, light, overlay); - } + public void render(PoseStack matrices, MultiBufferSource buffers, int light, NpcEntity entity, + float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, + float netHeadYaw, float headPitch) { + if (entity.isInvisible()) return; + if (!entity.getItemBySlot(EquipmentSlot.FEET).isEmpty() + || NpcEntityRenderer.getLOD(entity.position()) > ModClientConfigs.LOD_NPC_FEATURES_DISTANCE) return; + var data = entity.retrieveNpcTextureData(); + boolean simplified = ModClientConfigs.ENABLE_SIMPLIFIED_CHARACTER_RENDERING + && data.getSimplifiedSkin() != null; + ResourceLocation raw = simplified ? data.getSimplifiedFeet() : data.get(NpcRenderedPart.FEET); + ResourceLocation id = simplified ? raw : RenderResourceCache.npcTexture(raw, NpcPrefix.SKIN); + if (id == null) return; + + this.feetModel.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); + VertexConsumer vertices = this.atlas.getSprite(id).wrap( + buffers.getBuffer(ModTexturedRenderLayers.getCharacterTexturesRenderLayer())); + this.feetModel.renderToBuffer(matrices, vertices, light, LivingEntityRenderer.getOverlayCoords(entity, 0.0F)); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/feet/FeetModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/feet/FeetModel.java index 209590f0ab..98f9f272b4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/feet/FeetModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/feet/FeetModel.java @@ -1,15 +1,18 @@ package net.sevenstars.middleearth.entity.npcs.renderer.features.feet; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.util.Mth; +import net.sevenstars.middleearth.entity.npcs.NpcEntity; -import net.minecraft.util.math.MathHelper; -import net.sevenstars.middleearth.entity.npcs.renderer.NpcEntityRenderState; - -@Environment(EnvType.CLIENT) -public class FeetModel extends EntityModel { +public class FeetModel extends HierarchicalModel { + private final ModelPart root; public final ModelPart toeCubeLeft; public final ModelPart toeCubeRight; @@ -17,8 +20,7 @@ public class FeetModel extends EntityModel { public final ModelPart leftLeg; public FeetModel(ModelPart modelPart) { - super(modelPart); - + this.root = modelPart; this.leftLeg = modelPart.getChild("left_leg"); this.rightLeg = modelPart.getChild("right_leg"); @@ -26,44 +28,47 @@ public FeetModel(ModelPart modelPart) { this.toeCubeRight = rightLeg.getChild("feet"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - var rightLeg = modelPartData.addChild("right_leg", ModelPartBuilder.create().uv(0,0).cuboid(-2.0F, 0.0F, -2.0F, 0.0F, 12.0F, 0.0F, Dilation.NONE), ModelTransform.origin(-1.9F, 12.0F, 0.0F)); - var leftLeg = modelPartData.addChild("left_leg", ModelPartBuilder.create().uv(0,0).cuboid(-2.0F, 0.0F, -2.0F, 0.0F, 0.0F, 0.0F, Dilation.NONE), ModelTransform.origin(1.9F, 12.0F, 0.0F)); + var rightLeg = modelPartData.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(0,0).addBox(-2.0F, 0.0F, -2.0F, 0.0F, 12.0F, 0.0F, CubeDeformation.NONE), PartPose.offset(-1.9F, 12.0F, 0.0F)); + var leftLeg = modelPartData.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(0,0).addBox(-2.0F, 0.0F, -2.0F, 0.0F, 0.0F, 0.0F, CubeDeformation.NONE), PartPose.offset(1.9F, 12.0F, 0.0F)); - rightLeg.addChild("feet", - ModelPartBuilder.create().uv(0, 4).mirrored().cuboid(0,0,0,4,2,2, Dilation.NONE), - ModelTransform.origin(-2f,10f,-4f)); + rightLeg.addOrReplaceChild("feet", + CubeListBuilder.create().texOffs(0, 4).mirror().addBox(0,0,0,4,2,2, CubeDeformation.NONE), + PartPose.offset(-2f,10f,-4f)); - leftLeg.addChild("feet", - ModelPartBuilder.create().uv(0, 4).cuboid(0,0,0,4,2,2, Dilation.NONE), - ModelTransform.origin(-2f,10f,-4f)); + leftLeg.addOrReplaceChild("feet", + CubeListBuilder.create().texOffs(0, 4).addBox(0,0,0,4,2,2, CubeDeformation.NONE), + PartPose.offset(-2f,10f,-4f)); - return TexturedModelData.of(modelData, 16, 16); + return LayerDefinition.create(modelData, 16, 16); } @Override - public void setAngles(NpcEntityRenderState state) { - super.setAngles(state); - - float g = state.limbSwingAnimationProgress; - float h = state.limbSwingAmplitude; - - this.rightLeg.pitch = MathHelper.cos(g * 0.6662F) * 1.4F * h / state.limbAmplitudeInverse; - this.leftLeg.pitch = MathHelper.cos(g * 0.6662F + (float)Math.PI) * 1.4F * h / state.limbAmplitudeInverse; - this.rightLeg.yaw = 0.005F; - this.leftLeg.yaw = -0.005F; - this.rightLeg.roll = 0.005F; - this.leftLeg.roll = -0.005F; - if (state.hasVehicle) { - this.rightLeg.pitch = -1.4137167F; - this.rightLeg.yaw = ((float)Math.PI / 10F); - this.rightLeg.roll = 0.07853982F; - this.leftLeg.pitch = -1.4137167F; - this.leftLeg.yaw = (-(float)Math.PI / 10F); - this.leftLeg.roll = -0.07853982F; + public void setupAnim(NpcEntity entity, float limbSwing, float limbSwingAmount, + float ageInTicks, float netHeadYaw, float headPitch) { + this.rightLeg.resetPose(); + this.leftLeg.resetPose(); + this.rightLeg.xRot = Mth.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount; + this.leftLeg.xRot = Mth.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount; + this.rightLeg.yRot = 0.005F; + this.leftLeg.yRot = -0.005F; + this.rightLeg.zRot = 0.005F; + this.leftLeg.zRot = -0.005F; + if (entity.isPassenger()) { + this.rightLeg.xRot = -1.4137167F; + this.rightLeg.yRot = ((float)Math.PI / 10F); + this.rightLeg.zRot = 0.07853982F; + this.leftLeg.xRot = -1.4137167F; + this.leftLeg.yRot = (-(float)Math.PI / 10F); + this.leftLeg.zRot = -0.07853982F; } } + + @Override + public ModelPart root() { + return this.root; + } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/hair/HairFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/hair/HairFeatureRenderer.java index a3b30b3a4c..11e5715c7e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/hair/HairFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/hair/HairFeatureRenderer.java @@ -1,82 +1,70 @@ package net.sevenstars.middleearth.entity.npcs.renderer.features.hair; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.entity.state.LivingEntityRenderState; -import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; -import net.sevenstars.middleearth.MiddleEarth; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.LivingEntityRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.EquipmentSlot; import net.sevenstars.middleearth.client.ModTexturedRenderLayers; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache.NpcPrefix; import net.sevenstars.middleearth.config.ModClientConfigs; import net.sevenstars.middleearth.entity.EntityModelLayersME; +import net.sevenstars.middleearth.entity.npcs.NpcEntity; import net.sevenstars.middleearth.entity.npcs.renderer.NpcEntityModel; -import net.sevenstars.middleearth.entity.npcs.renderer.NpcEntityRenderState; +import net.sevenstars.middleearth.entity.npcs.renderer.NpcEntityRenderer; +import net.sevenstars.middleearth.entity.npcs.renderer.NpcRenderedPart; +import net.sevenstars.middleearth.item.DataComponentTypesME; import net.sevenstars.middleearth.registries.AtlasesME; +import net.sevenstars.middleearth.utils.ItemTagsME; +public class HairFeatureRenderer extends RenderLayer { + private final EntityModel hairModel; + private final TextureAtlas atlas; -@Environment(EnvType.CLIENT) -public class HairFeatureRenderer extends FeatureRenderer { - private final EntityModel hairModel; - private final SpriteAtlasTexture characterTexturesAtlas; - - public HairFeatureRenderer(FeatureRendererContext context, LoadedEntityModels loader) { - super(context); - this.hairModel = new HairModel(loader.getModelPart(EntityModelLayersME.NPC_ENTITY_HAIR)); - characterTexturesAtlas = AtlasesME.getAtlasFromPath(ModTexturedRenderLayers.CHARACTER_ATLAS_TEXTURES); + public HairFeatureRenderer(RenderLayerParent parent, EntityModelSet modelSet) { + super(parent); + this.hairModel = new HairModel(modelSet.bakeLayer(EntityModelLayersME.NPC_ENTITY_HAIR)); + this.atlas = AtlasesME.getAtlasFromPath(ModTexturedRenderLayers.CHARACTER_ATLAS_TEXTURES); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, NpcEntityRenderState state, float limbAngle, float limbDistance) { - EntityModel entityModel = hairModel; - - boolean isSimplified = ModClientConfigs.ENABLE_SIMPLIFIED_CHARACTER_RENDERING && state.simplifiedSkinId != null; - Identifier hairAddonTextureId = (isSimplified) ? state.simplifiedHairAddonId : MiddleEarth.ofPrefix(state.hairAddonId, AtlasesME.HAIR_PREFIX); - Identifier beardAddonTextureId = (isSimplified) ? null : MiddleEarth.ofPrefix(state.beardAddonId, AtlasesME.HAIR_PREFIX); - - - // TODO : Disable the beard based on the helmet - /* - if (entity.getEquippedStack(EquipmentSlot.HEAD).isIn(TagK°.of(RegistryKeys.ITEM, Identifier.of(MiddleEarth.MOD_ID, "helmet_hides_dwarf_beard")))){ - */ - - if(hairAddonTextureId == null && beardAddonTextureId == null){ - entityModel.getRootPart().visible = false; - return; - } else if (!entityModel.getRootPart().visible){ - entityModel.getRootPart().visible = true; - } - entityModel.setAngles(state); - VertexConsumer vertexConsumer = vertexConsumers.getBuffer(ModTexturedRenderLayers.getCharacterTexturesRenderLayer()); + public void render(PoseStack matrices, MultiBufferSource buffers, int light, NpcEntity entity, + float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, + float netHeadYaw, float headPitch) { + if (entity.isInvisible()) return; + if (NpcEntityRenderer.getLOD(entity.position()) > ModClientConfigs.LOD_NPC_FEATURES_DISTANCE) return; + var data = entity.retrieveNpcTextureData(); + boolean simplified = ModClientConfigs.ENABLE_SIMPLIFIED_CHARACTER_RENDERING + && data.getSimplifiedSkin() != null; + ResourceLocation rawHair = simplified ? data.getSimplifiedHair() : data.get(NpcRenderedPart.HAIR_ADDON); + ResourceLocation rawBeard = simplified ? null : data.get(NpcRenderedPart.BEARD_ADDON); + ResourceLocation hairId = simplified || rawHair == null + ? rawHair : RenderResourceCache.npcTexture(rawHair, NpcPrefix.HAIR); + ResourceLocation beardId = RenderResourceCache.npcTexture(rawBeard, NpcPrefix.HAIR); + if (hairId == null && beardId == null) return; - int overlay = state.hurt ? getOverlay(state, 0f) : OverlayTexture.DEFAULT_UV; + var helmet = entity.getItemBySlot(EquipmentSlot.HEAD); + var attachment = helmet.get(DataComponentTypesME.HELMET_ATTACHMENT_DATA); + boolean hoodDown = attachment == null || attachment.down(); + boolean showHair = helmet.isEmpty() + || (!helmet.is(ItemTagsME.CHARACTER_HELMET_HIDE_HAIR) && hoodDown); + boolean showBeard = helmet.isEmpty() || !helmet.is(ItemTagsME.CHARACTER_HELMET_HIDE_BEARD); - if(hairAddonTextureId != null && state.canShowHair){ - Sprite sprite = characterTexturesAtlas.getSprite(hairAddonTextureId); - renderModel(sprite, matrices, vertexConsumer, light, overlay); + this.hairModel.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); + VertexConsumer base = buffers.getBuffer(ModTexturedRenderLayers.getCharacterTexturesRenderLayer()); + int overlay = LivingEntityRenderer.getOverlayCoords(entity, 0.0F); + if (hairId != null && showHair) { + this.hairModel.renderToBuffer(matrices, this.atlas.getSprite(hairId).wrap(base), light, overlay); } - if(beardAddonTextureId != null && state.canShowBeard){ - Sprite sprite = characterTexturesAtlas.getSprite(beardAddonTextureId); - renderModel(sprite, matrices, vertexConsumer, light, overlay); + if (beardId != null && showBeard) { + this.hairModel.renderToBuffer(matrices, this.atlas.getSprite(beardId).wrap(base), light, overlay); } } - - private void renderModel(Sprite sprite, MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay){ - if(sprite != null){ - VertexConsumer newLayerVertexConsumer = sprite.getTextureSpecificVertexConsumer(vertexConsumer); - hairModel.render(matrices, newLayerVertexConsumer, light, overlay); - } - } - - public static int getOverlay(LivingEntityRenderState state, float whiteOverlayProgress) { - return OverlayTexture.packUv(OverlayTexture.getU(whiteOverlayProgress), OverlayTexture.getV(state.hurt)); - } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/hair/HairModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/hair/HairModel.java index fe22e683ec..b5475c707c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/hair/HairModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/hair/HairModel.java @@ -1,11 +1,18 @@ package net.sevenstars.middleearth.entity.npcs.renderer.features.hair; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.util.math.MathHelper; -import net.sevenstars.middleearth.entity.npcs.renderer.NpcEntityRenderState; - -public class HairModel extends EntityModel { +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.util.Mth; +import net.sevenstars.middleearth.entity.npcs.NpcEntity; + +public class HairModel extends HierarchicalModel { + private final ModelPart root; // https://i.pinimg.com/736x/9c/56/05/9c560508ceba0bc87b9d5beda7391adc.jpg public static final String BEARD = "beard"; public final ModelPart hair; @@ -14,39 +21,40 @@ public class HairModel extends EntityModel { public final ModelPart largeBeard; public HairModel(ModelPart modelPart) { - super(modelPart); - + this.root = modelPart; this.hair = modelPart.getChild("hair"); this.hairBase = hair.getChild("hairBase"); this.hairHat = hair.getChild("hairHat"); this.largeBeard = hair.getChild("largeBeard"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData hairGroup = modelPartData.addChild("hair", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - hairGroup.addChild("hairBase", ModelPartBuilder.create().uv(0, 0).cuboid(-4.0f, 0f, -4.0f, 8, 11, 8, Dilation.NONE), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - hairGroup.addChild("hairHat", ModelPartBuilder.create().uv(32, 0).cuboid(-4.0f, 1f, -4f, 8, 11, 8, Dilation.NONE.add(0.5f)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - hairGroup.addChild("largeBeard", ModelPartBuilder.create().uv(37, 37).cuboid(-6.5F, -3.5F, -4.1F,14.0F, 25.0F, -0.5F, Dilation.NONE.add(0.25f)), ModelTransform.NONE); - return TexturedModelData.of(modelData, 64, 64); + PartDefinition hairGroup = modelPartData.addOrReplaceChild("hair", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + hairGroup.addOrReplaceChild("hairBase", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0f, 0f, -4.0f, 8, 11, 8, CubeDeformation.NONE), PartPose.offset(0.0F, 0.0F, 0.0F)); + hairGroup.addOrReplaceChild("hairHat", CubeListBuilder.create().texOffs(32, 0).addBox(-4.0f, 1f, -4f, 8, 11, 8, CubeDeformation.NONE.extend(0.5f)), PartPose.offset(0.0F, 0.0F, 0.0F)); + hairGroup.addOrReplaceChild("largeBeard", CubeListBuilder.create().texOffs(37, 37).addBox(-6.5F, -3.5F, -4.1F,14.0F, 25.0F, -0.5F, CubeDeformation.NONE.extend(0.25f)), PartPose.ZERO); + return LayerDefinition.create(modelData, 64, 64); } @Override - public void setAngles(NpcEntityRenderState state) { - super.setAngles(state); - - // Taken from BipedEntityModel.class - float f = state.leaningPitch; - boolean bl = state.isGliding; - this.hair.pitch = state.pitch * 0.017453292F; - this.hair.yaw = state.relativeHeadYaw * 0.017453292F; - - if (bl) { - this.hair.pitch = -0.7853982F; - } else if (f > 0.0F) { - this.hair.pitch = MathHelper.lerpAngleRadians(f, this.hair.pitch, -0.7853982F); + public void setupAnim(NpcEntity entity, float limbSwing, float limbSwingAmount, + float ageInTicks, float netHeadYaw, float headPitch) { + this.hair.resetPose(); + float swimAmount = entity.getSwimAmount(0.0F); + this.hair.xRot = headPitch * Mth.DEG_TO_RAD; + this.hair.yRot = netHeadYaw * Mth.DEG_TO_RAD; + if (entity.isFallFlying()) { + this.hair.xRot = -0.7853982F; + } else if (swimAmount > 0.0F) { + this.hair.xRot = ModelUtils.rotlerpRad(this.hair.xRot, -0.7853982F, swimAmount); } } + + @Override + public ModelPart root() { + return this.root; + } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/nose/NoseFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/nose/NoseFeatureRenderer.java index c2b22fc04e..2bbaf40c3f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/nose/NoseFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/nose/NoseFeatureRenderer.java @@ -1,63 +1,52 @@ package net.sevenstars.middleearth.entity.npcs.renderer.features.nose; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.render.entity.model.LoadedEntityModels; -import net.minecraft.client.render.entity.state.LivingEntityRenderState; -import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; -import net.sevenstars.middleearth.MiddleEarth; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.LivingEntityRenderer; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.client.ModTexturedRenderLayers; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache; +import net.sevenstars.middleearth.client.renderer.RenderResourceCache.NpcPrefix; import net.sevenstars.middleearth.config.ModClientConfigs; import net.sevenstars.middleearth.entity.EntityModelLayersME; +import net.sevenstars.middleearth.entity.npcs.NpcEntity; import net.sevenstars.middleearth.entity.npcs.renderer.NpcEntityModel; -import net.sevenstars.middleearth.entity.npcs.renderer.NpcEntityRenderState; +import net.sevenstars.middleearth.entity.npcs.renderer.NpcEntityRenderer; +import net.sevenstars.middleearth.entity.npcs.renderer.NpcRenderedPart; import net.sevenstars.middleearth.registries.AtlasesME; -@Environment(EnvType.CLIENT) -public class NoseFeatureRenderer extends FeatureRenderer { - private final EntityModel noseModel; - private final SpriteAtlasTexture characterTexturesAtlas; +public class NoseFeatureRenderer extends RenderLayer { + private final EntityModel noseModel; + private final TextureAtlas atlas; - public NoseFeatureRenderer(FeatureRendererContext context, LoadedEntityModels loader) { - super(context); - this.noseModel = new NoseModel(loader.getModelPart(EntityModelLayersME.NPC_ENTITY_NOSE)); - characterTexturesAtlas = AtlasesME.getAtlasFromPath(ModTexturedRenderLayers.CHARACTER_ATLAS_TEXTURES); + public NoseFeatureRenderer(RenderLayerParent parent, EntityModelSet modelSet) { + super(parent); + this.noseModel = new NoseModel(modelSet.bakeLayer(EntityModelLayersME.NPC_ENTITY_NOSE)); + this.atlas = AtlasesME.getAtlasFromPath(ModTexturedRenderLayers.CHARACTER_ATLAS_TEXTURES); } @Override - public void render(MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, NpcEntityRenderState state, float limbAngle, float limbDistance) { - boolean isSimplified = ModClientConfigs.ENABLE_SIMPLIFIED_CHARACTER_RENDERING && state.simplifiedSkinId != null; - Identifier noseId = (isSimplified) ? state.simplifiedNoseId : MiddleEarth.ofPrefix(state.noseId, AtlasesME.SKIN_PREFIX); - - noseModel.setAngles(state); - - VertexConsumer vertexConsumer = vertexConsumers.getBuffer(ModTexturedRenderLayers.getCharacterTexturesRenderLayer()); - - int overlay = state.hurt ? getOverlay(state, 0f) : OverlayTexture.DEFAULT_UV; - - if(noseId != null) { - Sprite sprite = characterTexturesAtlas.getSprite(noseId); - renderModel(sprite, matrices, vertexConsumer, light, overlay); - } - } - - public static int getOverlay(LivingEntityRenderState state, float whiteOverlayProgress) { - return OverlayTexture.packUv(OverlayTexture.getU(whiteOverlayProgress), OverlayTexture.getV(state.hurt)); - } - - private void renderModel(Sprite sprite, MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay){ - if(sprite != null){ - VertexConsumer newLayerVertexConsumer = sprite.getTextureSpecificVertexConsumer(vertexConsumer); - noseModel.render(matrices, newLayerVertexConsumer, light, overlay); - } + public void render(PoseStack matrices, MultiBufferSource buffers, int light, NpcEntity entity, + float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, + float netHeadYaw, float headPitch) { + if (entity.isInvisible()) return; + if (NpcEntityRenderer.getLOD(entity.position()) > ModClientConfigs.LOD_NPC_FEATURES_DISTANCE) return; + var data = entity.retrieveNpcTextureData(); + boolean simplified = ModClientConfigs.ENABLE_SIMPLIFIED_CHARACTER_RENDERING + && data.getSimplifiedSkin() != null; + ResourceLocation raw = simplified ? data.getSimplifiedNose() : data.get(NpcRenderedPart.NOSE); + ResourceLocation id = simplified ? raw : RenderResourceCache.npcTexture(raw, NpcPrefix.SKIN); + if (id == null) return; + + this.noseModel.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); + VertexConsumer vertices = this.atlas.getSprite(id).wrap( + buffers.getBuffer(ModTexturedRenderLayers.getCharacterTexturesRenderLayer())); + this.noseModel.renderToBuffer(matrices, vertices, light, LivingEntityRenderer.getOverlayCoords(entity, 0.0F)); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/nose/NoseModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/nose/NoseModel.java index d7fb0fc42c..4e9a0fb933 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/nose/NoseModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/npcs/renderer/features/nose/NoseModel.java @@ -1,11 +1,18 @@ package net.sevenstars.middleearth.entity.npcs.renderer.features.nose; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.util.math.MathHelper; -import net.sevenstars.middleearth.entity.npcs.renderer.NpcEntityRenderState; - -public class NoseModel extends EntityModel { +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.util.Mth; +import net.sevenstars.middleearth.entity.npcs.NpcEntity; + +public class NoseModel extends HierarchicalModel { + private final ModelPart root; public final ModelPart noseRoot; public final ModelPart squareCube; @@ -14,7 +21,7 @@ public class NoseModel extends EntityModel { public final ModelPart largeCenterCube; public NoseModel(ModelPart modelPart) { - super(modelPart); + this.root = modelPart; this.noseRoot = modelPart.getChild("noseRoot"); this.squareCube = noseRoot.getChild("squareCube"); this.villagerCube = noseRoot.getChild("villagerCube"); @@ -23,41 +30,42 @@ public NoseModel(ModelPart modelPart) { this.largeCenterCube = noseRoot.getChild("largeCenterCube"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); - ModelPartData cubeRootPart = modelPartData.addChild("noseRoot", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - ModelPartData cubeNosePart = cubeRootPart.addChild("squareCube", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - cubeNosePart.addChild("cube", ModelPartBuilder.create().uv(0, 2).cuboid(-1.0f, -4f, -4.5f, 2, 2, 1, Dilation.NONE), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition cubeRootPart = modelPartData.addOrReplaceChild("noseRoot", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + PartDefinition cubeNosePart = cubeRootPart.addOrReplaceChild("squareCube", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + cubeNosePart.addOrReplaceChild("cube", CubeListBuilder.create().texOffs(0, 2).addBox(-1.0f, -4f, -4.5f, 2, 2, 1, CubeDeformation.NONE), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData villagerCubePart = cubeRootPart.addChild("villagerCube", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - villagerCubePart.addChild("cube", ModelPartBuilder.create().uv(0, 6).cuboid(-1.0f, -4f, -6f, 2, 4, 2, Dilation.NONE), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition villagerCubePart = cubeRootPart.addOrReplaceChild("villagerCube", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + villagerCubePart.addOrReplaceChild("cube", CubeListBuilder.create().texOffs(0, 6).addBox(-1.0f, -4f, -6f, 2, 4, 2, CubeDeformation.NONE), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData largeHighCubePart = cubeRootPart.addChild("largeHighCube", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - largeHighCubePart.addChild("cube", ModelPartBuilder.create().uv(11, 0).cuboid(-2.0f, -6f, -5f, 4, 3, 1, Dilation.NONE), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition largeHighCubePart = cubeRootPart.addOrReplaceChild("largeHighCube", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + largeHighCubePart.addOrReplaceChild("cube", CubeListBuilder.create().texOffs(11, 0).addBox(-2.0f, -6f, -5f, 4, 3, 1, CubeDeformation.NONE), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData largeCenterCubePart = cubeRootPart.addChild("largeCenterCube", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); - largeCenterCubePart.addChild("cube", ModelPartBuilder.create().uv(11, 5).cuboid(-2.0f, -5f, -5f, 4, 3, 1, Dilation.NONE), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition largeCenterCubePart = cubeRootPart.addOrReplaceChild("largeCenterCube", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); + largeCenterCubePart.addOrReplaceChild("cube", CubeListBuilder.create().texOffs(11, 5).addBox(-2.0f, -5f, -5f, 4, 3, 1, CubeDeformation.NONE), PartPose.offset(0.0F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 32, 32); + return LayerDefinition.create(modelData, 32, 32); } @Override - public void setAngles(NpcEntityRenderState state) { - super.setAngles(state); - - float f = state.leaningPitch; - boolean bl = state.isGliding; - - this.noseRoot.pitch = state.pitch * 0.017453292F; - this.noseRoot.yaw = state.relativeHeadYaw * 0.017453292F; - - if (bl) { - this.noseRoot.pitch = -0.7853982F; - - } else if (f > 0.0F) { - this.noseRoot.pitch = MathHelper.lerpAngleRadians(f, this.noseRoot.pitch, -0.7853982F); + public void setupAnim(NpcEntity entity, float limbSwing, float limbSwingAmount, + float ageInTicks, float netHeadYaw, float headPitch) { + this.noseRoot.resetPose(); + float swimAmount = entity.getSwimAmount(0.0F); + this.noseRoot.xRot = headPitch * Mth.DEG_TO_RAD; + this.noseRoot.yRot = netHeadYaw * Mth.DEG_TO_RAD; + if (entity.isFallFlying()) { + this.noseRoot.xRot = -0.7853982F; + } else if (swimAmount > 0.0F) { + this.noseRoot.xRot = ModelUtils.rotlerpRad(this.noseRoot.xRot, -0.7853982F, swimAmount); } } + + @Override + public ModelPart root() { + return this.root; + } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/AbstractProjectileEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/AbstractProjectileEntity.java index 924e73fec2..a8f4443f73 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/AbstractProjectileEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/AbstractProjectileEntity.java @@ -1,36 +1,38 @@ package net.sevenstars.middleearth.entity.projectile; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.projectile.thrown.ThrownItemEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.particle.ItemStackParticleEffect; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.util.hit.HitResult; -import net.minecraft.world.World; - -public abstract class AbstractProjectileEntity extends ThrownItemEntity { +import net.minecraft.core.particles.ItemParticleOption; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.projectile.ThrowableItemProjectile; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.phys.HitResult; + +public abstract class AbstractProjectileEntity extends ThrowableItemProjectile { private float damage; - public AbstractProjectileEntity(EntityType entityType, World world) { + public AbstractProjectileEntity(EntityType entityType, Level world) { super(entityType, world); } - public AbstractProjectileEntity(EntityType entityType, double d, double e, double f, World world, ItemStack stack) { - super(entityType, d, e, f, world, stack); + public AbstractProjectileEntity(EntityType entityType, double d, double e, double f, Level world, ItemStack stack) { + super(entityType, d, e, f, world); + this.setItem(stack); } - public AbstractProjectileEntity(EntityType entityType, LivingEntity livingEntity, World world, ItemStack stack) { - super(entityType, livingEntity, world, stack); + public AbstractProjectileEntity(EntityType entityType, LivingEntity livingEntity, Level world, ItemStack stack) { + super(entityType, livingEntity, world); + this.setItem(stack); } - public void handleStatus(byte status) { + public void handleEntityEvent(byte status) { if (status == 3) { for(int i = 0; i < 8; ++i) { - this.getWorld().addParticleClient(new ItemStackParticleEffect(ParticleTypes.ITEM, this.getStack()), this.getX(), this.getY(), this.getZ(), ((double)this.random.nextFloat() - 0.5) * 0.08, ((double)this.random.nextFloat() - 0.5) * 0.08, ((double)this.random.nextFloat() - 0.5) * 0.08); + this.level().addParticle(new ItemParticleOption(ParticleTypes.ITEM, this.getItem()), this.getX(), this.getY(), this.getZ(), ((double)this.random.nextFloat() - 0.5) * 0.08, ((double)this.random.nextFloat() - 0.5) * 0.08, ((double)this.random.nextFloat() - 0.5) * 0.08); } } } @@ -39,18 +41,18 @@ public void setDamage(float damage) { this.damage = damage; } - public void onEntityHit(EntityHitResult entityHitResult) { - super.onEntityHit(entityHitResult); + public void onHitEntity(EntityHitResult entityHitResult) { + super.onHitEntity(entityHitResult); Entity entity = entityHitResult.getEntity(); - if(entity.getWorld() instanceof ServerWorld serverWorld) { - entity.damage(serverWorld, this.getDamageSources().thrown(this, this.getOwner()), this.damage); + if(!entity.level().isClientSide()) { + entity.hurt(this.damageSources().thrown(this, this.getOwner()), this.damage); } } - protected void onCollision(HitResult hitResult) { - super.onCollision(hitResult); - if (!getWorld().isClient) { - getWorld().sendEntityStatus(this, (byte)3); + protected void onHit(HitResult hitResult) { + super.onHit(hitResult); + if (!level().isClientSide) { + level().broadcastEntityEvent(this, (byte)3); this.discard(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/WebbedEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/WebbedEntity.java index 7082d5f63f..c6b082def6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/WebbedEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/WebbedEntity.java @@ -1,24 +1,24 @@ package net.sevenstars.middleearth.entity.projectile; -import net.minecraft.block.BlockState; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.particle.BlockStateParticleEffect; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.util.hit.HitResult; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.ConfiguredFeature; +import net.minecraft.core.Holder; +import net.minecraft.core.particles.BlockParticleOption; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.Registries; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.phys.HitResult; import net.sevenstars.middleearth.block.registration.ModNatureBlocks; import net.sevenstars.middleearth.entity.EntitiesME; import net.sevenstars.middleearth.entity.EntityTypeTagsME; @@ -31,19 +31,19 @@ public class WebbedEntity extends AbstractProjectileEntity { private static ConfiguredFeature feature; private float damage; - public WebbedEntity(EntityType entityType, World world) { + public WebbedEntity(EntityType entityType, Level world) { super(entityType, world); } - public WebbedEntity(World world, LivingEntity owner, float dmg) { + public WebbedEntity(Level world, LivingEntity owner, float dmg) { super(EntitiesME.WEB, owner, world, new ItemStack(Items.COBWEB)); this.damage = dmg; if(feature == null) { - if(!this.getWorld().isClient) { - if(this.getWorld() instanceof ServerWorld serverWorld) { - Optional>> optional = serverWorld.getRegistryManager() - .getOrThrow(RegistryKeys.CONFIGURED_FEATURE) - .getOptional(ModVegetationConfiguredFeatures.PATCH_WEBBING); + if(!this.level().isClientSide) { + if(this.level() instanceof ServerLevel serverWorld) { + Optional>> optional = serverWorld.registryAccess() + .lookupOrThrow(Registries.CONFIGURED_FEATURE) + .get(ModVegetationConfiguredFeatures.PATCH_WEBBING); optional.ifPresent(configuredFeatureRegistryEntry -> feature = configuredFeatureRegistryEntry.value()); } } @@ -57,21 +57,21 @@ protected Item getDefaultItem() { @Override public void tick() { super.tick(); - if (this.getWorld().isClient) { + if (this.level().isClientSide) { this.spawnParticles(2); } } @Override - public void onEntityHit(EntityHitResult entityHitResult) { - super.onEntityHit(entityHitResult); + public void onHitEntity(EntityHitResult entityHitResult) { + super.onHitEntity(entityHitResult); Entity entity = entityHitResult.getEntity(); - if(this.getWorld() instanceof ServerWorld serverWorld) { - entity.damage(serverWorld, this.getDamageSources().thrown( this, this.getOwner()), this.damage); + if(this.level() instanceof ServerLevel serverWorld) { + entity.hurt(this.damageSources().thrown(this, this.getOwner()), this.damage); if(entity instanceof LivingEntity livingEntity) { - livingEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 200)); - livingEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.WEAVING, 200)); - livingEntity.addStatusEffect(new StatusEffectInstance(ModStatusEffects.RESTRAINED, 200)); + livingEntity.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 200)); + livingEntity.addEffect(new MobEffectInstance(MobEffects.WEAVING, 200)); + livingEntity.addEffect(new MobEffectInstance(ModStatusEffects.RESTRAINED, 200)); //if(entity instanceof ServerPlayerEntity playerEntity) { // ServerPlayNetworking.send(playerEntity, new PacketLivingEntityData(1)); //} @@ -80,46 +80,46 @@ public void onEntityHit(EntityHitResult entityHitResult) { } @Override - protected void onCollision(HitResult hitResult) { + protected void onHit(HitResult hitResult) { HitResult.Type type = hitResult.getType(); if (type == HitResult.Type.ENTITY) { EntityHitResult entityHitResult = (EntityHitResult) hitResult; Entity entity = entityHitResult.getEntity(); - if(entity.getType().isIn(EntityTypeTagsME.UNGOLIENI)) { + if(entity.getType().is(EntityTypeTagsME.UNGOLIENI)) { return; } } - super.onCollision(hitResult); + super.onHit(hitResult); spawnWebbing(); } @Override - protected void onBlockHit(BlockHitResult blockHitResult) { - super.onBlockHit(blockHitResult); + protected void onHitBlock(BlockHitResult blockHitResult) { + super.onHitBlock(blockHitResult); spawnWebbing(); } @Override - protected void onBlockCollision(BlockState state) { - super.onBlockCollision(state); + protected void onInsideBlock(BlockState state) { + super.onInsideBlock(state); spawnWebbing(); } private void spawnParticles(int amount) { if (amount > 0) { for (int j = 0; j < amount; j++) { - this.getWorld() - .addParticleClient( - new BlockStateParticleEffect(ParticleTypes.BLOCK, ModNatureBlocks.WEBBING.getDefaultState()), - this.getParticleX(0.5), this.getRandomBodyY(), this.getParticleZ(0.5), 0.0, 0.0, 0.0 + this.level() + .addParticle( + new BlockParticleOption(ParticleTypes.BLOCK, ModNatureBlocks.WEBBING.defaultBlockState()), + this.getRandomX(0.5), this.getRandomY(), this.getRandomZ(0.5), 0.0, 0.0, 0.0 ); } } } private void spawnWebbing() { - if(this.getWorld() instanceof ServerWorld serverWorld && feature != null) { - feature.generate(serverWorld, serverWorld.getChunkManager().getChunkGenerator(), random, this.getBlockPos()); + if(this.level() instanceof ServerLevel serverWorld && feature != null) { + feature.place(serverWorld, serverWorld.getChunkSource().getGenerator(), random, this.blockPosition()); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/boulder/BoulderEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/boulder/BoulderEntity.java index 4081fcd7c6..fac3247832 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/boulder/BoulderEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/boulder/BoulderEntity.java @@ -1,49 +1,49 @@ package net.sevenstars.middleearth.entity.projectile.boulder; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.projectile.ThrowableProjectile; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.phys.HitResult; import net.sevenstars.middleearth.entity.EntitiesME; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.projectile.thrown.ThrownEntity; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.util.hit.HitResult; -import net.minecraft.world.World; - -public class BoulderEntity extends ThrownEntity { - - public BoulderEntity(EntityType type, World world) { + +public class BoulderEntity extends ThrowableProjectile { + + public BoulderEntity(EntityType type, Level world) { super(type, world); } - public BoulderEntity(World world, double x, double y, double z) { + public BoulderEntity(Level world, double x, double y, double z) { super(EntitiesME.BOULDER, x, y, z, world); } @Override - protected void initDataTracker(DataTracker.Builder builder) { + protected void defineSynchedData(SynchedEntityData.Builder builder) { } - protected void onEntityHit(EntityHitResult entityHitResult) { - super.onEntityHit(entityHitResult); - if (this.getWorld().isClient) { + protected void onHitEntity(EntityHitResult entityHitResult) { + super.onHitEntity(entityHitResult); + if (this.level().isClientSide) { return; } Entity entity = entityHitResult.getEntity(); if(this.getOwner() != null) { Entity entity2 = this.getOwner(); - if (entity2 instanceof LivingEntity && entity2 != null && !entity.getWorld().isClient()) { - entity.damage((ServerWorld) entity.getWorld(), this.getDamageSources().mobProjectile(this, (LivingEntity) entity2), 10.0f); + if (entity2 instanceof LivingEntity && entity2 != null && !entity.level().isClientSide()) { + entity.hurt(this.damageSources().mobProjectile(this, (LivingEntity) entity2), 10.0f); } } } - protected void onCollision(HitResult hitResult) { - super.onCollision(hitResult); - if (!this.getWorld().isClient) { - this.getWorld().createExplosion((Entity)this, this.getX(), this.getY(), this.getZ(), 0.5f, false, World.ExplosionSourceType.MOB); + protected void onHit(HitResult hitResult) { + super.onHit(hitResult); + if (!this.level().isClientSide) { + this.level().explode((Entity)this, this.getX(), this.getY(), this.getZ(), 0.5f, false, Level.ExplosionInteraction.MOB); this.discard(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/boulder/BoulderEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/boulder/BoulderEntityRenderer.java index a9898971a2..5de4c84be9 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/boulder/BoulderEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/boulder/BoulderEntityRenderer.java @@ -1,62 +1,67 @@ package net.sevenstars.middleearth.entity.projectile.boulder; -import net.minecraft.block.BlockRenderType; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayers; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.BlockRenderManager; -import net.minecraft.client.render.entity.EntityRenderer; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.state.EntityRenderState; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.RotationAxis; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.World; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Axis; +import net.minecraft.client.renderer.ItemBlockRenderTypes; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.block.BlockRenderDispatcher; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.state.BlockState; -public class BoulderEntityRenderer extends EntityRenderer { - private final BlockRenderManager blockRenderManager; - public BoulderEntityRenderer(EntityRendererFactory.Context ctx) { +public class BoulderEntityRenderer extends EntityRenderer { + private static final ResourceLocation STONE_TEXTURE = + ResourceLocation.withDefaultNamespace("textures/block/stone.png"); + private static final BlockState STONE_STATE = Blocks.STONE.defaultBlockState(); + + private final BlockRenderDispatcher blockRenderManager; + private final RandomSource random = RandomSource.create(); + private final BlockPos.MutableBlockPos renderPos = new BlockPos.MutableBlockPos(); + + public BoulderEntityRenderer(EntityRendererProvider.Context ctx) { super(ctx); - this.blockRenderManager = ctx.getBlockRenderManager(); + this.blockRenderManager = ctx.getBlockRenderDispatcher(); } @Override - public EntityRenderState createRenderState() { - return new EntityRenderState(); - } - /* - @Override - public Identifier getTexture(EntityRenderState state) { - return Identifier.of("minecraft", "textures/block/stone.png"); + public ResourceLocation getTextureLocation(BoulderEntity entity) { + return STONE_TEXTURE; } - - public void render(BoulderEntity entity, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) { + @Override + public void render(BoulderEntity entity, float yaw, float tickDelta, PoseStack matrices, MultiBufferSource vertexConsumers, int light) { if(entity.getOwner() == null) { return; } - BlockState blockState = Blocks.STONE.getDefaultState(); - if (blockState.getRenderType() != BlockRenderType.MODEL) { + BlockState blockState = STONE_STATE; + if (blockState.getRenderShape() != RenderShape.MODEL) { return; } - World world = entity.getWorld(); - if (blockState == world.getBlockState(entity.getBlockPos()) || blockState.getRenderType() == BlockRenderType.INVISIBLE) { + Level world = entity.level(); + if (blockState == world.getBlockState(entity.blockPosition()) || blockState.getRenderShape() == RenderShape.INVISIBLE) { return; } - matrices.push(); - matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(MathHelper.lerp(tickDelta, entity.prevPitch, entity.getPitch()) + 90.0F)); - BlockPos blockPos = BlockPos.ofFloored(entity.getX(), entity.getBoundingBox().maxY, entity.getZ()); + matrices.pushPose(); + matrices.mulPose(Axis.ZP.rotationDegrees(Mth.lerp(tickDelta, entity.xRotO, entity.getXRot()) + 90.0F)); + this.renderPos.set( + Mth.floor(entity.getX()), + Mth.floor(entity.getBoundingBox().maxY), + Mth.floor(entity.getZ())); matrices.translate(-0.5, 0.0, -0.5); - - this.blockRenderManager.getModelRenderer().render(world, this.blockRenderManager.getModel(blockState), blockState, blockPos, matrices, vertexConsumers.getBuffer(RenderLayers.getMovingBlockLayer(blockState)), false, Random.create(), blockState.getRenderingSeed(entity.getOwner().getBlockPos()), OverlayTexture.DEFAULT_UV); - matrices.pop(); + this.blockRenderManager.getModelRenderer().tesselateBlock( + world, this.blockRenderManager.getBlockModel(blockState), blockState, this.renderPos, matrices, + vertexConsumers.getBuffer(ItemBlockRenderTypes.getMovingBlockRenderType(blockState)), + false, this.random, blockState.getSeed(entity.getOwner().blockPosition()), + OverlayTexture.NO_OVERLAY); + matrices.popPose(); super.render(entity, yaw, tickDelta, matrices, vertexConsumers, light); } - - */ } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/pebble/PebbleEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/pebble/PebbleEntity.java index cda75e8d26..7ceb127367 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/pebble/PebbleEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/pebble/PebbleEntity.java @@ -1,25 +1,25 @@ package net.sevenstars.middleearth.entity.projectile.pebble; -import net.minecraft.item.ItemStack; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.EntityHitResult; import net.sevenstars.middleearth.entity.EntitiesME; import net.sevenstars.middleearth.entity.projectile.AbstractProjectileEntity; import net.sevenstars.middleearth.item.ResourceItemsME; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.Item; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.world.World; public class PebbleEntity extends AbstractProjectileEntity { private float damage; - public PebbleEntity(EntityType entityType, World world) { + public PebbleEntity(EntityType entityType, Level world) { super(entityType, world); } - public PebbleEntity(World world, LivingEntity owner, float dmg) { + public PebbleEntity(Level world, LivingEntity owner, float dmg) { super(EntitiesME.PEBBLE, owner, world, new ItemStack(ResourceItemsME.PEBBLE)); this.damage = dmg; } @@ -29,11 +29,11 @@ protected Item getDefaultItem() { } @Override - public void onEntityHit(EntityHitResult entityHitResult) { - super.onEntityHit(entityHitResult); + public void onHitEntity(EntityHitResult entityHitResult) { + super.onHitEntity(entityHitResult); Entity entity = entityHitResult.getEntity(); //if(this.getOwner() instanceof ShireHobbitEntity && entity instanceof ShireHobbitEntity) return; - if(this.getWorld() instanceof ServerWorld serverWorld) - entity.damage(serverWorld, this.getDamageSources().thrown( this, this.getOwner()), this.damage); + if(this.level() instanceof ServerLevel) + entity.hurt(this.damageSources().thrown(this, this.getOwner()), this.damage); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/pinecone/LitPineconeEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/pinecone/LitPineconeEntity.java index 03e28f4d2b..42edf51c2a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/pinecone/LitPineconeEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/pinecone/LitPineconeEntity.java @@ -1,37 +1,37 @@ package net.sevenstars.middleearth.entity.projectile.pinecone; -import net.minecraft.item.ItemStack; -import net.minecraft.server.world.ServerWorld; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.EntityHitResult; import net.sevenstars.middleearth.entity.EntitiesME; import net.sevenstars.middleearth.entity.projectile.AbstractProjectileEntity; import net.sevenstars.middleearth.item.ResourceItemsME; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.Item; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.world.World; public class LitPineconeEntity extends AbstractProjectileEntity { private float damage; - public LitPineconeEntity(EntityType entityType, World world) { + public LitPineconeEntity(EntityType entityType, Level world) { super(entityType, world); } - public LitPineconeEntity(World world, LivingEntity owner, float dmg) { + public LitPineconeEntity(Level world, LivingEntity owner, float dmg) { super(EntitiesME.LIT_PINECONE, owner, world, new ItemStack(ResourceItemsME.LIT_PINECONE)); this.damage = dmg; } @Override - public void onEntityHit(EntityHitResult entityHitResult) { - super.onEntityHit(entityHitResult); + public void onHitEntity(EntityHitResult entityHitResult) { + super.onHitEntity(entityHitResult); Entity entity = entityHitResult.getEntity(); - entity.setOnFireFor(4); - if(this.getWorld() instanceof ServerWorld serverWorld) - entity.damage(serverWorld, this.getDamageSources().thrown( this, this.getOwner()), this.damage); + entity.igniteForSeconds(4); + if(this.level() instanceof ServerLevel) + entity.hurt(this.damageSources().thrown(this, this.getOwner()), this.damage); } protected Item getDefaultItem() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/pinecone/PineconeEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/pinecone/PineconeEntity.java index d4027559d5..4cf1dcfa85 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/pinecone/PineconeEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/pinecone/PineconeEntity.java @@ -1,23 +1,23 @@ package net.sevenstars.middleearth.entity.projectile.pinecone; -import net.minecraft.item.ItemStack; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.EntityHitResult; import net.sevenstars.middleearth.entity.EntitiesME; import net.sevenstars.middleearth.entity.projectile.AbstractProjectileEntity; import net.sevenstars.middleearth.item.ResourceItemsME; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.item.Item; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.world.World; public class PineconeEntity extends AbstractProjectileEntity { private float damage; - public PineconeEntity(EntityType entityType, World world) { + public PineconeEntity(EntityType entityType, Level world) { super(entityType, world); } - public PineconeEntity(World world, LivingEntity owner, float dmg) { + public PineconeEntity(Level world, LivingEntity owner, float dmg) { super(EntitiesME.PINECONE, owner, world, new ItemStack(ResourceItemsME.PINECONE)); this.damage = dmg; } @@ -27,7 +27,7 @@ protected Item getDefaultItem() { } @Override - public void onEntityHit(EntityHitResult entityHitResult) { - super.onEntityHit(entityHitResult); + public void onHitEntity(EntityHitResult entityHitResult) { + super.onHitEntity(entityHitResult); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/smoke/SmokeRingProjectileEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/smoke/SmokeRingProjectileEntity.java index 791eb3fc34..2ede3f1c49 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/smoke/SmokeRingProjectileEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/smoke/SmokeRingProjectileEntity.java @@ -1,25 +1,24 @@ package net.sevenstars.middleearth.entity.projectile.smoke; -import net.minecraft.entity.*; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.data.TrackedData; -import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.entity.projectile.ProjectileUtil; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.util.hit.HitResult; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.MoverType; +import net.minecraft.world.entity.projectile.Projectile; +import net.minecraft.world.entity.projectile.ProjectileUtil; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.utils.ModCollisionUtils; -public class SmokeRingProjectileEntity extends ProjectileEntity { +public class SmokeRingProjectileEntity extends Projectile { public static final int MAX_LIFESPAN_TICKS = 40; public static final int FAILED_MAX_LIFESPAN_TICKS = 14; - private static final TrackedData FAILED = DataTracker.registerData(SmokeRingProjectileEntity.class, TrackedDataHandlerRegistry.BOOLEAN); + private static final EntityDataAccessor FAILED = SynchedEntityData.defineId(SmokeRingProjectileEntity.class, EntityDataSerializers.BOOLEAN); private static final double ENTITY_BOX_EXPANSION = 1.0; private static final float ENTITY_COLLISION_MARGIN = 0.3F; @@ -27,7 +26,7 @@ public class SmokeRingProjectileEntity extends ProjectileEntity { public SmokeRingProjectileEntity( EntityType type, - World world) { + Level world) { super(type, world); this.setNoGravity(true); } @@ -40,40 +39,40 @@ public void tick() { } @Override - protected void onEntityHit(EntityHitResult hitResult) { - super.onEntityHit(hitResult); + protected void onHitEntity(EntityHitResult hitResult) { + super.onHitEntity(hitResult); } @Override - protected void onCollision(HitResult hitResult) { - super.onCollision(hitResult); + protected void onHit(HitResult hitResult) { + super.onHit(hitResult); this.triggerFadeOut(); } @Override - public boolean damage(ServerWorld world, DamageSource source, float amount) { + public boolean hurt(DamageSource source, float amount) { return false; } @Override - protected void initDataTracker(DataTracker.Builder builder) { - builder.add(FAILED, false); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + builder.define(FAILED, false); } @Override - protected void readCustomData(ReadView view) { - super.readCustomData(view); - this.setFailed(view.getBoolean("Failed", false)); + protected void readAdditionalSaveData(CompoundTag view) { + super.readAdditionalSaveData(view); + this.setFailed(view.getBoolean("Failed")); } @Override - protected void writeCustomData(WriteView view) { - super.writeCustomData(view); + protected void addAdditionalSaveData(CompoundTag view) { + super.addAdditionalSaveData(view); view.putBoolean("Failed", this.isFailed()); } private void checkLifespan() { - if (this.age >= this.getMaxLifespanTicks()) { + if (this.tickCount >= this.getMaxLifespanTicks()) { this.discard(); } } @@ -82,17 +81,17 @@ private void triggerFadeOut() { if (isFadingOut) return; isFadingOut = true; - this.age = this.getMaxLifespanTicks() - 3; + this.tickCount = this.getMaxLifespanTicks() - 3; - this.setVelocity(Vec3d.ZERO); - this.setPosition(this.getX(), this.getY(), this.getZ()); + this.setDeltaMovement(Vec3.ZERO); + this.setPos(this.getX(), this.getY(), this.getZ()); } private void checkCollision() { if (isFadingOut) return; if (this.isFailed()) { - this.move(MovementType.SELF, this.getVelocity()); + this.move(MoverType.SELF, this.getDeltaMovement()); return; } @@ -100,24 +99,24 @@ private void checkCollision() { return; } - this.move(MovementType.SELF, this.getVelocity()); + this.move(MoverType.SELF, this.getDeltaMovement()); } private boolean checkEntityCollision() { - Vec3d start = this.getPos(); - Vec3d end = this.getPos().add(this.getVelocity()); + Vec3 start = this.position(); + Vec3 end = this.position().add(this.getDeltaMovement()); - EntityHitResult hit = ProjectileUtil.getEntityCollision(this.getWorld(), + EntityHitResult hit = ProjectileUtil.getEntityHitResult(this.level(), this, start, end, - this.getBoundingBox().stretch(this.getVelocity()).expand(ENTITY_BOX_EXPANSION), - this::canHit, + this.getBoundingBox().expandTowards(this.getDeltaMovement()).inflate(ENTITY_BOX_EXPANSION), + this::canHitEntity, ENTITY_COLLISION_MARGIN); if (hit != null) { - this.setPosition(hit.getPos()); - this.onCollision(hit); + this.setPos(hit.getLocation()); + this.onHit(hit); return true; } @@ -125,19 +124,19 @@ private boolean checkEntityCollision() { } private boolean checkBlockCollision() { - return ModCollisionUtils.checkBlockFanCollision(this.getWorld(), + return ModCollisionUtils.checkBlockFanCollision(this.level(), this.getBoundingBox(), - this.getVelocity(), + this.getDeltaMovement(), this, - this::onCollision); + this::onHit); } public void setFailed(boolean failed) { - this.dataTracker.set(FAILED, failed); + this.entityData.set(FAILED, failed); } public boolean isFailed() { - return this.dataTracker.get(FAILED); + return this.entityData.get(FAILED); } public int getMaxLifespanTicks() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/smoke/SmokeRingProjectileRenderState.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/smoke/SmokeRingProjectileRenderState.java deleted file mode 100644 index 24da3f26ab..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/smoke/SmokeRingProjectileRenderState.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.sevenstars.middleearth.entity.projectile.smoke; - -import net.minecraft.client.render.entity.state.ProjectileEntityRenderState; -import org.joml.Quaternionf; - -public class SmokeRingProjectileRenderState extends ProjectileEntityRenderState { - public Quaternionf orientationQuat; - public int maxLifespan; - public boolean failed; -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/smoke/SmokeRingProjectileRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/smoke/SmokeRingProjectileRenderer.java index 168e02a76e..8a6a1cc1d3 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/smoke/SmokeRingProjectileRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/smoke/SmokeRingProjectileRenderer.java @@ -1,97 +1,80 @@ package net.sevenstars.middleearth.entity.projectile.smoke; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.EntityRenderer; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.MathHelper; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; import net.sevenstars.middleearth.MiddleEarth; import org.joml.Matrix4f; -import net.minecraft.client.render.RenderLayer; import org.joml.Quaternionf; -@Environment(EnvType.CLIENT) -public class SmokeRingProjectileRenderer extends EntityRenderer { - private final Sprite[] frames; +public class SmokeRingProjectileRenderer extends EntityRenderer { + private final TextureAtlasSprite[] frames; + private final Quaternionf orientation = new Quaternionf(); - private static final Identifier SPRITES_ATLAS_ID = Identifier.of(MiddleEarth.MOD_ID, "sprites"); + private static final ResourceLocation SPRITES_ATLAS_ID = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "sprites"); private static final String SPRITE_PATH_PREFIX = "sprites/smoke_ring/big_smoke_ring_"; private static final int FRAME_COUNT = 12; private static final int FAILED_FIRST_FRAME = 7; private static final int FAILED_FRAME_COUNT = 5; private static final float SMOKE_RING_SIZE = 1.0f; - public SmokeRingProjectileRenderer(EntityRendererFactory.Context context) { + public SmokeRingProjectileRenderer(EntityRendererProvider.Context context) { super(context); frames = loadFrames(); } @Override public void render( - SmokeRingProjectileRenderState state, - MatrixStack matrices, - VertexConsumerProvider vertexConsumers, + SmokeRingProjectileEntity entity, + float yaw, + float tickDelta, + PoseStack matrices, + MultiBufferSource vertexConsumers, int light) { - matrices.push(); + matrices.pushPose(); matrices.translate(0, 0.2, 0); - matrices.multiply(state.orientationQuat); + updateOrientationQuaternion(entity, tickDelta); + matrices.mulPose(this.orientation); - int firstFrame = state.failed ? FAILED_FIRST_FRAME : 0; - int frameCount = state.failed ? FAILED_FRAME_COUNT : frames.length; - int frame = firstFrame + Math.min((int) (state.age / state.maxLifespan * frameCount), frameCount - 1); - Sprite sprite = frames[frame]; + boolean failed = entity.isFailed(); + int firstFrame = failed ? FAILED_FIRST_FRAME : 0; + int frameCount = failed ? FAILED_FRAME_COUNT : frames.length; + float ageInTicks = entity.tickCount + tickDelta; + int frame = firstFrame + Math.min((int)(ageInTicks / entity.getMaxLifespanTicks() * frameCount), frameCount - 1); + TextureAtlasSprite sprite = frames[frame]; - Matrix4f matrix = matrices.peek().getPositionMatrix(); - VertexConsumer vc = vertexConsumers.getBuffer(RenderLayer.getEntityTranslucent(sprite.getAtlasId())); + Matrix4f matrix = matrices.last().pose(); + VertexConsumer vc = vertexConsumers.getBuffer(RenderType.entityTranslucent(sprite.atlasLocation())); - float minU = sprite.getMinU(); - float maxU = sprite.getMaxU(); - float minV = sprite.getMinV(); - float maxV = sprite.getMaxV(); + float minU = sprite.getU0(); + float maxU = sprite.getU1(); + float minV = sprite.getV0(); + float maxV = sprite.getV1(); - int overlay = net.minecraft.client.render.OverlayTexture.DEFAULT_UV; + int overlay = net.minecraft.client.renderer.texture.OverlayTexture.NO_OVERLAY; drawQuad(vc, matrix, SMOKE_RING_SIZE, minU, maxU, minV, maxV, light, overlay); - matrices.pop(); - } - - @Override - public SmokeRingProjectileRenderState createRenderState() { - SmokeRingProjectileRenderState state = new SmokeRingProjectileRenderState(); - state.maxLifespan = SmokeRingProjectileEntity.MAX_LIFESPAN_TICKS; - state.failed = false; - - return state; - } - - @Override - public void updateRenderState( - SmokeRingProjectileEntity entity, - SmokeRingProjectileRenderState state, - float tickDelta) { - super.updateRenderState(entity, state, tickDelta); - - state.maxLifespan = entity.getMaxLifespanTicks(); - state.failed = entity.isFailed(); - this.updateOrientationQuaternion(entity, state, tickDelta); + matrices.popPose(); + super.render(entity, yaw, tickDelta, matrices, vertexConsumers, light); } - private Sprite[] loadFrames() { - SpriteAtlasTexture atlas = (SpriteAtlasTexture) MinecraftClient.getInstance().getTextureManager().getTexture( + private TextureAtlasSprite[] loadFrames() { + TextureAtlas atlas = (TextureAtlas) Minecraft.getInstance().getTextureManager().getTexture( SPRITES_ATLAS_ID); - Sprite[] sprites = new Sprite[FRAME_COUNT]; + TextureAtlasSprite[] sprites = new TextureAtlasSprite[FRAME_COUNT]; for (int i = 0; i < FRAME_COUNT; i++) { - Identifier spriteId = Identifier.of(MiddleEarth.MOD_ID, SPRITE_PATH_PREFIX + i); + ResourceLocation spriteId = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, SPRITE_PATH_PREFIX + i); sprites[i] = atlas.getSprite(spriteId); } return sprites; @@ -108,27 +91,31 @@ private void drawQuad( int light, int overlay) { float half = size / 2f; - vc.vertex(matrix, -half, -half, 0).color(255, 255, 255, 255).texture(minU, minV).overlay( - overlay).light(light).normal(0, 0, 1); - vc.vertex(matrix, -half, +half, 0).color(255, 255, 255, 255).texture(minU, maxV).overlay( - overlay).light(light).normal(0, 0, 1); - vc.vertex(matrix, +half, +half, 0).color(255, 255, 255, 255).texture(maxU, maxV).overlay( - overlay).light(light).normal(0, 0, 1); - vc.vertex(matrix, +half, -half, 0).color(255, 255, 255, 255).texture(maxU, minV).overlay( - overlay).light(light).normal(0, 0, 1); + vc.addVertex(matrix, -half, -half, 0).setColor(255, 255, 255, 255).setUv(minU, minV).setOverlay( + overlay).setLight(light).setNormal(0, 0, 1); + vc.addVertex(matrix, -half, +half, 0).setColor(255, 255, 255, 255).setUv(minU, maxV).setOverlay( + overlay).setLight(light).setNormal(0, 0, 1); + vc.addVertex(matrix, +half, +half, 0).setColor(255, 255, 255, 255).setUv(maxU, maxV).setOverlay( + overlay).setLight(light).setNormal(0, 0, 1); + vc.addVertex(matrix, +half, -half, 0).setColor(255, 255, 255, 255).setUv(maxU, minV).setOverlay( + overlay).setLight(light).setNormal(0, 0, 1); } private void updateOrientationQuaternion( SmokeRingProjectileEntity entity, - SmokeRingProjectileRenderState state, float tickDelta) { - float yawRad = (float) Math.toRadians(-MathHelper.lerp(tickDelta, - entity.lastYaw, - entity.getYaw())); - float pitchRad = (float) Math.toRadians(MathHelper.lerp(tickDelta, - entity.lastPitch, - entity.getPitch())); - state.orientationQuat = new Quaternionf().rotateYXZ(yawRad, pitchRad, 0f); + float yawRad = (float) Math.toRadians(-Mth.lerp(tickDelta, + entity.yRotO, + entity.getYRot())); + float pitchRad = (float) Math.toRadians(Mth.lerp(tickDelta, + entity.xRotO, + entity.getXRot())); + this.orientation.identity().rotateYXZ(yawRad, pitchRad, 0f); + } + + @Override + public ResourceLocation getTextureLocation(SmokeRingProjectileEntity entity) { + return SPRITES_ATLAS_ID; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/spear/SpearEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/spear/SpearEntity.java index 5c156bb8b0..506bd78d33 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/spear/SpearEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/spear/SpearEntity.java @@ -1,112 +1,112 @@ package net.sevenstars.middleearth.entity.projectile.spear; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.projectile.AbstractArrow; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.entity.EntitiesME; import net.sevenstars.middleearth.item.WeaponItemsME; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.data.TrackedData; -import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.PersistentProjectileEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundEvent; -import net.minecraft.sound.SoundEvents; -import net.minecraft.util.hit.EntityHitResult; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; -public class SpearEntity extends PersistentProjectileEntity { +public class SpearEntity extends AbstractArrow { private float damage; - private static final TrackedData ITEM_STACK_DATA = DataTracker.registerData(SpearEntity.class, TrackedDataHandlerRegistry.ITEM_STACK); + private static final EntityDataAccessor ITEM_STACK_DATA = SynchedEntityData.defineId(SpearEntity.class, EntityDataSerializers.ITEM_STACK); - public SpearEntity(EntityType entityType, World world) { + public SpearEntity(EntityType entityType, Level world) { super(entityType, world); } - public SpearEntity(World world, ItemStack itemStack, LivingEntity owner, float dmg) { + public SpearEntity(Level world, ItemStack itemStack, LivingEntity owner, float dmg) { super(EntitiesME.SPEAR, owner, world, itemStack, null); - dataTracker.set(ITEM_STACK_DATA, itemStack); + entityData.set(ITEM_STACK_DATA, itemStack); this.damage = dmg; } @Override - protected void initDataTracker(DataTracker.Builder builder) { - super.initDataTracker(builder); - builder.add(ITEM_STACK_DATA, getDefaultItemStack()); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(ITEM_STACK_DATA, getDefaultPickupItem()); } public ItemStack getTrackedItemStackData() { - return this.dataTracker.get(ITEM_STACK_DATA); + return this.entityData.get(ITEM_STACK_DATA); } - protected SoundEvent getHitSound() { - return SoundEvents.ITEM_TRIDENT_HIT; + protected SoundEvent getDefaultHitGroundSoundEvent() { + return SoundEvents.TRIDENT_HIT; } @Override - protected boolean tryPickup(PlayerEntity player) { - return super.tryPickup(player) || this.isNoClip() && this.isOwner(player) && player.getInventory().insertStack(this.asItemStack()); + protected boolean tryPickup(Player player) { + return super.tryPickup(player) || this.isNoPhysics() && this.ownedBy(player) && player.getInventory().add(this.getPickupItem()); } @Override - protected void onEntityHit(EntityHitResult entityHitResult) { - ServerWorld serverWorld; + protected void onHitEntity(EntityHitResult entityHitResult) { + ServerLevel serverWorld; Entity entity = entityHitResult.getEntity(); float f = 8.0f; Entity entity2 = this.getOwner(); - DamageSource damageSource = this.getDamageSources().trident(this, entity2 == null ? this : entity2); - World world = this.getWorld(); + DamageSource damageSource = this.damageSources().trident(this, entity2 == null ? this : entity2); + Level world = this.level(); - if (entity.damage((ServerWorld) world, damageSource, f)) { + if (entity.hurt(damageSource, f)) { if (entity.getType() == EntityType.ENDERMAN) { return; } - if (world instanceof ServerWorld) { - serverWorld = (ServerWorld)world; - EnchantmentHelper.onTargetDamaged(serverWorld, entity, damageSource, this.getWeaponStack()); + if (world instanceof ServerLevel) { + serverWorld = (ServerLevel)world; + EnchantmentHelper.doPostAttackEffectsWithItemSource(serverWorld, entity, damageSource, this.getWeaponItem()); } if (entity instanceof LivingEntity livingEntity) { - this.knockback(livingEntity, damageSource); - this.onHit(livingEntity); + this.doKnockback(livingEntity, damageSource); + this.doPostHurtEffects(livingEntity); } } - this.setVelocity(this.getVelocity().multiply(-0.01, -0.1, -0.01)); - this.playSound(SoundEvents.ITEM_TRIDENT_HIT, 1.0f, 1.0f); + this.setDeltaMovement(this.getDeltaMovement().multiply(-0.01, -0.1, -0.01)); + this.playSound(SoundEvents.TRIDENT_HIT, 1.0f, 1.0f); } - protected void knockback(LivingEntity target, DamageSource source) { + protected void doKnockback(LivingEntity target, DamageSource source) { float f; - World world; - if (this.getItemStack() != null && (world = this.getWorld()) instanceof ServerWorld) { - ServerWorld serverWorld = (ServerWorld)world; - f = EnchantmentHelper.modifyKnockback(serverWorld, this.getItemStack(), target, source, 0.0f); + Level world; + if (this.getPickupItemStackOrigin() != null && (world = this.level()) instanceof ServerLevel) { + ServerLevel serverWorld = (ServerLevel)world; + f = EnchantmentHelper.modifyKnockback(serverWorld, this.getPickupItemStackOrigin(), target, source, 0.0f); } else { f = 0.0f; } double d = f; - double e = Math.max(0.0, 1.0 - target.getAttributeValue(EntityAttributes.KNOCKBACK_RESISTANCE)); - Vec3d velocity = this.getVelocity(); + double e = Math.max(0.0, 1.0 - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); + Vec3 velocity = this.getDeltaMovement(); velocity = velocity.multiply(1.0, 0.0, 1.0); velocity = velocity.normalize(); - Vec3d vec3d = velocity.multiply(1.45 * e + d * 1.5 * e); - if (vec3d.lengthSquared() > 0.0) { - target.addVelocity(vec3d.x, 0.15, vec3d.z); + Vec3 vec3d = velocity.scale(1.45 * e + d * 1.5 * e); + if (vec3d.lengthSqr() > 0.0) { + target.push(vec3d.x, 0.15, vec3d.z); } } @Override - protected ItemStack getDefaultItemStack() { - return WeaponItemsME.WOODEN_SPEAR.getDefaultStack(); + protected ItemStack getDefaultPickupItem() { + return WeaponItemsME.WOODEN_SPEAR.getDefaultInstance(); } - protected float getDragInWater() { + protected float getWaterInertia() { return 0.8f; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/spear/SpearEntityRenderState.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/spear/SpearEntityRenderState.java deleted file mode 100644 index be1f610e89..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/spear/SpearEntityRenderState.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.sevenstars.middleearth.entity.projectile.spear; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.entity.state.EntityRenderState; - -@Environment(EnvType.CLIENT) -public class SpearEntityRenderState extends EntityRenderState { - - SpearEntityRenderState(){ - - } -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/spear/SpearEntityRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/spear/SpearEntityRenderer.java index e4003291a1..448a5821c2 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/spear/SpearEntityRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/projectile/spear/SpearEntityRenderer.java @@ -1,75 +1,67 @@ package net.sevenstars.middleearth.entity.projectile.spear; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.EntityRenderer; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.equipment.EquipmentRenderer; -import net.minecraft.client.render.item.ItemRenderer; -import net.minecraft.client.texture.SpriteAtlasTexture; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemDisplayContext; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.RotationAxis; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Axis; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.ItemRenderer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.client.renderer.texture.TextureAtlas; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; -@Environment(EnvType.CLIENT) -public class SpearEntityRenderer extends EntityRenderer { +public class SpearEntityRenderer extends EntityRenderer { private static final float MIN_DISTANCE = 12.25F; private static final float SCALE = 1.0F; - private final EquipmentRenderer itemRenderer; + private final ItemRenderer itemRenderer; private final float scale; private final boolean lit; - public SpearEntityRenderer(EntityRendererFactory.Context ctx, float scale, boolean lit) { + public SpearEntityRenderer(EntityRendererProvider.Context ctx, float scale, boolean lit) { super(ctx); - this.itemRenderer = ctx.getEquipmentRenderer(); + this.itemRenderer = ctx.getItemRenderer(); this.scale = SCALE * scale; this.lit = lit; } - public SpearEntityRenderer(EntityRendererFactory.Context context) { + public SpearEntityRenderer(EntityRendererProvider.Context context) { this(context, 1.0F, false); } @Override - public SpearEntityRenderState createRenderState() { - return new SpearEntityRenderState(); - } - - @Override - protected int getBlockLight(SpearEntity entity, BlockPos pos) { - return this.lit ? 15 : super.getBlockLight(entity, pos); + protected int getBlockLightLevel(SpearEntity entity, BlockPos pos) { + return this.lit ? 15 : super.getBlockLightLevel(entity, pos); } - //TODO fix all this @Override - public void render(SpearEntityRenderState state, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light) { - /* - matrices.push(); - float cosYaw = (float) Math.cos(Math.toRadians(state.getYaw())); - float sinYaw = (float) Math.sin(Math.toRadians(state.getYaw())); - matrices.translate(sinYaw * -1.3D, 1.55D * (state.getPitch() / -90), cosYaw * -1.3D); - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(MathHelper.lerp(tickDelta, state.prevYaw, state.getYaw()) - 90.0f)); - matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(-90)); - matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(MathHelper.lerp(tickDelta, state.prevPitch, state.getPitch()))); - - matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(90.0f)); - - + public void render(SpearEntity entity, float yaw, float tickDelta, PoseStack matrices, MultiBufferSource vertexConsumers, int light) { + matrices.pushPose(); + float cosYaw = (float)Math.cos(Math.toRadians(entity.getYRot())); + float sinYaw = (float)Math.sin(Math.toRadians(entity.getYRot())); + matrices.translate(sinYaw * -1.3D, 1.55D * (entity.getXRot() / -90), cosYaw * -1.3D); + matrices.mulPose(Axis.YP.rotationDegrees(Mth.lerp(tickDelta, entity.yRotO, entity.getYRot()) - 90.0F)); + matrices.mulPose(Axis.ZP.rotationDegrees(-90.0F)); + matrices.mulPose(Axis.ZP.rotationDegrees(Mth.lerp(tickDelta, entity.xRotO, entity.getXRot()))); + matrices.mulPose(Axis.YP.rotationDegrees(90.0F)); matrices.scale(scale, scale, scale); - ItemStack itemStack = state.getTrackedItemStackData(); - if(itemStack == null) state.getDefaultItemStack(); - this.itemRenderer.renderItem(itemStack, ItemDisplayContext.THIRD_PERSON_RIGHT_HAND, light, OverlayTexture.DEFAULT_UV, matrices, vertexConsumers, entity.getWorld(), entity.getId()); - matrices.pop(); + ItemStack itemStack = entity.getTrackedItemStackData(); + if (itemStack == null) { + itemStack = entity.getDefaultPickupItem(); + } + this.itemRenderer.renderStatic(itemStack, ItemDisplayContext.THIRD_PERSON_RIGHT_HAND, light, + OverlayTexture.NO_OVERLAY, matrices, vertexConsumers, entity.level(), entity.getId()); + matrices.popPose(); + super.render(entity, yaw, tickDelta, matrices, vertexConsumers, light); + } - */ - super.render(state, matrices, vertexConsumers, light); + @Override + public ResourceLocation getTextureLocation(SpearEntity entity) { + return TextureAtlas.LOCATION_BLOCKS; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/seat/SeatEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/seat/SeatEntity.java index aba5fd5b3e..26183bc6d6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/seat/SeatEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/seat/SeatEntity.java @@ -1,61 +1,59 @@ package net.sevenstars.middleearth.entity.seat; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; +import net.minecraft.core.BlockPos; +import net.minecraft.core.registries.Registries; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.vehicle.VehicleEntity; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.SeatBlock; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.vehicle.VehicleEntity; -import net.minecraft.item.Item; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public class SeatEntity extends VehicleEntity { - public SeatEntity(EntityType type, World world) { + public SeatEntity(EntityType type, Level world) { super(type, world); } @Override - protected Item asItem() { + protected Item getDropItem() { return null; } @Override public void tick() { - if(!this.getWorld().isClient){ - World world = this.getWorld(); - BlockPos pos = this.getBlockPos(); - if (!this.hasPassengers() && this.getWorld().getBlockState(pos).isIn(TagKey.of(RegistryKeys.BLOCK, Identifier.of(MiddleEarth.MOD_ID, "seat")))){ - world.setBlockState(this.getBlockPos(), world.getBlockState(pos).with(SeatBlock.OCCUPIED, false)); + if(!this.level().isClientSide){ + Level world = this.level(); + BlockPos pos = this.blockPosition(); + if (!this.isVehicle() && this.level().getBlockState(pos).is(TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "seat")))){ + world.setBlockAndUpdate(this.blockPosition(), world.getBlockState(pos).setValue(SeatBlock.OCCUPIED, false)); this.remove(RemovalReason.DISCARDED); - } else if(!this.hasPassengers() || !this.getWorld().getBlockState(pos).isIn(TagKey.of(RegistryKeys.BLOCK, Identifier.of(MiddleEarth.MOD_ID, "seat")))){ + } else if(!this.isVehicle() || !this.level().getBlockState(pos).is(TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "seat")))){ this.remove(RemovalReason.DISCARDED); } } } @Override - protected void readCustomData(ReadView view) { + protected void readAdditionalSaveData(CompoundTag view) { } @Override - protected void writeCustomData(WriteView view) { + protected void addAdditionalSaveData(CompoundTag view) { } @Override protected void removePassenger(Entity passenger) { - World world = passenger.getWorld(); - if (!world.isClient){ - BlockPos pos = this.getBlockPos(); - passenger.requestTeleport(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5); + Level world = passenger.level(); + if (!world.isClientSide){ + BlockPos pos = this.blockPosition(); + passenger.teleportTo(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5); super.removePassenger(passenger); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/seat/SeatEntityRenderState.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/seat/SeatEntityRenderState.java deleted file mode 100644 index 20bbf1672c..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/seat/SeatEntityRenderState.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.sevenstars.middleearth.entity.seat; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.entity.state.EntityRenderState; - -@Environment(EnvType.CLIENT) -public class SeatEntityRenderState extends EntityRenderState { - - SeatEntityRenderState(){ - - } -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/seat/SeatRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/seat/SeatRenderer.java index 7f68e84754..635eb0a612 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/seat/SeatRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/seat/SeatRenderer.java @@ -1,16 +1,17 @@ package net.sevenstars.middleearth.entity.seat; -import net.minecraft.client.render.entity.EntityRenderer; -import net.minecraft.client.render.entity.EntityRendererFactory; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.resources.ResourceLocation; -public class SeatRenderer extends EntityRenderer { +public class SeatRenderer extends EntityRenderer { - public SeatRenderer(EntityRendererFactory.Context ctx) { + public SeatRenderer(EntityRendererProvider.Context ctx) { super(ctx); } @Override - public SeatEntityRenderState createRenderState() { - return new SeatEntityRenderState(); + public ResourceLocation getTextureLocation(SeatEntity entity) { + return null; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/EnwebbedFeatureRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/EnwebbedFeatureRenderer.java index 646f5753b0..1e23ce6099 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/EnwebbedFeatureRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/EnwebbedFeatureRenderer.java @@ -1,40 +1,41 @@ package net.sevenstars.middleearth.entity.spider; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.equipment.EquipmentRenderer; -import net.minecraft.client.render.entity.feature.FeatureRenderer; -import net.minecraft.client.render.entity.feature.FeatureRendererContext; -import net.minecraft.client.render.entity.model.*; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.entity.RenderLayerParent; +import net.minecraft.client.renderer.entity.layers.RenderLayer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.LivingEntity; import net.sevenstars.middleearth.MiddleEarth; -import net.sevenstars.middleearth.client.renderer.ArmedEntityRenderStateAccess; import net.sevenstars.middleearth.entity.EntityModelLayersME; +import net.sevenstars.middleearth.statusEffects.ModStatusEffects; -@Environment(EnvType.CLIENT) -public class EnwebbedFeatureRenderer > extends FeatureRenderer { - private static final Identifier TEXTURE = Identifier.of(MiddleEarth.MOD_ID, "textures/entities/spiders/enwebbed.png"); +public class EnwebbedFeatureRenderer> extends RenderLayer { + private static final ResourceLocation TEXTURE = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "textures/entities/spiders/enwebbed.png"); - private final EnwebbedModel model; + private final EnwebbedModel model; - public EnwebbedFeatureRenderer(FeatureRendererContext context, LoadedEntityModels loader, EquipmentRenderer equipmentRenderer) { + public EnwebbedFeatureRenderer(RenderLayerParent context, EntityModelSet loader) { super(context); - this.model = new EnwebbedModel(loader.getModelPart(EntityModelLayersME.ENWEBBED)); + this.model = new EnwebbedModel(loader.bakeLayer(EntityModelLayersME.ENWEBBED)); } - public void render(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, S bipedEntityRenderState, float f, float g) { - ArmedEntityRenderStateAccess renderStateAccess = ((ArmedEntityRenderStateAccess)bipedEntityRenderState); - if(renderStateAccess.isRestrained()) { - EnwebbedModel entityModel = this.model; - entityModel.setAngles(bipedEntityRenderState); - VertexConsumer vertexConsumer = vertexConsumerProvider.getBuffer(RenderLayer.getEntityTranslucent(TEXTURE)); - entityModel.render(matrixStack, vertexConsumer, i, OverlayTexture.DEFAULT_UV); + @Override + public void render(PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, T entity, + float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, + float netHeadYaw, float headPitch) { + var restrained = entity.getEffect(ModStatusEffects.RESTRAINED); + if (restrained != null && restrained.getDuration() > 0) { + this.getParentModel().copyPropertiesTo(this.model); + this.model.prepareMobModel(entity, limbSwing, limbSwingAmount, partialTick); + this.model.setupAnim(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch); + VertexConsumer vertexConsumer = bufferSource.getBuffer(RenderType.entityTranslucent(TEXTURE)); + this.model.renderToBuffer(poseStack, vertexConsumer, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF); } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/EnwebbedModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/EnwebbedModel.java index 0fdc6f52f0..1346f07717 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/EnwebbedModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/EnwebbedModel.java @@ -1,35 +1,50 @@ package net.sevenstars.middleearth.entity.spider; -import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.model.EntityModel; -import net.minecraft.client.render.entity.state.BipedEntityRenderState; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import net.minecraft.client.model.EntityModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; -public class EnwebbedModel extends EntityModel { +public class EnwebbedModel extends EntityModel { private final ModelPart bigBody; private final ModelPart smallBody; public EnwebbedModel(ModelPart root) { - super(root); this.bigBody = root.getChild("big_body"); this.smallBody = root.getChild("small_body"); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData dataRoot = modelData.getRoot(); - ModelPartData bigBody = dataRoot.addChild("big_body", ModelPartBuilder.create().uv(0, 0) - .cuboid(-8.0F, -23.5F, -2.0F, 16.0F, 11.0F, 4.0F, new Dilation(1.15F)), ModelTransform.origin(0.0F, 24.0F, 0.0F)); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition dataRoot = modelData.getRoot(); + PartDefinition bigBody = dataRoot.addOrReplaceChild("big_body", CubeListBuilder.create().texOffs(0, 0) + .addBox(-8.0F, -23.5F, -2.0F, 16.0F, 11.0F, 4.0F, new CubeDeformation(1.15F)), PartPose.offset(0.0F, 24.0F, 0.0F)); - ModelPartData smallBody = dataRoot.addChild("small_body", ModelPartBuilder.create().uv(0, 0) - .cuboid(-8.0F, -23.5F, -2.0F, 16.0F, 11.0F, 4.0F, new Dilation(0.65F)), ModelTransform.origin(0.0F, 24.0F, 0.0F)); + PartDefinition smallBody = dataRoot.addOrReplaceChild("small_body", CubeListBuilder.create().texOffs(0, 0) + .addBox(-8.0F, -23.5F, -2.0F, 16.0F, 11.0F, 4.0F, new CubeDeformation(0.65F)), PartPose.offset(0.0F, 24.0F, 0.0F)); - return TexturedModelData.of(modelData, 64, 64); + return LayerDefinition.create(modelData, 64, 64); } @Override - public void setAngles(BipedEntityRenderState state) { - boolean hasChestplate = !state.equippedChestStack.isEmpty(); - bigBody.hidden = !hasChestplate; - smallBody.hidden = hasChestplate; - super.setAngles(state); + public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { + boolean hasChestplate = !entity.getItemBySlot(EquipmentSlot.CHEST).isEmpty(); + bigBody.skipDraw = !hasChestplate; + smallBody.skipDraw = hasChestplate; } -} \ No newline at end of file + + @Override + public void renderToBuffer(PoseStack poseStack, + VertexConsumer vertexConsumer, + int packedLight, int packedOverlay, int packedColor) { + this.bigBody.render(poseStack, vertexConsumer, packedLight, packedOverlay, packedColor); + this.smallBody.render(poseStack, vertexConsumer, packedLight, packedOverlay, packedColor); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/SpiderVariant.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/SpiderVariant.java index 9809814006..727a0e0d21 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/SpiderVariant.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/SpiderVariant.java @@ -2,50 +2,39 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.entity.VariantSelectorProvider; -import net.minecraft.entity.spawn.SpawnCondition; -import net.minecraft.entity.spawn.SpawnConditionSelectors; -import net.minecraft.entity.spawn.SpawnContext; -import net.minecraft.network.RegistryByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.entry.RegistryFixedCodec; -import net.minecraft.util.AssetInfo; +import net.minecraft.core.Holder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.RegistryFixedCodec; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.registries.DynamicRegistriesME; -import java.util.List; - -public record SpiderVariant(SpiderAssetInfo assetInfo, SpawnConditionSelectors spawnConditions) implements VariantSelectorProvider { +public record SpiderVariant(SpiderAssetInfo assetInfo) { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( - SpiderAssetInfo.CODEC.fieldOf("assets").forGetter(SpiderVariant::assetInfo), - SpawnConditionSelectors.CODEC.fieldOf("spawn_conditions").forGetter(SpiderVariant::spawnConditions) + SpiderAssetInfo.CODEC.fieldOf("assets").forGetter(SpiderVariant::assetInfo) ) .apply(instance, SpiderVariant::new) ); - public static final Codec> ENTRY_CODEC = RegistryFixedCodec.of(DynamicRegistriesME.SPIDER_VARIANTS); - - public static final PacketCodec> PACKET_CODEC = PacketCodecs.registryEntry(DynamicRegistriesME.SPIDER_VARIANTS); + public static final Codec> ENTRY_CODEC = RegistryFixedCodec.create(DynamicRegistriesME.SPIDER_VARIANTS); - private SpiderVariant(SpiderAssetInfo assetInfo) { - this(assetInfo, SpawnConditionSelectors.EMPTY); - } + public static final StreamCodec> PACKET_CODEC = ByteBufCodecs.holderRegistry(DynamicRegistriesME.SPIDER_VARIANTS); - @Override - public List> getSelectors() { - return this.spawnConditions.selectors(); + public static ResourceLocation texture(ResourceLocation assetId) { + return ResourceLocation.fromNamespaceAndPath( + assetId.getNamespace(), "textures/" + assetId.getPath() + ".png"); } - public record SpiderAssetInfo(AssetInfo larva, AssetInfo scuttler, AssetInfo spawnOfShelob) { + public record SpiderAssetInfo(ResourceLocation larva, ResourceLocation scuttler, ResourceLocation spawnOfShelob) { public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( - AssetInfo.CODEC.fieldOf("larva").forGetter(SpiderAssetInfo::larva), - AssetInfo.CODEC.fieldOf("scuttler").forGetter(SpiderAssetInfo::scuttler), - AssetInfo.CODEC.fieldOf("spawn").forGetter(SpiderAssetInfo::spawnOfShelob) + ResourceLocation.CODEC.fieldOf("larva").forGetter(SpiderAssetInfo::larva), + ResourceLocation.CODEC.fieldOf("scuttler").forGetter(SpiderAssetInfo::scuttler), + ResourceLocation.CODEC.fieldOf("spawn").forGetter(SpiderAssetInfo::spawnOfShelob) ) .apply(instance, SpiderAssetInfo::new) ); } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/SpiderVariantSelector.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/SpiderVariantSelector.java new file mode 100644 index 0000000000..c1e425ae54 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/SpiderVariantSelector.java @@ -0,0 +1,32 @@ +package net.sevenstars.middleearth.entity.spider; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.Registries; +import net.minecraft.tags.TagKey; +import net.minecraft.world.level.ServerLevelAccessor; +import net.minecraft.world.level.biome.Biome; +import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.middleearth.registries.DynamicRegistriesME; +import net.sevenstars.middleearth.registries.content.spidervariants.SpiderVariantRegistry; + +public final class SpiderVariantSelector { + private static final TagKey CAVE_BIOMES = + TagKey.create(Registries.BIOME, MiddleEarth.of("is_cave")); + private static final TagKey MORDOR_BIOMES = + TagKey.create(Registries.BIOME, MiddleEarth.of("is_mordor")); + + private SpiderVariantSelector() {} + + public static Holder select(ServerLevelAccessor world, BlockPos pos) { + var biome = world.getBiome(pos); + var key = biome.is(MORDOR_BIOMES) + ? SpiderVariantRegistry.MORDOR + : biome.is(CAVE_BIOMES) + ? SpiderVariantRegistry.CAVE + : SpiderVariantRegistry.MIRKWOOD; + return world.registryAccess() + .registryOrThrow(DynamicRegistriesME.SPIDER_VARIANTS) + .getHolderOrThrow(key); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/larva/ShelobiteLarvaAnimations.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/larva/ShelobiteLarvaAnimations.java index bf6760b10b..cd116f8fc8 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/larva/ShelobiteLarvaAnimations.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/larva/ShelobiteLarvaAnimations.java @@ -1,140 +1,140 @@ package net.sevenstars.middleearth.entity.spider.larva; -import net.minecraft.client.render.entity.animation.AnimationDefinition; -import net.minecraft.client.render.entity.animation.AnimationHelper; -import net.minecraft.client.render.entity.animation.Keyframe; -import net.minecraft.client.render.entity.animation.Transformation; +import net.minecraft.client.animation.AnimationChannel; +import net.minecraft.client.animation.AnimationDefinition; +import net.minecraft.client.animation.Keyframe; +import net.minecraft.client.animation.KeyframeAnimations; public class ShelobiteLarvaAnimations { // region WALK - public static final AnimationDefinition SHELOBITE_LARVA_WALK = AnimationDefinition.Builder.create(1f).looping() - .addBoneAnimation("leg_left_front", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.33333f, AnimationHelper.createRotationalVector(0f, -15f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(-37.23f, -9.24f, -30.47f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 2.5f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("leg_left_center_front", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-37.23f, -9.24f, -30.47f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.29167f, AnimationHelper.createRotationalVector(0f, 2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(0f, -15f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(-37.23f, -9.24f, -30.47f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("leg_left_center_back", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.33333f, AnimationHelper.createRotationalVector(0f, -15f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(-37.23f, -9.24f, -30.47f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 2.5f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("leg_left_back", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-37.23f, -9.24f, -30.47f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.29167f, AnimationHelper.createRotationalVector(0f, 2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(0f, -15f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(-37.23f, -9.24f, -30.47f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("leg_right_front", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-37.23f, 9.24f, 30.47f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.29167f, AnimationHelper.createRotationalVector(0f, -2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(0f, 15f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(-37.23f, 9.24f, 30.47f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("leg_right_center_front", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.33333f, AnimationHelper.createRotationalVector(0f, 15f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(-37.23f, 9.24f, 30.47f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 2.5f, 0f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("leg_right_center_back", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-14.73f, 9.24f, 30.47f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.29167f, AnimationHelper.createRotationalVector(0f, -2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(0f, 15f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(-14.73f, 9.24f, 30.47f), - Transformation.Interpolations.CUBIC))) - .addBoneAnimation("leg_right_back", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 2.5f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.33333f, AnimationHelper.createRotationalVector(0f, 15f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(-37.23f, 9.24f, 30.47f), - Transformation.Interpolations.CUBIC), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 2.5f, 0f), - Transformation.Interpolations.CUBIC))).build(); + public static final AnimationDefinition SHELOBITE_LARVA_WALK = AnimationDefinition.Builder.withLength(1f).looping() + .addAnimation("leg_left_front", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.33333f, KeyframeAnimations.degreeVec(0f, -15f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(-37.23f, -9.24f, -30.47f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("leg_left_center_front", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-37.23f, -9.24f, -30.47f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.29167f, KeyframeAnimations.degreeVec(0f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(0f, -15f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(-37.23f, -9.24f, -30.47f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("leg_left_center_back", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.33333f, KeyframeAnimations.degreeVec(0f, -15f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(-37.23f, -9.24f, -30.47f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("leg_left_back", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-37.23f, -9.24f, -30.47f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.29167f, KeyframeAnimations.degreeVec(0f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(0f, -15f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(-37.23f, -9.24f, -30.47f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("leg_right_front", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-37.23f, 9.24f, 30.47f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.29167f, KeyframeAnimations.degreeVec(0f, -2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(0f, 15f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(-37.23f, 9.24f, 30.47f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("leg_right_center_front", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.33333f, KeyframeAnimations.degreeVec(0f, 15f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(-37.23f, 9.24f, 30.47f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("leg_right_center_back", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-14.73f, 9.24f, 30.47f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.29167f, KeyframeAnimations.degreeVec(0f, -2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(0f, 15f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(-14.73f, 9.24f, 30.47f), + AnimationChannel.Interpolations.CATMULLROM))) + .addAnimation("leg_right_back", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.33333f, KeyframeAnimations.degreeVec(0f, 15f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(-37.23f, 9.24f, 30.47f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 2.5f, 0f), + AnimationChannel.Interpolations.CATMULLROM))).build(); // endregion // region BITE - public static final AnimationDefinition SHELOBITE_LARVA_BITE = AnimationDefinition.Builder.create(0.65f) - .addBoneAnimation("root", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.125f, AnimationHelper.createRotationalVector(-25f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("abdomen", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.125f, AnimationHelper.createRotationalVector(-15f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.2916767f, AnimationHelper.createRotationalVector(20f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("core", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.125f, AnimationHelper.createRotationalVector(-30f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.375f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("leg_left", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.125f, AnimationHelper.createRotationalVector(25f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.375f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("leg_right", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.125f, AnimationHelper.createRotationalVector(25f, 0f, 0f), - Transformation.Interpolations.CUBIC), - new Keyframe(0.375f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); + public static final AnimationDefinition SHELOBITE_LARVA_BITE = AnimationDefinition.Builder.withLength(0.65f) + .addAnimation("root", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.125f, KeyframeAnimations.degreeVec(-25f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("abdomen", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.125f, KeyframeAnimations.degreeVec(-15f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.2916767f, KeyframeAnimations.degreeVec(20f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("core", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.125f, KeyframeAnimations.degreeVec(-30f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("leg_left", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.125f, KeyframeAnimations.degreeVec(25f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("leg_right", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.125f, KeyframeAnimations.degreeVec(25f, 0f, 0f), + AnimationChannel.Interpolations.CATMULLROM), + new Keyframe(0.375f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); // endregion } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/larva/ShelobiteLarvaEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/larva/ShelobiteLarvaEntity.java index c4b841143d..c23858a3d9 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/larva/ShelobiteLarvaEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/larva/ShelobiteLarvaEntity.java @@ -1,56 +1,64 @@ package net.sevenstars.middleearth.entity.spider.larva; -import net.minecraft.block.BlockState; -import net.minecraft.entity.*; -import net.minecraft.entity.ai.goal.*; -import net.minecraft.entity.ai.pathing.EntityNavigation; -import net.minecraft.entity.ai.pathing.SpiderNavigation; -import net.minecraft.entity.attribute.DefaultAttributeContainer; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.data.TrackedData; -import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.entity.mob.HostileEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.spawn.SpawnContext; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundEvent; -import net.minecraft.sound.SoundEvents; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.LocalDifficulty; -import net.minecraft.world.ServerWorldAccess; -import net.minecraft.world.World; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.tags.TagKey; +import net.minecraft.util.RandomSource; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.AnimationState; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.SpawnGroupData; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.goal.FloatGoal; +import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; +import net.minecraft.world.entity.ai.goal.MeleeAttackGoal; +import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; +import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; +import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; +import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; +import net.minecraft.world.entity.ai.navigation.PathNavigation; +import net.minecraft.world.entity.ai.navigation.WallClimberNavigation; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.ServerLevelAccessor; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.TrackedDataHandlerRegistryME; +import net.sevenstars.middleearth.entity.VariantHolderUtils; import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntity; import net.sevenstars.middleearth.entity.goals.FollowDifferentMobGoal; import net.sevenstars.middleearth.entity.npcs.NpcEntity; import net.sevenstars.middleearth.entity.spider.SpiderVariant; +import net.sevenstars.middleearth.entity.spider.SpiderVariantSelector; import net.sevenstars.middleearth.entity.spider.scuttler.ShelobiteScuttlerEntity; import net.sevenstars.middleearth.registries.DynamicRegistriesME; import net.sevenstars.middleearth.registries.content.spidervariants.SpiderVariantRegistry; import net.sevenstars.middleearth.utils.SpawnUtil; import org.jetbrains.annotations.Nullable; -import java.util.Optional; - -public class ShelobiteLarvaEntity extends HostileEntity { +public class ShelobiteLarvaEntity extends Monster { public static final int CLIMBING_TIME_TRANSITION = 12; public static final float MOVEMENT_SPEED = 1f; - private static final TrackedData SPIDER_FLAGS; - private static final TrackedData ATTACK_FLAG; - private static final TrackedData> VARIANT; + private static final EntityDataAccessor SPIDER_FLAGS; + private static final EntityDataAccessor ATTACK_FLAG; + private static final EntityDataAccessor> VARIANT; public final AnimationState idleAnimation = new AnimationState(); public final AnimationState walkingAnimation = new AnimationState(); @@ -58,85 +66,84 @@ public class ShelobiteLarvaEntity extends HostileEntity { private int climbingTicks = 0; - public ShelobiteLarvaEntity(EntityType entityType, World world) { + public ShelobiteLarvaEntity(EntityType entityType, Level world) { super(entityType, world); } - public static DefaultAttributeContainer.Builder setAttributes() { - return HostileEntity.createHostileAttributes() - .add(EntityAttributes.MAX_HEALTH, 8.0) - .add(EntityAttributes.MOVEMENT_SPEED, 0.27) - .add(EntityAttributes.FOLLOW_RANGE, 24.0); + public static AttributeSupplier.Builder setAttributes() { + return Monster.createMonsterAttributes() + .add(Attributes.MAX_HEALTH, 8.0) + .add(Attributes.MOVEMENT_SPEED, 0.27) + .add(Attributes.FOLLOW_RANGE, 24.0); } - protected void initGoals() { - this.goalSelector.add(1, new SwimGoal(this)); - this.goalSelector.add(3, new MeleeAttackGoal(this, MOVEMENT_SPEED , false)); - this.goalSelector.add(4, new WanderAroundFarGoal(this, 0.8)); - this.goalSelector.add(5, new FollowDifferentMobGoal(this, + protected void registerGoals() { + this.goalSelector.addGoal(1, new FloatGoal(this)); + this.goalSelector.addGoal(3, new MeleeAttackGoal(this, MOVEMENT_SPEED , false)); + this.goalSelector.addGoal(4, new WaterAvoidingRandomStrollGoal(this, 0.8)); + this.goalSelector.addGoal(5, new FollowDifferentMobGoal(this, ShelobiteScuttlerEntity.class, 1.0, 7, 16)); - this.goalSelector.add(6, new LookAtEntityGoal(this, PlayerEntity.class, 8.0F)); - this.goalSelector.add(6, new LookAroundGoal(this)); - this.targetSelector.add(1, new RevengeGoal(this)); - this.targetSelector.add(2, new ActiveTargetGoal<>(this, PlayerEntity.class, true)); - this.targetSelector.add(3, new ActiveTargetGoal<>(this, NpcEntity.class, true)); - this.targetSelector.add(4, new ActiveTargetGoal<>(this, CaveTrollEntity.class, true)); + this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 8.0F)); + this.goalSelector.addGoal(6, new RandomLookAroundGoal(this)); + this.targetSelector.addGoal(1, new HurtByTargetGoal(this)); + this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true)); + this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, NpcEntity.class, true)); + this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, CaveTrollEntity.class, true)); } @Nullable @Override - public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData) { + public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData) { if (entityData instanceof ShelobiteScuttlerEntity.SpiderData spiderData) { this.setVariant(spiderData.variant); } else { - Optional> optional = Variants.select(SpawnContext.of(world, this.getBlockPos()), DynamicRegistriesME.SPIDER_VARIANTS); - if (optional.isPresent()) { - this.setVariant(optional.get()); - entityData = new ShelobiteScuttlerEntity.SpiderData(optional.get()); - } + Holder variant = SpiderVariantSelector.select(world, this.blockPosition()); + this.setVariant(variant); + entityData = new ShelobiteScuttlerEntity.SpiderData(variant); } - return super.initialize(world, difficulty, spawnReason, entityData); + return super.finalizeSpawn(world, difficulty, spawnReason, entityData); } public double getMountedHeightOffset() { - return (double)(this.getHeight() * 0.5F); + return (double)(this.getBbHeight() * 0.5F); } @Override - protected EntityNavigation createNavigation(World world) { - return new SpiderNavigation(this, world); + protected PathNavigation createNavigation(Level world) { + return new WallClimberNavigation(this, world); } - protected void initDataTracker(DataTracker.Builder builder) { - super.initDataTracker(builder); - RegistryEntry spiderVariantRegistryEntry = Variants.getOrDefaultOrThrow(this.getRegistryManager(), SpiderVariantRegistry.DEFAULT); - builder.add(VARIANT, spiderVariantRegistryEntry); - builder.add(ATTACK_FLAG, false); - builder.add(SPIDER_FLAGS, (byte)0); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + Holder spiderVariantRegistryEntry = + VariantHolderUtils.getDefaultOrAny(this.registryAccess(), SpiderVariantRegistry.DEFAULT); + builder.define(VARIANT, spiderVariantRegistryEntry); + builder.define(ATTACK_FLAG, false); + builder.define(SPIDER_FLAGS, (byte)0); } protected void setupAnimationStates() { - if (!this.idleAnimation.isRunning()) { - this.idleAnimation.start(this.age); + if (!this.idleAnimation.isStarted()) { + this.idleAnimation.start(this.tickCount); } - boolean attackState = this.dataTracker.get(ATTACK_FLAG); + boolean attackState = this.entityData.get(ATTACK_FLAG); if(attackState) { this.biteAnimation.stop(); - this.biteAnimation.start(this.age); - this.dataTracker.set(ATTACK_FLAG, false); + this.biteAnimation.start(this.tickCount); + this.entityData.set(ATTACK_FLAG, false); } } @Override - public boolean tryAttack(ServerWorld world, Entity target) { - boolean result = super.tryAttack(world, target); - this.dataTracker.set(ATTACK_FLAG, result); + public boolean doHurtTarget(Entity target) { + boolean result = super.doHurtTarget(target); + this.entityData.set(ATTACK_FLAG, result); return result; } public void tick() { super.tick(); - if (!this.getWorld().isClient) { + if (!this.level().isClientSide) { this.setClimbingWall(this.horizontalCollision); } else { setupAnimationStates(); @@ -145,8 +152,8 @@ public void tick() { } @Override - public void tickMovement() { - super.tickMovement(); + public void aiStep() { + super.aiStep(); if(isClimbingWall()) { this.climbingTicks = Math.min(CLIMBING_TIME_TRANSITION, this.climbingTicks + 1); } else { @@ -155,7 +162,7 @@ public void tickMovement() { } @Override - protected int getExperienceToDrop(ServerWorld world) { + protected int getBaseExperienceReward() { return 1; } @@ -163,47 +170,47 @@ public SpiderVariant getVariant() { return getRegistryVariant().value(); } - private RegistryEntry getRegistryVariant() { - return this.dataTracker.get(VARIANT); + private Holder getRegistryVariant() { + return this.entityData.get(VARIANT); } - private void setVariant(RegistryEntry variant) { - this.dataTracker.set(VARIANT, variant); + private void setVariant(Holder variant) { + this.entityData.set(VARIANT, variant); } protected SoundEvent getAmbientSound() { - return SoundEvents.ENTITY_SPIDER_AMBIENT; + return SoundEvents.SPIDER_AMBIENT; } protected SoundEvent getHurtSound(DamageSource source) { - return SoundEvents.ENTITY_SPIDER_HURT; + return SoundEvents.SPIDER_HURT; } protected SoundEvent getDeathSound() { - return SoundEvents.ENTITY_SPIDER_DEATH; + return SoundEvents.SPIDER_DEATH; } protected void playStepSound(BlockPos pos, BlockState state) { - this.playSound(SoundEvents.ENTITY_SPIDER_STEP, 0.15F, 1.0F); + this.playSound(SoundEvents.SPIDER_STEP, 0.15F, 1.0F); } - public boolean isClimbing() { + public boolean onClimbable() { return this.isClimbingWall(); } - public void slowMovement(BlockState state, Vec3d multiplier) { - if (!state.isIn(TagKey.of(RegistryKeys.BLOCK, Identifier.of(MiddleEarth.MOD_ID, "cobwebs")))) { - super.slowMovement(state, multiplier); + public void makeStuckInBlock(BlockState state, Vec3 multiplier) { + if (!state.is(TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "cobwebs")))) { + super.makeStuckInBlock(state, multiplier); } } // Immune to Poison - public boolean canHaveStatusEffect(StatusEffectInstance effect) { - return effect.getEffectType() != StatusEffects.POISON && super.canHaveStatusEffect(effect); + public boolean canBeAffected(MobEffectInstance effect) { + return effect.getEffect() != MobEffects.POISON && super.canBeAffected(effect); } public boolean isClimbingWall() { - return (this.dataTracker.get(SPIDER_FLAGS) & 1) != 0; + return (this.entityData.get(SPIDER_FLAGS) & 1) != 0; } public boolean isCollidingWall() { @@ -211,14 +218,14 @@ public boolean isCollidingWall() { } public void setClimbingWall(boolean climbing) { - byte b = (Byte)this.dataTracker.get(SPIDER_FLAGS); + byte b = (Byte)this.entityData.get(SPIDER_FLAGS); if (climbing) { b = (byte)(b | 1); } else { b &= -2; } - this.dataTracker.set(SPIDER_FLAGS, b); + this.entityData.set(SPIDER_FLAGS, b); } public int getClimbingTicks() { @@ -226,26 +233,27 @@ public int getClimbingTicks() { } @Override - protected void writeCustomData(WriteView view) { - super.writeCustomData(view); - Variants.writeVariantToNbt(view, this.getRegistryVariant()); + public void addAdditionalSaveData(CompoundTag view) { + super.addAdditionalSaveData(view); + VariantHolderUtils.writeVariant(view, this.getRegistryVariant()); } @Override - protected void readCustomData(ReadView view) { - super.readCustomData(view); - Variants.readVariantFromNbt(view, DynamicRegistriesME.SPIDER_VARIANTS).ifPresent(this::setVariant); + public void readAdditionalSaveData(CompoundTag view) { + super.readAdditionalSaveData(view); + VariantHolderUtils.readVariant(view, this.registryAccess(), DynamicRegistriesME.SPIDER_VARIANTS) + .ifPresent(this::setVariant); } static { - SPIDER_FLAGS = DataTracker.registerData(ShelobiteLarvaEntity.class, TrackedDataHandlerRegistry.BYTE); - ATTACK_FLAG = DataTracker.registerData(ShelobiteLarvaEntity.class, TrackedDataHandlerRegistry.BOOLEAN); - VARIANT = DataTracker.registerData(ShelobiteLarvaEntity.class, TrackedDataHandlerRegistryME.SPIDER_VARIANT); + SPIDER_FLAGS = SynchedEntityData.defineId(ShelobiteLarvaEntity.class, EntityDataSerializers.BYTE); + ATTACK_FLAG = SynchedEntityData.defineId(ShelobiteLarvaEntity.class, EntityDataSerializers.BOOLEAN); + VARIANT = SynchedEntityData.defineId(ShelobiteLarvaEntity.class, TrackedDataHandlerRegistryME.SPIDER_VARIANT); } - public static boolean canSpawn(EntityType type, ServerWorldAccess serverWorldAccess, SpawnReason spawnReason, BlockPos blockPos, Random random) { - if(spawnReason != SpawnReason.NATURAL) - return ShelobiteLarvaEntity.canSpawnInDark(type, serverWorldAccess, spawnReason, blockPos, random); + public static boolean canSpawn(EntityType type, ServerLevelAccessor serverWorldAccess, MobSpawnType spawnReason, BlockPos blockPos, RandomSource random) { + if(spawnReason != MobSpawnType.NATURAL) + return ShelobiteLarvaEntity.checkMonsterSpawnRules(type, serverWorldAccess, spawnReason, blockPos, random); return SpawnUtil.canSpawn(blockPos, serverWorldAccess, spawnReason); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/larva/ShelobiteLarvaModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/larva/ShelobiteLarvaModel.java index 37ce9ac9cf..c7492f6ab1 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/larva/ShelobiteLarvaModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/larva/ShelobiteLarvaModel.java @@ -1,78 +1,82 @@ package net.sevenstars.middleearth.entity.spider.larva; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.animation.Animation; -import net.minecraft.client.render.entity.model.EntityModel; -import net.sevenstars.middleearth.entity.spider.scuttler.ShelobiteScuttlerRenderState; - -public class ShelobiteLarvaModel extends EntityModel { +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; + +public class ShelobiteLarvaModel extends HierarchicalModel { private final ModelPart root; - private final Animation walkingAnimation; - private final Animation biteAnimation; - public ShelobiteLarvaModel(ModelPart root) { - super(root); this.root = root.getChild("root"); - - this.walkingAnimation = ShelobiteLarvaAnimations.SHELOBITE_LARVA_WALK.createAnimation(root); - this.biteAnimation = ShelobiteLarvaAnimations.SHELOBITE_LARVA_BITE.createAnimation(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData root = modelPartData.addChild("root", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 23.5F, 5.0F)); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition root = modelPartData.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 23.5F, 5.0F)); - ModelPartData abdomen = root.addChild("abdomen", ModelPartBuilder.create(), ModelTransform.origin(0.0F, -1.5F, -3.0F)); + PartDefinition abdomen = root.addOrReplaceChild("abdomen", CubeListBuilder.create(), PartPose.offset(0.0F, -1.5F, -3.0F)); - ModelPartData cube_r1 = abdomen.addChild("cube_r1", ModelPartBuilder.create().uv(0, 0).cuboid(-2.5F, -2.0F, -1.5F, 5.0F, 3.0F, 5.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, -0.2F, 0.5F, 0.1745F, 0.0F, 0.0F)); + PartDefinition cube_r1 = abdomen.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(0, 0).addBox(-2.5F, -2.0F, -1.5F, 5.0F, 3.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -0.2F, 0.5F, 0.1745F, 0.0F, 0.0F)); - ModelPartData core = root.addChild("core", ModelPartBuilder.create().uv(0, 11).cuboid(-1.5F, -0.95F, -1.2F, 3.0F, 2.0F, 3.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, -1.05F, -5.8F)); + PartDefinition core = root.addOrReplaceChild("core", CubeListBuilder.create().texOffs(0, 11).addBox(-1.5F, -0.95F, -1.2F, 3.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -1.05F, -5.8F)); - ModelPartData leg_left = core.addChild("leg_left", ModelPartBuilder.create(), ModelTransform.origin(1.5F, -0.45F, 0.3F)); + PartDefinition leg_left = core.addOrReplaceChild("leg_left", CubeListBuilder.create(), PartPose.offset(1.5F, -0.45F, 0.3F)); - ModelPartData leg_left_front = leg_left.addChild("leg_left_front", ModelPartBuilder.create(), ModelTransform.of(-0.2617F, 0.65F, 0.0804F, -1.5708F, 1.0472F, 0.0F)); + PartDefinition leg_left_front = leg_left.addOrReplaceChild("leg_left_front", CubeListBuilder.create(), PartPose.offsetAndRotation(-0.2617F, 0.65F, 0.0804F, -1.5708F, 1.0472F, 0.0F)); - ModelPartData cube_r2 = leg_left_front.addChild("cube_r2", ModelPartBuilder.create().uv(0, 17).cuboid(-0.1608F, -1.5F, -0.0804F, 4.0F, 3.0F, 0.0F, new Dilation(0.0F)), ModelTransform.of(0.1608F, 0.0804F, 0.5F, -1.5708F, 0.2182F, 0.0F)); + PartDefinition cube_r2 = leg_left_front.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(0, 17).addBox(-0.1608F, -1.5F, -0.0804F, 4.0F, 3.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.1608F, 0.0804F, 0.5F, -1.5708F, 0.2182F, 0.0F)); - ModelPartData leg_left_center_front = leg_left.addChild("leg_left_center_front", ModelPartBuilder.create(), ModelTransform.of(-0.2617F, 0.65F, 0.0804F, -1.6411F, 0.6474F, -0.2534F)); + PartDefinition leg_left_center_front = leg_left.addOrReplaceChild("leg_left_center_front", CubeListBuilder.create(), PartPose.offsetAndRotation(-0.2617F, 0.65F, 0.0804F, -1.6411F, 0.6474F, -0.2534F)); - ModelPartData cube_r3 = leg_left_center_front.addChild("cube_r3", ModelPartBuilder.create().uv(0, 17).cuboid(-0.1608F, -1.5F, -0.0804F, 4.0F, 3.0F, 0.0F, new Dilation(0.0F)), ModelTransform.of(0.1608F, 0.0804F, 0.5F, -1.5708F, 0.0F, 0.0F)); + PartDefinition cube_r3 = leg_left_center_front.addOrReplaceChild("cube_r3", CubeListBuilder.create().texOffs(0, 17).addBox(-0.1608F, -1.5F, -0.0804F, 4.0F, 3.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.1608F, 0.0804F, 0.5F, -1.5708F, 0.0F, 0.0F)); - ModelPartData leg_left_center_back = leg_left.addChild("leg_left_center_back", ModelPartBuilder.create(), ModelTransform.of(-0.2617F, 0.65F, 0.0804F, -1.5327F, -0.1704F, -0.2214F)); + PartDefinition leg_left_center_back = leg_left.addOrReplaceChild("leg_left_center_back", CubeListBuilder.create(), PartPose.offsetAndRotation(-0.2617F, 0.65F, 0.0804F, -1.5327F, -0.1704F, -0.2214F)); - ModelPartData cube_r4 = leg_left_center_back.addChild("cube_r4", ModelPartBuilder.create().uv(0, 17).cuboid(-0.1608F, -1.5F, -0.0804F, 4.0F, 3.0F, 0.0F, new Dilation(0.0F)), ModelTransform.of(0.1608F, 0.0804F, 0.5F, -1.5708F, 0.0F, 0.0F)); + PartDefinition cube_r4 = leg_left_center_back.addOrReplaceChild("cube_r4", CubeListBuilder.create().texOffs(0, 17).addBox(-0.1608F, -1.5F, -0.0804F, 4.0F, 3.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.1608F, 0.0804F, 0.5F, -1.5708F, 0.0F, 0.0F)); - ModelPartData leg_left_back = leg_left.addChild("leg_left_back", ModelPartBuilder.create(), ModelTransform.of(-0.2617F, 0.65F, 0.0804F, -1.4338F, -0.5522F, -0.257F)); + PartDefinition leg_left_back = leg_left.addOrReplaceChild("leg_left_back", CubeListBuilder.create(), PartPose.offsetAndRotation(-0.2617F, 0.65F, 0.0804F, -1.4338F, -0.5522F, -0.257F)); - ModelPartData cube_r5 = leg_left_back.addChild("cube_r5", ModelPartBuilder.create().uv(0, 17).cuboid(-0.1608F, -1.5F, -0.0804F, 4.0F, 3.0F, 0.0F, new Dilation(0.0F)), ModelTransform.of(0.1608F, 0.0804F, 0.5F, -1.5708F, 0.0F, 0.0F)); + PartDefinition cube_r5 = leg_left_back.addOrReplaceChild("cube_r5", CubeListBuilder.create().texOffs(0, 17).addBox(-0.1608F, -1.5F, -0.0804F, 4.0F, 3.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.1608F, 0.0804F, 0.5F, -1.5708F, 0.0F, 0.0F)); - ModelPartData leg_right = core.addChild("leg_right", ModelPartBuilder.create(), ModelTransform.origin(-1.5F, -0.45F, 0.3F)); + PartDefinition leg_right = core.addOrReplaceChild("leg_right", CubeListBuilder.create(), PartPose.offset(-1.5F, -0.45F, 0.3F)); - ModelPartData leg_right_front = leg_right.addChild("leg_right_front", ModelPartBuilder.create(), ModelTransform.of(0.2617F, 0.65F, 0.0804F, -1.5708F, -1.0472F, 0.0F)); + PartDefinition leg_right_front = leg_right.addOrReplaceChild("leg_right_front", CubeListBuilder.create(), PartPose.offsetAndRotation(0.2617F, 0.65F, 0.0804F, -1.5708F, -1.0472F, 0.0F)); - ModelPartData cube_r6 = leg_right_front.addChild("cube_r6", ModelPartBuilder.create().uv(0, 17).mirrored().cuboid(-3.8392F, -1.5F, -0.0804F, 4.0F, 3.0F, 0.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.of(-0.1608F, 0.0804F, 0.5F, -1.5708F, -0.2182F, 0.0F)); + PartDefinition cube_r6 = leg_right_front.addOrReplaceChild("cube_r6", CubeListBuilder.create().texOffs(0, 17).mirror().addBox(-3.8392F, -1.5F, -0.0804F, 4.0F, 3.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-0.1608F, 0.0804F, 0.5F, -1.5708F, -0.2182F, 0.0F)); - ModelPartData leg_right_center_front = leg_right.addChild("leg_right_center_front", ModelPartBuilder.create(), ModelTransform.of(0.2617F, 0.65F, 0.0804F, -1.6411F, -0.6474F, 0.2534F)); + PartDefinition leg_right_center_front = leg_right.addOrReplaceChild("leg_right_center_front", CubeListBuilder.create(), PartPose.offsetAndRotation(0.2617F, 0.65F, 0.0804F, -1.6411F, -0.6474F, 0.2534F)); - ModelPartData cube_r7 = leg_right_center_front.addChild("cube_r7", ModelPartBuilder.create().uv(0, 17).mirrored().cuboid(-3.8392F, -1.5F, -0.0804F, 4.0F, 3.0F, 0.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.of(-0.1608F, 0.0804F, 0.5F, -1.5708F, 0.0F, 0.0F)); + PartDefinition cube_r7 = leg_right_center_front.addOrReplaceChild("cube_r7", CubeListBuilder.create().texOffs(0, 17).mirror().addBox(-3.8392F, -1.5F, -0.0804F, 4.0F, 3.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-0.1608F, 0.0804F, 0.5F, -1.5708F, 0.0F, 0.0F)); - ModelPartData leg_right_center_back = leg_right.addChild("leg_right_center_back", ModelPartBuilder.create(), ModelTransform.of(0.2617F, 0.65F, 0.0804F, -1.5327F, 0.1704F, 0.2214F)); + PartDefinition leg_right_center_back = leg_right.addOrReplaceChild("leg_right_center_back", CubeListBuilder.create(), PartPose.offsetAndRotation(0.2617F, 0.65F, 0.0804F, -1.5327F, 0.1704F, 0.2214F)); - ModelPartData cube_r8 = leg_right_center_back.addChild("cube_r8", ModelPartBuilder.create().uv(0, 17).mirrored().cuboid(-3.8392F, -1.5F, -0.0804F, 4.0F, 3.0F, 0.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.of(-0.1608F, 0.0804F, 0.5F, -1.5708F, 0.0F, 0.0F)); + PartDefinition cube_r8 = leg_right_center_back.addOrReplaceChild("cube_r8", CubeListBuilder.create().texOffs(0, 17).mirror().addBox(-3.8392F, -1.5F, -0.0804F, 4.0F, 3.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-0.1608F, 0.0804F, 0.5F, -1.5708F, 0.0F, 0.0F)); - ModelPartData leg_right_back = leg_right.addChild("leg_right_back", ModelPartBuilder.create(), ModelTransform.of(0.2617F, 0.65F, 0.0804F, -1.4338F, 0.5522F, 0.257F)); + PartDefinition leg_right_back = leg_right.addOrReplaceChild("leg_right_back", CubeListBuilder.create(), PartPose.offsetAndRotation(0.2617F, 0.65F, 0.0804F, -1.4338F, 0.5522F, 0.257F)); - ModelPartData cube_r9 = leg_right_back.addChild("cube_r9", ModelPartBuilder.create().uv(0, 17).mirrored().cuboid(-3.8392F, -1.5F, -0.0804F, 4.0F, 3.0F, 0.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.of(-0.1608F, 0.0804F, 0.5F, -1.5708F, 0.0F, 0.0F)); - return TexturedModelData.of(modelData, 32, 32); + PartDefinition cube_r9 = leg_right_back.addOrReplaceChild("cube_r9", CubeListBuilder.create().texOffs(0, 17).mirror().addBox(-3.8392F, -1.5F, -0.0804F, 4.0F, 3.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-0.1608F, 0.0804F, 0.5F, -1.5708F, 0.0F, 0.0F)); + return LayerDefinition.create(modelData, 32, 32); } @Override - public void setAngles(ShelobiteScuttlerRenderState state) { - super.setAngles(state); + public ModelPart root() { + return this.root; + } - this.walkingAnimation.applyWalking(state.limbSwingAnimationProgress, state.limbSwingAmplitude, 3F, 2.5F); - this.biteAnimation.apply(state.biteAnimationState, state.age, 1.25f); + @Override + public void setupAnim(ShelobiteLarvaEntity entity, float limbSwing, float limbSwingAmount, + float ageInTicks, float netHeadYaw, float headPitch) { + this.root.getAllParts().forEach(ModelPart::resetPose); + this.animateWalk(ShelobiteLarvaAnimations.SHELOBITE_LARVA_WALK, + limbSwing, limbSwingAmount, 3.0F, 2.5F); + this.animate(entity.biteAnimation, ShelobiteLarvaAnimations.SHELOBITE_LARVA_BITE, + ageInTicks, 1.25F); } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/larva/ShelobiteLarvaRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/larva/ShelobiteLarvaRenderer.java index e638c9307a..f905c37416 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/larva/ShelobiteLarvaRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/larva/ShelobiteLarvaRenderer.java @@ -1,46 +1,25 @@ package net.sevenstars.middleearth.entity.spider.larva; - -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.MobEntityRenderer; -import net.minecraft.client.render.entity.model.EntityModelLayer; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.util.Identifier; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.MobRenderer; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.entity.EntityModelLayersME; -import net.sevenstars.middleearth.entity.spider.scuttler.ShelobiteScuttlerRenderState; +import net.sevenstars.middleearth.entity.spider.SpiderVariant; -public class ShelobiteLarvaRenderer extends MobEntityRenderer { - private static final String PATH = "textures/entities/spiders/"; +public class ShelobiteLarvaRenderer extends MobRenderer { - public ShelobiteLarvaRenderer(EntityRendererFactory.Context context) { + public ShelobiteLarvaRenderer(EntityRendererProvider.Context context) { this(context, 0.2F, EntityModelLayersME.SHELOBITE_LARVA); } - @Override - public ShelobiteScuttlerRenderState createRenderState() { - return new ShelobiteScuttlerRenderState(); + protected ShelobiteLarvaRenderer(EntityRendererProvider.Context ctx, float shadowRadius, ModelLayerLocation layer) { + super(ctx, new ShelobiteLarvaModel(ctx.bakeLayer(layer)), shadowRadius); } - protected ShelobiteLarvaRenderer(EntityRendererFactory.Context ctx, float shadowRadius, EntityModelLayer layer) { - super(ctx, new ShelobiteLarvaModel(ctx.getPart(layer)), shadowRadius); - } - - - @Override - public Identifier getTexture(ShelobiteScuttlerRenderState state) { - return state.spiderVariant.assetInfo().larva().texturePath(); - } - - public void updateRenderState(ShelobiteLarvaEntity larvaEntity, ShelobiteScuttlerRenderState shelobiteScuttlerEntityRenderState, float f) { - super.updateRenderState(larvaEntity, shelobiteScuttlerEntityRenderState, f); - shelobiteScuttlerEntityRenderState.walkAnimationState.copyFrom(larvaEntity.walkingAnimation); - shelobiteScuttlerEntityRenderState.biteAnimationState.copyFrom(larvaEntity.biteAnimation); - shelobiteScuttlerEntityRenderState.spiderVariant = larvaEntity.getVariant(); - } @Override - public void render(ShelobiteScuttlerRenderState livingEntityRenderState, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) { - super.render(livingEntityRenderState, matrixStack, vertexConsumerProvider, i); + public ResourceLocation getTextureLocation(ShelobiteLarvaEntity entity) { + return SpiderVariant.texture(entity.getVariant().assetInfo().larva()); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerAnimations.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerAnimations.java index 7897f8fe07..0463ca56a7 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerAnimations.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerAnimations.java @@ -1,1686 +1,1686 @@ package net.sevenstars.middleearth.entity.spider.scuttler; -import net.minecraft.client.render.entity.animation.AnimationDefinition; -import net.minecraft.client.render.entity.animation.AnimationHelper; -import net.minecraft.client.render.entity.animation.Keyframe; -import net.minecraft.client.render.entity.animation.Transformation; +import net.minecraft.client.animation.AnimationChannel; +import net.minecraft.client.animation.AnimationDefinition; +import net.minecraft.client.animation.Keyframe; +import net.minecraft.client.animation.KeyframeAnimations; public class ShelobiteScuttlerAnimations { // region IDLE - public static final AnimationDefinition SHELOBITE_SCUTTLER_IDLE = AnimationDefinition.Builder.create(4f).looping() - .addBoneAnimation("abdomen", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(20.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(22.01f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(17.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(20.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(22.01f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(17.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(20.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(22.01f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(17.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(20.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(22.01f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(17.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(20.93f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("stinger", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(39.05f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(30.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(35.52f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(39.05f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(30.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(35.52f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(39.05f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(30.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(35.52f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(39.05f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(30.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(35.52f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(39.05f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("prosoma", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-0.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(-2.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(-5.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-0.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(-2.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(-5.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(-0.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(-2.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(-5.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(-0.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(-2.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(-5.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(-0.07f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("chelicerae", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(120.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(125.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(122.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(120.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(125.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(122.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(120.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(125.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(122.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(120.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(125.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(122.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(120.07f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("leftchel", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(-4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(-3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(-4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(-3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, -0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, -0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, -0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createTranslationalVector(0f, -0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createTranslationalVector(0f, -0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createTranslationalVector(0f, 0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, 0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createTranslationalVector(0f, 0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-2.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(-0.31f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(2.74f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-2.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(-0.31f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(2.74f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(-2.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(-0.31f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(2.74f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(-2.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(-0.31f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(2.74f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(-2.43f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, -0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, -0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, -0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createTranslationalVector(0f, -0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createTranslationalVector(0f, -0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createTranslationalVector(0f, 0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, 0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createTranslationalVector(0f, 0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation2", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, -0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, -0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, -0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createTranslationalVector(0f, -0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createTranslationalVector(0f, -0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createTranslationalVector(0f, 0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, 0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createTranslationalVector(0f, 0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation3", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, -0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, -0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, -0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createTranslationalVector(0f, -0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createTranslationalVector(0f, -0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createTranslationalVector(0f, 0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, 0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createTranslationalVector(0f, 0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation4", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, -0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, -0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, -0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createTranslationalVector(0f, -0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createTranslationalVector(0f, -0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createTranslationalVector(0f, 0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, 0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createTranslationalVector(0f, 0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation4", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rightchel", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(-4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(-3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(-4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(-3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -6.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -3.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0.21f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 7.03f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 8f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, 6.82f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, 3.82f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -0.21f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, -4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, -7.03f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, -8f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -6.82f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 5.12f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 2.86f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -0.16f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -3.13f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -5.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -6f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, -5.12f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, -2.86f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 0.16f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 3.13f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, 5.27f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, 6f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 5.12f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -2.56f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0.08f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 1.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 2.64f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, 2.56f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, 1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -0.08f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, -1.57f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, -2.64f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, -3f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -2.56f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg8", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -6.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -3.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0.21f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 7.03f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 8f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, 6.82f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, 3.82f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -0.21f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, -4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, -7.03f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, -8f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -6.82f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg9", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 5.12f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 2.86f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -0.16f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -3.13f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -5.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -6f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, -5.12f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, -2.86f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 0.16f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 3.13f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, 5.27f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, 6f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 5.12f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg10", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -2.56f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0.08f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 1.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 2.64f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, 2.56f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, 1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -0.08f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, -1.57f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, -2.64f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, -3f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -2.56f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg11", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -6.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -3.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0.21f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 7.03f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 8f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, 6.82f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, 3.82f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -0.21f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, -4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, -7.03f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, -8f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -6.82f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg12", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 5.12f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 2.86f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -0.16f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -3.13f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -5.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -6f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, -5.12f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, -2.86f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 0.16f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 3.13f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, 5.27f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, 6f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 5.12f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg13", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -2.56f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0.08f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 1.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 2.64f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, 2.56f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, 1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -0.08f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, -1.57f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, -2.64f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, -3f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -2.56f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg4", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -6.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -3.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0.21f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 7.03f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 8f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, 6.82f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, 3.82f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -0.21f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, -4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, -7.03f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, -8f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -6.82f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg5", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 5.12f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 2.86f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -0.16f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -3.13f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -5.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -6f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, -5.12f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, -2.86f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 0.16f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 3.13f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, 5.27f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, 6f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 5.12f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg6", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -2.56f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0.08f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 1.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 2.64f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, 2.56f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, 1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -0.08f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, -1.57f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, -2.64f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, -3f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -2.56f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("fang", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("fang2", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation5", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, -0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, -0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, -0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createTranslationalVector(0f, -0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createTranslationalVector(0f, -0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createTranslationalVector(0f, 0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, 0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createTranslationalVector(0f, 0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation5", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg7", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 6.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 3.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -0.21f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -7.03f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -8f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, -6.82f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, -3.82f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 0.21f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, 7.03f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, 8f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 6.82f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg14", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -5.12f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -2.86f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0.16f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 3.13f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 5.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 6f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, 5.12f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, 2.86f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -0.16f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, -3.13f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, -5.27f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, -6f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -5.12f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg15", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 2.56f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -0.08f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -1.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -2.64f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, -2.56f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, -1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 0.08f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 1.57f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, 2.64f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 2.56f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation6", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, -0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, -0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, -0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createTranslationalVector(0f, -0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createTranslationalVector(0f, -0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createTranslationalVector(0f, 0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, 0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createTranslationalVector(0f, 0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation6", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 15f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg16", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 6.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 3.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -0.21f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -7.03f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -8f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, -6.82f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, -3.82f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 0.21f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, 7.03f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, 8f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 6.82f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg17", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -5.12f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -2.86f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0.16f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 3.13f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 5.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 6f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, 5.12f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, 2.86f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -0.16f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, -3.13f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, -5.27f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, -6f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -5.12f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg18", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 2.56f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -0.08f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -1.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -2.64f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, -2.56f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, -1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 0.08f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 1.57f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, 2.64f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 2.56f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation7", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, -0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, -0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, -0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createTranslationalVector(0f, -0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createTranslationalVector(0f, -0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createTranslationalVector(0f, 0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, 0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createTranslationalVector(0f, 0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation7", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg19", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 6.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 3.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -0.21f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -7.03f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -8f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, -6.82f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, -3.82f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 0.21f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, 7.03f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, 8f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 6.82f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg20", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -5.12f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -2.86f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0.16f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 3.13f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 5.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 6f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, 5.12f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, 2.86f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -0.16f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, -3.13f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, -5.27f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, -6f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -5.12f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg21", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 2.56f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -0.08f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -1.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -2.64f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, -2.56f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, -1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 0.08f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 1.57f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, 2.64f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 2.56f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation8", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, -0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, -0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, -0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createTranslationalVector(0f, -0.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createTranslationalVector(0f, -0.24f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createTranslationalVector(0f, 0.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createTranslationalVector(0f, 0.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createTranslationalVector(0f, 0.44f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.43f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation8", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg22", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 6.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 3.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -0.21f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -7.03f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -8f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, -6.82f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, -3.82f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 0.21f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, 7.03f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, 8f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 6.82f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg23", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -5.12f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -2.86f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0.16f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 3.13f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 5.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 6f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, 5.12f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, 2.86f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -0.16f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, -3.13f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, -5.27f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, -6f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -5.12f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg24", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 2.56f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -0.08f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -1.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -2.64f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766665f, AnimationHelper.createRotationalVector(0f, 0f, -3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.9999999999999998f, AnimationHelper.createRotationalVector(0f, 0f, -2.56f), Transformation.Interpolations.LINEAR), - new Keyframe(2.343333f, AnimationHelper.createRotationalVector(0f, 0f, -1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(2.6766665f, AnimationHelper.createRotationalVector(0f, 0f, 0.08f), Transformation.Interpolations.LINEAR), - new Keyframe(3f, AnimationHelper.createRotationalVector(0f, 0f, 1.57f), Transformation.Interpolations.LINEAR), - new Keyframe(3.3433335f, AnimationHelper.createRotationalVector(0f, 0f, 2.64f), Transformation.Interpolations.LINEAR), - new Keyframe(3.676667f, AnimationHelper.createRotationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 2.56f), Transformation.Interpolations.LINEAR))).build(); + public static final AnimationDefinition SHELOBITE_SCUTTLER_IDLE = AnimationDefinition.Builder.withLength(4f).looping() + .addAnimation("abdomen", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(20.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(22.01f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(17.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(20.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(22.01f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(17.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(20.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(22.01f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(17.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(20.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(22.01f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(17.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(20.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("stinger", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(39.05f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(30.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(35.52f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(39.05f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(30.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(35.52f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(39.05f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(30.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(35.52f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(39.05f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(30.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(35.52f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(39.05f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("prosoma", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-0.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(-2.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(-5.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-0.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(-2.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(-5.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(-0.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(-2.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(-5.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(-0.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(-2.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(-5.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(-0.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("chelicerae", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(120.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(125.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(122.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(120.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(125.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(122.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(120.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(125.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(122.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(120.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(125.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(122.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(120.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("leftchel", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(-4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(-3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(-4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(-3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, -0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, -0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, -0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.posVec(0f, -0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.posVec(0f, -0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.posVec(0f, 0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.posVec(0f, 0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.posVec(0f, 0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(-0.31f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(2.74f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(-0.31f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(2.74f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(-2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(-0.31f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(2.74f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(-2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(-0.31f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(2.74f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(-2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, -0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, -0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, -0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.posVec(0f, -0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.posVec(0f, -0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.posVec(0f, 0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.posVec(0f, 0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.posVec(0f, 0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation2", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, -0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, -0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, -0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.posVec(0f, -0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.posVec(0f, -0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.posVec(0f, 0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.posVec(0f, 0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.posVec(0f, 0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation3", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, -0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, -0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, -0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.posVec(0f, -0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.posVec(0f, -0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.posVec(0f, 0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.posVec(0f, 0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.posVec(0f, 0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation4", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, -0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, -0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, -0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.posVec(0f, -0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.posVec(0f, -0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.posVec(0f, 0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.posVec(0f, 0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.posVec(0f, 0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation4", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rightchel", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(-4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(-3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(-4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(-3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -6.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -3.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 7.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, 6.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, 3.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -0.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, -4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, -7.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, -8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -6.82f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 5.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 2.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -0.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -3.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -5.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -6f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, -5.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, -2.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 0.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 3.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, 5.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, 6f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 5.12f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -2.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 1.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 2.64f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, 2.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, 1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -0.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, -1.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, -2.64f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, -3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -2.56f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg8", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -6.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -3.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 7.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, 6.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, 3.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -0.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, -4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, -7.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, -8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -6.82f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg9", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 5.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 2.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -0.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -3.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -5.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -6f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, -5.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, -2.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 0.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 3.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, 5.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, 6f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 5.12f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg10", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -2.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 1.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 2.64f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, 2.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, 1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -0.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, -1.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, -2.64f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, -3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -2.56f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg11", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -6.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -3.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 7.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, 6.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, 3.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -0.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, -4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, -7.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, -8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -6.82f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg12", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 5.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 2.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -0.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -3.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -5.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -6f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, -5.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, -2.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 0.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 3.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, 5.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, 6f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 5.12f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg13", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -2.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 1.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 2.64f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, 2.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, 1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -0.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, -1.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, -2.64f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, -3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -2.56f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg4", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -6.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -3.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 7.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, 6.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, 3.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -0.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, -4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, -7.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, -8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -6.82f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg5", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 5.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 2.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -0.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -3.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -5.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -6f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, -5.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, -2.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 0.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 3.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, 5.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, 6f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 5.12f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg6", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -2.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 1.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 2.64f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, 2.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, 1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -0.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, -1.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, -2.64f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, -3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -2.56f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("fang", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("fang2", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation5", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, -0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, -0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, -0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.posVec(0f, -0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.posVec(0f, -0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.posVec(0f, 0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.posVec(0f, 0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.posVec(0f, 0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation5", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg7", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 6.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 3.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -0.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -7.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, -6.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, -3.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 0.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, 7.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, 8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 6.82f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg14", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -5.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -2.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 3.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 5.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 6f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, 5.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, 2.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -0.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, -3.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, -5.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, -6f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -5.12f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg15", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 2.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -0.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -1.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -2.64f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, -2.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, -1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 0.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 1.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, 2.64f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 2.56f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation6", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, -0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, -0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, -0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.posVec(0f, -0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.posVec(0f, -0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.posVec(0f, 0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.posVec(0f, 0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.posVec(0f, 0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation6", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 15f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg16", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 6.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 3.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -0.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -7.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, -6.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, -3.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 0.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, 7.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, 8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 6.82f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg17", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -5.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -2.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 3.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 5.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 6f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, 5.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, 2.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -0.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, -3.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, -5.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, -6f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -5.12f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg18", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 2.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -0.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -1.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -2.64f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, -2.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, -1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 0.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 1.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, 2.64f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 2.56f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation7", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, -0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, -0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, -0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.posVec(0f, -0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.posVec(0f, -0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.posVec(0f, 0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.posVec(0f, 0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.posVec(0f, 0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation7", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg19", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 6.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 3.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -0.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -7.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, -6.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, -3.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 0.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, 7.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, 8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 6.82f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg20", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -5.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -2.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 3.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 5.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 6f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, 5.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, 2.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -0.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, -3.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, -5.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, -6f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -5.12f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg21", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 2.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -0.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -1.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -2.64f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, -2.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, -1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 0.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 1.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, 2.64f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 2.56f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation8", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, -0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, -0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, -0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.posVec(0f, -0.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.posVec(0f, -0.24f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.posVec(0f, 0.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.posVec(0f, 0.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.posVec(0f, 0.44f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.43f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation8", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg22", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 6.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 3.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -0.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -7.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, -6.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, -3.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 0.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, 7.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, 8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 6.82f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg23", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -5.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -2.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 3.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 5.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 6f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, 5.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, 2.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -0.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, -3.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, -5.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, -6f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -5.12f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg24", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 2.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -0.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -1.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -2.64f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766665f, KeyframeAnimations.degreeVec(0f, 0f, -3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.9999999999999998f, KeyframeAnimations.degreeVec(0f, 0f, -2.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.343333f, KeyframeAnimations.degreeVec(0f, 0f, -1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.6766665f, KeyframeAnimations.degreeVec(0f, 0f, 0.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3f, KeyframeAnimations.degreeVec(0f, 0f, 1.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.3433335f, KeyframeAnimations.degreeVec(0f, 0f, 2.64f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.676667f, KeyframeAnimations.degreeVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 2.56f), AnimationChannel.Interpolations.LINEAR))).build(); // endregion // region WALK - public static final AnimationDefinition SHELOBITE_SCUTTLER_WALK = AnimationDefinition.Builder.create(2f).looping() - .addBoneAnimation("abdomen", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(20.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(17.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(22.01f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(20.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(17.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(22.01f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(20.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(17.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(22.01f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(20.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(17.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(22.01f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(20.93f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("stinger", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(30.95f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(34.48f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(39.57f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(30.95f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(34.48f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(39.57f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(30.95f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(34.48f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(39.57f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(30.95f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(34.48f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(39.57f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(30.95f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("prosoma", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-0.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(-5.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(-2.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-0.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(-5.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(-2.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(-0.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(-5.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(-2.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-0.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(-5.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(-2.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(-0.07f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("chelicerae", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(120.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(122.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(125.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(120.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(122.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(125.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(120.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(122.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(125.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(120.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(122.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(125.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(120.07f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("leftchel", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(-3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(-3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(-3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(-3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createTranslationalVector(0f, -0.49f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0.33f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0.15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, -0.49f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createTranslationalVector(0f, 0.33f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createTranslationalVector(0f, 0.15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createTranslationalVector(0f, -0.49f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, 0.33f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, 0.15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createTranslationalVector(0f, -0.49f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createTranslationalVector(0f, 0.33f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0.15f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-2.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(2.74f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(-0.31f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-2.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(2.74f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(-0.31f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(-2.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(2.74f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(-0.31f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-2.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(2.74f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(-0.31f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(-2.43f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rightchel", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(-3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(-3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(-3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(-3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -28.82f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, -26.73f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, -42.91f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, -61.18f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, -63.27f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, -47.09f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, -28.82f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, -26.73f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, -42.91f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, -61.18f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, -63.27f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, -47.09f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, -28.82f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, -20f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, -20f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 36.54f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 32.36f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 36.54f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 32.36f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 3.14f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 27.41f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 24.27f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 3.14f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 27.41f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 24.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation2", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -27.14f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, -28.7f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, -16.57f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, -2.86f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, -1.3f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, -13.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, -27.14f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, -28.7f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, -16.57f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, -2.86f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, -1.3f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, -13.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, -27.14f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg8", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -20f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, -20f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -20f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg9", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 32.36f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 36.54f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 32.36f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 36.54f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 32.36f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg10", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 24.27f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 3.14f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 27.41f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 24.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 3.14f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 27.41f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 24.27f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation3", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 27.14f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 28.7f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 16.57f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 2.86f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 1.3f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 13.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 27.14f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 28.7f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 16.57f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 2.86f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 1.3f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 13.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 27.14f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg11", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, -20f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, -20f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg12", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 36.54f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 32.36f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 36.54f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 32.36f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg13", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 3.14f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 27.41f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 24.27f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 3.14f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 27.41f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 24.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation4", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation4", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 28.82f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 26.73f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 42.91f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 61.18f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 63.27f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 47.09f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 28.82f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 26.73f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 42.91f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 61.18f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 63.27f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 47.09f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 28.82f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg4", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -20f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, -20f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -20f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg5", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 32.36f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 36.54f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 32.36f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 36.54f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 32.36f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg6", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 24.27f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 3.14f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 27.41f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 24.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 3.14f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 27.41f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 24.27f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("fang", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("fang2", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, 3f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation5", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation5", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 61.18f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 63.27f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 47.09f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 28.82f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 26.73f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 42.91f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 61.18f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 63.27f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 47.09f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 28.82f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 26.73f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 42.91f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 61.18f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg7", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 20f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 20f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 20f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg14", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -32.36f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, -36.54f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, -32.36f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, -4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, -36.54f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -32.36f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg15", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -24.27f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -3.14f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, -27.41f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, -24.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, -3.14f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, -27.41f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -24.27f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation6", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation6", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 2.86f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 1.3f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 13.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 27.14f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 28.7f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 16.57f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 2.86f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 1.3f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 13.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 27.14f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 28.7f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 16.57f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 2.86f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg16", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 20f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 20f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg17", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, -4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -36.54f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, -32.36f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, -4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -36.54f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, -32.36f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg18", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, -3.14f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -27.41f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, -24.27f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, -3.14f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -27.41f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, -24.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation7", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation7", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -2.86f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, -1.3f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, -13.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, -27.14f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, -28.7f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, -16.57f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, -2.86f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, -1.3f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, -13.43f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, -27.14f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, -28.7f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, -16.57f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, -2.86f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg19", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 20f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 20f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 20f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg20", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -32.36f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, -36.54f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, -32.36f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, -4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, -36.54f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -32.36f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg21", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -24.27f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, -3.14f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, -27.41f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, -24.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, -3.14f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, -27.41f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -24.27f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation8", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createTranslationalVector(0f, 0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createTranslationalVector(0f, -0.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation8", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -61.18f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, -63.27f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, -47.09f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, -28.82f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, -26.73f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, -42.91f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, -61.18f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, -63.27f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, -47.09f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, -28.82f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, -26.73f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, -42.91f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, -61.18f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg22", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 20f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, 20f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg23", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, -4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -36.54f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, -32.36f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, -4.18f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -36.54f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, -32.36f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg24", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.16766666f, AnimationHelper.createRotationalVector(0f, 0f, -3.14f), Transformation.Interpolations.LINEAR), - new Keyframe(0.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -27.41f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, -24.27f), Transformation.Interpolations.LINEAR), - new Keyframe(0.6766666f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.8343333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.9999999999999999f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.1676665f, AnimationHelper.createRotationalVector(0f, 0f, -3.14f), Transformation.Interpolations.LINEAR), - new Keyframe(1.3433333f, AnimationHelper.createRotationalVector(0f, 0f, -27.41f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(0f, 0f, -24.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.6766667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.8343335f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))).build(); + public static final AnimationDefinition SHELOBITE_SCUTTLER_WALK = AnimationDefinition.Builder.withLength(2f).looping() + .addAnimation("abdomen", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(20.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(17.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(22.01f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(20.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(17.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(22.01f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(20.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(17.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(22.01f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(20.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(17.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(22.01f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(20.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("stinger", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(30.95f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(34.48f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(39.57f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(30.95f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(34.48f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(39.57f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(30.95f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(34.48f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(39.57f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(30.95f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(34.48f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(39.57f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(30.95f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("prosoma", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-0.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(-5.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(-2.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-0.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(-5.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(-2.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(-0.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(-5.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(-2.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-0.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(-5.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(-2.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(-0.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("chelicerae", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(120.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(122.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(125.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(120.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(122.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(125.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(120.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(122.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(125.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(120.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(122.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(125.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(120.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("leftchel", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(-3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(-3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(-3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(-3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.posVec(0f, -0.49f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0.33f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 0.15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, -0.49f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.posVec(0f, 0.33f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.posVec(0f, 0.15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.posVec(0f, -0.49f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, 0.33f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, 0.15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.posVec(0f, -0.49f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.posVec(0f, 0.33f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0.15f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(2.74f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(-0.31f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(2.74f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(-0.31f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(-2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(2.74f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(-0.31f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(2.74f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(-0.31f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(-2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rightchel", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(-3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(-3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(-3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(-3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -28.82f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, -26.73f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, -42.91f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, -61.18f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, -63.27f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, -47.09f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, -28.82f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, -26.73f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, -42.91f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, -61.18f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, -63.27f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, -47.09f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, -28.82f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, -20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, -20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 36.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 32.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 36.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 32.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 3.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 27.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 24.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 3.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 27.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 24.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation2", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -27.14f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, -28.7f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, -16.57f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, -2.86f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, -1.3f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, -13.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, -27.14f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, -28.7f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, -16.57f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, -2.86f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, -1.3f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, -13.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, -27.14f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg8", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, -20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -20f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg9", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 32.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 36.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 32.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 36.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 32.36f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg10", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 24.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 3.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 27.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 24.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 3.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 27.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 24.27f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation3", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 27.14f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 28.7f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 16.57f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 2.86f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 1.3f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 13.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 27.14f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 28.7f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 16.57f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 2.86f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 1.3f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 13.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 27.14f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg11", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, -20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, -20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg12", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 36.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 32.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 36.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 32.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg13", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 3.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 27.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 24.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 3.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 27.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 24.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation4", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation4", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 28.82f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 26.73f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 42.91f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 61.18f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 63.27f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 47.09f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 28.82f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 26.73f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 42.91f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 61.18f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 63.27f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 47.09f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 28.82f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg4", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, -20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -20f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg5", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 32.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 36.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 32.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 36.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 32.36f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg6", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 24.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 3.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 27.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 24.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 3.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 27.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 24.27f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("fang", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("fang2", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0f, 3f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation5", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation5", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 61.18f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 63.27f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 47.09f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 28.82f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 26.73f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 42.91f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 61.18f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 63.27f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 47.09f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 28.82f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 26.73f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 42.91f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 61.18f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg7", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 20f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg14", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -32.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, -36.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, -32.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, -4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, -36.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -32.36f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg15", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -24.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -3.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, -27.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, -24.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, -3.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, -27.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -24.27f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation6", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation6", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 2.86f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 1.3f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 13.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 27.14f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 28.7f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 16.57f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 2.86f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 1.3f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 13.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 27.14f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 28.7f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 16.57f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 2.86f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg16", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg17", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, -4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -36.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, -32.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, -4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -36.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, -32.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg18", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, -3.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -27.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, -24.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, -3.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -27.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, -24.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation7", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation7", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -2.86f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, -1.3f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, -13.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, -27.14f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, -28.7f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, -16.57f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, -2.86f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, -1.3f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, -13.43f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, -27.14f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, -28.7f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, -16.57f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, -2.86f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg19", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 20f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg20", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -32.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, -36.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, -32.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, -4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, -36.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -32.36f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg21", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -24.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, -3.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, -27.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, -24.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, -3.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, -27.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -24.27f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation8", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.posVec(0f, 0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.posVec(0f, -0.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation8", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -61.18f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, -63.27f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, -47.09f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, -28.82f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, -26.73f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, -42.91f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, -61.18f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, -63.27f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, -47.09f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, -28.82f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, -26.73f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, -42.91f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, -61.18f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg22", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, 20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg23", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, -4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -36.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, -32.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, -4.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -36.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, -32.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg24", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.16766666f, KeyframeAnimations.degreeVec(0f, 0f, -3.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -27.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, -24.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.6766666f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.8343333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.9999999999999999f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.1676665f, KeyframeAnimations.degreeVec(0f, 0f, -3.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.3433333f, KeyframeAnimations.degreeVec(0f, 0f, -27.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(0f, 0f, -24.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.6766667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.8343335f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))).build(); // endregion // region BITE - public static final AnimationDefinition SHELOBITE_SCUTTLER_BITE = AnimationDefinition.Builder.create(4f) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0f, 1f), Transformation.Interpolations.LINEAR), - new Keyframe(0.91667f, AnimationHelper.createTranslationalVector(0f, 0f, 2f), Transformation.Interpolations.LINEAR), - new Keyframe(0.95833f, AnimationHelper.createTranslationalVector(0f, 0f, -3f), Transformation.Interpolations.LINEAR), - new Keyframe(1.20833f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(27.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.91667f, AnimationHelper.createRotationalVector(32.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.95833f, AnimationHelper.createRotationalVector(-5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.20833f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("prosoma", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("chelicerae", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-140f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.91667f, AnimationHelper.createRotationalVector(-145f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.95833f, AnimationHelper.createRotationalVector(-122.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.125f, AnimationHelper.createRotationalVector(-122.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.20833f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("leftchel", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.54167f, AnimationHelper.createRotationalVector(0f, -12.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, -12.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.66667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.875f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("fang", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0f, 1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.875f, AnimationHelper.createTranslationalVector(0f, 0f, 1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.95833f, AnimationHelper.createTranslationalVector(0f, 0f, -2f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("fang", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.875f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rightchel", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.54167f, AnimationHelper.createRotationalVector(0f, 12.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 12.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.66667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.875f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("fang2", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0f, 1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.875f, AnimationHelper.createTranslationalVector(0f, 0f, 1.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.95833f, AnimationHelper.createTranslationalVector(0f, 0f, -2f), Transformation.Interpolations.LINEAR))).build(); + public static final AnimationDefinition SHELOBITE_SCUTTLER_BITE = AnimationDefinition.Builder.withLength(4f) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 0f, 1f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.91667f, KeyframeAnimations.posVec(0f, 0f, 2f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.95833f, KeyframeAnimations.posVec(0f, 0f, -3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.20833f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(27.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.91667f, KeyframeAnimations.degreeVec(32.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.95833f, KeyframeAnimations.degreeVec(-5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.20833f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("prosoma", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("chelicerae", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-140f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.91667f, KeyframeAnimations.degreeVec(-145f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.95833f, KeyframeAnimations.degreeVec(-122.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.125f, KeyframeAnimations.degreeVec(-122.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.20833f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("leftchel", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.54167f, KeyframeAnimations.degreeVec(0f, -12.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, -12.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.66667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.875f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("fang", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 0f, 1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.875f, KeyframeAnimations.posVec(0f, 0f, 1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.95833f, KeyframeAnimations.posVec(0f, 0f, -2f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("fang", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.875f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rightchel", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.54167f, KeyframeAnimations.degreeVec(0f, 12.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 12.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.66667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.875f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("fang2", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 0f, 1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.875f, KeyframeAnimations.posVec(0f, 0f, 1.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.95833f, KeyframeAnimations.posVec(0f, 0f, -2f), AnimationChannel.Interpolations.LINEAR))).build(); // endregion // region POUNCE - public static final AnimationDefinition SHELOBITE_SCUTTLER_POUNCE = AnimationDefinition.Builder.create(1f) - .addBoneAnimation("rleg", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, -10f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, -15f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg2", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(-1f, 1f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 55f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 55f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg3", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(-1f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 60f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 60f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg7", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg7", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 10f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 15f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg14", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(1f, 1f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg14", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, -55f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -55f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg15", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(1f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg15", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, -60f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -60f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("abdomen", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.875f, AnimationHelper.createRotationalVector(30f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("stinger", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(135f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("prosoma", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(20f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); + public static final AnimationDefinition SHELOBITE_SCUTTLER_POUNCE = AnimationDefinition.Builder.withLength(1f) + .addAnimation("rleg", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, -10f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, -15f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg2", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(-1f, 1f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 55f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 55f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg3", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(-1f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 60f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 60f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg7", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 1f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg7", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 10f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 15f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg14", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(1f, 1f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg14", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, -55f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -55f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg15", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(1f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg15", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, -60f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -60f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("abdomen", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.875f, KeyframeAnimations.degreeVec(30f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("stinger", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(135f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("prosoma", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(20f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); // endregion } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerBrain.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerBrain.java index 54076771f0..bc6405f51d 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerBrain.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerBrain.java @@ -3,23 +3,42 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.mojang.datafixers.util.Pair; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.brain.*; -import net.minecraft.entity.ai.brain.sensor.Sensor; -import net.minecraft.entity.ai.brain.task.*; -import net.minecraft.entity.mob.*; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundEvents; -import net.minecraft.util.math.GlobalPos; -import net.minecraft.util.math.intprovider.UniformIntProvider; +import net.minecraft.core.GlobalPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.valueproviders.UniformInt; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.Brain; +import net.minecraft.world.entity.ai.behavior.BehaviorUtils; +import net.minecraft.world.entity.ai.behavior.CountDownCooldownTicks; +import net.minecraft.world.entity.ai.behavior.DoNothing; +import net.minecraft.world.entity.ai.behavior.InteractWith; +import net.minecraft.world.entity.ai.behavior.LookAtTargetSink; +import net.minecraft.world.entity.ai.behavior.MeleeAttack; +import net.minecraft.world.entity.ai.behavior.MoveToTargetSink; +import net.minecraft.world.entity.ai.behavior.RandomStroll; +import net.minecraft.world.entity.ai.behavior.RunOne; +import net.minecraft.world.entity.ai.behavior.SetEntityLookTarget; +import net.minecraft.world.entity.ai.behavior.SetLookAndInteract; +import net.minecraft.world.entity.ai.behavior.SetWalkTargetFromAttackTargetIfTargetOutOfReach; +import net.minecraft.world.entity.ai.behavior.StartAttacking; +import net.minecraft.world.entity.ai.behavior.StopAttackingIfTargetInvalid; +import net.minecraft.world.entity.ai.behavior.StopBeingAngryIfTargetDead; +import net.minecraft.world.entity.ai.behavior.StrollAroundPoi; +import net.minecraft.world.entity.ai.behavior.StrollToPoi; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.MemoryStatus; +import net.minecraft.world.entity.ai.sensing.Sensor; +import net.minecraft.world.entity.monster.piglin.AbstractPiglin; +import net.minecraft.world.entity.schedule.Activity; import net.sevenstars.middleearth.entity.EntitiesME; import net.sevenstars.middleearth.entity.tasks.SpiderPounceTask; import java.util.Optional; public class ShelobiteScuttlerBrain { - private static final UniformIntProvider POUNCE_COOLDOWN_RANGE = UniformIntProvider.create(50, 80); + private static final UniformInt POUNCE_COOLDOWN_RANGE = UniformInt.of(50, 80); public static final int POUNCE_VERTICAL_RANGE = 1; public static final int POUNCE_HORIZONTAL_RANGE = 3; @@ -30,70 +49,70 @@ protected static Brain create(ShelobiteScuttlerEntity shelobiteScuttlerEntity addPounceActivities(shelobiteScuttlerEntity, brain); brain.setCoreActivities(ImmutableSet.of(Activity.CORE)); brain.setDefaultActivity(Activity.IDLE); - brain.resetPossibleActivities(); + brain.useDefaultActivity(); return brain; } protected static void setCurrentPosAsHome(ShelobiteScuttlerEntity shelobiteScuttler) { - GlobalPos globalPos = GlobalPos.create(shelobiteScuttler.getWorld().getRegistryKey(), shelobiteScuttler.getBlockPos()); - shelobiteScuttler.getBrain().remember(MemoryModuleType.HOME, globalPos); + GlobalPos globalPos = GlobalPos.of(shelobiteScuttler.level().dimension(), shelobiteScuttler.blockPosition()); + shelobiteScuttler.getBrain().setMemory(MemoryModuleType.HOME, globalPos); } private static void addCoreActivities(ShelobiteScuttlerEntity shelobiteScuttler, Brain brain) { - brain.setTaskList( + brain.addActivity( Activity.CORE, 0, ImmutableList.of( - new UpdateLookControlTask(45, 90), - new MoveToTargetTask(), - ForgetAngryAtTargetTask.create(), - new TickCooldownTask(MemoryModuleType.LONG_JUMP_COOLING_DOWN) + new LookAtTargetSink(45, 90), + new MoveToTargetSink(), + StopBeingAngryIfTargetDead.create(), + new CountDownCooldownTicks(MemoryModuleType.LONG_JUMP_COOLDOWN_TICKS) ) ); } private static void addIdleActivities(ShelobiteScuttlerEntity shelobiteScuttler, Brain brain) { - brain.setTaskList( + brain.addActivity( Activity.IDLE, 10, ImmutableList.of( - UpdateAttackTargetTask.create(ShelobiteScuttlerBrain::getTarget), + StartAttacking.create(ShelobiteScuttlerBrain::getTarget), getFollowTasks(), getIdleTasks(), - FindInteractionTargetTask.create(EntityType.PLAYER, 4) + SetLookAndInteract.create(EntityType.PLAYER, 4) ) ); } private static void addFightActivities(ShelobiteScuttlerEntity shelobiteScuttler, Brain brain) { - brain.setTaskList( + brain.addActivityAndRemoveMemoryWhenStopped( Activity.FIGHT, 10, ImmutableList.of( - ForgetAttackTargetTask.create((world, target) -> !isTarget(world, shelobiteScuttler, target)), - RangedApproachTask.create(1.0F), - MeleeAttackTask.create(20) + StopAttackingIfTargetInvalid.create(target -> !isTarget(shelobiteScuttler, target)), + SetWalkTargetFromAttackTargetIfTargetOutOfReach.create(1.0F), + MeleeAttack.create(20) ), MemoryModuleType.ATTACK_TARGET ); } private static void addPounceActivities(ShelobiteScuttlerEntity shelobiteScuttler, Brain brain) { - brain.setTaskList( + brain.addActivityAndRemoveMemoriesWhenStopped( Activity.LONG_JUMP, ImmutableList.of( - Pair.of(0, ForgetAttackTargetTask.create( - (world, target) -> !isTarget(world, shelobiteScuttler, target)) + Pair.of(0, StopAttackingIfTargetInvalid.create( + target -> !isTarget(shelobiteScuttler, target)) ), //new LeapingChargeTask(POUNCE_COOLDOWN_RANGE, SoundEvents.ENTITY_SPIDER_STEP), Pair.of(1, new SpiderPounceTask<>( POUNCE_COOLDOWN_RANGE, POUNCE_VERTICAL_RANGE, POUNCE_HORIZONTAL_RANGE, - 3.5714288F, spider -> SoundEvents.ENTITY_SPIDER_STEP + 3.5714288F, spider -> SoundEvents.SPIDER_STEP )) ), ImmutableSet.of( - Pair.of(MemoryModuleType.ATTACK_TARGET, MemoryModuleState.VALUE_PRESENT), - Pair.of(MemoryModuleType.LONG_JUMP_COOLING_DOWN, MemoryModuleState.VALUE_ABSENT) + Pair.of(MemoryModuleType.ATTACK_TARGET, MemoryStatus.VALUE_PRESENT), + Pair.of(MemoryModuleType.LONG_JUMP_COOLDOWN_TICKS, MemoryStatus.VALUE_ABSENT) ), - ImmutableSet.of(MemoryModuleType.ATTACK_TARGET, MemoryModuleType.LONG_JUMP_COOLING_DOWN) + ImmutableSet.of(MemoryModuleType.ATTACK_TARGET, MemoryModuleType.LONG_JUMP_COOLDOWN_TICKS) //MemoryModuleType.LONG_JUMP_COOLING_DOWN //Activity.LONG_JUMP, //10, @@ -115,140 +134,61 @@ private static void addPounceActivities(ShelobiteScuttlerEntity shelobiteScuttle ); } - private static RandomTask getFollowTasks() { - return new RandomTask<>( + private static RunOne getFollowTasks() { + return new RunOne<>( ImmutableList.of( - Pair.of(LookAtMobTask.create(EntityType.PLAYER, 8.0F), 1), - Pair.of(LookAtMobTask.create(EntitiesME.SHELOBITE_SCUTTLER, 8.0F), 1), - Pair.of(LookAtMobTask.create(8.0F), 1), - Pair.of(new WaitTask(30, 60), 1) + Pair.of(SetEntityLookTarget.create(EntityType.PLAYER, 8.0F), 1), + Pair.of(SetEntityLookTarget.create(EntitiesME.SHELOBITE_SCUTTLER, 8.0F), 1), + Pair.of(SetEntityLookTarget.create(8.0F), 1), + Pair.of(new DoNothing(30, 60), 1) ) ); } - private static RandomTask getIdleTasks() { - return new RandomTask<>( + private static RunOne getIdleTasks() { + return new RunOne<>( ImmutableList.of( - Pair.of(StrollTask.create(0.6F), 2), - Pair.of(FindEntityTask.create(EntitiesME.SHELOBITE_SCUTTLER, 8, MemoryModuleType.INTERACTION_TARGET, 0.6F, 2), 2), - Pair.of(GoToPosTask.create(MemoryModuleType.HOME, 0.6F, 2, 100), 2), - Pair.of(GoAroundTask.create(MemoryModuleType.HOME, 0.6F, 5), 2), - Pair.of(new WaitTask(30, 60), 1) + Pair.of(RandomStroll.stroll(0.6F), 2), + Pair.of(InteractWith.of(EntitiesME.SHELOBITE_SCUTTLER, 8, MemoryModuleType.INTERACTION_TARGET, 0.6F, 2), 2), + Pair.of(StrollToPoi.create(MemoryModuleType.HOME, 0.6F, 2, 100), 2), + Pair.of(StrollAroundPoi.create(MemoryModuleType.HOME, 0.6F, 5), 2), + Pair.of(new DoNothing(30, 60), 1) ) ); } -/* - protected static void tick(MirkwoodSpiderEntity shelobiteScuttler) { - Random random = shelobiteScuttler.getWorld().getRandom(); - Brain brain = shelobiteScuttler.getBrain(); - List> runningTasks = brain.getRunningTasks(); - brain.resetPossibleActivities(ImmutableList.of(Activity.LONG_JUMP, Activity.FIGHT, Activity.IDLE)); - System.out.println(shelobiteScuttler.getBrain().getOptionalRegisteredMemory(MemoryModuleType.LONG_JUMP_COOLING_DOWN)); - shelobiteScuttler.setAttacking(brain.hasMemoryModule(MemoryModuleType.ATTACK_TARGET)); + private static boolean isTarget(ShelobiteScuttlerEntity shelobiteScuttler, LivingEntity target) { + return getTarget(shelobiteScuttler).filter(targetx -> targetx == target).isPresent(); } - protected static void updateActivities(MirkwoodSpiderEntity shelobiteScuttler) { - //Brain brain = shelobiteScuttler.getBrain(); - brain.resetPossibleActivities(ImmutableList.of(Activity.IDLE, Activity.FIGHT, Activity.LONG_JUMP)); - - Optional isAttacking = brain.getOptionalMemory(MemoryModuleType.ATTACK_TARGET); - if(isAttacking != null && isAttacking.isPresent()) { - Optional canJump = brain.getOptionalMemory(MemoryModuleType.LONG_JUMP_COOLING_DOWN); - if(canJump != null && canJump.isPresent()) { - int cooldown = canJump.get(); - if(cooldown == 0) { - System.out.println("JUMP!!"); - brain.forget(MemoryModuleType.LONG_JUMP_COOLING_DOWN); - brain.doExclusively(Activity.LONG_JUMP); - } else { - brain.doExclusively(Activity.FIGHT); - } - } else { - brain.resetPossibleActivities(ImmutableList.of(Activity.LONG_JUMP)); - brain.doExclusively(Activity.FIGHT); - brain.remember(MemoryModuleType.LONG_JUMP_COOLING_DOWN, POUNCE_COOLDOWN_RANGE.get(shelobiteScuttler.getRandom())); - } - } - else { - brain.doExclusively(Activity.IDLE); - } - Activity activity = brain.getFirstPossibleNonCoreActivity().orElse(null); - System.out.println(activity); - } - - protected static void updateActivities(MirkwoodSpiderEntity shelobiteScuttler) { - Brain brain = shelobiteScuttler.getBrain(); - Optional isAttacking = brain.getOptionalMemory(MemoryModuleType.ATTACK_TARGET); - if(isAttacking != null && isAttacking.isPresent()) { - Optional canJump = brain.getOptionalMemory(MemoryModuleType.LONG_JUMP_COOLING_DOWN); - if(canJump != null && canJump.isPresent()) { - int cooldown = canJump.get(); - if(cooldown == 0) { - System.out.println("JUMP!!"); - brain.forget(MemoryModuleType.LONG_JUMP_COOLING_DOWN); - } - else { - brain.resetPossibleActivities(ImmutableList.of(Activity.IDLE, Activity.FIGHT)); - } - } else { - brain.resetPossibleActivities(ImmutableList.of(Activity.LONG_JUMP)); - brain.remember(MemoryModuleType.LONG_JUMP_COOLING_DOWN, POUNCE_COOLDOWN_RANGE.get(shelobiteScuttler.getRandom())); - } - } - else { - brain.resetPossibleActivities(ImmutableList.of(Activity.IDLE, Activity.FIGHT, Activity.LONG_JUMP)); - } - brain.resetPossibleActivities(ImmutableList.of(Activity.IDLE, Activity.FIGHT, Activity.LONG_JUMP)); - shelobiteScuttler.getBrain().refreshActivities(shelobiteScuttler.getWorld().getTimeOfDay(), shelobiteScuttler.getWorld().getTime()); - - Activity activity = brain.getFirstPossibleNonCoreActivity().orElse(null); - System.out.println(activity); - } - - public static void updateActivities(AxolotlEntity axolotl) { - Brain brain = axolotl.getBrain(); - Activity activity = (Activity)brain.getFirstPossibleNonCoreActivity().orElse(null); - if (activity != Activity.PLAY_DEAD) { - brain.resetPossibleActivities(ImmutableList.of(Activity.PLAY_DEAD, Activity.FIGHT, Activity.IDLE)); - if (activity == Activity.FIGHT && brain.getFirstPossibleNonCoreActivity().orElse(null) != Activity.FIGHT) { - brain.remember(MemoryModuleType.HAS_HUNTING_COOLDOWN, true, 2400L); - } - } - }*/ - - private static boolean isTarget(ServerWorld world, ShelobiteScuttlerEntity shelobiteScuttler, LivingEntity target) { - return getTarget(world, shelobiteScuttler).filter(targetx -> targetx == target).isPresent(); - } - - private static Optional getTarget(ServerWorld world, ShelobiteScuttlerEntity shelobiteScuttler) { - Optional optional = TargetUtil.getEntity(shelobiteScuttler, MemoryModuleType.ANGRY_AT); - if (optional.isPresent() && Sensor.testAttackableTargetPredicateIgnoreVisibility(world, shelobiteScuttler, (LivingEntity)optional.get())) { + private static Optional getTarget(ShelobiteScuttlerEntity shelobiteScuttler) { + Optional optional = BehaviorUtils.getLivingEntityFromUUIDMemory(shelobiteScuttler, MemoryModuleType.ANGRY_AT); + if (optional.isPresent() && Sensor.isEntityAttackableIgnoringLineOfSight(shelobiteScuttler, optional.get())) { return optional; } else { - Optional optional2 = shelobiteScuttler.getBrain().getOptionalRegisteredMemory(MemoryModuleType.NEAREST_VISIBLE_TARGETABLE_PLAYER); - return optional2.isPresent() ? optional2 : shelobiteScuttler.getBrain().getOptionalRegisteredMemory(MemoryModuleType.NEAREST_VISIBLE_NEMESIS); + Optional optional2 = shelobiteScuttler.getBrain().getMemory(MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER); + return optional2.isPresent() ? optional2 : shelobiteScuttler.getBrain().getMemory(MemoryModuleType.NEAREST_VISIBLE_NEMESIS); } } - protected static void tryRevenge(ServerWorld world, ShelobiteScuttlerEntity shelobiteScuttler, LivingEntity target) { - if (!(target instanceof AbstractPiglinEntity)) { + protected static void tryRevenge(ServerLevel world, ShelobiteScuttlerEntity shelobiteScuttler, LivingEntity target) { + if (!(target instanceof AbstractPiglin)) { tryRevenge(world, shelobiteScuttler, target); } } protected static void setTarget(ShelobiteScuttlerEntity shelobiteScuttler, LivingEntity target) { - shelobiteScuttler.getBrain().forget(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE); - shelobiteScuttler.getBrain().remember(MemoryModuleType.ANGRY_AT, target.getUuid(), 600L); + shelobiteScuttler.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE); + shelobiteScuttler.getBrain().setMemoryWithExpiry(MemoryModuleType.ANGRY_AT, target.getUUID(), 600L); } protected static void playSoundRandomly(ShelobiteScuttlerEntity shelobiteScuttlerEntity) { - if (shelobiteScuttlerEntity.getWorld().random.nextFloat() < 0.0125) { + if (shelobiteScuttlerEntity.level().random.nextFloat() < 0.0125) { playSoundIfAngry(shelobiteScuttlerEntity); } } private static void playSoundIfAngry(ShelobiteScuttlerEntity shelobiteScuttlerEntity) { - shelobiteScuttlerEntity.getBrain().getFirstPossibleNonCoreActivity().ifPresent(activity -> { + shelobiteScuttlerEntity.getBrain().getActiveNonCoreActivity().ifPresent(activity -> { if (activity == Activity.FIGHT) { //mirkwoodSpiderEntity.playAngrySound(); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerEntity.java index 9ea1ca495c..ade9e3d799 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerEntity.java @@ -2,70 +2,74 @@ import com.google.common.collect.ImmutableList; import com.mojang.serialization.Dynamic; -import net.minecraft.block.BlockState; -import net.minecraft.entity.*; -import net.minecraft.entity.ai.brain.Brain; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.sensor.Sensor; -import net.minecraft.entity.ai.brain.sensor.SensorType; -import net.minecraft.entity.ai.goal.*; -import net.minecraft.entity.ai.pathing.EntityNavigation; -import net.minecraft.entity.ai.pathing.SpiderNavigation; -import net.minecraft.entity.attribute.DefaultAttributeContainer; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.data.TrackedData; -import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.entity.mob.HostileEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.spawn.SpawnContext; -import net.minecraft.particle.BlockStateParticleEffect; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.tag.BlockTags; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundEvent; -import net.minecraft.sound.SoundEvents; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; -import net.minecraft.world.LocalDifficulty; -import net.minecraft.world.ServerWorldAccess; -import net.minecraft.world.World; -import net.minecraft.world.WorldAccess; -import net.minecraft.world.biome.Biome; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.core.particles.BlockParticleOption; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.tags.TagKey; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; +import net.minecraft.world.DifficultyInstance; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.AnimationState; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.SpawnGroupData; +import net.minecraft.world.entity.ai.Brain; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.goal.FloatGoal; +import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; +import net.minecraft.world.entity.ai.goal.MeleeAttackGoal; +import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; +import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; +import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; +import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.navigation.PathNavigation; +import net.minecraft.world.entity.ai.navigation.WallClimberNavigation; +import net.minecraft.world.entity.ai.sensing.Sensor; +import net.minecraft.world.entity.ai.sensing.SensorType; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.ServerLevelAccessor; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.TrackedDataHandlerRegistryME; +import net.sevenstars.middleearth.entity.VariantHolderUtils; import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntity; import net.sevenstars.middleearth.entity.goals.SpiderPonceAtTargetGoal; import net.sevenstars.middleearth.entity.npcs.NpcEntity; import net.sevenstars.middleearth.entity.spider.Pouncer; import net.sevenstars.middleearth.entity.spider.SpiderVariant; +import net.sevenstars.middleearth.entity.spider.SpiderVariantSelector; import net.sevenstars.middleearth.registries.DynamicRegistriesME; import net.sevenstars.middleearth.registries.content.spidervariants.SpiderVariantRegistry; -import net.sevenstars.middleearth.resources.datas.biome_events.BiomeEventDataLookup; import net.sevenstars.middleearth.utils.SpawnUtil; import org.jetbrains.annotations.Nullable; -import java.util.Optional; - -public class ShelobiteScuttlerEntity extends HostileEntity implements Pouncer { +public class ShelobiteScuttlerEntity extends Monster implements Pouncer { public static final int CLIMBING_TIME_TRANSITION = 12; public static final int LEAPING_TIME_TRANSITION = 8; public static final float MOVEMENT_SPEED = 1.15f; - private static final TrackedData SPIDER_FLAGS; - private static final TrackedData BITE_FLAG; - private static final TrackedData POUNCE_FLAG; - private static final TrackedData> VARIANT; + private static final EntityDataAccessor SPIDER_FLAGS; + private static final EntityDataAccessor BITE_FLAG; + private static final EntityDataAccessor POUNCE_FLAG; + private static final EntityDataAccessor> VARIANT; // region Brain protected static final ImmutableList>> SENSOR_TYPES = ImmutableList.of( @@ -73,10 +77,10 @@ public class ShelobiteScuttlerEntity extends HostileEntity implements Pouncer { ); protected static final ImmutableList> MEMORY_MODULE_TYPES = ImmutableList.of( MemoryModuleType.LOOK_TARGET, - MemoryModuleType.MOBS, - MemoryModuleType.VISIBLE_MOBS, + MemoryModuleType.NEAREST_LIVING_ENTITIES, + MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, - MemoryModuleType.NEAREST_VISIBLE_TARGETABLE_PLAYER, + MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.WALK_TARGET, @@ -88,7 +92,7 @@ public class ShelobiteScuttlerEntity extends HostileEntity implements Pouncer { MemoryModuleType.ANGRY_AT, MemoryModuleType.NEAREST_VISIBLE_NEMESIS, MemoryModuleType.HOME, - MemoryModuleType.LONG_JUMP_COOLING_DOWN, + MemoryModuleType.LONG_JUMP_COOLDOWN_TICKS, MemoryModuleType.LONG_JUMP_MID_JUMP ); // endregion @@ -102,91 +106,77 @@ public class ShelobiteScuttlerEntity extends HostileEntity implements Pouncer { private int leapingTicks = 0; private int biteAnimationCooldown = 0; - public ShelobiteScuttlerEntity(EntityType entityType, World world) { + public ShelobiteScuttlerEntity(EntityType entityType, Level world) { super(entityType, world); } - public static DefaultAttributeContainer.Builder setAttributes() { - return HostileEntity.createHostileAttributes() - .add(EntityAttributes.MAX_HEALTH, 16.0) - .add(EntityAttributes.MOVEMENT_SPEED, 0.34) - .add(EntityAttributes.ATTACK_DAMAGE, 4) - .add(EntityAttributes.FOLLOW_RANGE, 36.0); + public static AttributeSupplier.Builder setAttributes() { + return Monster.createMonsterAttributes() + .add(Attributes.MAX_HEALTH, 16.0) + .add(Attributes.MOVEMENT_SPEED, 0.34) + .add(Attributes.ATTACK_DAMAGE, 4) + .add(Attributes.FOLLOW_RANGE, 36.0); } @Nullable @Override - public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData) { + public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData) { if (entityData instanceof SpiderData spiderData) { this.setVariant(spiderData.variant); } else { - Optional> optional = Variants.select(SpawnContext.of(world, this.getBlockPos()), DynamicRegistriesME.SPIDER_VARIANTS); - if (optional.isPresent()) { - this.setVariant(optional.get()); - entityData = new SpiderData(optional.get()); - } + Holder variant = SpiderVariantSelector.select(world, this.blockPosition()); + this.setVariant(variant); + entityData = new SpiderData(variant); } - return super.initialize(world, difficulty, spawnReason, entityData); + return super.finalizeSpawn(world, difficulty, spawnReason, entityData); } @Override - public boolean isPersistent() { + public boolean isPersistenceRequired() { return false; } - public static boolean canSpawn(EntityType type, WorldAccess worldAccess, SpawnReason spawnReason, BlockPos pos, Random random) { - BlockPos below = pos.down(); - boolean isOnSolidGround = worldAccess.getBlockState(below).isSolidBlock(worldAccess, below); - boolean isNotOnTopOfLogs = !worldAccess.getBlockState(below).isIn(BlockTags.LOGS); - - if (spawnReason == SpawnReason.NATURAL && worldAccess instanceof ServerWorld world) { - RegistryEntry biome = world.getBiome(pos); - boolean canSpawn = BiomeEventDataLookup.canEntitySpawn(world, biome, pos, type, random); - return isOnSolidGround && isNotOnTopOfLogs && canSpawn; - } - return isOnSolidGround && isNotOnTopOfLogs; - } - @Override - protected Brain.Profile createBrainProfile() { - return Brain.createProfile(MEMORY_MODULE_TYPES, SENSOR_TYPES); + protected Brain.Provider brainProvider() { + return Brain.provider(MEMORY_MODULE_TYPES, SENSOR_TYPES); } @Override - protected Brain deserializeBrain(Dynamic dynamic) { - return ShelobiteScuttlerBrain.create(this, this.createBrainProfile().deserialize(dynamic)); + protected Brain makeBrain(Dynamic dynamic) { + return ShelobiteScuttlerBrain.create(this, this.brainProvider().makeBrain(dynamic)); } - protected void initGoals() { - this.goalSelector.add(1, new SwimGoal(this)); - this.goalSelector.add(3, new SpiderPonceAtTargetGoal(this, this, + protected void registerGoals() { + this.goalSelector.addGoal(1, new FloatGoal(this)); + this.goalSelector.addGoal(3, new SpiderPonceAtTargetGoal(this, this, 0.45F, 0.25f, 4, 14, 17)); - this.goalSelector.add(4, new MeleeAttackGoal(this, MOVEMENT_SPEED , false)); - this.goalSelector.add(5, new WanderAroundFarGoal(this, 0.8)); - this.goalSelector.add(6, new LookAtEntityGoal(this, PlayerEntity.class, 8.0F)); - this.goalSelector.add(6, new LookAroundGoal(this)); - this.targetSelector.add(1, new RevengeGoal(this)); - this.targetSelector.add(2, new ActiveTargetGoal<>(this, PlayerEntity.class, true)); - this.targetSelector.add(3, new ActiveTargetGoal<>(this, NpcEntity.class, true)); - this.targetSelector.add(4, new ActiveTargetGoal<>(this, CaveTrollEntity.class, true)); + this.goalSelector.addGoal(4, new MeleeAttackGoal(this, MOVEMENT_SPEED , false)); + this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 0.8)); + this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 8.0F)); + this.goalSelector.addGoal(6, new RandomLookAroundGoal(this)); + this.targetSelector.addGoal(1, new HurtByTargetGoal(this)); + this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true)); + this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, NpcEntity.class, true)); + this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, CaveTrollEntity.class, true)); } public double getMountedHeightOffset() { - return (double)(this.getHeight() * 0.5F); + return (double)(this.getBbHeight() * 0.5F); } @Override - protected EntityNavigation createNavigation(World world) { - return new SpiderNavigation(this, world); + protected PathNavigation createNavigation(Level world) { + return new WallClimberNavigation(this, world); } - protected void initDataTracker(DataTracker.Builder builder) { - super.initDataTracker(builder); - RegistryEntry spiderVariantRegistryEntry = Variants.getOrDefaultOrThrow(this.getRegistryManager(), SpiderVariantRegistry.DEFAULT); - builder.add(VARIANT, spiderVariantRegistryEntry); - builder.add(SPIDER_FLAGS, (byte)0); - builder.add(BITE_FLAG, 0); - builder.add(POUNCE_FLAG, 0); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + Holder spiderVariantRegistryEntry = + VariantHolderUtils.getDefaultOrAny(this.registryAccess(), SpiderVariantRegistry.DEFAULT); + builder.define(VARIANT, spiderVariantRegistryEntry); + builder.define(SPIDER_FLAGS, (byte)0); + builder.define(BITE_FLAG, 0); + builder.define(POUNCE_FLAG, 0); } //@Override @@ -195,60 +185,60 @@ protected void initDataTracker(DataTracker.Builder builder) { //} protected void setupAnimationStates() { - if (!this.idleAnimation.isRunning()) { - this.idleAnimation.start(this.age); + if (!this.idleAnimation.isStarted()) { + this.idleAnimation.start(this.tickCount); } - if (!this.walkingAnimation.isRunning()) { - this.walkingAnimation.start(this.age); + if (!this.walkingAnimation.isStarted()) { + this.walkingAnimation.start(this.tickCount); } setTrackerState(BITE_FLAG, biteAnimation); setTrackerState(POUNCE_FLAG, pounceAnimation); } - protected void setTrackerState(TrackedData trackedData, AnimationState animationState) { - int state = this.dataTracker.get(trackedData); + protected void setTrackerState(EntityDataAccessor trackedData, AnimationState animationState) { + int state = this.entityData.get(trackedData); if(state == 1) { - animationState.start(this.age); + animationState.start(this.tickCount); } else if (state == -1) { animationState.stop(); } - this.dataTracker.set(trackedData, 0); + this.entityData.set(trackedData, 0); } @Override - public boolean tryAttack(ServerWorld world, Entity target) { - this.dataTracker.set(BITE_FLAG, 1); + public boolean doHurtTarget(Entity target) { + this.entityData.set(BITE_FLAG, 1); if(biteAnimationCooldown == 0) biteAnimationCooldown = 40; - return super.tryAttack(world, target); + return super.doHurtTarget(target); } @Override - public void onLanding() { - if (this.getWorld() instanceof ServerWorld serverWorld) { - if (this.isOnGround() && this.fallDistance > 1.5) { - Vec3d vec3d = getPos().add(0.0, 0.5, 0.0); - BlockState blockState = this.getSteppingBlockState(); - int count = (int) MathHelper.clamp(20.0 * this.fallDistance - 1, 0.0, 120.0); - serverWorld.spawnParticles(new BlockStateParticleEffect(ParticleTypes.BLOCK, blockState), vec3d.x, vec3d.y, vec3d.z, + public void resetFallDistance() { + if (this.level() instanceof ServerLevel serverWorld) { + if (this.onGround() && this.fallDistance > 1.5) { + Vec3 vec3d = position().add(0.0, 0.5, 0.0); + BlockState blockState = this.getBlockStateOn(); + int count = (int) Mth.clamp(20.0 * this.fallDistance - 1, 0.0, 120.0); + serverWorld.sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, blockState), vec3d.x, vec3d.y, vec3d.z, count, this.random.nextDouble() - 0.5, 0.15, this.random.nextDouble() - 0.5, 0.16f); } } - super.onLanding(); + super.resetFallDistance(); } public void startPounceAnimation() { - this.dataTracker.set(POUNCE_FLAG, 1); + this.entityData.set(POUNCE_FLAG, 1); } public void stopPounceAnimation() { - this.dataTracker.set(POUNCE_FLAG, -1); + this.entityData.set(POUNCE_FLAG, -1); } public void tick() { super.tick(); - if (!this.getWorld().isClient) { + if (!this.level().isClientSide) { if(biteAnimationCooldown <= 1) { - this.dataTracker.set(BITE_FLAG, -1); + this.entityData.set(BITE_FLAG, -1); } biteAnimationCooldown = Math.max(biteAnimationCooldown - 1, 0); this.setClimbingWall(this.horizontalCollision); @@ -259,8 +249,8 @@ public void tick() { } @Override - protected void mobTick(ServerWorld world) { - super.mobTick(world); + protected void customServerAiStep() { + super.customServerAiStep(); //Profiler profiler = Profilers.get(); //profiler.push("shelobiteScuttlerBrain"); //this.getBrain().tick(world, this); @@ -270,15 +260,15 @@ protected void mobTick(ServerWorld world) { } @Override - public void tickMovement() { - super.tickMovement(); + public void aiStep() { + super.aiStep(); if(isClimbingWall()) { this.climbingTicks = this.climbingTicks + 1; } else { this.climbingTicks = Math.max(0, this.climbingTicks - 1); } - if(isOnGround()) { + if(onGround()) { leapingTicks = 0; } else { leapingTicks++; @@ -286,7 +276,7 @@ public void tickMovement() { } @Override - protected int getExperienceToDrop(ServerWorld world) { + protected int getBaseExperienceReward() { return 6 + this.random.nextInt(3); } @@ -294,47 +284,47 @@ public SpiderVariant getVariant() { return getRegistryVariant().value(); } - private RegistryEntry getRegistryVariant() { - return this.dataTracker.get(VARIANT); + private Holder getRegistryVariant() { + return this.entityData.get(VARIANT); } - private void setVariant(RegistryEntry variant) { - this.dataTracker.set(VARIANT, variant); + private void setVariant(Holder variant) { + this.entityData.set(VARIANT, variant); } protected SoundEvent getAmbientSound() { - return SoundEvents.ENTITY_SPIDER_AMBIENT; + return SoundEvents.SPIDER_AMBIENT; } protected SoundEvent getHurtSound(DamageSource source) { - return SoundEvents.ENTITY_SPIDER_HURT; + return SoundEvents.SPIDER_HURT; } protected SoundEvent getDeathSound() { - return SoundEvents.ENTITY_SPIDER_DEATH; + return SoundEvents.SPIDER_DEATH; } protected void playStepSound(BlockPos pos, BlockState state) { - this.playSound(SoundEvents.ENTITY_SPIDER_STEP, 0.15F, 1.0F); + this.playSound(SoundEvents.SPIDER_STEP, 0.15F, 1.0F); } - public boolean isClimbing() { + public boolean onClimbable() { return this.isClimbingWall(); } - public void slowMovement(BlockState state, Vec3d multiplier) { - if (!state.isIn(TagKey.of(RegistryKeys.BLOCK, Identifier.of(MiddleEarth.MOD_ID, "cobwebs")))) { - super.slowMovement(state, multiplier); + public void makeStuckInBlock(BlockState state, Vec3 multiplier) { + if (!state.is(TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "cobwebs")))) { + super.makeStuckInBlock(state, multiplier); } } // Immune to Poison - public boolean canHaveStatusEffect(StatusEffectInstance effect) { - return effect.getEffectType() != StatusEffects.POISON && super.canHaveStatusEffect(effect); + public boolean canBeAffected(MobEffectInstance effect) { + return effect.getEffect() != MobEffects.POISON && super.canBeAffected(effect); } public boolean isClimbingWall() { - return (this.dataTracker.get(SPIDER_FLAGS) & 1) != 0; + return (this.entityData.get(SPIDER_FLAGS) & 1) != 0; } public boolean isCollidingWall() { @@ -342,14 +332,14 @@ public boolean isCollidingWall() { } public void setClimbingWall(boolean climbing) { - byte b = (Byte)this.dataTracker.get(SPIDER_FLAGS); + byte b = (Byte)this.entityData.get(SPIDER_FLAGS); if (climbing) { b = (byte)(b | 1); } else { b &= -2; } - this.dataTracker.set(SPIDER_FLAGS, b); + this.entityData.set(SPIDER_FLAGS, b); } public int getClimbingTicks() { @@ -361,34 +351,35 @@ public int getLeapingTicks() { } @Override - protected void writeCustomData(WriteView view) { - super.writeCustomData(view); - Variants.writeVariantToNbt(view, this.getRegistryVariant()); + public void addAdditionalSaveData(CompoundTag view) { + super.addAdditionalSaveData(view); + VariantHolderUtils.writeVariant(view, this.getRegistryVariant()); } @Override - protected void readCustomData(ReadView view) { - super.readCustomData(view); - Variants.readVariantFromNbt(view, DynamicRegistriesME.SPIDER_VARIANTS).ifPresent(this::setVariant); + public void readAdditionalSaveData(CompoundTag view) { + super.readAdditionalSaveData(view); + VariantHolderUtils.readVariant(view, this.registryAccess(), DynamicRegistriesME.SPIDER_VARIANTS) + .ifPresent(this::setVariant); } static { - SPIDER_FLAGS = DataTracker.registerData(ShelobiteScuttlerEntity.class, TrackedDataHandlerRegistry.BYTE); - BITE_FLAG = DataTracker.registerData(ShelobiteScuttlerEntity.class, TrackedDataHandlerRegistry.INTEGER); - POUNCE_FLAG = DataTracker.registerData(ShelobiteScuttlerEntity.class, TrackedDataHandlerRegistry.INTEGER); - VARIANT = DataTracker.registerData(ShelobiteScuttlerEntity.class, TrackedDataHandlerRegistryME.SPIDER_VARIANT); + SPIDER_FLAGS = SynchedEntityData.defineId(ShelobiteScuttlerEntity.class, EntityDataSerializers.BYTE); + BITE_FLAG = SynchedEntityData.defineId(ShelobiteScuttlerEntity.class, EntityDataSerializers.INT); + POUNCE_FLAG = SynchedEntityData.defineId(ShelobiteScuttlerEntity.class, EntityDataSerializers.INT); + VARIANT = SynchedEntityData.defineId(ShelobiteScuttlerEntity.class, TrackedDataHandlerRegistryME.SPIDER_VARIANT); } - public static boolean canSpawn(EntityType type, ServerWorldAccess serverWorldAccess, SpawnReason spawnReason, BlockPos blockPos, Random random) { - if(spawnReason != SpawnReason.NATURAL) - return ShelobiteScuttlerEntity.canSpawnInDark(type, serverWorldAccess, spawnReason, blockPos, random); + public static boolean canSpawn(EntityType type, ServerLevelAccessor serverWorldAccess, MobSpawnType spawnReason, BlockPos blockPos, RandomSource random) { + if(spawnReason != MobSpawnType.NATURAL) + return ShelobiteScuttlerEntity.checkMonsterSpawnRules(type, serverWorldAccess, spawnReason, blockPos, random); return SpawnUtil.canSpawn(blockPos, serverWorldAccess, spawnReason); } - public static class SpiderData implements EntityData { - public final RegistryEntry variant; + public static class SpiderData implements SpawnGroupData { + public final Holder variant; - public SpiderData(RegistryEntry variant) { + public SpiderData(Holder variant) { this.variant = variant; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerEntityRenderState.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerEntityRenderState.java deleted file mode 100644 index 5be6ce13d9..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerEntityRenderState.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.sevenstars.middleearth.entity.spider.scuttler; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.entity.state.LivingEntityRenderState; -import net.sevenstars.middleearth.entity.spider.MirkwoodSpiderVariants; - -@Environment(EnvType.CLIENT) -public class ShelobiteScuttlerEntityRenderState extends LivingEntityRenderState { - public MirkwoodSpiderVariants variant; - - public ShelobiteScuttlerEntityRenderState() { - variant = MirkwoodSpiderVariants.BLACK; - ; - } -} \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerModel.java index 1f26417db9..6d6f4afd99 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerModel.java @@ -1,169 +1,172 @@ package net.sevenstars.middleearth.entity.spider.scuttler; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.animation.Animation; -import net.minecraft.client.render.entity.model.EntityModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.entity.spider.spawn.SpawnOfShelobEntity; -public class ShelobiteScuttlerModel extends EntityModel { +public class ShelobiteScuttlerModel extends HierarchicalModel { private static final int CLIMBING_ROTATION_MAX = 90; private final ModelPart root; private final ModelPart legscore; private final ModelPart body; - private final Animation idleAnimation; - private final Animation walkingAnimation; - private final Animation biteAnimation; - private final Animation pounceAnimation; - public ShelobiteScuttlerModel(ModelPart root) { - super(root); - this.root = root.getChild("root"); this.legscore = this.root.getChild("legscore"); this.body = this.root.getChild("body"); - - this.idleAnimation = ShelobiteScuttlerAnimations.SHELOBITE_SCUTTLER_IDLE.createAnimation(root); - this.walkingAnimation = ShelobiteScuttlerAnimations.SHELOBITE_SCUTTLER_WALK.createAnimation(root); - this.biteAnimation = ShelobiteScuttlerAnimations.SHELOBITE_SCUTTLER_BITE.createAnimation(root); - this.pounceAnimation = ShelobiteScuttlerAnimations.SHELOBITE_SCUTTLER_POUNCE.createAnimation(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData root = modelPartData.addChild("root", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 18.0F, 0.0F)); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition root = modelPartData.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 18.0F, 0.0F)); - ModelPartData legscore = root.addChild("legscore", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, -5.0F)); + PartDefinition legscore = root.addOrReplaceChild("legscore", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, -5.0F)); - ModelPartData rights = legscore.addChild("rights", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition rights = legscore.addOrReplaceChild("rights", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData rrotation = rights.addChild("rrotation", ModelPartBuilder.create(), ModelTransform.origin(-2.0F, 1.0F, -3.0F)); + PartDefinition rrotation = rights.addOrReplaceChild("rrotation", CubeListBuilder.create(), PartPose.offset(-2.0F, 1.0F, -3.0F)); - ModelPartData rleg = rrotation.addChild("rleg", ModelPartBuilder.create().uv(146, 142).cuboid(-2.0F, -4.0F, -1.0F, 2.0F, 4.0F, 2.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition rleg = rrotation.addOrReplaceChild("rleg", CubeListBuilder.create().texOffs(146, 142).addBox(-2.0F, -4.0F, -1.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData rleg2 = rleg.addChild("rleg2", ModelPartBuilder.create().uv(56, 131).cuboid(-4.0F, -2.0F, -1.5F, 4.0F, 2.0F, 3.0F, new Dilation(0.0F)), ModelTransform.origin(-1.0F, -3.0F, 0.0F)); + PartDefinition rleg2 = rleg.addOrReplaceChild("rleg2", CubeListBuilder.create().texOffs(56, 131).addBox(-4.0F, -2.0F, -1.5F, 4.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(-1.0F, -3.0F, 0.0F)); - ModelPartData rleg3 = rleg2.addChild("rleg3", ModelPartBuilder.create().uv(158, 96).cuboid(-2.0F, -2.0F, -0.5F, 2.0F, 6.0F, 1.0F, new Dilation(0.0F)) - .uv(88, 83).cuboid(-11.0F, -6.0F, 0.0F, 15.0F, 13.0F, 0.0F, new Dilation(0.0F)), ModelTransform.origin(-3.0F, 1.0F, 0.0F)); + PartDefinition rleg3 = rleg2.addOrReplaceChild("rleg3", CubeListBuilder.create().texOffs(158, 96).addBox(-2.0F, -2.0F, -0.5F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(88, 83).addBox(-11.0F, -6.0F, 0.0F, 15.0F, 13.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(-3.0F, 1.0F, 0.0F)); - ModelPartData rrotation2 = rights.addChild("rrotation2", ModelPartBuilder.create(), ModelTransform.origin(-2.0F, 1.0F, 0.0F)); + PartDefinition rrotation2 = rights.addOrReplaceChild("rrotation2", CubeListBuilder.create(), PartPose.offset(-2.0F, 1.0F, 0.0F)); - ModelPartData rleg8 = rrotation2.addChild("rleg8", ModelPartBuilder.create().uv(146, 135).cuboid(-1.0F, -4.0F, -1.0F, 2.0F, 5.0F, 2.0F, new Dilation(0.0F)), ModelTransform.origin(-1.0F, -1.0F, 0.0F)); + PartDefinition rleg8 = rrotation2.addOrReplaceChild("rleg8", CubeListBuilder.create().texOffs(146, 135).addBox(-1.0F, -4.0F, -1.0F, 2.0F, 5.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(-1.0F, -1.0F, 0.0F)); - ModelPartData rleg9 = rleg8.addChild("rleg9", ModelPartBuilder.create().uv(53, 114).cuboid(-6.0F, -1.0F, -1.5F, 6.0F, 2.0F, 3.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, -4.0F, 0.0F)); + PartDefinition rleg9 = rleg8.addOrReplaceChild("rleg9", CubeListBuilder.create().texOffs(53, 114).addBox(-6.0F, -1.0F, -1.5F, 6.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -4.0F, 0.0F)); - ModelPartData rleg10 = rleg9.addChild("rleg10", ModelPartBuilder.create().uv(152, 96).cuboid(-2.0F, -1.0F, -0.5F, 2.0F, 7.0F, 1.0F, new Dilation(0.0F)) - .uv(4, 0).cuboid(-11.0F, -3.0F, 0.0F, 16.0F, 16.0F, 0.0F, new Dilation(0.0F)), ModelTransform.origin(-5.0F, 1.0F, 0.0F)); + PartDefinition rleg10 = rleg9.addOrReplaceChild("rleg10", CubeListBuilder.create().texOffs(152, 96).addBox(-2.0F, -1.0F, -0.5F, 2.0F, 7.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(4, 0).addBox(-11.0F, -3.0F, 0.0F, 16.0F, 16.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(-5.0F, 1.0F, 0.0F)); - ModelPartData rrotation3 = rights.addChild("rrotation3", ModelPartBuilder.create(), ModelTransform.origin(-2.0F, 1.0F, 3.0F)); + PartDefinition rrotation3 = rights.addOrReplaceChild("rrotation3", CubeListBuilder.create(), PartPose.offset(-2.0F, 1.0F, 3.0F)); - ModelPartData rleg11 = rrotation3.addChild("rleg11", ModelPartBuilder.create().uv(146, 135).cuboid(-1.0F, -4.0F, -1.0F, 2.0F, 5.0F, 2.0F, new Dilation(0.0F)), ModelTransform.origin(-1.0F, -1.0F, 0.0F)); + PartDefinition rleg11 = rrotation3.addOrReplaceChild("rleg11", CubeListBuilder.create().texOffs(146, 135).addBox(-1.0F, -4.0F, -1.0F, 2.0F, 5.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(-1.0F, -1.0F, 0.0F)); - ModelPartData rleg12 = rleg11.addChild("rleg12", ModelPartBuilder.create().uv(53, 114).cuboid(-6.0F, -1.0F, -1.5F, 6.0F, 2.0F, 3.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, -4.0F, 0.0F)); + PartDefinition rleg12 = rleg11.addOrReplaceChild("rleg12", CubeListBuilder.create().texOffs(53, 114).addBox(-6.0F, -1.0F, -1.5F, 6.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -4.0F, 0.0F)); - ModelPartData rleg13 = rleg12.addChild("rleg13", ModelPartBuilder.create().uv(152, 96).cuboid(-2.0F, -1.0F, -0.5F, 2.0F, 7.0F, 1.0F, new Dilation(0.0F)) - .uv(4, 0).cuboid(-11.0F, -3.0F, 0.0F, 16.0F, 16.0F, 0.0F, new Dilation(0.0F)), ModelTransform.origin(-5.0F, 1.0F, 0.0F)); + PartDefinition rleg13 = rleg12.addOrReplaceChild("rleg13", CubeListBuilder.create().texOffs(152, 96).addBox(-2.0F, -1.0F, -0.5F, 2.0F, 7.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(4, 0).addBox(-11.0F, -3.0F, 0.0F, 16.0F, 16.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(-5.0F, 1.0F, 0.0F)); - ModelPartData rrotation4 = rights.addChild("rrotation4", ModelPartBuilder.create(), ModelTransform.origin(-2.0F, 1.0F, 6.0F)); + PartDefinition rrotation4 = rights.addOrReplaceChild("rrotation4", CubeListBuilder.create(), PartPose.offset(-2.0F, 1.0F, 6.0F)); - ModelPartData rleg4 = rrotation4.addChild("rleg4", ModelPartBuilder.create().uv(146, 142).cuboid(-1.0F, -3.0F, -1.0F, 2.0F, 4.0F, 2.0F, new Dilation(0.0F)), ModelTransform.origin(-1.0F, -1.0F, 0.0F)); + PartDefinition rleg4 = rrotation4.addOrReplaceChild("rleg4", CubeListBuilder.create().texOffs(146, 142).addBox(-1.0F, -3.0F, -1.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(-1.0F, -1.0F, 0.0F)); - ModelPartData rleg5 = rleg4.addChild("rleg5", ModelPartBuilder.create().uv(56, 131).cuboid(-4.0F, -2.0F, -1.5F, 4.0F, 2.0F, 3.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, -2.0F, 0.0F)); + PartDefinition rleg5 = rleg4.addOrReplaceChild("rleg5", CubeListBuilder.create().texOffs(56, 131).addBox(-4.0F, -2.0F, -1.5F, 4.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -2.0F, 0.0F)); - ModelPartData rleg6 = rleg5.addChild("rleg6", ModelPartBuilder.create().uv(158, 96).cuboid(-2.0F, -2.0F, -0.5F, 2.0F, 6.0F, 1.0F, new Dilation(0.0F)) - .uv(88, 83).cuboid(-11.0F, -6.0F, 0.0F, 15.0F, 13.0F, 0.0F, new Dilation(0.0F)), ModelTransform.origin(-3.0F, 1.0F, 0.0F)); + PartDefinition rleg6 = rleg5.addOrReplaceChild("rleg6", CubeListBuilder.create().texOffs(158, 96).addBox(-2.0F, -2.0F, -0.5F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(88, 83).addBox(-11.0F, -6.0F, 0.0F, 15.0F, 13.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(-3.0F, 1.0F, 0.0F)); - ModelPartData lefts = legscore.addChild("lefts", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition lefts = legscore.addOrReplaceChild("lefts", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData rrotation5 = lefts.addChild("rrotation5", ModelPartBuilder.create(), ModelTransform.origin(2.0F, 1.0F, -3.0F)); + PartDefinition rrotation5 = lefts.addOrReplaceChild("rrotation5", CubeListBuilder.create(), PartPose.offset(2.0F, 1.0F, -3.0F)); - ModelPartData rleg7 = rrotation5.addChild("rleg7", ModelPartBuilder.create().uv(146, 142).mirrored().cuboid(0.0F, -4.0F, -1.0F, 2.0F, 4.0F, 2.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition rleg7 = rrotation5.addOrReplaceChild("rleg7", CubeListBuilder.create().texOffs(146, 142).mirror().addBox(0.0F, -4.0F, -1.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData rleg14 = rleg7.addChild("rleg14", ModelPartBuilder.create().uv(56, 131).mirrored().cuboid(0.0F, -2.0F, -1.5F, 4.0F, 2.0F, 3.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(1.0F, -3.0F, 0.0F)); + PartDefinition rleg14 = rleg7.addOrReplaceChild("rleg14", CubeListBuilder.create().texOffs(56, 131).mirror().addBox(0.0F, -2.0F, -1.5F, 4.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(1.0F, -3.0F, 0.0F)); - ModelPartData rleg15 = rleg14.addChild("rleg15", ModelPartBuilder.create().uv(158, 96).mirrored().cuboid(0.0F, -2.0F, -0.5F, 2.0F, 6.0F, 1.0F, new Dilation(0.0F)).mirrored(false) - .uv(88, 83).mirrored().cuboid(-4.0F, -6.0F, 0.0F, 15.0F, 13.0F, 0.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(3.0F, 1.0F, 0.0F)); + PartDefinition rleg15 = rleg14.addOrReplaceChild("rleg15", CubeListBuilder.create().texOffs(158, 96).mirror().addBox(0.0F, -2.0F, -0.5F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(88, 83).mirror().addBox(-4.0F, -6.0F, 0.0F, 15.0F, 13.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(3.0F, 1.0F, 0.0F)); - ModelPartData rrotation6 = lefts.addChild("rrotation6", ModelPartBuilder.create(), ModelTransform.origin(2.0F, 1.0F, 0.0F)); + PartDefinition rrotation6 = lefts.addOrReplaceChild("rrotation6", CubeListBuilder.create(), PartPose.offset(2.0F, 1.0F, 0.0F)); - ModelPartData rleg16 = rrotation6.addChild("rleg16", ModelPartBuilder.create().uv(146, 135).mirrored().cuboid(-1.0F, -4.0F, -1.0F, 2.0F, 5.0F, 2.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(1.0F, -1.0F, 0.0F)); + PartDefinition rleg16 = rrotation6.addOrReplaceChild("rleg16", CubeListBuilder.create().texOffs(146, 135).mirror().addBox(-1.0F, -4.0F, -1.0F, 2.0F, 5.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(1.0F, -1.0F, 0.0F)); - ModelPartData rleg17 = rleg16.addChild("rleg17", ModelPartBuilder.create().uv(53, 114).mirrored().cuboid(0.0F, -1.0F, -1.5F, 6.0F, 2.0F, 3.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(0.0F, -4.0F, 0.0F)); + PartDefinition rleg17 = rleg16.addOrReplaceChild("rleg17", CubeListBuilder.create().texOffs(53, 114).mirror().addBox(0.0F, -1.0F, -1.5F, 6.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(0.0F, -4.0F, 0.0F)); - ModelPartData rleg18 = rleg17.addChild("rleg18", ModelPartBuilder.create().uv(152, 96).mirrored().cuboid(0.0F, -1.0F, -0.5F, 2.0F, 7.0F, 1.0F, new Dilation(0.0F)).mirrored(false) - .uv(4, 0).mirrored().cuboid(-5.0F, -3.0F, 0.0F, 16.0F, 16.0F, 0.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(5.0F, 1.0F, 0.0F)); + PartDefinition rleg18 = rleg17.addOrReplaceChild("rleg18", CubeListBuilder.create().texOffs(152, 96).mirror().addBox(0.0F, -1.0F, -0.5F, 2.0F, 7.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(4, 0).mirror().addBox(-5.0F, -3.0F, 0.0F, 16.0F, 16.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(5.0F, 1.0F, 0.0F)); - ModelPartData rrotation7 = lefts.addChild("rrotation7", ModelPartBuilder.create(), ModelTransform.origin(2.0F, 1.0F, 3.0F)); + PartDefinition rrotation7 = lefts.addOrReplaceChild("rrotation7", CubeListBuilder.create(), PartPose.offset(2.0F, 1.0F, 3.0F)); - ModelPartData rleg19 = rrotation7.addChild("rleg19", ModelPartBuilder.create().uv(146, 135).mirrored().cuboid(-1.0F, -4.0F, -1.0F, 2.0F, 5.0F, 2.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(1.0F, -1.0F, 0.0F)); + PartDefinition rleg19 = rrotation7.addOrReplaceChild("rleg19", CubeListBuilder.create().texOffs(146, 135).mirror().addBox(-1.0F, -4.0F, -1.0F, 2.0F, 5.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(1.0F, -1.0F, 0.0F)); - ModelPartData rleg20 = rleg19.addChild("rleg20", ModelPartBuilder.create().uv(53, 114).mirrored().cuboid(0.0F, -1.0F, -1.5F, 6.0F, 2.0F, 3.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(0.0F, -4.0F, 0.0F)); + PartDefinition rleg20 = rleg19.addOrReplaceChild("rleg20", CubeListBuilder.create().texOffs(53, 114).mirror().addBox(0.0F, -1.0F, -1.5F, 6.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(0.0F, -4.0F, 0.0F)); - ModelPartData rleg21 = rleg20.addChild("rleg21", ModelPartBuilder.create().uv(152, 96).mirrored().cuboid(0.0F, -1.0F, -0.5F, 2.0F, 7.0F, 1.0F, new Dilation(0.0F)).mirrored(false) - .uv(4, 0).mirrored().cuboid(-5.0F, -3.0F, 0.0F, 16.0F, 16.0F, 0.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(5.0F, 1.0F, 0.0F)); + PartDefinition rleg21 = rleg20.addOrReplaceChild("rleg21", CubeListBuilder.create().texOffs(152, 96).mirror().addBox(0.0F, -1.0F, -0.5F, 2.0F, 7.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(4, 0).mirror().addBox(-5.0F, -3.0F, 0.0F, 16.0F, 16.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(5.0F, 1.0F, 0.0F)); - ModelPartData rrotation8 = lefts.addChild("rrotation8", ModelPartBuilder.create(), ModelTransform.origin(2.0F, 1.0F, 6.0F)); + PartDefinition rrotation8 = lefts.addOrReplaceChild("rrotation8", CubeListBuilder.create(), PartPose.offset(2.0F, 1.0F, 6.0F)); - ModelPartData rleg22 = rrotation8.addChild("rleg22", ModelPartBuilder.create().uv(146, 142).mirrored().cuboid(-1.0F, -3.0F, -1.0F, 2.0F, 4.0F, 2.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(1.0F, -1.0F, 0.0F)); + PartDefinition rleg22 = rrotation8.addOrReplaceChild("rleg22", CubeListBuilder.create().texOffs(146, 142).mirror().addBox(-1.0F, -3.0F, -1.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(1.0F, -1.0F, 0.0F)); - ModelPartData rleg23 = rleg22.addChild("rleg23", ModelPartBuilder.create().uv(56, 131).mirrored().cuboid(0.0F, -2.0F, -1.5F, 4.0F, 2.0F, 3.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(0.0F, -2.0F, 0.0F)); + PartDefinition rleg23 = rleg22.addOrReplaceChild("rleg23", CubeListBuilder.create().texOffs(56, 131).mirror().addBox(0.0F, -2.0F, -1.5F, 4.0F, 2.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(0.0F, -2.0F, 0.0F)); - ModelPartData rleg24 = rleg23.addChild("rleg24", ModelPartBuilder.create().uv(158, 96).mirrored().cuboid(0.0F, -2.0F, -0.5F, 2.0F, 6.0F, 1.0F, new Dilation(0.0F)).mirrored(false) - .uv(88, 83).mirrored().cuboid(-4.0F, -6.0F, 0.0F, 15.0F, 13.0F, 0.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(3.0F, 1.0F, 0.0F)); + PartDefinition rleg24 = rleg23.addOrReplaceChild("rleg24", CubeListBuilder.create().texOffs(158, 96).mirror().addBox(0.0F, -2.0F, -0.5F, 2.0F, 6.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(88, 83).mirror().addBox(-4.0F, -6.0F, 0.0F, 15.0F, 13.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(3.0F, 1.0F, 0.0F)); - ModelPartData body = root.addChild("body", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, -4.0F)); + PartDefinition body = root.addOrReplaceChild("body", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, -4.0F)); - ModelPartData abdomen = body.addChild("abdomen", ModelPartBuilder.create().uv(19, 72).cuboid(-4.0F, -2.0F, 0.0F, 8.0F, 5.0F, 10.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, -3.0F, 2.0F)); + PartDefinition abdomen = body.addOrReplaceChild("abdomen", CubeListBuilder.create().texOffs(19, 72).addBox(-4.0F, -2.0F, 0.0F, 8.0F, 5.0F, 10.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -3.0F, 2.0F)); - ModelPartData stinger = abdomen.addChild("stinger", ModelPartBuilder.create().uv(156, 134).cuboid(-1.0F, 3.0F, -5.0F, 2.0F, 2.0F, 6.0F, new Dilation(0.0F)) - .uv(0, 30).cuboid(0.0F, -2.0F, -10.0F, 0.0F, 10.0F, 15.0F, new Dilation(0.0F)) - .uv(156, 142).cuboid(-1.0F, -2.0F, -2.0F, 2.0F, 5.0F, 3.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, 3.0F, 11.0F)); + PartDefinition stinger = abdomen.addOrReplaceChild("stinger", CubeListBuilder.create().texOffs(156, 134).addBox(-1.0F, 3.0F, -5.0F, 2.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)) + .texOffs(0, 30).addBox(0.0F, -2.0F, -10.0F, 0.0F, 10.0F, 15.0F, new CubeDeformation(0.0F)) + .texOffs(156, 142).addBox(-1.0F, -2.0F, -2.0F, 2.0F, 5.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 3.0F, 11.0F)); - ModelPartData prosoma = body.addChild("prosoma", ModelPartBuilder.create().uv(96, 68).cuboid(-2.0F, -1.0F, -7.0F, 4.0F, 4.0F, 9.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, -2.0F, 3.0F)); + PartDefinition prosoma = body.addOrReplaceChild("prosoma", CubeListBuilder.create().texOffs(96, 68).addBox(-2.0F, -1.0F, -7.0F, 4.0F, 4.0F, 9.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -2.0F, 3.0F)); - ModelPartData chelicerae = prosoma.addChild("chelicerae", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 2.0F, -7.0F)); + PartDefinition chelicerae = prosoma.addOrReplaceChild("chelicerae", CubeListBuilder.create(), PartPose.offset(0.0F, 2.0F, -7.0F)); - ModelPartData leftchel = chelicerae.addChild("leftchel", ModelPartBuilder.create().uv(0, 22).mirrored().cuboid(-0.5F, -0.5F, -3.5F, 1.0F, 2.0F, 4.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(0.5F, -0.5F, 0.5F)); + PartDefinition leftchel = chelicerae.addOrReplaceChild("leftchel", CubeListBuilder.create().texOffs(0, 22).mirror().addBox(-0.5F, -0.5F, -3.5F, 1.0F, 2.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(0.5F, -0.5F, 0.5F)); - ModelPartData fang = leftchel.addChild("fang", ModelPartBuilder.create().uv(0, 32).mirrored().cuboid(0.0F, -3.0F, -6.0F, 3.0F, 3.0F, 7.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(-0.5F, 1.5F, -3.5F)); + PartDefinition fang = leftchel.addOrReplaceChild("fang", CubeListBuilder.create().texOffs(0, 32).mirror().addBox(0.0F, -3.0F, -6.0F, 3.0F, 3.0F, 7.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(-0.5F, 1.5F, -3.5F)); - ModelPartData rightchel = chelicerae.addChild("rightchel", ModelPartBuilder.create().uv(0, 22).cuboid(-0.5F, -0.5F, -3.5F, 1.0F, 2.0F, 4.0F, new Dilation(0.0F)), ModelTransform.origin(-0.5F, -0.5F, 0.5F)); + PartDefinition rightchel = chelicerae.addOrReplaceChild("rightchel", CubeListBuilder.create().texOffs(0, 22).addBox(-0.5F, -0.5F, -3.5F, 1.0F, 2.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(-0.5F, -0.5F, 0.5F)); - ModelPartData fang2 = rightchel.addChild("fang2", ModelPartBuilder.create().uv(0, 32).cuboid(-3.0F, -3.0F, -6.0F, 3.0F, 3.0F, 7.0F, new Dilation(0.0F)), ModelTransform.origin(0.5F, 1.5F, -3.5F)); - return TexturedModelData.of(modelData, 256, 256); + PartDefinition fang2 = rightchel.addOrReplaceChild("fang2", CubeListBuilder.create().texOffs(0, 32).addBox(-3.0F, -3.0F, -6.0F, 3.0F, 3.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offset(0.5F, 1.5F, -3.5F)); + return LayerDefinition.create(modelData, 256, 256); + } + + @Override + public ModelPart root() { + return this.root; } @Override - public void setAngles(ShelobiteScuttlerRenderState state) { - super.setAngles(state); - int croppedClimbingTicks = Math.min(ShelobiteScuttlerEntity.CLIMBING_TIME_TRANSITION, state.climbingTicks); + public void setupAnim(ShelobiteScuttlerEntity entity, float limbSwing, float limbSwingAmount, + float ageInTicks, float netHeadYaw, float headPitch) { + this.root.getAllParts().forEach(ModelPart::resetPose); + int climbingTicks = entity.getClimbingTicks(); + int leapingTicks = entity.getLeapingTicks(); + int croppedClimbingTicks = Math.min(ShelobiteScuttlerEntity.CLIMBING_TIME_TRANSITION, climbingTicks); float climbingPercentage = (float) croppedClimbingTicks / ShelobiteScuttlerEntity.CLIMBING_TIME_TRANSITION; - int croppedLeapingTicks = Math.min(ShelobiteScuttlerEntity.LEAPING_TIME_TRANSITION, state.leapingTicks); + int croppedLeapingTicks = Math.min(ShelobiteScuttlerEntity.LEAPING_TIME_TRANSITION, leapingTicks); float leapingPercentage = (float) croppedLeapingTicks / ShelobiteScuttlerEntity.LEAPING_TIME_TRANSITION; - if(state.climbingTicks > 0 && climbingPercentage > leapingPercentage) { - this.root.pitch = -1.5f * climbingPercentage; - this.walkingAnimation.applyWalking(state.age, 0.4f, 1.75F, 2F); + if(climbingTicks > 0 && climbingPercentage > leapingPercentage) { + this.root.xRot = -1.5f * climbingPercentage; + this.animateWalk(ShelobiteScuttlerAnimations.SHELOBITE_SCUTTLER_WALK, ageInTicks, 0.4f, 1.75F, 2F); return; - } else if(state.leapingTicks > 0 && leapingPercentage > climbingPercentage) { - this.root.pitch = -0.7f * leapingPercentage; - this.walkingAnimation.applyWalking((float)state.leapingTicks / 3.7f, 0.7f, 2.2F, 2.5F); + } else if(leapingTicks > 0 && leapingPercentage > climbingPercentage) { + this.root.xRot = -0.7f * leapingPercentage; + this.animateWalk(ShelobiteScuttlerAnimations.SHELOBITE_SCUTTLER_WALK, + (float)leapingTicks / 3.7f, 0.7f, 2.2F, 2.5F); return; } - if(state.limbSwingAmplitude <= 0.4) { - this.idleAnimation.apply(state.idleAnimationState, state.age, 0.75f); + if(limbSwingAmount <= 0.4) { + this.animate(entity.idleAnimation, ShelobiteScuttlerAnimations.SHELOBITE_SCUTTLER_IDLE, ageInTicks, 0.75f); } else { - this.walkingAnimation.applyWalking(state.limbSwingAnimationProgress, state.limbSwingAmplitude, 2.25F, 2.5F); + this.animateWalk(ShelobiteScuttlerAnimations.SHELOBITE_SCUTTLER_WALK, + limbSwing, limbSwingAmount, 2.25F, 2.5F); } - if(state.biteAnimationState.isRunning()) { - this.biteAnimation.apply(state.biteAnimationState, state.age, 1.5f); + if(entity.biteAnimation.isStarted()) { + this.animate(entity.biteAnimation, ShelobiteScuttlerAnimations.SHELOBITE_SCUTTLER_BITE, ageInTicks, 1.5f); } - if(state.pounceAnimationState.isRunning()) { - this.pounceAnimation.apply(state.pounceAnimationState, state.age, 1.1f); + if(entity.pounceAnimation.isStarted()) { + this.animate(entity.pounceAnimation, ShelobiteScuttlerAnimations.SHELOBITE_SCUTTLER_POUNCE, ageInTicks, 1.1f); } } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerRenderState.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerRenderState.java deleted file mode 100644 index a0a03358ec..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerRenderState.java +++ /dev/null @@ -1,24 +0,0 @@ -package net.sevenstars.middleearth.entity.spider.scuttler; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.render.entity.state.LivingEntityRenderState; -import net.minecraft.entity.AnimationState; -import net.sevenstars.middleearth.entity.spider.SpiderVariant; - -@Environment(EnvType.CLIENT) -public class ShelobiteScuttlerRenderState extends LivingEntityRenderState { - - public final AnimationState idleAnimationState = new AnimationState(); - public final AnimationState walkAnimationState = new AnimationState(); - public final AnimationState biteAnimationState = new AnimationState(); - public final AnimationState pounceAnimationState = new AnimationState(); - public int timelineTicks; - public int climbingTicks; - public int leapingTicks; - public SpiderVariant spiderVariant; - - public ShelobiteScuttlerRenderState() { - - } -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerRenderer.java index fb42fb8666..4a87c0cca1 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/scuttler/ShelobiteScuttlerRenderer.java @@ -1,39 +1,24 @@ package net.sevenstars.middleearth.entity.spider.scuttler; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.MobEntityRenderer; -import net.minecraft.client.render.entity.model.EntityModelLayer; -import net.minecraft.util.Identifier; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.MobRenderer; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.entity.EntityModelLayersME; +import net.sevenstars.middleearth.entity.spider.SpiderVariant; -public class ShelobiteScuttlerRenderer extends MobEntityRenderer { +public class ShelobiteScuttlerRenderer extends MobRenderer { - public ShelobiteScuttlerRenderer(EntityRendererFactory.Context context) { + public ShelobiteScuttlerRenderer(EntityRendererProvider.Context context) { this(context, 0.45F, EntityModelLayersME.SHELOBITE_SCUTTLER); } - @Override - public ShelobiteScuttlerRenderState createRenderState() { - return new ShelobiteScuttlerRenderState(); - } - - protected ShelobiteScuttlerRenderer(EntityRendererFactory.Context ctx, float shadowRadius, EntityModelLayer layer) { - super(ctx, new ShelobiteScuttlerModel(ctx.getPart(layer)), shadowRadius); + protected ShelobiteScuttlerRenderer(EntityRendererProvider.Context ctx, float shadowRadius, ModelLayerLocation layer) { + super(ctx, new ShelobiteScuttlerModel(ctx.bakeLayer(layer)), shadowRadius); } @Override - public Identifier getTexture(ShelobiteScuttlerRenderState state) { - return state.spiderVariant.assetInfo().scuttler().texturePath(); - } - - public void updateRenderState(ShelobiteScuttlerEntity shelobiteScuttlerEntity, ShelobiteScuttlerRenderState shelobiteScuttlerEntityRenderState, float f) { - super.updateRenderState(shelobiteScuttlerEntity, shelobiteScuttlerEntityRenderState, f); - shelobiteScuttlerEntityRenderState.idleAnimationState.copyFrom(shelobiteScuttlerEntity.idleAnimation); - shelobiteScuttlerEntityRenderState.walkAnimationState.copyFrom(shelobiteScuttlerEntity.walkingAnimation); - shelobiteScuttlerEntityRenderState.biteAnimationState.copyFrom(shelobiteScuttlerEntity.biteAnimation); - shelobiteScuttlerEntityRenderState.pounceAnimationState.copyFrom(shelobiteScuttlerEntity.pounceAnimation); - shelobiteScuttlerEntityRenderState.climbingTicks = shelobiteScuttlerEntity.getClimbingTicks(); - shelobiteScuttlerEntityRenderState.leapingTicks = shelobiteScuttlerEntity.getLeapingTicks(); - shelobiteScuttlerEntityRenderState.spiderVariant = shelobiteScuttlerEntity.getVariant(); + public ResourceLocation getTextureLocation(ShelobiteScuttlerEntity entity) { + return SpiderVariant.texture(entity.getVariant().assetInfo().scuttler()); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobAnimations.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobAnimations.java index 433f6e6b6c..9cb8350553 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobAnimations.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobAnimations.java @@ -1,2287 +1,2287 @@ package net.sevenstars.middleearth.entity.spider.spawn; -import net.minecraft.client.render.entity.animation.AnimationDefinition; -import net.minecraft.client.render.entity.animation.AnimationHelper; -import net.minecraft.client.render.entity.animation.Keyframe; -import net.minecraft.client.render.entity.animation.Transformation; +import net.minecraft.client.animation.AnimationChannel; +import net.minecraft.client.animation.AnimationDefinition; +import net.minecraft.client.animation.Keyframe; +import net.minecraft.client.animation.KeyframeAnimations; public class SpawnOfShelobAnimations { // region WALK - public static final AnimationDefinition SPAWN_OF_SHELOB_WALK = AnimationDefinition.Builder.create(2f).looping() - .addBoneAnimation("rleg4", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -20.17f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -19.51f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -17.66f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -20.43f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -18.86f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg6", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 99.27f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 103.62f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 119.34f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 91.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 110.07f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 116.73f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 99.27f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg7", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -73.23f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -70.09f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -78.62f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -94.36f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -67.87f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -73.23f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 15f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 0.18f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 14.32f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 9.14f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 15f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -10.73f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -11.69f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -35f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -35f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -6.99f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -17.37f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -30.31f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -10.73f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -53.23f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -32.54f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -56.26f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -46.16f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -33.97f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -53.23f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("abdomen", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(20.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(17.77f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(22.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(17.15f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(22.01f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(19.38f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(19.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(22.23f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(17.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(22.85f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(20.93f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("stinger", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(30.95f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(37.03f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(35.52f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(32.06f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(39.57f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(30.03f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(39.05f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(32.97f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(34.48f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(37.94f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(30.95f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("prosoma", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-0.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(-5.48f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(-4.26f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(-2.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(-1.28f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(-4.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0.48f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(-5.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(-0.74f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(-0.07f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("chelicerae", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 3f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createTranslationalVector(0f, 0.78f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, 1.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createTranslationalVector(0f, 2.9f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createTranslationalVector(0f, 2.12f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 3f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -51.76f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, -58.67f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, -37.91f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, -20.25f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, -31.87f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, -55.54f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, -56.18f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, -32.83f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, -20.11f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, -36.87f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, -51.76f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation1", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 2.67f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, 2.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createTranslationalVector(0f, 0.16f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, 2.93f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createTranslationalVector(0f, 1.36f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation1", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -26.76f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, -2.41f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 3.27f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, -18.13f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, -34.89f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, -22.17f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 1.18f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0.54f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, -23.13f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, -34.75f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, -26.76f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("leftchel", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(3.72f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(-4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(4.76f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(-3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(1.04f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(-3.72f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(-4.76f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("leftooth", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("leftjaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg5", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 17.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 13.38f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 1.05f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 19.56f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 9.08f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rightchel", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(4.05f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(-2.03f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(-0.52f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(2.94f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(-4.57f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(4.97f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(-4.05f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(2.03f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0.52f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(-2.94f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(4.05f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rightooth", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rightjaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation2", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 3f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createTranslationalVector(0f, 0.78f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, 1.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createTranslationalVector(0f, 2.9f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createTranslationalVector(0f, 2.12f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 3f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -1.76f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, -8.67f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 12.09f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 29.75f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 18.13f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, -5.54f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, -6.18f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 17.17f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 29.89f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 13.13f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, -1.76f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg8", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -20.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -18.28f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -19f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -20.4f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -19.62f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -20.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg9", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 20f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 5.18f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 19.32f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 14.14f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 20f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg10", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 106.18f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 105.54f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 108.67f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 101.76f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 93.13f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 106.18f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg11", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -88.23f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -67.54f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -91.26f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -81.16f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -68.97f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -88.23f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -26.76f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, -33.67f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, -12.91f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 4.75f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, -6.87f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, -30.54f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, -31.18f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, -7.83f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 4.89f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, -11.87f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, -26.76f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg8", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 20.1f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 19.62f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 20.4f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 19f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg9", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -17.32f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -14.14f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -19.32f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg10", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -98.13f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -109.75f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -92.09f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -102.59f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -108.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg11", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 70.77f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 77.43f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 95.93f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 68.16f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 83.88f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 2.6f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 2.12f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createTranslationalVector(0f, 2.9f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, 1.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 25.74f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 18.83f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 39.59f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 57.25f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 45.63f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 21.96f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 21.32f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 44.67f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 57.39f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 40.63f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 25.74f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -12.32f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -9.14f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -14.32f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 35f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 35f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 22.8f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 5.37f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 31.86f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 16.12f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 7.59f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 35f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 35f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 50.3f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 32.87f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 59.36f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 43.62f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 35.09f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 62.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation2", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.93f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createTranslationalVector(0f, 3f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 0.62f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createTranslationalVector(0f, 1.63f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 2.85f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0.93f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -1.76f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 22.59f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 28.27f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 6.87f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, -9.89f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 2.83f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 26.18f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 25.54f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 1.87f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, -9.75f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, -1.76f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg4", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 18.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 20.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 18.12f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 19.13f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 20.35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 18.43f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg5", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -6.18f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -19.97f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -4.16f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -10.89f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -19.02f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -6.18f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg6", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -115.16f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -112.29f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -118.53f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -106.34f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg7", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 86.75f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 67.66f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 92.81f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 79.87f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 69.49f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation3", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 2.6f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 2.12f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createTranslationalVector(0f, 2.9f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, 1.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 49.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 56.17f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 35.41f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 17.75f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 29.37f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 53.04f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 53.68f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 30.33f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 17.61f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 34.37f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 49.26f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg12", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 12.32f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 9.14f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 14.32f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg13", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -35f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -35f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -22.8f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -5.37f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -31.86f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -16.12f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -7.59f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -35f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -35f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg14", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -35.77f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -42.43f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -60.93f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -33.16f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -48.88f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -62.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation4", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -25.74f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, -18.83f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, -39.59f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, -57.25f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, -45.63f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, -21.96f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, -21.32f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, -44.67f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, -57.39f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, -40.63f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, -25.74f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg12", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -15f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -0.18f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -14.32f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -9.14f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -15f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg13", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 10.73f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 11.69f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 35f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 35f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 6.99f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 17.37f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 30.31f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 10.73f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg14", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 53.23f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 32.54f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 56.26f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 46.16f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 33.97f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 53.23f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -0.62f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createTranslationalVector(0f, 1.49f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, -1.96f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 1.9f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, -1.34f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createTranslationalVector(0f, 0.42f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0.62f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createTranslationalVector(0f, -1.49f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, 1.96f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createTranslationalVector(0f, -1.9f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, -0.62f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-2.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(2.98f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(-2.74f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(1.76f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(-0.31f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(-1.22f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(2.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(-2.98f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(2.74f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(-1.76f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(-2.43f, 0f, 0f), Transformation.Interpolations.LINEAR))).build(); + public static final AnimationDefinition SPAWN_OF_SHELOB_WALK = AnimationDefinition.Builder.withLength(2f).looping() + .addAnimation("rleg4", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -20.17f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -19.51f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -17.66f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -20.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -18.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg6", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 99.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 103.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 119.34f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 91.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 110.07f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 116.73f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 99.27f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg7", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -73.23f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -70.09f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -78.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -94.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -67.87f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -73.23f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 15f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 0.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 14.32f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 9.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 15f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -10.73f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -11.69f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -6.99f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -17.37f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -30.31f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -10.73f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -53.23f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -32.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -56.26f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -46.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -33.97f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -53.23f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("abdomen", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(20.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(17.77f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(22.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(17.15f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(22.01f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(19.38f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(19.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(22.23f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(17.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(22.85f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(20.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("stinger", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(30.95f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(37.03f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(35.52f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(32.06f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(39.57f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(30.03f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(39.05f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(32.97f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(34.48f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(37.94f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(30.95f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("prosoma", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-0.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(-5.48f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(-4.26f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(-2.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(-1.28f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(-4.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0.48f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(-5.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(-0.74f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(-0.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("chelicerae", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 3f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.posVec(0f, 0.78f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, 1.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.posVec(0f, 2.9f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.posVec(0f, 2.12f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 3f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -51.76f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, -58.67f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, -37.91f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, -20.25f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, -31.87f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, -55.54f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, -56.18f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, -32.83f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, -20.11f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, -36.87f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, -51.76f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation1", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 2.67f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, 2.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.posVec(0f, 0.16f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, 2.93f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.posVec(0f, 1.36f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation1", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -26.76f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, -2.41f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 3.27f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, -18.13f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, -34.89f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, -22.17f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 1.18f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0.54f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, -23.13f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, -34.75f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, -26.76f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("leftchel", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(3.72f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(-4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(4.76f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(-3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(1.04f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(-3.72f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(-4.76f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("leftooth", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("leftjaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg5", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 17.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 13.38f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 1.05f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 19.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 9.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rightchel", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(4.05f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(-2.03f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(-0.52f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(2.94f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(-4.57f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(4.97f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(-4.05f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(2.03f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0.52f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(-2.94f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(4.05f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rightooth", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rightjaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation2", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 3f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.posVec(0f, 0.78f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, 1.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.posVec(0f, 2.9f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.posVec(0f, 2.12f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 3f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -1.76f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, -8.67f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 12.09f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 29.75f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 18.13f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, -5.54f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, -6.18f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 17.17f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 29.89f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 13.13f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, -1.76f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg8", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -20.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -18.28f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -19f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -20.4f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -19.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -20.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg9", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 5.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 19.32f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 14.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 20f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg10", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 106.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 105.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 108.67f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 101.76f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 93.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 106.18f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg11", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -88.23f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -67.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -91.26f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -81.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -68.97f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -88.23f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -26.76f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, -33.67f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, -12.91f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 4.75f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, -6.87f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, -30.54f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, -31.18f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, -7.83f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 4.89f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, -11.87f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, -26.76f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg8", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 20.1f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 19.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 20.4f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 19f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg9", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -17.32f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -14.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -19.32f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg10", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -98.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -109.75f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -92.09f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -102.59f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -108.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg11", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 70.77f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 77.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 95.93f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 68.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 83.88f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 2.6f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 2.12f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.posVec(0f, 2.9f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, 1.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 25.74f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 18.83f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 39.59f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 57.25f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 45.63f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 21.96f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 21.32f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 44.67f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 57.39f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 40.63f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 25.74f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -12.32f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -9.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -14.32f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 22.8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 5.37f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 31.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 16.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 7.59f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 35f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 50.3f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 32.87f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 59.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 43.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 35.09f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 62.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation2", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.93f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.posVec(0f, 3f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 0.62f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.posVec(0f, 1.63f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 2.85f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0.93f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -1.76f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 22.59f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 28.27f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 6.87f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, -9.89f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 2.83f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 26.18f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 25.54f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 1.87f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, -9.75f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, -1.76f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg4", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 18.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 20.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 18.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 19.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 20.35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 18.43f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg5", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -6.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -19.97f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -4.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -10.89f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -19.02f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -6.18f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg6", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -115.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -112.29f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -118.53f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -106.34f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg7", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 86.75f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 67.66f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 92.81f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 79.87f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 69.49f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation3", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 2.6f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 2.12f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.posVec(0f, 2.9f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, 1.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 49.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 56.17f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 35.41f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 17.75f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 29.37f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 53.04f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 53.68f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 30.33f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 17.61f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 34.37f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 49.26f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg12", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 12.32f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 9.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 14.32f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg13", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -22.8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -5.37f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -31.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -16.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -7.59f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -35f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg14", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -35.77f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -42.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -60.93f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -33.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -48.88f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -62.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation4", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -25.74f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, -18.83f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, -39.59f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, -57.25f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, -45.63f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, -21.96f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, -21.32f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, -44.67f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, -57.39f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, -40.63f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, -25.74f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg12", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -15f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -0.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -14.32f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -9.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -15f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg13", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 10.73f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 11.69f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 6.99f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 17.37f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 30.31f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 10.73f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg14", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 53.23f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 32.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 56.26f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 46.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 33.97f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 53.23f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -0.62f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.posVec(0f, 1.49f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, -1.96f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 1.9f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, -1.34f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.posVec(0f, 0.42f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0.62f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.posVec(0f, -1.49f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, 1.96f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.posVec(0f, -1.9f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, -0.62f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(2.98f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(-2.74f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(1.76f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(-0.31f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(-1.22f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(-2.98f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(2.74f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(-1.76f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(-2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))).build(); // endregion WALK // region IDLE - public static final AnimationDefinition SPAWN_OF_SHELOB_IDLE = AnimationDefinition.Builder.create(4f).looping() - .addBoneAnimation("rleg4", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg6", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 88.29f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 89.28f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 90.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 91.62f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 92f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, 91.55f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 90.47f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, 89.19f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, 88.24f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, 88.02f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 88.29f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg7", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -94.94f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -96.42f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -98.35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -99.93f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -100.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, -99.83f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, -98.2f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, -96.28f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, -94.86f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, -94.54f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -94.94f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -8.41f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -6.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -3.86f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -1.76f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -1f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, -1.89f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, -4.07f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, -6.63f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, -8.52f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, -8.95f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -8.41f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -33.29f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -34.28f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -35.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -36.62f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -37f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, -36.55f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, -35.47f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, -34.19f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, -33.24f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, -33.02f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -33.29f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -64.21f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -63.22f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -61.93f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -60.88f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -60.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, -60.95f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, -62.03f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, -63.31f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, -64.26f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, -64.48f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -64.21f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("abdomen", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(20.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(22.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(22.01f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(19.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(17.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(17.99f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(20.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(22.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(22.01f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(19.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(20.93f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("stinger", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(39.05f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(34.48f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(30.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(30.95f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(35.52f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(39.57f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(39.05f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(34.48f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(30.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(30.95f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(39.05f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("prosoma", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-0.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(-2.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(-4.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(-5.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(-2.81f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(-0.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(-2.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(-4.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(-0.07f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("chelicerae", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 0.36f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, -0.28f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, -0.81f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createTranslationalVector(0f, -0.78f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createTranslationalVector(0f, -0.23f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createTranslationalVector(0f, 0.41f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createTranslationalVector(0f, 0.88f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createTranslationalVector(0f, 0.99f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, -40f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation1", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 0.36f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, -0.28f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, -0.81f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createTranslationalVector(0f, -0.78f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createTranslationalVector(0f, -0.23f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createTranslationalVector(0f, 0.41f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createTranslationalVector(0f, 0.88f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createTranslationalVector(0f, 0.99f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation1", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("leftchel", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(-4.99f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(-1.04f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(4.46f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(-2.72f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(-4.76f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0.26f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(2.27f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("leftooth", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("leftjaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg5", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -1.71f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -0.72f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 0.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 1.62f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 2f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, 1.55f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 0.47f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, -0.81f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, -1.76f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, -1.98f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -1.71f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rightchel", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-2.94f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(-4.67f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0.52f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(4.94f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(2.03f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(-3.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(-4.05f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(1.79f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(4.97f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0.78f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(-2.94f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rightooth", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rightjaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation2", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 0.36f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, -0.28f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, -0.81f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createTranslationalVector(0f, -0.78f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createTranslationalVector(0f, -0.23f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createTranslationalVector(0f, 0.41f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createTranslationalVector(0f, 0.88f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createTranslationalVector(0f, 0.99f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg8", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg9", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -1.71f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -0.72f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 0.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 1.62f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 2f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, 1.55f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 0.47f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, -0.81f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, -1.76f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, -1.98f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -1.71f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg10", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 88.29f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 89.28f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 90.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 91.62f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 92f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, 91.55f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 90.47f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, 89.19f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, 88.24f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, 88.02f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 88.29f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg11", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -94.94f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -96.42f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -98.35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -99.93f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -100.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, -99.83f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, -98.2f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, -96.28f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, -94.86f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, -94.54f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -94.94f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation3", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 0.36f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, -0.28f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, -0.81f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createTranslationalVector(0f, -0.78f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createTranslationalVector(0f, -0.23f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createTranslationalVector(0f, 0.41f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createTranslationalVector(0f, 0.88f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createTranslationalVector(0f, 0.99f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, -15f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg8", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg9", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 1.71f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 0.72f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -0.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -1.62f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -2f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, -1.55f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, -0.47f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, 0.81f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, 1.76f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, 1.98f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 1.71f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg10", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -88.29f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -89.28f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -90.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -91.62f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -92f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, -91.55f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, -90.47f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, -89.19f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, -88.24f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, -88.02f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -88.29f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg11", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 94.94f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 96.42f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 98.35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 99.93f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 100.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, 99.83f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 98.2f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, 96.28f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, 94.86f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, 94.54f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 94.94f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 0.36f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, -0.28f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, -0.81f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createTranslationalVector(0f, -0.78f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createTranslationalVector(0f, -0.23f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createTranslationalVector(0f, 0.41f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createTranslationalVector(0f, 0.88f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createTranslationalVector(0f, 0.99f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 8.41f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 6.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 3.86f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 1.76f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 1f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, 1.89f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 4.07f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, 6.63f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, 8.52f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, 8.95f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 8.41f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 33.29f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 34.28f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 35.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 36.62f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 37f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, 36.55f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 35.47f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, 34.19f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, 33.24f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, 33.02f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 33.29f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 64.21f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 63.22f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 61.93f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 60.88f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 60.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, 60.95f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 62.03f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, 63.31f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, 64.26f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, 64.48f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 64.21f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation2", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 0.36f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, -0.28f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, -0.81f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createTranslationalVector(0f, -0.78f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createTranslationalVector(0f, -0.23f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createTranslationalVector(0f, 0.41f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createTranslationalVector(0f, 0.88f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createTranslationalVector(0f, 0.99f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 10f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg4", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg5", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 1.71f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 0.72f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -0.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -1.62f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -2f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, -1.55f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, -0.47f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, 0.81f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, 1.76f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, 1.98f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 1.71f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg6", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -88.29f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -89.28f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -90.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -91.62f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -92f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, -91.55f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, -90.47f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, -89.19f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, -88.24f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, -88.02f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -88.29f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg7", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 94.94f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 96.42f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 98.35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 99.93f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 100.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, 99.83f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 98.2f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, 96.28f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, 94.86f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, 94.54f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 94.94f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation3", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 0.36f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, -0.28f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, -0.81f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createTranslationalVector(0f, -0.78f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createTranslationalVector(0f, -0.23f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createTranslationalVector(0f, 0.41f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createTranslationalVector(0f, 0.88f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createTranslationalVector(0f, 0.99f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 37.5f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg12", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -8.41f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -6.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -3.86f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -1.76f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -1f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, -1.89f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, -4.07f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, -6.63f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, -8.52f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, -8.95f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -8.41f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg13", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -33.29f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -34.28f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -35.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -36.62f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -37f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, -36.55f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, -35.47f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, -34.19f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, -33.24f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, -33.02f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -33.29f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg14", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -64.21f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -63.22f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -61.93f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -60.88f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -60.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, -60.95f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, -62.03f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, -63.31f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, -64.26f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, -64.48f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, -64.21f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation4", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 0.36f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, -0.28f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, -0.81f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createTranslationalVector(0f, -0.78f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createTranslationalVector(0f, -0.23f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createTranslationalVector(0f, 0.41f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createTranslationalVector(0f, 0.88f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createTranslationalVector(0f, 0.99f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation4", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, -37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, -37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, -37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, -37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, -37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, -37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, -37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, -37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, -37.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, -37.5f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg12", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 8.41f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 6.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 3.86f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 1.76f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 1f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, 1.89f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 4.07f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, 6.63f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, 8.52f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, 8.95f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 8.41f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg13", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 33.29f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 34.28f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 35.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 36.62f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 37f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, 36.55f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 35.47f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, 34.19f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, 33.24f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, 33.02f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 33.29f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg14", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 64.21f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 63.22f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 61.93f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 60.88f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 60.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0f, 0f, 60.95f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(0f, 0f, 62.03f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(0f, 0f, 63.31f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(0f, 0f, 64.26f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(0f, 0f, 64.48f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(0f, 0f, 64.21f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 0.36f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, -0.28f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, -0.81f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, -1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createTranslationalVector(0f, -0.78f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createTranslationalVector(0f, -0.23f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createTranslationalVector(0f, 0.41f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createTranslationalVector(0f, 0.88f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createTranslationalVector(0f, 0.99f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createTranslationalVector(0f, 0.85f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-2.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(-2.74f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(-0.31f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(2.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(2.74f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.08333f, AnimationHelper.createRotationalVector(0.31f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.5f, AnimationHelper.createRotationalVector(-2.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2.91667f, AnimationHelper.createRotationalVector(-2.74f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.33333f, AnimationHelper.createRotationalVector(-0.31f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(3.75f, AnimationHelper.createRotationalVector(2.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(4f, AnimationHelper.createRotationalVector(-2.43f, 0f, 0f), Transformation.Interpolations.LINEAR))).build(); + public static final AnimationDefinition SPAWN_OF_SHELOB_IDLE = AnimationDefinition.Builder.withLength(4f).looping() + .addAnimation("rleg4", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg6", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 88.29f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 89.28f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 90.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 91.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 92f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, 91.55f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 90.47f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, 89.19f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, 88.24f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, 88.02f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 88.29f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg7", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -94.94f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -96.42f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -98.35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -99.93f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -100.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, -99.83f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, -98.2f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, -96.28f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, -94.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, -94.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -94.94f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -8.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -6.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -3.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -1.76f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -1f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, -1.89f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, -4.07f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, -6.63f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, -8.52f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, -8.95f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -8.41f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -33.29f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -34.28f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -35.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -36.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -37f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, -36.55f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, -35.47f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, -34.19f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, -33.24f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, -33.02f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -33.29f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -64.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -63.22f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -61.93f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -60.88f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -60.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, -60.95f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, -62.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, -63.31f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, -64.26f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, -64.48f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -64.21f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("abdomen", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(20.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(22.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(22.01f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(19.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(17.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(17.99f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(20.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(22.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(22.01f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(19.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(20.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("stinger", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(39.05f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(34.48f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(30.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(30.95f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(35.52f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(39.57f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(39.05f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(34.48f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(30.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(30.95f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(39.05f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("prosoma", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-0.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(-2.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(-4.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(-5.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(-2.81f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(-0.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(-2.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(-4.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(-0.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("chelicerae", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 0.36f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, -0.28f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, -0.81f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.posVec(0f, -0.78f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.posVec(0f, -0.23f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.posVec(0f, 0.41f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.posVec(0f, 0.88f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.posVec(0f, 0.99f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, -40f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation1", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 0.36f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, -0.28f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, -0.81f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.posVec(0f, -0.78f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.posVec(0f, -0.23f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.posVec(0f, 0.41f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.posVec(0f, 0.88f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.posVec(0f, 0.99f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation1", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("leftchel", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(-4.99f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(-1.04f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(4.46f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(-2.72f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(-4.76f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0.26f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(2.27f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("leftooth", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("leftjaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg5", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -1.71f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -0.72f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 0.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 1.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 2f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, 1.55f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 0.47f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, -0.81f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, -1.76f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, -1.98f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -1.71f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rightchel", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-2.94f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(-4.67f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0.52f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(4.94f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(2.03f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(-3.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(-4.05f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(1.79f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(4.97f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0.78f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(-2.94f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rightooth", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rightjaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation2", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 0.36f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, -0.28f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, -0.81f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.posVec(0f, -0.78f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.posVec(0f, -0.23f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.posVec(0f, 0.41f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.posVec(0f, 0.88f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.posVec(0f, 0.99f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg8", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg9", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -1.71f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -0.72f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 0.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 1.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 2f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, 1.55f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 0.47f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, -0.81f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, -1.76f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, -1.98f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -1.71f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg10", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 88.29f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 89.28f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 90.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 91.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 92f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, 91.55f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 90.47f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, 89.19f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, 88.24f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, 88.02f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 88.29f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg11", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -94.94f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -96.42f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -98.35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -99.93f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -100.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, -99.83f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, -98.2f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, -96.28f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, -94.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, -94.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -94.94f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation3", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 0.36f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, -0.28f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, -0.81f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.posVec(0f, -0.78f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.posVec(0f, -0.23f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.posVec(0f, 0.41f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.posVec(0f, 0.88f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.posVec(0f, 0.99f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, -15f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg8", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg9", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 1.71f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 0.72f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -0.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -1.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -2f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, -1.55f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, -0.47f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, 0.81f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, 1.76f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, 1.98f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 1.71f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg10", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -88.29f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -89.28f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -90.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -91.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -92f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, -91.55f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, -90.47f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, -89.19f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, -88.24f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, -88.02f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -88.29f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg11", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 94.94f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 96.42f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 98.35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 99.93f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 100.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, 99.83f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 98.2f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, 96.28f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, 94.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, 94.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 94.94f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 0.36f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, -0.28f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, -0.81f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.posVec(0f, -0.78f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.posVec(0f, -0.23f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.posVec(0f, 0.41f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.posVec(0f, 0.88f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.posVec(0f, 0.99f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 8.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 6.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 3.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 1.76f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 1f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, 1.89f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 4.07f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, 6.63f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, 8.52f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, 8.95f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 8.41f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 33.29f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 34.28f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 35.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 36.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 37f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, 36.55f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 35.47f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, 34.19f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, 33.24f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, 33.02f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 33.29f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 64.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 63.22f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 61.93f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 60.88f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 60.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, 60.95f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 62.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, 63.31f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, 64.26f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, 64.48f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 64.21f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation2", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 0.36f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, -0.28f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, -0.81f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.posVec(0f, -0.78f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.posVec(0f, -0.23f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.posVec(0f, 0.41f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.posVec(0f, 0.88f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.posVec(0f, 0.99f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 10f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg4", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg5", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 1.71f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 0.72f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -0.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -1.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -2f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, -1.55f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, -0.47f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, 0.81f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, 1.76f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, 1.98f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 1.71f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg6", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -88.29f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -89.28f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -90.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -91.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -92f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, -91.55f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, -90.47f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, -89.19f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, -88.24f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, -88.02f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -88.29f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg7", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 94.94f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 96.42f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 98.35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 99.93f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 100.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, 99.83f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 98.2f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, 96.28f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, 94.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, 94.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 94.94f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation3", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 0.36f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, -0.28f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, -0.81f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.posVec(0f, -0.78f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.posVec(0f, -0.23f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.posVec(0f, 0.41f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.posVec(0f, 0.88f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.posVec(0f, 0.99f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 37.5f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg12", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -8.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -6.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -3.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -1.76f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -1f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, -1.89f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, -4.07f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, -6.63f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, -8.52f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, -8.95f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -8.41f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg13", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -33.29f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -34.28f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -35.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -36.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -37f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, -36.55f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, -35.47f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, -34.19f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, -33.24f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, -33.02f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -33.29f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg14", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -64.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -63.22f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -61.93f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -60.88f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -60.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, -60.95f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, -62.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, -63.31f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, -64.26f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, -64.48f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, -64.21f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation4", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 0.36f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, -0.28f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, -0.81f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.posVec(0f, -0.78f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.posVec(0f, -0.23f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.posVec(0f, 0.41f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.posVec(0f, 0.88f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.posVec(0f, 0.99f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation4", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, -37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, -37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, -37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, -37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, -37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, -37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, -37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, -37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, -37.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, -37.5f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg12", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 8.41f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 6.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 3.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 1.76f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 1f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, 1.89f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 4.07f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, 6.63f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, 8.52f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, 8.95f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 8.41f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg13", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 33.29f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 34.28f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 35.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 36.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 37f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, 36.55f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 35.47f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, 34.19f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, 33.24f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, 33.02f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 33.29f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg14", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 64.21f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 63.22f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 61.93f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 60.88f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 60.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0f, 0f, 60.95f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(0f, 0f, 62.03f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(0f, 0f, 63.31f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(0f, 0f, 64.26f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(0f, 0f, 64.48f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(0f, 0f, 64.21f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 0.36f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, -0.28f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, -0.81f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, -1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.posVec(0f, -0.78f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.posVec(0f, -0.23f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.posVec(0f, 0.41f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.posVec(0f, 0.88f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.posVec(0f, 0.99f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.posVec(0f, 0.85f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(-2.74f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(-0.31f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(2.74f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.08333f, KeyframeAnimations.degreeVec(0.31f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.5f, KeyframeAnimations.degreeVec(-2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2.91667f, KeyframeAnimations.degreeVec(-2.74f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.33333f, KeyframeAnimations.degreeVec(-0.31f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(3.75f, KeyframeAnimations.degreeVec(2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(4f, KeyframeAnimations.degreeVec(-2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))).build(); // endregion // region BITE - public static final AnimationDefinition SPAWN_OF_SHELOB_BITE = AnimationDefinition.Builder.create(2f) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 1f, -2f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 1f, -2f), Transformation.Interpolations.LINEAR), - new Keyframe(0.70833f, AnimationHelper.createTranslationalVector(0f, 1f, -4f), Transformation.Interpolations.LINEAR), - new Keyframe(0.91667f, AnimationHelper.createTranslationalVector(0f, 1f, -2f), Transformation.Interpolations.LINEAR), - new Keyframe(1.125f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.66667f, AnimationHelper.createRotationalVector(-2.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(5.75f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.91667f, AnimationHelper.createRotationalVector(5.75f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.125f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("abdomen", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(60f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(-32.75f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("stinger", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.54167f, AnimationHelper.createRotationalVector(10f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.66667f, AnimationHelper.createRotationalVector(65f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.75f, AnimationHelper.createRotationalVector(-32.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("prosoma", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.58333f, AnimationHelper.createTranslationalVector(0f, 0f, -3.65f), Transformation.Interpolations.LINEAR), - new Keyframe(0.70833f, AnimationHelper.createTranslationalVector(0f, 0f, -2f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, 0f, -2f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("prosoma", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-37.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(-37.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.66667f, AnimationHelper.createRotationalVector(18.67f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(27.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(27.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("chelicerae", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 0f, 4f), Transformation.Interpolations.LINEAR), - new Keyframe(0.58333f, AnimationHelper.createTranslationalVector(0f, 0f, 4f), Transformation.Interpolations.LINEAR), - new Keyframe(0.70833f, AnimationHelper.createTranslationalVector(0f, 0f, -2f), Transformation.Interpolations.LINEAR), - new Keyframe(0.79167f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("chelicerae", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-140f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(-165f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(-126.25f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.79167f, AnimationHelper.createRotationalVector(-126.25f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("leftchel", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, -12.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.66667f, AnimationHelper.createRotationalVector(0f, -12.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("leftooth", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-122.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.54167f, AnimationHelper.createRotationalVector(-100f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(-137.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(-95f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.66667f, AnimationHelper.createRotationalVector(-135f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(-50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.79167f, AnimationHelper.createRotationalVector(-50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("leftjaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.54167f, AnimationHelper.createRotationalVector(5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.66667f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(-55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.79167f, AnimationHelper.createRotationalVector(-55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rightchel", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 12.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.66667f, AnimationHelper.createRotationalVector(0f, 12.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rightooth", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-122.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.54167f, AnimationHelper.createRotationalVector(-100f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(-137.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(-95f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.66667f, AnimationHelper.createRotationalVector(-135f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(-50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.79167f, AnimationHelper.createRotationalVector(-50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rightjaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.54167f, AnimationHelper.createRotationalVector(5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.66667f, AnimationHelper.createRotationalVector(-7.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.70833f, AnimationHelper.createRotationalVector(-55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.79167f, AnimationHelper.createRotationalVector(-55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))).build(); + public static final AnimationDefinition SPAWN_OF_SHELOB_BITE = AnimationDefinition.Builder.withLength(2f) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 1f, -2f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 1f, -2f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.70833f, KeyframeAnimations.posVec(0f, 1f, -4f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.91667f, KeyframeAnimations.posVec(0f, 1f, -2f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.125f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.66667f, KeyframeAnimations.degreeVec(-2.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(5.75f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.91667f, KeyframeAnimations.degreeVec(5.75f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.125f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("abdomen", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(60f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(-32.75f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("stinger", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.54167f, KeyframeAnimations.degreeVec(10f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.66667f, KeyframeAnimations.degreeVec(65f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.75f, KeyframeAnimations.degreeVec(-32.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("prosoma", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.58333f, KeyframeAnimations.posVec(0f, 0f, -3.65f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.70833f, KeyframeAnimations.posVec(0f, 0f, -2f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, 0f, -2f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("prosoma", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-37.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(-37.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.66667f, KeyframeAnimations.degreeVec(18.67f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(27.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(27.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("chelicerae", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 0f, 4f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.58333f, KeyframeAnimations.posVec(0f, 0f, 4f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.70833f, KeyframeAnimations.posVec(0f, 0f, -2f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.79167f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("chelicerae", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-140f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(-165f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(-126.25f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.79167f, KeyframeAnimations.degreeVec(-126.25f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("leftchel", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, -12.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.66667f, KeyframeAnimations.degreeVec(0f, -12.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("leftooth", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-122.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.54167f, KeyframeAnimations.degreeVec(-100f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(-137.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(-95f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.66667f, KeyframeAnimations.degreeVec(-135f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(-50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.79167f, KeyframeAnimations.degreeVec(-50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("leftjaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-7.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.54167f, KeyframeAnimations.degreeVec(5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(-7.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.66667f, KeyframeAnimations.degreeVec(-7.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(-55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.79167f, KeyframeAnimations.degreeVec(-55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rightchel", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 12.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.66667f, KeyframeAnimations.degreeVec(0f, 12.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rightooth", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-122.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.54167f, KeyframeAnimations.degreeVec(-100f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(-137.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(-95f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.66667f, KeyframeAnimations.degreeVec(-135f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(-50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.79167f, KeyframeAnimations.degreeVec(-50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rightjaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(-7.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.54167f, KeyframeAnimations.degreeVec(5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(-7.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.66667f, KeyframeAnimations.degreeVec(-7.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.70833f, KeyframeAnimations.degreeVec(-55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.79167f, KeyframeAnimations.degreeVec(-55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))).build(); // endregion // region WALK_BLOCK - public static final AnimationDefinition SPAWN_OF_SHELOB_BLOCK = AnimationDefinition.Builder.create(2f).looping() - .addBoneAnimation("rleg4", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -20.17f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -19.51f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -17.66f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -20.43f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -18.86f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg6", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 99.27f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 103.62f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 119.34f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 91.57f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 110.07f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 116.73f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 99.27f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg7", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -73.23f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -70.09f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -78.62f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -94.36f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -67.87f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -73.23f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -42.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(-10f, 0f, -42.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, -42.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.625f, AnimationHelper.createRotationalVector(-10f, 0f, -42.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -42.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(75f, -75f, -35f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(50f, -85f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(75f, -75f, -35f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(55f, -5f, -60f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(55f, -5f, -70f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(55f, -5f, -60f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(55f, -5f, -70f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(55f, -5f, -60f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("abdomen", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(20.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(17.77f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(22.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(17.15f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(22.01f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(19.38f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(19.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(22.23f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(17.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(22.85f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(20.93f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("stinger", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(30.95f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(37.03f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(35.52f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(32.06f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(39.57f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(30.03f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(39.05f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(32.97f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(34.48f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(37.94f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(30.95f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("prosoma", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-0.07f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(-5.48f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(-4.26f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(-2.19f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(-1.28f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(-4.93f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0.48f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(-5.24f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(-0.74f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(-0.07f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("chelicerae", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(125f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -45f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(0f, -35f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(10f, -45f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(1.58333f, AnimationHelper.createRotationalVector(0f, -35f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, -45f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation1", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 2.67f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, 2.01f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createTranslationalVector(0f, 0.16f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, 2.93f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createTranslationalVector(0f, 1.36f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation1", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -26.76f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, -2.41f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 3.27f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, -18.13f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, -34.89f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, -22.17f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 1.18f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0.54f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, -23.13f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, -34.75f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, -26.76f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("leftchel", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(3.72f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(-4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(4.76f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(-3.35f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(1.04f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(1.55f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(-3.72f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(4.89f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(-4.76f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(-1.55f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("leftooth", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("leftjaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg5", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 17.82f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 13.38f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 1.05f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 19.56f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 9.08f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rightchel", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(4.05f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(-2.03f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(-0.52f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(2.94f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(-4.57f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(4.97f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(-4.05f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(2.03f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0.52f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(-2.94f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(4.05f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rightooth", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(67.5f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rightjaw", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(50f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation2", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 3f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createTranslationalVector(0f, 0.78f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, 1.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createTranslationalVector(0f, 2.9f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createTranslationalVector(0f, 2.12f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 3f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -1.76f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, -8.67f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 12.09f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 29.75f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 18.13f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, -5.54f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, -6.18f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 17.17f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 29.89f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 13.13f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, -1.76f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg8", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -20.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -18.28f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -19f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -20.4f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -19.62f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -20.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg9", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 20f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 5.18f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 10f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 19.32f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 14.14f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 20f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg10", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 106.18f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 105.54f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 108.67f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 101.76f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 93.13f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 106.18f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg11", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -88.23f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -67.54f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -91.26f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -81.16f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -68.97f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -88.23f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -26.76f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, -33.67f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, -12.91f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 4.75f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, -6.87f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, -30.54f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, -31.18f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, -7.83f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 4.89f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, -11.87f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, -26.76f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg8", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 20.1f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 19.62f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 20.4f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 19f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg9", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -17.32f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -14.14f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -19.32f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -10f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg10", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -98.13f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -109.75f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -92.09f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -102.59f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -108.27f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg11", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 70.77f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 77.43f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 95.93f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 68.16f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 83.88f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 1f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.58333f, AnimationHelper.createRotationalVector(0f, 42.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.58333f, AnimationHelper.createRotationalVector(0f, 42.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 40f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 42.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 10f, 42.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 42.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.625f, AnimationHelper.createRotationalVector(0f, 10f, 42.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 42.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-70f, 75f, -110f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(-85f, 60f, -140f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(-70f, 75f, -110f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(5f, 30f, 35f), Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(5f, 30f, 25f), Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(5f, 30f, 35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.5f, AnimationHelper.createRotationalVector(5f, 30f, 25f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(5f, 30f, 35f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation2", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0.93f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createTranslationalVector(0f, 3f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 0.62f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createTranslationalVector(0f, 1.63f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 2.85f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0.93f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -1.76f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 22.59f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 28.27f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 6.87f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, -9.89f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 2.83f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 26.18f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 25.54f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 1.87f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, -9.75f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, -1.76f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg4", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 18.43f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 20.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 18.12f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 19.13f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 20.35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 17.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 18.43f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg5", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -6.18f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -19.97f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -4.16f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -10.89f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -19.02f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -6.18f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg6", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -115.16f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -112.29f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -118.53f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -106.34f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -90f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg7", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 86.75f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 67.66f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 92.81f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 79.87f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 69.49f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 97.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation3", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, 2.6f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 2.12f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createTranslationalVector(0f, 2.9f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, 1.5f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rrotation3", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 49.26f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 56.17f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 35.41f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 17.75f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 29.37f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 53.04f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 53.68f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 30.33f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 17.61f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 34.37f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 49.26f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg12", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 12.32f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 9.14f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 14.32f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg13", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -35f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -35f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -22.8f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -5.37f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -31.86f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -16.12f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -7.59f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -35f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -35f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg14", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, -62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, -35.77f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -42.43f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, -62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, -60.93f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, -33.16f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -48.88f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -62.5f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation4", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, -25.74f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, -18.83f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, -39.59f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, -57.25f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, -45.63f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, -21.96f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, -21.32f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, -44.67f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, -57.39f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, -40.63f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, -25.74f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg12", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, -15f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, -0.18f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, -14.32f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, -9.14f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, -15f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg13", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 10.73f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 11.69f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 35f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 35f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 6.99f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 17.37f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 35f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 30.31f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 10.73f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg14", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 53.23f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(0f, 0f, 32.54f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(0f, 0f, 56.26f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(0f, 0f, 62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(0f, 0f, 46.16f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(0f, 0f, 33.97f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(0f, 0f, 62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(0f, 0f, 62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(0f, 0f, 62.5f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(0f, 0f, 53.23f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, -0.62f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createTranslationalVector(0f, 1.49f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createTranslationalVector(0f, -1.96f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createTranslationalVector(0f, 1.9f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, -1.34f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createTranslationalVector(0f, 0.42f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createTranslationalVector(0f, 0.62f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createTranslationalVector(0f, -1.49f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createTranslationalVector(0f, 1.96f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createTranslationalVector(0f, -1.9f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createTranslationalVector(0f, -0.62f, 0f), Transformation.Interpolations.LINEAR))) - .addBoneAnimation("body", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(-2.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.20833f, AnimationHelper.createRotationalVector(2.98f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.41667f, AnimationHelper.createRotationalVector(-2.74f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.625f, AnimationHelper.createRotationalVector(1.76f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(-0.31f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.04167f, AnimationHelper.createRotationalVector(-1.22f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.25f, AnimationHelper.createRotationalVector(2.43f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.45833f, AnimationHelper.createRotationalVector(-2.98f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.66667f, AnimationHelper.createRotationalVector(2.74f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(1.875f, AnimationHelper.createRotationalVector(-1.76f, 0f, 0f), Transformation.Interpolations.LINEAR), - new Keyframe(2f, AnimationHelper.createRotationalVector(-2.43f, 0f, 0f), Transformation.Interpolations.LINEAR))).build(); + public static final AnimationDefinition SPAWN_OF_SHELOB_BLOCK = AnimationDefinition.Builder.withLength(2f).looping() + .addAnimation("rleg4", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -20.17f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -19.51f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -17.66f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -20.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -18.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg6", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 99.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 103.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 119.34f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 91.57f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 110.07f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 116.73f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 99.27f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg7", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -73.23f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -70.09f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -78.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -94.36f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -67.87f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -73.23f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -42.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(-10f, 0f, -42.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, -42.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.625f, KeyframeAnimations.degreeVec(-10f, 0f, -42.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -42.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(75f, -75f, -35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(50f, -85f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(75f, -75f, -35f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(55f, -5f, -60f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(55f, -5f, -70f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(55f, -5f, -60f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(55f, -5f, -70f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(55f, -5f, -60f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("abdomen", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(20.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(17.77f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(22.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(17.15f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(22.01f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(19.38f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(19.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(22.23f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(17.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(22.85f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(20.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("stinger", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(30.95f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(37.03f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(35.52f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(32.06f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(39.57f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(30.03f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(39.05f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(32.97f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(34.48f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(37.94f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(30.95f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("prosoma", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-0.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(-5.48f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(-4.26f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(-2.19f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(-1.28f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(-4.93f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0.48f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(-5.24f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(-0.74f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(-0.07f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("chelicerae", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(125f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -45f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(0f, -35f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(10f, -45f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.58333f, KeyframeAnimations.degreeVec(0f, -35f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, -45f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation1", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 2.67f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, 2.01f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.posVec(0f, 0.16f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, 2.93f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.posVec(0f, 1.36f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation1", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -26.76f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, -2.41f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 3.27f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, -18.13f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, -34.89f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, -22.17f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 1.18f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0.54f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, -23.13f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, -34.75f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, -26.76f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("leftchel", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(3.72f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(-4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(4.76f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(-3.35f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(1.04f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(-3.72f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(4.89f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(-4.76f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(-1.55f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("leftooth", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("leftjaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg5", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 17.82f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 13.38f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 1.05f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 19.56f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 9.08f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rightchel", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(4.05f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(-2.03f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(-0.52f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(2.94f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(-4.57f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(4.97f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(-4.05f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(2.03f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0.52f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(-2.94f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(4.05f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rightooth", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(67.5f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rightjaw", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(50f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation2", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 3f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.posVec(0f, 0.78f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, 1.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.posVec(0f, 2.9f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.posVec(0f, 2.12f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 3f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -1.76f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, -8.67f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 12.09f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 29.75f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 18.13f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, -5.54f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, -6.18f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 17.17f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 29.89f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 13.13f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, -1.76f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg8", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -20.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -18.28f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -19f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -20.4f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -19.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -20.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg9", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 20f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 5.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 19.32f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 14.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 20f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg10", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 106.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 105.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 108.67f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 101.76f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 93.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 106.18f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg11", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -88.23f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -67.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -91.26f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -81.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -68.97f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -88.23f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -26.76f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, -33.67f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, -12.91f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 4.75f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, -6.87f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, -30.54f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, -31.18f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, -7.83f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 4.89f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, -11.87f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, -26.76f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg8", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 20.1f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 19.62f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 20.4f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 19f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg9", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -17.32f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -14.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -19.32f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -10f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg10", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -98.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -109.75f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -92.09f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -102.59f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -108.27f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg11", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 70.77f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 77.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 95.93f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 68.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 83.88f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 1f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.58333f, KeyframeAnimations.degreeVec(0f, 42.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.58333f, KeyframeAnimations.degreeVec(0f, 42.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 40f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 42.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 10f, 42.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 42.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.625f, KeyframeAnimations.degreeVec(0f, 10f, 42.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 42.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-70f, 75f, -110f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(-85f, 60f, -140f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(-70f, 75f, -110f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(5f, 30f, 35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(5f, 30f, 25f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(5f, 30f, 35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.5f, KeyframeAnimations.degreeVec(5f, 30f, 25f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(5f, 30f, 35f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation2", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0.93f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.posVec(0f, 3f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 0.62f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.posVec(0f, 1.63f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 2.85f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0.93f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -1.76f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 22.59f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 28.27f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 6.87f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, -9.89f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 2.83f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 26.18f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 25.54f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 1.87f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, -9.75f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, -1.76f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg4", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 18.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 20.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 18.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 19.13f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 20.35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 17.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 18.43f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg5", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -6.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -19.97f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -4.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -10.89f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -19.02f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -6.18f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg6", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -115.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -112.29f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -118.53f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -106.34f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -90f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg7", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 86.75f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 67.66f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 92.81f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 79.87f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 69.49f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 97.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation3", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, 2.6f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 2.12f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.posVec(0f, 2.9f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, 1.5f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rrotation3", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 49.26f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 56.17f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 35.41f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 17.75f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 29.37f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 53.04f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 53.68f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 30.33f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 17.61f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 34.37f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 49.26f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg12", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 12.32f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 9.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 14.32f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg13", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -22.8f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -5.37f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -31.86f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -16.12f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -7.59f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -35f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg14", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, -62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, -35.77f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -42.43f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, -62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, -60.93f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, -33.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -48.88f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -62.5f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation4", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, -25.74f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, -18.83f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, -39.59f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, -57.25f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, -45.63f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, -21.96f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, -21.32f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, -44.67f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, -57.39f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, -40.63f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, -25.74f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg12", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, -15f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, -0.18f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, -14.32f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, -9.14f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, -15f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg13", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 10.73f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 11.69f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 6.99f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 17.37f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 35f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 30.31f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 10.73f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg14", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 53.23f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(0f, 0f, 32.54f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(0f, 0f, 56.26f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(0f, 0f, 62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(0f, 0f, 46.16f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(0f, 0f, 33.97f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(0f, 0f, 62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(0f, 0f, 62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(0f, 0f, 62.5f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(0f, 0f, 53.23f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, -0.62f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.posVec(0f, 1.49f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.posVec(0f, -1.96f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.posVec(0f, 1.9f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, -1.34f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.posVec(0f, 0.42f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.posVec(0f, 0.62f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.posVec(0f, -1.49f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.posVec(0f, 1.96f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.posVec(0f, -1.9f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.posVec(0f, -0.62f, 0f), AnimationChannel.Interpolations.LINEAR))) + .addAnimation("body", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(-2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.20833f, KeyframeAnimations.degreeVec(2.98f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.41667f, KeyframeAnimations.degreeVec(-2.74f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.625f, KeyframeAnimations.degreeVec(1.76f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(-0.31f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.04167f, KeyframeAnimations.degreeVec(-1.22f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.25f, KeyframeAnimations.degreeVec(2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.45833f, KeyframeAnimations.degreeVec(-2.98f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.66667f, KeyframeAnimations.degreeVec(2.74f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(1.875f, KeyframeAnimations.degreeVec(-1.76f, 0f, 0f), AnimationChannel.Interpolations.LINEAR), + new Keyframe(2f, KeyframeAnimations.degreeVec(-2.43f, 0f, 0f), AnimationChannel.Interpolations.LINEAR))).build(); // endregion // region POUNCE - public static final AnimationDefinition SPAWN_OF_SHELOB_POUNCE = AnimationDefinition.Builder.create(1f) - .addBoneAnimation("rrotation", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, -15f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, -15f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("rleg2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, 55f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, 55f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lrotation", - new Transformation(Transformation.Targets.MOVE_ORIGIN, - new Keyframe(0f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createTranslationalVector(0f, 2f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createTranslationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 15f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 15f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("lleg2", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.5f, AnimationHelper.createRotationalVector(0f, 0f, -55f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(0f, 0f, -55f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("abdomen", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.875f, AnimationHelper.createRotationalVector(40f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))) - .addBoneAnimation("prosoma", - new Transformation(Transformation.Targets.ROTATE, - new Keyframe(0f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.33333f, AnimationHelper.createRotationalVector(15f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(0.83333f, AnimationHelper.createRotationalVector(15f, 0f, 0f), - Transformation.Interpolations.LINEAR), - new Keyframe(1f, AnimationHelper.createRotationalVector(0f, 0f, 0f), - Transformation.Interpolations.LINEAR))).build(); + public static final AnimationDefinition SPAWN_OF_SHELOB_POUNCE = AnimationDefinition.Builder.withLength(1f) + .addAnimation("rrotation", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, -15f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, -15f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("rleg2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, 55f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, 55f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lrotation", + new AnimationChannel(AnimationChannel.Targets.POSITION, + new Keyframe(0f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.posVec(0f, 2f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.posVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 15f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 15f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("lleg2", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.5f, KeyframeAnimations.degreeVec(0f, 0f, -55f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(0f, 0f, -55f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("abdomen", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.875f, KeyframeAnimations.degreeVec(40f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))) + .addAnimation("prosoma", + new AnimationChannel(AnimationChannel.Targets.ROTATION, + new Keyframe(0f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.33333f, KeyframeAnimations.degreeVec(15f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(0.83333f, KeyframeAnimations.degreeVec(15f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR), + new Keyframe(1f, KeyframeAnimations.degreeVec(0f, 0f, 0f), + AnimationChannel.Interpolations.LINEAR))).build(); // endregion } \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobEntity.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobEntity.java index ddc9410d8b..77c413bf4f 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobEntity.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobEntity.java @@ -1,42 +1,52 @@ package net.sevenstars.middleearth.entity.spider.spawn; -import net.minecraft.block.BlockState; -import net.minecraft.entity.*; -import net.minecraft.entity.ai.goal.*; -import net.minecraft.entity.ai.pathing.EntityNavigation; -import net.minecraft.entity.ai.pathing.SpiderNavigation; -import net.minecraft.entity.attribute.DefaultAttributeContainer; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.entity.damage.DamageSource; -import net.minecraft.entity.data.DataTracker; -import net.minecraft.entity.data.TrackedData; -import net.minecraft.entity.data.TrackedDataHandlerRegistry; -import net.minecraft.entity.effect.StatusEffectInstance; -import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.entity.mob.HostileEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.projectile.ProjectileEntity; -import net.minecraft.entity.spawn.SpawnContext; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.particle.BlockStateParticleEffect; -import net.minecraft.particle.ParticleTypes; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundEvent; -import net.minecraft.sound.SoundEvents; -import net.minecraft.storage.ReadView; -import net.minecraft.storage.WriteView; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.Vec3d; -import net.minecraft.util.math.random.Random; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.core.particles.BlockParticleOption; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.syncher.EntityDataAccessor; +import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.tags.TagKey; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; import net.minecraft.world.*; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; +import net.minecraft.world.entity.AnimationState; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.SpawnGroupData; +import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.goal.FloatGoal; +import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal; +import net.minecraft.world.entity.ai.goal.MeleeAttackGoal; +import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal; +import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal; +import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; +import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; +import net.minecraft.world.entity.ai.navigation.PathNavigation; +import net.minecraft.world.entity.ai.navigation.WallClimberNavigation; +import net.minecraft.world.entity.monster.Monster; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.ServerLevelAccessor; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.TrackedDataHandlerRegistryME; +import net.sevenstars.middleearth.entity.VariantHolderUtils; import net.sevenstars.middleearth.entity.beasts.cave_troll.CaveTrollEntity; import net.sevenstars.middleearth.entity.goals.PounceRetreatGoal; import net.sevenstars.middleearth.entity.goals.ShieldAgainstProjectileGoal; @@ -48,15 +58,14 @@ import net.sevenstars.middleearth.entity.projectile.WebbedEntity; import net.sevenstars.middleearth.entity.spider.Pouncer; import net.sevenstars.middleearth.entity.spider.SpiderVariant; +import net.sevenstars.middleearth.entity.spider.SpiderVariantSelector; import net.sevenstars.middleearth.entity.spider.scuttler.ShelobiteScuttlerEntity; import net.sevenstars.middleearth.registries.DynamicRegistriesME; import net.sevenstars.middleearth.registries.content.spidervariants.SpiderVariantRegistry; import net.sevenstars.middleearth.utils.SpawnUtil; import org.jetbrains.annotations.Nullable; -import java.util.Optional; - -public class SpawnOfShelobEntity extends HostileEntity implements Pouncer, Shielder, CooldownRangedAttackMob { +public class SpawnOfShelobEntity extends Monster implements Pouncer, Shielder, CooldownRangedAttackMob { public static final int CLIMBING_MAX_TICKS = 40; public static final int PASSIVE_HEALING_COOLDOWN = 80; public static final int CLIMBING_TIME_TRANSITION = 12; @@ -64,11 +73,11 @@ public class SpawnOfShelobEntity extends HostileEntity implements Pouncer, Shiel public static final float MOVEMENT_SPEED = 1.15f; public static final float WEB_PROJECTILE_DAMAGE = 2f; - private static final TrackedData SPIDER_FLAGS; - private static final TrackedData BITE_FLAG; - private static final TrackedData POUNCE_FLAG; - private static final TrackedData BLOCK_FLAG; - private static final TrackedData> VARIANT; + private static final EntityDataAccessor SPIDER_FLAGS; + private static final EntityDataAccessor BITE_FLAG; + private static final EntityDataAccessor POUNCE_FLAG; + private static final EntityDataAccessor BLOCK_FLAG; + private static final EntityDataAccessor> VARIANT; public final AnimationState idleAnimation = new AnimationState(); public final AnimationState walkingAnimation = new AnimationState(); @@ -83,152 +92,151 @@ public class SpawnOfShelobEntity extends HostileEntity implements Pouncer, Shiel private int shootCooldown = 0; private int biteAnimationCooldown = 0; - public SpawnOfShelobEntity(EntityType entityType, World world) { + public SpawnOfShelobEntity(EntityType entityType, Level world) { super(entityType, world); } - public static DefaultAttributeContainer.Builder setAttributes() { - return HostileEntity.createHostileAttributes() - .add(EntityAttributes.MAX_HEALTH, 36.0) - .add(EntityAttributes.MOVEMENT_SPEED, 0.3) - .add(EntityAttributes.ATTACK_DAMAGE, 7) - .add(EntityAttributes.ARMOR, 3) - .add(EntityAttributes.FOLLOW_RANGE, 48.0); + public static AttributeSupplier.Builder setAttributes() { + return Monster.createMonsterAttributes() + .add(Attributes.MAX_HEALTH, 36.0) + .add(Attributes.MOVEMENT_SPEED, 0.3) + .add(Attributes.ATTACK_DAMAGE, 7) + .add(Attributes.ARMOR, 3) + .add(Attributes.FOLLOW_RANGE, 48.0); } - protected void initGoals() { - this.goalSelector.add(1, new SwimGoal(this)); - this.goalSelector.add(2, new PounceRetreatGoal(this, 0.8f, 1.15f, 0.3f)); - this.goalSelector.add(3, new ShieldAgainstProjectileGoal(this, this, 13, 32)); - this.goalSelector.add(4, new SmartProjectileAttackGoal(this, 0.75f, 40, 90, 17, 40)); - this.goalSelector.add(5, new SpiderPonceAtTargetGoal(this, this, + protected void registerGoals() { + this.goalSelector.addGoal(1, new FloatGoal(this)); + this.goalSelector.addGoal(2, new PounceRetreatGoal(this, 0.8f, 1.15f, 0.3f)); + this.goalSelector.addGoal(3, new ShieldAgainstProjectileGoal(this, this, 13, 32)); + this.goalSelector.addGoal(4, new SmartProjectileAttackGoal(this, 0.75f, 40, 90, 17, 40)); + this.goalSelector.addGoal(5, new SpiderPonceAtTargetGoal(this, this, 0.5F, 0.25f, 4, 17, 4)); - this.goalSelector.add(5, new MeleeAttackGoal(this, MOVEMENT_SPEED , false)); - this.goalSelector.add(6, new WanderAroundFarGoal(this, 0.8)); - this.goalSelector.add(8, new LookAtEntityGoal(this, PlayerEntity.class, 8.0F)); - this.goalSelector.add(8, new LookAroundGoal(this)); - this.targetSelector.add(1, new RevengeGoal(this)); - this.targetSelector.add(2, new ActiveTargetGoal<>(this, PlayerEntity.class, true)); - this.targetSelector.add(3, new ActiveTargetGoal<>(this, NpcEntity.class, true)); - this.targetSelector.add(4, new ActiveTargetGoal<>(this, CaveTrollEntity.class, true)); + this.goalSelector.addGoal(5, new MeleeAttackGoal(this, MOVEMENT_SPEED , false)); + this.goalSelector.addGoal(6, new WaterAvoidingRandomStrollGoal(this, 0.8)); + this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 8.0F)); + this.goalSelector.addGoal(8, new RandomLookAroundGoal(this)); + this.targetSelector.addGoal(1, new HurtByTargetGoal(this)); + this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true)); + this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, NpcEntity.class, true)); + this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, CaveTrollEntity.class, true)); } @Nullable @Override - public EntityData initialize(ServerWorldAccess world, LocalDifficulty difficulty, SpawnReason spawnReason, @Nullable EntityData entityData) { + public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData) { if (entityData instanceof ShelobiteScuttlerEntity.SpiderData spiderData) { this.setVariant(spiderData.variant); } else { - Optional> optional = Variants.select(SpawnContext.of(world, this.getBlockPos()), DynamicRegistriesME.SPIDER_VARIANTS); - if (optional.isPresent()) { - this.setVariant(optional.get()); - entityData = new ShelobiteScuttlerEntity.SpiderData(optional.get()); - } + Holder variant = SpiderVariantSelector.select(world, this.blockPosition()); + this.setVariant(variant); + entityData = new ShelobiteScuttlerEntity.SpiderData(variant); } - return super.initialize(world, difficulty, spawnReason, entityData); + return super.finalizeSpawn(world, difficulty, spawnReason, entityData); } public double getMountedHeightOffset() { - return (double)(this.getHeight() * 0.5F); + return (double)(this.getBbHeight() * 0.5F); } @Override - protected EntityNavigation createNavigation(World world) { - return new SpiderNavigation(this, world); + protected PathNavigation createNavigation(Level world) { + return new WallClimberNavigation(this, world); } - protected void initDataTracker(DataTracker.Builder builder) { - super.initDataTracker(builder); - builder.add(SPIDER_FLAGS, (byte)0); - builder.add(BITE_FLAG, 0); - builder.add(POUNCE_FLAG, 0); - builder.add(BLOCK_FLAG, 0); - RegistryEntry spiderVariantRegistryEntry = Variants.getOrDefaultOrThrow(this.getRegistryManager(), SpiderVariantRegistry.DEFAULT); - builder.add(VARIANT, spiderVariantRegistryEntry); + protected void defineSynchedData(SynchedEntityData.Builder builder) { + super.defineSynchedData(builder); + builder.define(SPIDER_FLAGS, (byte)0); + builder.define(BITE_FLAG, 0); + builder.define(POUNCE_FLAG, 0); + builder.define(BLOCK_FLAG, 0); + Holder spiderVariantRegistryEntry = + VariantHolderUtils.getDefaultOrAny(this.registryAccess(), SpiderVariantRegistry.DEFAULT); + builder.define(VARIANT, spiderVariantRegistryEntry); } protected void setupAnimationStates() { - if(!this.idleAnimation.isRunning()) { - this.idleAnimation.start(this.age); + if(!this.idleAnimation.isStarted()) { + this.idleAnimation.start(this.tickCount); } setTrackerState(POUNCE_FLAG, pounceAnimation); setTrackerState(BLOCK_FLAG, blockAnimation); setTrackerState(BITE_FLAG, biteAnimation); } - protected void setTrackerState(TrackedData trackedData, AnimationState animationState) { - int state = this.dataTracker.get(trackedData); + protected void setTrackerState(EntityDataAccessor trackedData, AnimationState animationState) { + int state = this.entityData.get(trackedData); if(state == 1) { - animationState.start(this.age); + animationState.start(this.tickCount); } else if (state == -1) { animationState.stop(); } - this.dataTracker.set(trackedData, 0); + this.entityData.set(trackedData, 0); } public void startPounceAnimation() { - this.dataTracker.set(POUNCE_FLAG, 1); + this.entityData.set(POUNCE_FLAG, 1); } public void stopPounceAnimation() { - this.dataTracker.set(POUNCE_FLAG, -1); + this.entityData.set(POUNCE_FLAG, -1); } @Override public void blockShield() { - this.dataTracker.set(BLOCK_FLAG, 1); + this.entityData.set(BLOCK_FLAG, 1); } @Override public void unblockShield() { - this.dataTracker.set(BLOCK_FLAG, -1); + this.entityData.set(BLOCK_FLAG, -1); } @Override - public boolean tryAttack(ServerWorld world, Entity target) { - boolean result = super.tryAttack(world, target); - this.dataTracker.set(BITE_FLAG, 1); + public boolean doHurtTarget(Entity target) { + boolean result = super.doHurtTarget(target); + this.entityData.set(BITE_FLAG, 1); if(biteAnimationCooldown == 0) biteAnimationCooldown = 40; if (target instanceof LivingEntity) { int i = 0; - if (this.getWorld().getDifficulty() == Difficulty.NORMAL) { + if (this.level().getDifficulty() == Difficulty.NORMAL) { i = 7; - } else if (this.getWorld().getDifficulty() == Difficulty.HARD) { + } else if (this.level().getDifficulty() == Difficulty.HARD) { i = 15; } if (i > 0) { - ((LivingEntity)target).addStatusEffect(new StatusEffectInstance(StatusEffects.POISON, i * 20, 0), this); + ((LivingEntity)target).addEffect(new MobEffectInstance(MobEffects.POISON, i * 20, 0), this); } } return result; } @Override - public void onLanding() { - if (this.getWorld() instanceof ServerWorld serverWorld) { - if (this.isOnGround() && this.fallDistance > 1.5) { - Vec3d vec3d = getPos().add(0.0, 0.5, 0.0); - BlockState blockState = this.getSteppingBlockState(); - int count = (int) MathHelper.clamp(25.0 * this.fallDistance - 1, 0.0, 150.0); - serverWorld.spawnParticles(new BlockStateParticleEffect(ParticleTypes.BLOCK, blockState), vec3d.x, vec3d.y, vec3d.z, + public void resetFallDistance() { + if (this.level() instanceof ServerLevel serverWorld) { + if (this.onGround() && this.fallDistance > 1.5) { + Vec3 vec3d = position().add(0.0, 0.5, 0.0); + BlockState blockState = this.getBlockStateOn(); + int count = (int) Mth.clamp(25.0 * this.fallDistance - 1, 0.0, 150.0); + serverWorld.sendParticles(new BlockParticleOption(ParticleTypes.BLOCK, blockState), vec3d.x, vec3d.y, vec3d.z, count, this.random.nextDouble() - 0.5, 0.15, this.random.nextDouble() - 0.5, 0.2f); } } - super.onLanding(); + super.resetFallDistance(); } public void tick() { super.tick(); - if (!this.getWorld().isClient) { + if (!this.level().isClientSide) { this.setClimbingWall(this.horizontalCollision); if(biteAnimationCooldown <= 1) { - this.dataTracker.set(BITE_FLAG, -1); + this.entityData.set(BITE_FLAG, -1); } biteAnimationCooldown = Math.max(biteAnimationCooldown - 1, 0); this.shootCooldown = Math.max(0, this.shootCooldown - 1); - if(!this.hasStatusEffect(StatusEffects.REGENERATION)) { + if(!this.hasEffect(MobEffects.REGENERATION)) { passiveHealingCooldown = Math.max(0, passiveHealingCooldown - 1); if(passiveHealingCooldown == 0 && this.getHealth() < this.getMaxHealth()) { this.heal(1); @@ -242,8 +250,8 @@ public void tick() { } @Override - public void tickMovement() { - super.tickMovement(); + public void aiStep() { + super.aiStep(); if(isClimbingWall()) { timelineTicks++; this.climbingTicks = Math.min( this.climbingTicks + 1, CLIMBING_MAX_TICKS); @@ -253,7 +261,7 @@ public void tickMovement() { this.climbingTicks = Math.max(0, this.climbingTicks - amount); } - if(isOnGround()) { + if(onGround()) { leapingTicks = 0; } else { leapingTicks++; @@ -261,7 +269,7 @@ public void tickMovement() { } @Override - protected int getExperienceToDrop(ServerWorld world) { + protected int getBaseExperienceReward() { return 13 + this.random.nextInt(4); } @@ -269,29 +277,28 @@ public SpiderVariant getVariant() { return getRegistryVariant().value(); } - private RegistryEntry getRegistryVariant() { - return this.dataTracker.get(VARIANT); + private Holder getRegistryVariant() { + return this.entityData.get(VARIANT); } - private void setVariant(RegistryEntry variant) { - this.dataTracker.set(VARIANT, variant); + private void setVariant(Holder variant) { + this.entityData.set(VARIANT, variant); } @Override - public void shootAt(LivingEntity target, float pullProgress) { + public void performRangedAttack(LivingEntity target, float pullProgress) { double dX = target.getX() - this.getX(); double e = target.getEyeY() - 1.1F; double dZ = target.getZ() - this.getZ(); double g = Math.sqrt(dX * dX + dZ * dZ) * 0.2F; - if (this.getWorld() instanceof ServerWorld serverWorld) { - ItemStack itemStack = new ItemStack(Items.COBWEB); - ProjectileEntity.spawn( - new WebbedEntity(serverWorld, this, WEB_PROJECTILE_DAMAGE * pullProgress), serverWorld, itemStack, - entity -> entity.setVelocity(dX, e + g - entity.getY(), dZ, 1.6F, 8 - this.getWorld().getDifficulty().getId() * 4) - ); + if (this.level() instanceof ServerLevel serverWorld) { + WebbedEntity projectile = new WebbedEntity(serverWorld, this, WEB_PROJECTILE_DAMAGE * pullProgress); + projectile.shoot(dX, e + g - projectile.getY(), dZ, 1.6F, + 8 - this.level().getDifficulty().getId() * 4); + serverWorld.addFreshEntity(projectile); } - this.playSound(SoundEvents.ENTITY_BREEZE_SHOOT, 1.0F, 0.7F + (this.getRandom().nextFloat() * 0.6F)); + this.playSound(SoundEvents.BREEZE_SHOOT, 1.0F, 0.7F + (this.getRandom().nextFloat() * 0.6F)); } @Override @@ -305,38 +312,38 @@ public void setRangeAttackCooldown(int cooldown) { } protected SoundEvent getAmbientSound() { - return SoundEvents.ENTITY_SPIDER_AMBIENT; + return SoundEvents.SPIDER_AMBIENT; } protected SoundEvent getHurtSound(DamageSource source) { - return SoundEvents.ENTITY_SPIDER_HURT; + return SoundEvents.SPIDER_HURT; } protected SoundEvent getDeathSound() { - return SoundEvents.ENTITY_SPIDER_DEATH; + return SoundEvents.SPIDER_DEATH; } protected void playStepSound(BlockPos pos, BlockState state) { - this.playSound(SoundEvents.ENTITY_SPIDER_STEP, 0.15F, 1.0F); + this.playSound(SoundEvents.SPIDER_STEP, 0.15F, 1.0F); } - public boolean isClimbing() { + public boolean onClimbable() { return this.isClimbingWall(); } - public void slowMovement(BlockState state, Vec3d multiplier) { - if (!state.isIn(TagKey.of(RegistryKeys.BLOCK, Identifier.of(MiddleEarth.MOD_ID, "cobwebs")))) { - super.slowMovement(state, multiplier); + public void makeStuckInBlock(BlockState state, Vec3 multiplier) { + if (!state.is(TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "cobwebs")))) { + super.makeStuckInBlock(state, multiplier); } } // Immune to Poison - public boolean canHaveStatusEffect(StatusEffectInstance effect) { - return effect.getEffectType() != StatusEffects.POISON && super.canHaveStatusEffect(effect); + public boolean canBeAffected(MobEffectInstance effect) { + return effect.getEffect() != MobEffects.POISON && super.canBeAffected(effect); } public boolean isClimbingWall() { - return (this.dataTracker.get(SPIDER_FLAGS) & 1) != 0; + return (this.entityData.get(SPIDER_FLAGS) & 1) != 0; } public boolean isCollidingWall() { @@ -344,14 +351,14 @@ public boolean isCollidingWall() { } public void setClimbingWall(boolean climbing) { - byte b = (Byte)this.dataTracker.get(SPIDER_FLAGS); + byte b = (Byte)this.entityData.get(SPIDER_FLAGS); if (climbing) { b = (byte)(b | 1); } else { b &= -2; } - this.dataTracker.set(SPIDER_FLAGS, b); + this.entityData.set(SPIDER_FLAGS, b); } public int getTimelineTicks() { @@ -367,33 +374,34 @@ public int getLeapingTicks() { } @Override - protected void writeCustomData(WriteView view) { - super.writeCustomData(view); - Variants.writeVariantToNbt(view, this.getRegistryVariant()); + public void addAdditionalSaveData(CompoundTag view) { + super.addAdditionalSaveData(view); + VariantHolderUtils.writeVariant(view, this.getRegistryVariant()); } @Override - protected void readCustomData(ReadView view) { - super.readCustomData(view); - Variants.readVariantFromNbt(view, DynamicRegistriesME.SPIDER_VARIANTS).ifPresent(this::setVariant); + public void readAdditionalSaveData(CompoundTag view) { + super.readAdditionalSaveData(view); + VariantHolderUtils.readVariant(view, this.registryAccess(), DynamicRegistriesME.SPIDER_VARIANTS) + .ifPresent(this::setVariant); } static { - SPIDER_FLAGS = DataTracker.registerData(SpawnOfShelobEntity.class, TrackedDataHandlerRegistry.BYTE); - BITE_FLAG = DataTracker.registerData(SpawnOfShelobEntity.class, TrackedDataHandlerRegistry.INTEGER); - POUNCE_FLAG = DataTracker.registerData(SpawnOfShelobEntity.class, TrackedDataHandlerRegistry.INTEGER); - BLOCK_FLAG = DataTracker.registerData(SpawnOfShelobEntity.class, TrackedDataHandlerRegistry.INTEGER); - VARIANT = DataTracker.registerData(SpawnOfShelobEntity.class, TrackedDataHandlerRegistryME.SPIDER_VARIANT); + SPIDER_FLAGS = SynchedEntityData.defineId(SpawnOfShelobEntity.class, EntityDataSerializers.BYTE); + BITE_FLAG = SynchedEntityData.defineId(SpawnOfShelobEntity.class, EntityDataSerializers.INT); + POUNCE_FLAG = SynchedEntityData.defineId(SpawnOfShelobEntity.class, EntityDataSerializers.INT); + BLOCK_FLAG = SynchedEntityData.defineId(SpawnOfShelobEntity.class, EntityDataSerializers.INT); + VARIANT = SynchedEntityData.defineId(SpawnOfShelobEntity.class, TrackedDataHandlerRegistryME.SPIDER_VARIANT); } - public static boolean canSpawn(EntityType type, ServerWorldAccess serverWorldAccess, SpawnReason spawnReason, BlockPos blockPos, Random random) { - if(spawnReason != SpawnReason.NATURAL) - return SpawnOfShelobEntity.canSpawnInDark(type, serverWorldAccess, spawnReason, blockPos, random); + public static boolean canSpawn(EntityType type, ServerLevelAccessor serverWorldAccess, MobSpawnType spawnReason, BlockPos blockPos, RandomSource random) { + if(spawnReason != MobSpawnType.NATURAL) + return SpawnOfShelobEntity.checkMonsterSpawnRules(type, serverWorldAccess, spawnReason, blockPos, random); return SpawnUtil.canSpawn(blockPos, serverWorldAccess, spawnReason); } @Override - public boolean canSpawn(WorldAccess world, SpawnReason spawnReason) { + public boolean checkSpawnRules(LevelAccessor world, MobSpawnType spawnReason) { return true; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobModel.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobModel.java index 260c398349..8df16c316e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobModel.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobModel.java @@ -1,197 +1,199 @@ package net.sevenstars.middleearth.entity.spider.spawn; import net.minecraft.client.model.*; -import net.minecraft.client.render.entity.animation.Animation; -import net.minecraft.client.render.entity.model.EntityModel; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.model.geom.PartPose; +import net.minecraft.client.model.geom.builders.CubeDeformation; +import net.minecraft.client.model.geom.builders.CubeListBuilder; +import net.minecraft.client.model.geom.builders.LayerDefinition; +import net.minecraft.client.model.geom.builders.MeshDefinition; +import net.minecraft.client.model.geom.builders.PartDefinition; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.spider.scuttler.ShelobiteScuttlerEntity; -public class SpawnOfShelobModel extends EntityModel { +public class SpawnOfShelobModel extends HierarchicalModel { private final ModelPart root; - private final Animation idleAnimation; - private final Animation walkingAnimation; - private final Animation biteAnimation; - private final Animation walkingBlockAnimation; - private final Animation pounceAnimation; - public SpawnOfShelobModel(ModelPart root) { - super(root); this.root = root.getChild("root"); - - this.idleAnimation = SpawnOfShelobAnimations.SPAWN_OF_SHELOB_IDLE.createAnimation(root); - this.walkingAnimation = SpawnOfShelobAnimations.SPAWN_OF_SHELOB_WALK.createAnimation(root); - this.biteAnimation = SpawnOfShelobAnimations.SPAWN_OF_SHELOB_BITE.createAnimation(root); - this.walkingBlockAnimation = SpawnOfShelobAnimations.SPAWN_OF_SHELOB_BLOCK.createAnimation(root); - this.pounceAnimation = SpawnOfShelobAnimations.SPAWN_OF_SHELOB_POUNCE.createAnimation(root); } - public static TexturedModelData getTexturedModelData() { - ModelData modelData = new ModelData(); - ModelPartData modelPartData = modelData.getRoot(); - ModelPartData root = modelPartData.addChild("root", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 12.0F, 0.0F)); + public static LayerDefinition getTexturedModelData() { + MeshDefinition modelData = new MeshDefinition(); + PartDefinition modelPartData = modelData.getRoot(); + PartDefinition root = modelPartData.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 12.0F, 0.0F)); - ModelPartData legscore = root.addChild("legscore", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 6.0F, -5.0F)); + PartDefinition legscore = root.addOrReplaceChild("legscore", CubeListBuilder.create(), PartPose.offset(0.0F, 6.0F, -5.0F)); - ModelPartData rights = legscore.addChild("rights", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition rights = legscore.addOrReplaceChild("rights", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData rrotation = rights.addChild("rrotation", ModelPartBuilder.create(), ModelTransform.origin(-3.0F, 0.0F, -4.5F)); + PartDefinition rrotation = rights.addOrReplaceChild("rrotation", CubeListBuilder.create(), PartPose.offset(-3.0F, 0.0F, -4.5F)); - ModelPartData rleg = rrotation.addChild("rleg", ModelPartBuilder.create().uv(150, 129).cuboid(-4.0F, -1.0F, -1.5F, 5.0F, 2.0F, 2.0F, new Dilation(0.0F)) - .uv(146, 135).cuboid(-6.0F, -13.0F, -1.5F, 2.0F, 14.0F, 2.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition rleg = rrotation.addOrReplaceChild("rleg", CubeListBuilder.create().texOffs(150, 129).addBox(-4.0F, -1.0F, -1.5F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(146, 135).addBox(-6.0F, -13.0F, -1.5F, 2.0F, 14.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData rleg2 = rleg.addChild("rleg2", ModelPartBuilder.create().uv(50, 130).cuboid(-10.0F, -2.0F, -2.0F, 10.0F, 3.0F, 3.0F, new Dilation(0.0F)), ModelTransform.origin(-5.0F, -13.0F, 0.0F)); + PartDefinition rleg2 = rleg.addOrReplaceChild("rleg2", CubeListBuilder.create().texOffs(50, 130).addBox(-10.0F, -2.0F, -2.0F, 10.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(-5.0F, -13.0F, 0.0F)); - ModelPartData rleg3 = rleg2.addChild("rleg3", ModelPartBuilder.create().uv(147, 96).cuboid(-7.0F, -2.0F, -1.0F, 8.0F, 3.0F, 1.0F, new Dilation(0.0F)) - .uv(84, 83).cuboid(-15.0F, -12.0F, -0.5F, 27.0F, 25.0F, 0.0F, new Dilation(0.0F)), ModelTransform.origin(-9.0F, 1.0F, 0.0F)); + PartDefinition rleg3 = rleg2.addOrReplaceChild("rleg3", CubeListBuilder.create().texOffs(147, 96).addBox(-7.0F, -2.0F, -1.0F, 8.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(84, 83).addBox(-15.0F, -12.0F, -0.5F, 27.0F, 25.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(-9.0F, 1.0F, 0.0F)); - ModelPartData rrotation1 = rights.addChild("rrotation1", ModelPartBuilder.create(), ModelTransform.origin(-3.0F, 0.0F, -1.0F)); + PartDefinition rrotation1 = rights.addOrReplaceChild("rrotation1", CubeListBuilder.create(), PartPose.offset(-3.0F, 0.0F, -1.0F)); - ModelPartData rleg4 = rrotation1.addChild("rleg4", ModelPartBuilder.create().uv(52, 99).cuboid(-5.0F, -2.0F, -2.0F, 6.0F, 3.0F, 3.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition rleg4 = rrotation1.addOrReplaceChild("rleg4", CubeListBuilder.create().texOffs(52, 99).addBox(-5.0F, -2.0F, -2.0F, 6.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData rleg5 = rleg4.addChild("rleg5", ModelPartBuilder.create().uv(144, 110).cuboid(-1.0F, -15.0F, -2.0F, 3.0F, 15.0F, 3.0F, new Dilation(0.0F)), ModelTransform.origin(-5.0F, 0.0F, 0.0F)); + PartDefinition rleg5 = rleg4.addOrReplaceChild("rleg5", CubeListBuilder.create().texOffs(144, 110).addBox(-1.0F, -15.0F, -2.0F, 3.0F, 15.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(-5.0F, 0.0F, 0.0F)); - ModelPartData rleg6 = rleg5.addChild("rleg6", ModelPartBuilder.create().uv(84, 133).cuboid(-3.0F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, -15.0F, -0.5F)); + PartDefinition rleg6 = rleg5.addOrReplaceChild("rleg6", CubeListBuilder.create().texOffs(84, 133).addBox(-3.0F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -15.0F, -0.5F)); - ModelPartData rleg7 = rleg6.addChild("rleg7", ModelPartBuilder.create().uv(0, 167).cuboid(-1.0F, -1.0F, -1.0F, 3.0F, 10.0F, 2.0F, new Dilation(0.0F)) - .uv(112, 25).cuboid(-10.0F, -13.0F, 0.0F, 20.0F, 29.0F, 0.0F, new Dilation(0.0F)), ModelTransform.origin(1.0F, 11.0F, 0.0F)); + PartDefinition rleg7 = rleg6.addOrReplaceChild("rleg7", CubeListBuilder.create().texOffs(0, 167).addBox(-1.0F, -1.0F, -1.0F, 3.0F, 10.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(112, 25).addBox(-10.0F, -13.0F, 0.0F, 20.0F, 29.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(1.0F, 11.0F, 0.0F)); - ModelPartData rrotation2 = rights.addChild("rrotation2", ModelPartBuilder.create(), ModelTransform.origin(-3.0F, 0.0F, 3.0F)); + PartDefinition rrotation2 = rights.addOrReplaceChild("rrotation2", CubeListBuilder.create(), PartPose.offset(-3.0F, 0.0F, 3.0F)); - ModelPartData rleg8 = rrotation2.addChild("rleg8", ModelPartBuilder.create().uv(52, 99).cuboid(-5.0F, -2.0F, -2.0F, 6.0F, 3.0F, 3.0F, new Dilation(0.01F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition rleg8 = rrotation2.addOrReplaceChild("rleg8", CubeListBuilder.create().texOffs(52, 99).addBox(-5.0F, -2.0F, -2.0F, 6.0F, 3.0F, 3.0F, new CubeDeformation(0.01F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData rleg9 = rleg8.addChild("rleg9", ModelPartBuilder.create().uv(144, 110).cuboid(-1.0F, -15.0F, -2.0F, 3.0F, 15.0F, 3.0F, new Dilation(0.0F)), ModelTransform.origin(-5.0F, 0.0F, 0.0F)); + PartDefinition rleg9 = rleg8.addOrReplaceChild("rleg9", CubeListBuilder.create().texOffs(144, 110).addBox(-1.0F, -15.0F, -2.0F, 3.0F, 15.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(-5.0F, 0.0F, 0.0F)); - ModelPartData rleg10 = rleg9.addChild("rleg10", ModelPartBuilder.create().uv(84, 133).cuboid(-3.0F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, -15.0F, -0.5F)); + PartDefinition rleg10 = rleg9.addOrReplaceChild("rleg10", CubeListBuilder.create().texOffs(84, 133).addBox(-3.0F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -15.0F, -0.5F)); - ModelPartData rleg11 = rleg10.addChild("rleg11", ModelPartBuilder.create().uv(0, 167).cuboid(-1.0F, -1.0F, -1.0F, 3.0F, 10.0F, 2.0F, new Dilation(0.0F)) - .uv(112, 25).cuboid(-10.0F, -13.0F, 0.0F, 20.0F, 29.0F, 0.0F, new Dilation(0.0F)), ModelTransform.origin(1.0F, 11.0F, 0.0F)); + PartDefinition rleg11 = rleg10.addOrReplaceChild("rleg11", CubeListBuilder.create().texOffs(0, 167).addBox(-1.0F, -1.0F, -1.0F, 3.0F, 10.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(112, 25).addBox(-10.0F, -13.0F, 0.0F, 20.0F, 29.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(1.0F, 11.0F, 0.0F)); - ModelPartData rrotation3 = rights.addChild("rrotation3", ModelPartBuilder.create(), ModelTransform.origin(-3.0F, 0.0F, 6.5F)); + PartDefinition rrotation3 = rights.addOrReplaceChild("rrotation3", CubeListBuilder.create(), PartPose.offset(-3.0F, 0.0F, 6.5F)); - ModelPartData rleg12 = rrotation3.addChild("rleg12", ModelPartBuilder.create().uv(150, 129).cuboid(-4.0F, -1.0F, -1.5F, 5.0F, 2.0F, 2.0F, new Dilation(0.0F)) - .uv(146, 135).cuboid(-6.0F, -13.0F, -1.5F, 2.0F, 14.0F, 2.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition rleg12 = rrotation3.addOrReplaceChild("rleg12", CubeListBuilder.create().texOffs(150, 129).addBox(-4.0F, -1.0F, -1.5F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)) + .texOffs(146, 135).addBox(-6.0F, -13.0F, -1.5F, 2.0F, 14.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData rleg13 = rleg12.addChild("rleg13", ModelPartBuilder.create().uv(50, 130).cuboid(-10.0F, -2.0F, -2.0F, 10.0F, 3.0F, 3.0F, new Dilation(0.0F)), ModelTransform.origin(-5.0F, -13.0F, 0.0F)); + PartDefinition rleg13 = rleg12.addOrReplaceChild("rleg13", CubeListBuilder.create().texOffs(50, 130).addBox(-10.0F, -2.0F, -2.0F, 10.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(-5.0F, -13.0F, 0.0F)); - ModelPartData rleg14 = rleg13.addChild("rleg14", ModelPartBuilder.create().uv(147, 96).cuboid(-7.0F, -2.0F, -1.0F, 8.0F, 3.0F, 1.0F, new Dilation(0.0F)) - .uv(84, 83).cuboid(-15.0F, -12.0F, -0.5F, 27.0F, 25.0F, 0.0F, new Dilation(0.0F)), ModelTransform.origin(-9.0F, 1.0F, 0.0F)); + PartDefinition rleg14 = rleg13.addOrReplaceChild("rleg14", CubeListBuilder.create().texOffs(147, 96).addBox(-7.0F, -2.0F, -1.0F, 8.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)) + .texOffs(84, 83).addBox(-15.0F, -12.0F, -0.5F, 27.0F, 25.0F, 0.0F, new CubeDeformation(0.0F)), PartPose.offset(-9.0F, 1.0F, 0.0F)); - ModelPartData lefts = legscore.addChild("lefts", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition lefts = legscore.addOrReplaceChild("lefts", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData lrotation = lefts.addChild("lrotation", ModelPartBuilder.create(), ModelTransform.origin(3.0F, 0.0F, -4.5F)); + PartDefinition lrotation = lefts.addOrReplaceChild("lrotation", CubeListBuilder.create(), PartPose.offset(3.0F, 0.0F, -4.5F)); - ModelPartData lleg = lrotation.addChild("lleg", ModelPartBuilder.create().uv(150, 129).mirrored().cuboid(-1.0F, -1.0F, -1.5F, 5.0F, 2.0F, 2.0F, new Dilation(0.0F)).mirrored(false) - .uv(146, 135).mirrored().cuboid(4.0F, -13.0F, -1.5F, 2.0F, 14.0F, 2.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition lleg = lrotation.addOrReplaceChild("lleg", CubeListBuilder.create().texOffs(150, 129).mirror().addBox(-1.0F, -1.0F, -1.5F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(146, 135).mirror().addBox(4.0F, -13.0F, -1.5F, 2.0F, 14.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData lleg2 = lleg.addChild("lleg2", ModelPartBuilder.create().uv(50, 130).mirrored().cuboid(0.0F, -2.0F, -2.0F, 10.0F, 3.0F, 3.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(5.0F, -13.0F, 0.0F)); + PartDefinition lleg2 = lleg.addOrReplaceChild("lleg2", CubeListBuilder.create().texOffs(50, 130).mirror().addBox(0.0F, -2.0F, -2.0F, 10.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(5.0F, -13.0F, 0.0F)); - ModelPartData lleg3 = lleg2.addChild("lleg3", ModelPartBuilder.create().uv(147, 96).mirrored().cuboid(-1.0F, -2.0F, -1.0F, 8.0F, 3.0F, 1.0F, new Dilation(0.0F)).mirrored(false) - .uv(84, 83).mirrored().cuboid(-12.0F, -12.0F, -0.5F, 27.0F, 25.0F, 0.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(9.0F, 1.0F, 0.0F)); + PartDefinition lleg3 = lleg2.addOrReplaceChild("lleg3", CubeListBuilder.create().texOffs(147, 96).mirror().addBox(-1.0F, -2.0F, -1.0F, 8.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(84, 83).mirror().addBox(-12.0F, -12.0F, -0.5F, 27.0F, 25.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(9.0F, 1.0F, 0.0F)); - ModelPartData lrotation2 = lefts.addChild("lrotation2", ModelPartBuilder.create(), ModelTransform.origin(3.0F, 0.0F, -1.0F)); + PartDefinition lrotation2 = lefts.addOrReplaceChild("lrotation2", CubeListBuilder.create(), PartPose.offset(3.0F, 0.0F, -1.0F)); - ModelPartData lleg4 = lrotation2.addChild("lleg4", ModelPartBuilder.create().uv(52, 99).mirrored().cuboid(-1.0F, -2.0F, -2.0F, 6.0F, 3.0F, 3.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition lleg4 = lrotation2.addOrReplaceChild("lleg4", CubeListBuilder.create().texOffs(52, 99).mirror().addBox(-1.0F, -2.0F, -2.0F, 6.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData lleg5 = lleg4.addChild("lleg5", ModelPartBuilder.create().uv(144, 110).mirrored().cuboid(-2.0F, -15.0F, -2.0F, 3.0F, 15.0F, 3.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(5.0F, 0.0F, 0.0F)); + PartDefinition lleg5 = lleg4.addOrReplaceChild("lleg5", CubeListBuilder.create().texOffs(144, 110).mirror().addBox(-2.0F, -15.0F, -2.0F, 3.0F, 15.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(5.0F, 0.0F, 0.0F)); - ModelPartData lleg6 = lleg5.addChild("lleg6", ModelPartBuilder.create().uv(84, 133).mirrored().cuboid(-1.0F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(0.0F, -15.0F, -0.5F)); + PartDefinition lleg6 = lleg5.addOrReplaceChild("lleg6", CubeListBuilder.create().texOffs(84, 133).mirror().addBox(-1.0F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(0.0F, -15.0F, -0.5F)); - ModelPartData lleg7 = lleg6.addChild("lleg7", ModelPartBuilder.create().uv(0, 167).mirrored().cuboid(-2.0F, -1.0F, -1.0F, 3.0F, 10.0F, 2.0F, new Dilation(0.0F)).mirrored(false) - .uv(112, 25).mirrored().cuboid(-10.0F, -13.0F, 0.0F, 20.0F, 29.0F, 0.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(-1.0F, 11.0F, 0.0F)); + PartDefinition lleg7 = lleg6.addOrReplaceChild("lleg7", CubeListBuilder.create().texOffs(0, 167).mirror().addBox(-2.0F, -1.0F, -1.0F, 3.0F, 10.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(112, 25).mirror().addBox(-10.0F, -13.0F, 0.0F, 20.0F, 29.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(-1.0F, 11.0F, 0.0F)); - ModelPartData lrotation3 = lefts.addChild("lrotation3", ModelPartBuilder.create(), ModelTransform.origin(3.0F, 0.0F, 3.0F)); + PartDefinition lrotation3 = lefts.addOrReplaceChild("lrotation3", CubeListBuilder.create(), PartPose.offset(3.0F, 0.0F, 3.0F)); - ModelPartData lleg8 = lrotation3.addChild("lleg8", ModelPartBuilder.create().uv(52, 99).mirrored().cuboid(-1.0F, -2.0F, -2.0F, 6.0F, 3.0F, 3.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition lleg8 = lrotation3.addOrReplaceChild("lleg8", CubeListBuilder.create().texOffs(52, 99).mirror().addBox(-1.0F, -2.0F, -2.0F, 6.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData lleg9 = lleg8.addChild("lleg9", ModelPartBuilder.create().uv(144, 110).mirrored().cuboid(-2.0F, -15.0F, -2.0F, 3.0F, 15.0F, 3.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(5.0F, 0.0F, 0.0F)); + PartDefinition lleg9 = lleg8.addOrReplaceChild("lleg9", CubeListBuilder.create().texOffs(144, 110).mirror().addBox(-2.0F, -15.0F, -2.0F, 3.0F, 15.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(5.0F, 0.0F, 0.0F)); - ModelPartData lleg10 = lleg9.addChild("lleg10", ModelPartBuilder.create().uv(84, 133).mirrored().cuboid(-1.0F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(0.0F, -15.0F, -0.5F)); + PartDefinition lleg10 = lleg9.addOrReplaceChild("lleg10", CubeListBuilder.create().texOffs(84, 133).mirror().addBox(-1.0F, -1.0F, -2.0F, 4.0F, 12.0F, 4.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(0.0F, -15.0F, -0.5F)); - ModelPartData lleg11 = lleg10.addChild("lleg11", ModelPartBuilder.create().uv(0, 167).mirrored().cuboid(-2.0F, -1.0F, -1.0F, 3.0F, 10.0F, 2.0F, new Dilation(0.0F)).mirrored(false) - .uv(112, 25).mirrored().cuboid(-10.0F, -13.0F, 0.0F, 20.0F, 29.0F, 0.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(-1.0F, 11.0F, 0.0F)); + PartDefinition lleg11 = lleg10.addOrReplaceChild("lleg11", CubeListBuilder.create().texOffs(0, 167).mirror().addBox(-2.0F, -1.0F, -1.0F, 3.0F, 10.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(112, 25).mirror().addBox(-10.0F, -13.0F, 0.0F, 20.0F, 29.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(-1.0F, 11.0F, 0.0F)); - ModelPartData lrotation4 = lefts.addChild("lrotation4", ModelPartBuilder.create(), ModelTransform.origin(3.0F, 0.0F, 6.5F)); + PartDefinition lrotation4 = lefts.addOrReplaceChild("lrotation4", CubeListBuilder.create(), PartPose.offset(3.0F, 0.0F, 6.5F)); - ModelPartData lleg12 = lrotation4.addChild("lleg12", ModelPartBuilder.create().uv(150, 129).mirrored().cuboid(-1.0F, -1.0F, -1.5F, 5.0F, 2.0F, 2.0F, new Dilation(0.0F)).mirrored(false) - .uv(146, 135).mirrored().cuboid(4.0F, -13.0F, -1.5F, 2.0F, 14.0F, 2.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition lleg12 = lrotation4.addOrReplaceChild("lleg12", CubeListBuilder.create().texOffs(150, 129).mirror().addBox(-1.0F, -1.0F, -1.5F, 5.0F, 2.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(146, 135).mirror().addBox(4.0F, -13.0F, -1.5F, 2.0F, 14.0F, 2.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData lleg13 = lleg12.addChild("lleg13", ModelPartBuilder.create().uv(50, 130).mirrored().cuboid(0.0F, -2.0F, -2.0F, 10.0F, 3.0F, 3.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(5.0F, -13.0F, 0.0F)); + PartDefinition lleg13 = lleg12.addOrReplaceChild("lleg13", CubeListBuilder.create().texOffs(50, 130).mirror().addBox(0.0F, -2.0F, -2.0F, 10.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(5.0F, -13.0F, 0.0F)); - ModelPartData lleg14 = lleg13.addChild("lleg14", ModelPartBuilder.create().uv(147, 96).mirrored().cuboid(-1.0F, -2.0F, -1.0F, 8.0F, 3.0F, 1.0F, new Dilation(0.0F)).mirrored(false) - .uv(84, 83).mirrored().cuboid(-12.0F, -12.0F, -0.5F, 27.0F, 25.0F, 0.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(9.0F, 1.0F, 0.0F)); + PartDefinition lleg14 = lleg13.addOrReplaceChild("lleg14", CubeListBuilder.create().texOffs(147, 96).mirror().addBox(-1.0F, -2.0F, -1.0F, 8.0F, 3.0F, 1.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(84, 83).mirror().addBox(-12.0F, -12.0F, -0.5F, 27.0F, 25.0F, 0.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(9.0F, 1.0F, 0.0F)); - ModelPartData body = root.addChild("body", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 6.0F, -1.0F)); + PartDefinition body = root.addOrReplaceChild("body", CubeListBuilder.create(), PartPose.offset(0.0F, 6.0F, -1.0F)); - ModelPartData abdomen = body.addChild("abdomen", ModelPartBuilder.create().uv(6, 63).cuboid(-8.0F, -6.0F, 0.0F, 16.0F, 9.0F, 19.0F, new Dilation(0.0F)) - .uv(5, 96).cuboid(-3.0F, -8.0F, -2.0F, 6.0F, 7.0F, 11.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, -4.0F, 1.0F)); + PartDefinition abdomen = body.addOrReplaceChild("abdomen", CubeListBuilder.create().texOffs(6, 63).addBox(-8.0F, -6.0F, 0.0F, 16.0F, 9.0F, 19.0F, new CubeDeformation(0.0F)) + .texOffs(5, 96).addBox(-3.0F, -8.0F, -2.0F, 6.0F, 7.0F, 11.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -4.0F, 1.0F)); - ModelPartData stinger = abdomen.addChild("stinger", ModelPartBuilder.create().uv(156, 134).cuboid(-1.0F, 3.0F, -5.0F, 2.0F, 2.0F, 6.0F, new Dilation(0.0F)) - .uv(0, 30).cuboid(0.0F, -2.0F, -10.0F, 0.0F, 10.0F, 15.0F, new Dilation(0.0F)) - .uv(156, 142).cuboid(-1.0F, -2.0F, -2.0F, 2.0F, 5.0F, 3.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, 3.0F, 19.0F)); + PartDefinition stinger = abdomen.addOrReplaceChild("stinger", CubeListBuilder.create().texOffs(156, 134).addBox(-1.0F, 3.0F, -5.0F, 2.0F, 2.0F, 6.0F, new CubeDeformation(0.0F)) + .texOffs(0, 30).addBox(0.0F, -2.0F, -10.0F, 0.0F, 10.0F, 15.0F, new CubeDeformation(0.0F)) + .texOffs(156, 142).addBox(-1.0F, -2.0F, -2.0F, 2.0F, 5.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, 3.0F, 19.0F)); - ModelPartData thorns = abdomen.addChild("thorns", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 0.0F, 0.0F)); + PartDefinition thorns = abdomen.addOrReplaceChild("thorns", CubeListBuilder.create(), PartPose.offset(0.0F, 0.0F, 0.0F)); - ModelPartData cube_r1 = thorns.addChild("cube_r1", ModelPartBuilder.create().uv(21, 36).mirrored().cuboid(-6.0F, 0.0F, -11.0F, 9.0F, 0.0F, 22.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.of(-3.0F, -8.0F, 8.0F, 0.0F, 0.0F, 0.7854F)); - ModelPartData cube_r2 = thorns.addChild("cube_r2", ModelPartBuilder.create().uv(21, 36).cuboid(-3.0F, 0.0F, -11.0F, 9.0F, 0.0F, 22.0F, new Dilation(0.0F)), ModelTransform.of(3.0F, -8.0F, 8.0F, 0.0F, 0.0F, -0.7854F)); - ModelPartData cube_r3 = thorns.addChild("cube_r3", ModelPartBuilder.create().uv(-16, 217).mirrored().cuboid(-14.0F, 0.0F, -19.5F, 23.0F, 0.0F, 39.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.of(-8.0F, -6.0F, 16.5F, 0.0F, 0.0F, 0.2618F)); - ModelPartData cube_r4 = thorns.addChild("cube_r4", ModelPartBuilder.create().uv(-16, 217).cuboid(-9.0F, 0.0F, -19.5F, 23.0F, 0.0F, 39.0F, new Dilation(0.0F)), ModelTransform.of(8.0F, -6.0F, 16.5F, 0.0F, 0.0F, -0.2618F)); + PartDefinition cube_r1 = thorns.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(21, 36).mirror().addBox(-6.0F, 0.0F, -11.0F, 9.0F, 0.0F, 22.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-3.0F, -8.0F, 8.0F, 0.0F, 0.0F, 0.7854F)); + PartDefinition cube_r2 = thorns.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(21, 36).addBox(-3.0F, 0.0F, -11.0F, 9.0F, 0.0F, 22.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(3.0F, -8.0F, 8.0F, 0.0F, 0.0F, -0.7854F)); + PartDefinition cube_r3 = thorns.addOrReplaceChild("cube_r3", CubeListBuilder.create().texOffs(-16, 217).mirror().addBox(-14.0F, 0.0F, -19.5F, 23.0F, 0.0F, 39.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offsetAndRotation(-8.0F, -6.0F, 16.5F, 0.0F, 0.0F, 0.2618F)); + PartDefinition cube_r4 = thorns.addOrReplaceChild("cube_r4", CubeListBuilder.create().texOffs(-16, 217).addBox(-9.0F, 0.0F, -19.5F, 23.0F, 0.0F, 39.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(8.0F, -6.0F, 16.5F, 0.0F, 0.0F, -0.2618F)); - ModelPartData prosoma = body.addChild("prosoma", ModelPartBuilder.create().uv(88, 62).cuboid(-4.0F, -2.0F, -15.0F, 8.0F, 6.0F, 15.0F, new Dilation(0.0F)), ModelTransform.origin(0.0F, -4.0F, 3.0F)); + PartDefinition prosoma = body.addOrReplaceChild("prosoma", CubeListBuilder.create().texOffs(88, 62).addBox(-4.0F, -2.0F, -15.0F, 8.0F, 6.0F, 15.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -4.0F, 3.0F)); - ModelPartData chelicerae = prosoma.addChild("chelicerae", ModelPartBuilder.create(), ModelTransform.origin(0.0F, 1.0F, -13.0F)); + PartDefinition chelicerae = prosoma.addOrReplaceChild("chelicerae", CubeListBuilder.create(), PartPose.offset(0.0F, 1.0F, -13.0F)); - ModelPartData leftchel = chelicerae.addChild("leftchel", ModelPartBuilder.create().uv(140, 80).mirrored().cuboid(-2.0F, -3.0F, -8.0F, 3.0F, 6.0F, 8.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(2.0F, -1.0F, 1.0F)); + PartDefinition leftchel = chelicerae.addOrReplaceChild("leftchel", CubeListBuilder.create().texOffs(140, 80).mirror().addBox(-2.0F, -3.0F, -8.0F, 3.0F, 6.0F, 8.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(2.0F, -1.0F, 1.0F)); - ModelPartData leftooth = leftchel.addChild("leftooth", ModelPartBuilder.create().uv(9, 130).cuboid(-1.0F, 0.0F, -9.0F, 2.0F, 4.0F, 13.0F, new Dilation(0.0F)) - .uv(0, 154).mirrored().cuboid(-1.0F, -3.0F, -9.0F, 2.0F, 3.0F, 10.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(-0.5F, -1.0F, -7.0F)); + PartDefinition leftooth = leftchel.addOrReplaceChild("leftooth", CubeListBuilder.create().texOffs(9, 130).addBox(-1.0F, 0.0F, -9.0F, 2.0F, 4.0F, 13.0F, new CubeDeformation(0.0F)) + .texOffs(0, 154).mirror().addBox(-1.0F, -3.0F, -9.0F, 2.0F, 3.0F, 10.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(-0.5F, -1.0F, -7.0F)); - ModelPartData leftjaw = leftchel.addChild("leftjaw", ModelPartBuilder.create().uv(0, 132).mirrored().cuboid(-1.0F, -1.0F, -7.0F, 2.0F, 2.0F, 9.0F, new Dilation(0.0F)).mirrored(false) - .uv(26, 132).mirrored().cuboid(-1.0F, 1.0F, -7.0F, 2.0F, 2.0F, 9.0F, new Dilation(0.0F)).mirrored(false), ModelTransform.origin(-0.5F, 1.0F, -8.0F)); + PartDefinition leftjaw = leftchel.addOrReplaceChild("leftjaw", CubeListBuilder.create().texOffs(0, 132).mirror().addBox(-1.0F, -1.0F, -7.0F, 2.0F, 2.0F, 9.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(26, 132).mirror().addBox(-1.0F, 1.0F, -7.0F, 2.0F, 2.0F, 9.0F, new CubeDeformation(0.0F)).mirror(false), PartPose.offset(-0.5F, 1.0F, -8.0F)); - ModelPartData rightchel = chelicerae.addChild("rightchel", ModelPartBuilder.create().uv(140, 80).cuboid(-1.0F, -3.0F, -8.0F, 3.0F, 6.0F, 8.0F, new Dilation(0.0F)), ModelTransform.origin(-2.0F, -1.0F, 1.0F)); + PartDefinition rightchel = chelicerae.addOrReplaceChild("rightchel", CubeListBuilder.create().texOffs(140, 80).addBox(-1.0F, -3.0F, -8.0F, 3.0F, 6.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(-2.0F, -1.0F, 1.0F)); - ModelPartData rightooth = rightchel.addChild("rightooth", ModelPartBuilder.create().uv(9, 130).mirrored().cuboid(-1.0F, 0.0F, -9.0F, 2.0F, 4.0F, 13.0F, new Dilation(0.0F)).mirrored(false) - .uv(0, 154).cuboid(-1.0F, -3.0F, -9.0F, 2.0F, 3.0F, 10.0F, new Dilation(0.0F)), ModelTransform.origin(0.5F, -1.0F, -7.0F)); + PartDefinition rightooth = rightchel.addOrReplaceChild("rightooth", CubeListBuilder.create().texOffs(9, 130).mirror().addBox(-1.0F, 0.0F, -9.0F, 2.0F, 4.0F, 13.0F, new CubeDeformation(0.0F)).mirror(false) + .texOffs(0, 154).addBox(-1.0F, -3.0F, -9.0F, 2.0F, 3.0F, 10.0F, new CubeDeformation(0.0F)), PartPose.offset(0.5F, -1.0F, -7.0F)); - ModelPartData rightjaw = rightchel.addChild("rightjaw", ModelPartBuilder.create().uv(0, 132).cuboid(-1.0F, -1.0F, -7.0F, 2.0F, 2.0F, 9.0F, new Dilation(0.0F)) - .uv(26, 132).cuboid(-1.0F, 1.0F, -7.0F, 2.0F, 2.0F, 9.0F, new Dilation(0.0F)), ModelTransform.origin(0.5F, 1.0F, -8.0F)); - return TexturedModelData.of(modelData, 256, 256); + PartDefinition rightjaw = rightchel.addOrReplaceChild("rightjaw", CubeListBuilder.create().texOffs(0, 132).addBox(-1.0F, -1.0F, -7.0F, 2.0F, 2.0F, 9.0F, new CubeDeformation(0.0F)) + .texOffs(26, 132).addBox(-1.0F, 1.0F, -7.0F, 2.0F, 2.0F, 9.0F, new CubeDeformation(0.0F)), PartPose.offset(0.5F, 1.0F, -8.0F)); + return LayerDefinition.create(modelData, 256, 256); } @Override - public void setAngles(SpawnOfShelobRenderState state) { - super.setAngles(state); + public ModelPart root() { + return this.root; + } - int croppedClimbingTicks = Math.min(ShelobiteScuttlerEntity.CLIMBING_TIME_TRANSITION, state.climbingTicks); + @Override + public void setupAnim(SpawnOfShelobEntity entity, float limbSwing, float limbSwingAmount, + float ageInTicks, float netHeadYaw, float headPitch) { + this.root.getAllParts().forEach(ModelPart::resetPose); + int climbingTicks = entity.getClimbingTicks(); + int leapingTicks = entity.getLeapingTicks(); + int croppedClimbingTicks = Math.min(ShelobiteScuttlerEntity.CLIMBING_TIME_TRANSITION, climbingTicks); float climbingPercentage = (float) croppedClimbingTicks / SpawnOfShelobEntity.CLIMBING_TIME_TRANSITION; - int croppedLeapingTicks = Math.min(ShelobiteScuttlerEntity.LEAPING_TIME_TRANSITION, state.leapingTicks); + int croppedLeapingTicks = Math.min(ShelobiteScuttlerEntity.LEAPING_TIME_TRANSITION, leapingTicks); float leapingPercentage = (float) croppedLeapingTicks / SpawnOfShelobEntity.LEAPING_TIME_TRANSITION; - if(state.climbingTicks > 0 && climbingPercentage > leapingPercentage) { - this.root.pitch = -1.5f * climbingPercentage; - this.walkingAnimation.applyWalking(state.age, 0.4f, 1.75F, 2F); + if(climbingTicks > 0 && climbingPercentage > leapingPercentage) { + this.root.xRot = -1.5f * climbingPercentage; + this.animateWalk(SpawnOfShelobAnimations.SPAWN_OF_SHELOB_WALK, ageInTicks, 0.4f, 1.75F, 2F); return; - } else if(state.leapingTicks > 0 && leapingPercentage > climbingPercentage) { - this.root.pitch = -0.8f * leapingPercentage; - this.walkingAnimation.applyWalking((float)state.leapingTicks / 3.1f, 0.75f, 2.2F, 2.5F); + } else if(leapingTicks > 0 && leapingPercentage > climbingPercentage) { + this.root.xRot = -0.8f * leapingPercentage; + this.animateWalk(SpawnOfShelobAnimations.SPAWN_OF_SHELOB_WALK, + (float)leapingTicks / 3.1f, 0.75f, 2.2F, 2.5F); return; } - if(state.limbSwingAmplitude <= 0.4) { - this.idleAnimation.apply(state.idleAnimationState, state.age, 0.75f); - } else if(state.blockAnimationState.isRunning()) { - this.walkingBlockAnimation.applyWalking(state.limbSwingAnimationProgress, state.limbSwingAmplitude, 2.2F, 2.25F); + if(limbSwingAmount <= 0.4) { + this.animate(entity.idleAnimation, SpawnOfShelobAnimations.SPAWN_OF_SHELOB_IDLE, ageInTicks, 0.75f); + } else if(entity.blockAnimation.isStarted()) { + this.animateWalk(SpawnOfShelobAnimations.SPAWN_OF_SHELOB_BLOCK, + limbSwing, limbSwingAmount, 2.2F, 2.25F); } else { - this.walkingAnimation.applyWalking(state.limbSwingAnimationProgress, state.limbSwingAmplitude, 2.25F, 2.5F); + this.animateWalk(SpawnOfShelobAnimations.SPAWN_OF_SHELOB_WALK, + limbSwing, limbSwingAmount, 2.25F, 2.5F); } - if(state.biteAnimationState.isRunning()) { - this.biteAnimation.apply(state.biteAnimationState, state.age, 1.3f); + if(entity.biteAnimation.isStarted()) { + this.animate(entity.biteAnimation, SpawnOfShelobAnimations.SPAWN_OF_SHELOB_BITE, ageInTicks, 1.3f); } - if(state.pounceAnimationState.isRunning()) { - this.pounceAnimation.apply(state.pounceAnimationState, state.age, 1.0f); + if(entity.pounceAnimation.isStarted()) { + this.animate(entity.pounceAnimation, SpawnOfShelobAnimations.SPAWN_OF_SHELOB_POUNCE, ageInTicks, 1.0f); } } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobRenderState.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobRenderState.java deleted file mode 100644 index 65b03ad4ad..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobRenderState.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.sevenstars.middleearth.entity.spider.spawn; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.entity.AnimationState; -import net.sevenstars.middleearth.entity.spider.scuttler.ShelobiteScuttlerRenderState; - -@Environment(EnvType.CLIENT) -public class SpawnOfShelobRenderState extends ShelobiteScuttlerRenderState { - public final AnimationState blockAnimationState = new AnimationState(); - - public SpawnOfShelobRenderState() { - - } -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobRenderer.java index 47f9808445..a86b9f68a7 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/spider/spawn/SpawnOfShelobRenderer.java @@ -1,42 +1,24 @@ package net.sevenstars.middleearth.entity.spider.spawn; -import net.minecraft.client.render.entity.EntityRendererFactory; -import net.minecraft.client.render.entity.MobEntityRenderer; -import net.minecraft.client.render.entity.model.EntityModelLayer; -import net.minecraft.util.Identifier; +import net.minecraft.client.model.geom.ModelLayerLocation; +import net.minecraft.client.renderer.entity.EntityRendererProvider; +import net.minecraft.client.renderer.entity.MobRenderer; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.entity.EntityModelLayersME; +import net.sevenstars.middleearth.entity.spider.SpiderVariant; -public class SpawnOfShelobRenderer extends MobEntityRenderer { - private static final String PATH = "textures/entities/spiders/"; +public class SpawnOfShelobRenderer extends MobRenderer { - public SpawnOfShelobRenderer(EntityRendererFactory.Context context) { + public SpawnOfShelobRenderer(EntityRendererProvider.Context context) { this(context, 0.75F, EntityModelLayersME.SPAWN_OF_SHELOB); } - @Override - public SpawnOfShelobRenderState createRenderState() { - return new SpawnOfShelobRenderState(); - } - - protected SpawnOfShelobRenderer(EntityRendererFactory.Context ctx, float shadowRadius, EntityModelLayer layer) { - super(ctx, new SpawnOfShelobModel(ctx.getPart(layer)), shadowRadius); + protected SpawnOfShelobRenderer(EntityRendererProvider.Context ctx, float shadowRadius, ModelLayerLocation layer) { + super(ctx, new SpawnOfShelobModel(ctx.bakeLayer(layer)), shadowRadius); } @Override - public Identifier getTexture(SpawnOfShelobRenderState state) { - return state.spiderVariant.assetInfo().spawnOfShelob().texturePath(); - } - - public void updateRenderState(SpawnOfShelobEntity spawnofShelobEntity, SpawnOfShelobRenderState shelobiteScuttlerEntityRenderState, float f) { - super.updateRenderState(spawnofShelobEntity, shelobiteScuttlerEntityRenderState, f); - shelobiteScuttlerEntityRenderState.idleAnimationState.copyFrom(spawnofShelobEntity.idleAnimation); - shelobiteScuttlerEntityRenderState.walkAnimationState.copyFrom(spawnofShelobEntity.walkingAnimation); - shelobiteScuttlerEntityRenderState.biteAnimationState.copyFrom(spawnofShelobEntity.biteAnimation); - shelobiteScuttlerEntityRenderState.blockAnimationState.copyFrom(spawnofShelobEntity.blockAnimation); - shelobiteScuttlerEntityRenderState.pounceAnimationState.copyFrom(spawnofShelobEntity.pounceAnimation); - shelobiteScuttlerEntityRenderState.timelineTicks = spawnofShelobEntity.getTimelineTicks(); - shelobiteScuttlerEntityRenderState.climbingTicks = spawnofShelobEntity.getClimbingTicks(); - shelobiteScuttlerEntityRenderState.leapingTicks = spawnofShelobEntity.getLeapingTicks(); - shelobiteScuttlerEntityRenderState.spiderVariant = spawnofShelobEntity.getVariant(); + public ResourceLocation getTextureLocation(SpawnOfShelobEntity entity) { + return SpiderVariant.texture(entity.getVariant().assetInfo().spawnOfShelob()); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/tasks/SpiderPounceTask.java b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/tasks/SpiderPounceTask.java index 3abbf426df..b9734cd9b1 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/entity/tasks/SpiderPounceTask.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/entity/tasks/SpiderPounceTask.java @@ -2,54 +2,57 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; -import net.minecraft.block.Blocks; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.ai.brain.BlockPosLookTarget; -import net.minecraft.entity.ai.brain.MemoryModuleState; -import net.minecraft.entity.ai.brain.MemoryModuleType; -import net.minecraft.entity.ai.brain.task.LongJumpTask; -import net.minecraft.entity.ai.brain.task.MultiTickTask; -import net.minecraft.entity.ai.pathing.EntityNavigation; -import net.minecraft.entity.ai.pathing.Path; -import net.minecraft.entity.attribute.EntityAttributes; -import net.minecraft.entity.mob.MobEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvent; -import net.minecraft.util.collection.Weighting; -import net.minecraft.util.math.*; -import net.minecraft.util.math.intprovider.UniformIntProvider; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundSource; +import net.minecraft.util.random.WeightedRandom; +import net.minecraft.util.random.Weight; +import net.minecraft.util.random.WeightedEntry; +import net.minecraft.util.valueproviders.UniformInt; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.ai.behavior.Behavior; +import net.minecraft.world.entity.ai.behavior.BlockPosTracker; +import net.minecraft.world.entity.ai.behavior.LongJumpToRandomPos; +import net.minecraft.world.entity.ai.behavior.LongJumpUtil; +import net.minecraft.world.entity.ai.memory.MemoryModuleType; +import net.minecraft.world.entity.ai.memory.MemoryStatus; +import net.minecraft.world.entity.ai.navigation.PathNavigation; +import net.minecraft.world.level.pathfinder.Path; +import net.minecraft.world.phys.Vec3; import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.function.BiPredicate; import java.util.function.Function; -public class SpiderPounceTask extends MultiTickTask { +public class SpiderPounceTask extends Behavior { protected static final int MAX_TARGET_SEARCH_TIME = 20; private static final int JUMP_WINDUP_TIME = 40; protected static final int PATHING_DISTANCE = 8; private static final int RUN_TIME = 200; private static final List POUNCE_ANGLES = Lists.newArrayList(30, 37, 45, 50, 55); - private final UniformIntProvider cooldownRange; + private final UniformInt cooldownRange; protected final int verticalRange; protected final int horizontalRange; protected final float maxRange; protected List potentialTargets = Lists.newArrayList(); - protected Optional startPos = Optional.empty(); + protected Optional startPos = Optional.empty(); @Nullable - protected Vec3d currentTarget; + protected Vec3 currentTarget; protected int targetSearchTime; protected long targetPickedTime; private final Function entityToSound; private final BiPredicate jumpToPredicate; - public SpiderPounceTask(UniformIntProvider cooldownRange, int verticalRange, int horizontalRange, float maxRange, + public SpiderPounceTask(UniformInt cooldownRange, int verticalRange, int horizontalRange, float maxRange, Function entityToSound) { super( ImmutableMap.of( MemoryModuleType.LOOK_TARGET, - MemoryModuleState.REGISTERED + MemoryStatus.REGISTERED //MemoryModuleType.LONG_JUMP_COOLING_DOWN, //MemoryModuleState.VALUE_ABSENT, //MemoryModuleType.LONG_JUMP_MID_JUMP, @@ -62,28 +65,27 @@ public SpiderPounceTask(UniformIntProvider cooldownRange, int verticalRange, int this.horizontalRange = horizontalRange; this.maxRange = maxRange; this.entityToSound = entityToSound; - this.jumpToPredicate = LongJumpTask::shouldJumpTo; + this.jumpToPredicate = LongJumpToRandomPos::defaultAcceptableLandingSpot; } @Override - protected boolean shouldRun(ServerWorld serverWorld, MobEntity mobEntity) { - boolean validTerrain = mobEntity.isOnGround(); + protected boolean checkExtraStartConditions(ServerLevel serverWorld, Mob mobEntity) { + boolean validTerrain = mobEntity.onGround(); //&& !mobEntity.isTouchingWater() //&& !mobEntity.isInLava() //&& !serverWorld.getBlockState(mobEntity.getBlockPos()).isOf(Blocks.HONEY_BLOCK); if (!validTerrain) { - mobEntity.getBrain().remember(MemoryModuleType.LONG_JUMP_COOLING_DOWN, 40); - System.out.println("Can't shouldRun, bad terrain, 40"); + mobEntity.getBrain().setMemory(MemoryModuleType.LONG_JUMP_COOLDOWN_TICKS, 40); } return validTerrain; } @Override - protected boolean shouldKeepRunning(ServerWorld serverWorld, MobEntity mobEntity, long l) { + protected boolean canStillUse(ServerLevel serverWorld, Mob mobEntity, long l) { boolean canJump = this.startPos.isPresent(); canJump = canJump && this.targetSearchTime > 0; - canJump = canJump && !mobEntity.isTouchingWater(); + canJump = canJump && !mobEntity.isInWater(); canJump = canJump && (this.currentTarget != null || !this.potentialTargets.isEmpty()); //Optional optionalMemory = mobEntity.getBrain().getOptionalMemory(MemoryModuleType.LONG_JUMP_COOLING_DOWN); @@ -92,71 +94,65 @@ protected boolean shouldKeepRunning(ServerWorld serverWorld, MobEntity mobEntity //} if (!canJump) { //&& mobEntity.getBrain().getOptionalRegisteredMemory(MemoryModuleType.LONG_JUMP_MID_JUMP).isEmpty()) { - System.out.println("Should not keep running... 50. StartPos present: " + startPos.isPresent() + " TargetST:" - + targetSearchTime + ". Current Trgt: " + currentTarget + ". Potential Trgt: " + potentialTargets.size()); - mobEntity.getBrain().remember(MemoryModuleType.LONG_JUMP_COOLING_DOWN, cooldownRange.get(mobEntity.getRandom())); + mobEntity.getBrain().setMemory(MemoryModuleType.LONG_JUMP_COOLDOWN_TICKS, cooldownRange.sample(mobEntity.getRandom())); } return canJump; } @Override - protected void run(ServerWorld serverWorld, E mobEntity, long l) { + protected void start(ServerLevel serverWorld, E mobEntity, long l) { this.currentTarget = null; - Optional targetEntity = mobEntity.getBrain().getOptionalRegisteredMemory(MemoryModuleType.ATTACK_TARGET); + Optional targetEntity = mobEntity.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET); if(targetEntity.isPresent()) { LivingEntity value = targetEntity.get(); - this.potentialTargets.add(new Target(value.getPos(), 1)); - System.out.println("add potential target pos"); + this.potentialTargets.add(new Target(value.position(), 1)); } this.targetSearchTime = 20; - this.startPos = Optional.of(mobEntity.getPos()); + this.startPos = Optional.of(mobEntity.position()); } @Override - protected void keepRunning(ServerWorld serverWorld, E mobEntity, long l) { + protected void tick(ServerLevel serverWorld, E mobEntity, long l) { if (this.currentTarget != null) { if (l - this.targetPickedTime >= 40L) { - System.out.println("JUMP RUNNING!"); - mobEntity.setYaw(mobEntity.bodyYaw); - mobEntity.setNoDrag(true); + mobEntity.setYRot(mobEntity.yBodyRot); + mobEntity.setDiscardFriction(true); double d = this.currentTarget.length(); - double e = d + mobEntity.getJumpBoostVelocityModifier(); - mobEntity.setVelocity(this.currentTarget.multiply(e / d)); - mobEntity.getBrain().remember(MemoryModuleType.LONG_JUMP_COOLING_DOWN, cooldownRange.get(mobEntity.getRandom())); - serverWorld.playSoundFromEntity(null, mobEntity, (SoundEvent)this.entityToSound.apply(mobEntity), SoundCategory.NEUTRAL, 1.0F, 1.0F); + double e = d + mobEntity.getJumpBoostPower(); + mobEntity.setDeltaMovement(this.currentTarget.scale(e / d)); + mobEntity.getBrain().setMemory(MemoryModuleType.LONG_JUMP_COOLDOWN_TICKS, cooldownRange.sample(mobEntity.getRandom())); + serverWorld.playSound(null, mobEntity, (SoundEvent)this.entityToSound.apply(mobEntity), SoundSource.NEUTRAL, 1.0F, 1.0F); potentialTargets.clear(); targetSearchTime = 0; } } else { this.targetSearchTime--; - System.out.println("Searching target vec"); this.pickTarget(serverWorld, mobEntity, l); } } @Override - protected void finishRunning(ServerWorld world, E entity, long time) { - super.finishRunning(world, entity, time); - entity.getBrain().forget(MemoryModuleType.ATTACK_TARGET); - entity.getBrain().remember(MemoryModuleType.LONG_JUMP_COOLING_DOWN, this.cooldownRange.get(world.getRandom())); - System.out.println("FINISH POUNCE"); + protected void stop(ServerLevel world, E entity, long time) { + super.stop(world, entity, time); + entity.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET); + entity.getBrain().setMemory(MemoryModuleType.LONG_JUMP_COOLDOWN_TICKS, this.cooldownRange.sample(world.getRandom())); } - protected void pickTarget(ServerWorld world, E entity, long time) { + protected void pickTarget(ServerLevel world, E entity, long time) { while (!this.potentialTargets.isEmpty()) { Optional optional = this.removeRandomTarget(world); if (!optional.isEmpty()) { Target target = optional.get(); BlockPos pos = new BlockPos((int)target.pos.x, (int)target.pos.y, (int)target.pos.z); if (this.canJumpTo(world, entity, pos)) { - Vec3d vec3d = Vec3d.ofCenter(pos); - Vec3d vec3d2 = this.getJumpingVelocity(entity, vec3d); + Vec3 vec3d = Vec3.atCenterOf(pos); + Vec3 vec3d2 = this.getJumpingVelocity(entity, vec3d); if (vec3d2 != null) { - entity.getBrain().remember(MemoryModuleType.LOOK_TARGET, new BlockPosLookTarget(pos)); - EntityNavigation entityNavigation = entity.getNavigation(); - Path path = entityNavigation.findPathTo(pos, 0, 8); - if (path == null || !path.reachesTarget()) { + entity.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, new BlockPosTracker(pos)); + PathNavigation entityNavigation = entity.getNavigation(); + Path path = entityNavigation.createPath(pos, 0, 8); + if (path == null || !path.canReach()) { this.currentTarget = vec3d2; this.targetPickedTime = time; return; @@ -167,35 +163,43 @@ protected void pickTarget(ServerWorld world, E entity, long time) { } } - protected Optional removeRandomTarget(ServerWorld world) { - Optional optional = Weighting.getRandom(world.random, this.potentialTargets, Target::weight); + protected Optional removeRandomTarget(ServerLevel world) { + Optional optional = WeightedRandom.getRandomItem(world.random, this.potentialTargets); optional.ifPresent(this.potentialTargets::remove); return optional; } - private boolean canJumpTo(ServerWorld world, E entity, BlockPos pos) { - BlockPos blockPos = entity.getBlockPos(); + private boolean canJumpTo(ServerLevel world, E entity, BlockPos pos) { + BlockPos blockPos = entity.blockPosition(); int i = blockPos.getX(); int j = blockPos.getZ(); return i == pos.getX() && j == pos.getZ() ? false : this.jumpToPredicate.test(entity, pos); } @Nullable - protected Vec3d getJumpingVelocity(MobEntity entity, Vec3d targetPos) { + protected Vec3 getJumpingVelocity(Mob entity, Vec3 targetPos) { List list = Lists.newArrayList(POUNCE_ANGLES); Collections.shuffle(list); - float f = (float)(entity.getAttributeValue(EntityAttributes.JUMP_STRENGTH) * this.maxRange); + float f = (float)(entity.getAttributeValue(Attributes.JUMP_STRENGTH) * this.maxRange); for (int i : list) { - Optional optional = LongJumpUtil.getJumpingVelocity(entity, targetPos, f, i, true); + Optional optional = LongJumpUtil.calculateJumpVectorForAngle(entity, targetPos, f, i, true); if (optional.isPresent()) { - return (Vec3d)optional.get(); + return (Vec3)optional.get(); } } return null; } - public record Target(Vec3d pos, int weight) { + public record Target(Vec3 pos, Weight weight) implements WeightedEntry { + public Target(Vec3 pos, int weight) { + this(pos, Weight.of(weight)); + } + + @Override + public Weight getWeight() { + return this.weight; + } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/event/KeyInputHandler.java b/middle-earth/src/main/java/net/sevenstars/middleearth/event/KeyInputHandler.java index 7ff274421b..915e732bd9 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/event/KeyInputHandler.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/event/KeyInputHandler.java @@ -1,66 +1,65 @@ package net.sevenstars.middleearth.event; -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; -import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; +import com.mojang.blaze3d.platform.InputConstants; +import net.minecraft.client.KeyMapping; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.client.event.ClientTickEvent; +import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent; +import net.neoforged.neoforge.network.PacketDistributor; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.network.packets.C2S.HoodStateTogglePacket; -import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.util.InputUtil; import org.lwjgl.glfw.GLFW; -public class KeyInputHandler { - +@EventBusSubscriber(modid = MiddleEarth.NEOFORGE_MOD_ID, value = Dist.CLIENT) +public final class KeyInputHandler { public static final String ME_KEY_CATEGORY = "key.category.%s.%s".formatted(MiddleEarth.MOD_ID, MiddleEarth.MOD_ID); public static final String ME_KEY_HOOD_STATE_TOGGLE = "key.%s.hood_state_toggle".formatted(MiddleEarth.MOD_ID); public static final String ME_KEY_MAP_TELEPORT = "key.%s.map_teleport".formatted(MiddleEarth.MOD_ID); public static final String ME_KEY_MAP_FULLSCREEN_TOGGLE = "key.%s.map_fullscreen_toggle".formatted(MiddleEarth.MOD_ID); - public static KeyBinding hoodStateToggleKey; - // Used in MapScreen - public static KeyBinding mapTeleportKey; - public static KeyBinding mapFullscreenToggle; - - public static void registerKeyInputs(){ - var ref = new Object() { - int counter = 0; - }; + public static KeyMapping hoodStateToggleKey; + public static KeyMapping mapTeleportKey; + public static KeyMapping mapFullscreenToggle; - ClientTickEvents.END_CLIENT_TICK.register(client -> { - if(hoodStateToggleKey.isPressed()) { - if (ref.counter == 0) { - ref.counter = 1; - assert client.player != null; - ClientPlayNetworking.send(new HoodStateTogglePacket()); - } - } else { - ref.counter = 0; - } - }); + private KeyInputHandler() { } - public static void register(){ - hoodStateToggleKey = KeyBindingHelper.registerKeyBinding(new KeyBinding( + @SubscribeEvent + private static void registerKeyMappings(RegisterKeyMappingsEvent event) { + hoodStateToggleKey = new KeyMapping( ME_KEY_HOOD_STATE_TOGGLE, - InputUtil.Type.KEYSYM, + InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_J, ME_KEY_CATEGORY - )); - - mapTeleportKey = KeyBindingHelper.registerKeyBinding(new KeyBinding( + ); + mapTeleportKey = new KeyMapping( ME_KEY_MAP_TELEPORT, - InputUtil.Type.KEYSYM, + InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_N, ME_KEY_CATEGORY - )); - - mapFullscreenToggle = KeyBindingHelper.registerKeyBinding(new KeyBinding( + ); + mapFullscreenToggle = new KeyMapping( ME_KEY_MAP_FULLSCREEN_TOGGLE, - InputUtil.Type.KEYSYM, + InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_M, ME_KEY_CATEGORY - )); + ); + + event.register(hoodStateToggleKey); + event.register(mapTeleportKey); + event.register(mapFullscreenToggle); + } + + @SubscribeEvent + private static void onClientTick(ClientTickEvent.Post event) { + if (hoodStateToggleKey != null && hoodStateToggleKey.consumeClick()) { + PacketDistributor.sendToServer(HoodStateTogglePacket.INSTANCE); + } + } - registerKeyInputs(); + public static void register() { + // EventBusSubscriber performs the NeoForge registration. } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/event/ModEvents.java b/middle-earth/src/main/java/net/sevenstars/middleearth/event/ModEvents.java index 3e9d33a102..1a44f85161 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/event/ModEvents.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/event/ModEvents.java @@ -1,247 +1,320 @@ package net.sevenstars.middleearth.event; -import net.fabricmc.fabric.api.entity.event.v1.ServerEntityCombatEvents; -import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents; -import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents; -import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.ProfileComponent; -import net.minecraft.component.type.ToolComponent; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.tag.BlockTags; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.World; +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.Holder; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.Registries; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.tags.BlockTags; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.component.ResolvableProfile; +import net.minecraft.world.item.component.Tool; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.neoforged.neoforge.common.CommonHooks; +import net.neoforged.neoforge.common.NeoForge; +import net.neoforged.neoforge.event.EventHooks; +import net.neoforged.neoforge.event.entity.living.LivingDropsEvent; +import net.neoforged.neoforge.event.entity.player.PlayerEvent; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.config.ModServerConfigs; import net.sevenstars.middleearth.enchantments.EnchantmentsME; import net.sevenstars.middleearth.item.ResourceItemsME; +import net.sevenstars.middleearth.network.handlers.OnboardingServerHandler; import net.sevenstars.middleearth.resources.StateSaverAndLoader; import net.sevenstars.middleearth.resources.datas.races.RaceUtil; import net.sevenstars.middleearth.resources.persistent_datas.PlayerData; -import net.sevenstars.middleearth.world.chunkgen.map.MiddleEarthHeightMap; import net.sevenstars.middleearth.world.dimension.ModDimensions; -import java.util.Objects; +import java.util.ArrayDeque; public class ModEvents { private static final String GOT_STARTER_ITEM = MiddleEarth.MOD_ID + ".received_starter_item"; + private static final int TREE_FELLER_NEIGHBOR_COUNT = 16; public static void register(){ - ServerPlayConnectionEvents.JOIN.register((serverPlayNetworkHandler, packetSender, minecraftServer) -> { - ServerPlayerEntity player = serverPlayNetworkHandler.getPlayer(); - MiddleEarthHeightMap.setSeed(player.getWorld().getSeed()); - - PlayerData data = StateSaverAndLoader.getPlayerState(player); - if(data == null) - return; - if(data != null && data.getRace() != null){ - RaceUtil.reset(player); - boolean isInMiddleEarth = ModDimensions.isInMiddleEarth(player.getWorld()); - if(isInMiddleEarth){ - RaceUtil.initializeRace(player); - } else if(ModServerConfigs.ENABLE_KEEP_RACE_ON_DIMENSION_SWAP){ - RaceUtil.initializeRace(player); - } - } + NeoForge.EVENT_BUS.addListener(ModEvents::onPlayerLoggedIn); + NeoForge.EVENT_BUS.addListener(ModEvents::onPlayerLoggedOut); + NeoForge.EVENT_BUS.addListener(ModEvents::onLivingDrops); + } - if(!player.getCommandTags().contains(GOT_STARTER_ITEM)) { - ItemStack starterItem = new ItemStack(ResourceItemsME.PLAYER_BOOK); - player.getInventory().offerOrDrop(starterItem); - player.addCommandTag(GOT_STARTER_ITEM); - } - }); - - ServerEntityCombatEvents.AFTER_KILLED_OTHER_ENTITY.register((world, entity, killedEntity) -> { - if(entity instanceof PlayerEntity playerEntity) { - ItemStack stack = Objects.requireNonNull(playerEntity.getStackInHand(playerEntity.getActiveHand())); - RegistryEntry enchantmentRegistryEntry = world.getRegistryManager() - .getOrThrow(RegistryKeys.ENCHANTMENT).getOptional(EnchantmentsME.BEHEADING).orElseThrow(); - boolean hasEnchant = stack.getEnchantments().getEnchantments().contains(enchantmentRegistryEntry); - - if (hasEnchant) { - ItemStack drop = ItemStack.EMPTY; - if(killedEntity instanceof PlayerEntity killedPlayer) { - drop = new ItemStack(Items.PLAYER_HEAD); - drop.set(DataComponentTypes.PROFILE, new ProfileComponent(killedPlayer.getGameProfile())); - } - if(!drop.isEmpty()) { - killedEntity.dropStack(world, drop); - } - } + private static void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) { + if (!(event.getEntity() instanceof ServerPlayer player)) { + return; + } + + PlayerData data = StateSaverAndLoader.getPlayerStateReadOnly(player); + if (data != null && data.getRace() != null) { + RaceUtil.reset(player); + if (ModDimensions.isInMiddleEarth(player.level()) || ModServerConfigs.ENABLE_KEEP_RACE_ON_DIMENSION_SWAP) { + RaceUtil.initializeRace(player); } - }); - - PlayerBlockBreakEvents.AFTER.register((world, playerEntity, blockPos, blockState, blockEntity) -> { - ItemStack stack = Objects.requireNonNull(playerEntity.getStackInHand(playerEntity.getActiveHand())); - ToolComponent toolComponent = stack.get(DataComponentTypes.TOOL); - RegistryEntry enchantmentRegistryEntry = world.getRegistryManager().getOrThrow(RegistryKeys.ENCHANTMENT).getOptional(EnchantmentsME.HEWING).orElseThrow(); - boolean hasEnchant = stack.getEnchantments().getEnchantments().contains(enchantmentRegistryEntry); - int level = EnchantmentHelper.getLevel(enchantmentRegistryEntry, stack); - float hardness = blockState.getBlock().getHardness(); - - if (hasEnchant) { - if (!playerEntity.isCreative() && !playerEntity.isSneaking()) { - assert toolComponent != null; - if (toolComponent.isCorrectForDrops(blockState)){ - if (playerEntity.getFacing() == Direction.DOWN || playerEntity.getFacing() == Direction.UP){ - if (level == 1){ - level1BreakVertical(world, playerEntity, blockPos, stack, hardness); - } else if (level == 2){ - level2BreakVertical(world, playerEntity, blockPos, stack, hardness); - } else { - level3BreakVertical(world, playerEntity, blockPos, stack, hardness); - } - } else { - if (level == 1){ - level1Break(world, playerEntity, blockPos, stack, hardness); - } else if (level == 2){ - level2Break(world, playerEntity, blockPos, stack, hardness); - } else { - level3Break(world, playerEntity, blockPos, stack, hardness); - } - } - } - } + } + + if (!player.getTags().contains(GOT_STARTER_ITEM)) { + player.getInventory().placeItemBackInInventory(new ItemStack(ResourceItemsME.PLAYER_BOOK)); + player.addTag(GOT_STARTER_ITEM); + } + } + + private static void onPlayerLoggedOut(PlayerEvent.PlayerLoggedOutEvent event) { + if (event.getEntity() instanceof ServerPlayer player) { + OnboardingServerHandler.clearSession(player); + } + } + + private static void onLivingDrops(LivingDropsEvent event) { + if (!(event.getSource().getEntity() instanceof Player playerEntity)) { + return; + } + + ItemStack stack = playerEntity.getMainHandItem(); + Holder enchantment = event.getEntity().level().registryAccess() + .lookupOrThrow(Registries.ENCHANTMENT).get(EnchantmentsME.BEHEADING).orElseThrow(); + if (!stack.getEnchantments().keySet().contains(enchantment)) { + return; + } + + if (event.getEntity() instanceof Player killedPlayer) { + ItemStack drop = new ItemStack(Items.PLAYER_HEAD); + drop.set(DataComponents.PROFILE, new ResolvableProfile(killedPlayer.getGameProfile())); + event.getDrops().add(new ItemEntity( + killedPlayer.level(), + killedPlayer.getX(), + killedPlayer.getY(), + killedPlayer.getZ(), + drop + )); + } + } + + public static void afterBlockBreak( + ServerPlayer player, + BlockPos blockPos, + BlockState blockState + ) { + Level world = player.level(); + if (blockState.isAir()) { + return; + } + + ItemStack stack = player.getMainHandItem(); + Tool toolComponent = stack.get(DataComponents.TOOL); + if (player.isCreative() || player.isShiftKeyDown() || toolComponent == null + || !toolComponent.isCorrectForDrops(blockState)) { + return; + } + + applyHewing(world, player, blockPos, blockState, stack); + applyTreeFeller(world, player, blockPos, blockState, stack); + } + + private static void applyHewing(Level world, Player player, BlockPos blockPos, BlockState blockState, ItemStack stack) { + Holder enchantment = world.registryAccess().lookupOrThrow(Registries.ENCHANTMENT) + .get(EnchantmentsME.HEWING).orElseThrow(); + if (!stack.getEnchantments().keySet().contains(enchantment)) { + return; + } + + int level = EnchantmentHelper.getItemEnchantmentLevel(enchantment, stack); + float hardness = blockState.getBlock().defaultDestroyTime(); + if (player.getNearestViewDirection() == Direction.DOWN || player.getNearestViewDirection() == Direction.UP) { + if (level == 1) { + level1BreakVertical(world, player, blockPos, stack, hardness); + } else if (level == 2) { + level2BreakVertical(world, player, blockPos, stack, hardness); + } else { + level3BreakVertical(world, player, blockPos, stack, hardness); } - }); - - PlayerBlockBreakEvents.AFTER.register((world, playerEntity, blockPos, blockState, blockEntity) -> { - ItemStack stack = Objects.requireNonNull(playerEntity.getStackInHand(playerEntity.getActiveHand())); - ToolComponent toolComponent = stack.get(DataComponentTypes.TOOL); - RegistryEntry enchantmentRegistryEntry = world.getRegistryManager() - .getOrThrow(RegistryKeys.ENCHANTMENT).getOptional(EnchantmentsME.TREE_FELLER).orElseThrow(); - boolean hasEnchant = stack.getEnchantments().getEnchantments().contains(enchantmentRegistryEntry); - int level = EnchantmentHelper.getLevel(enchantmentRegistryEntry, stack); - float hardness = blockState.getBlock().getHardness(); - - if (hasEnchant) { - if (!playerEntity.isCreative() && !playerEntity.isSneaking()) { - assert toolComponent != null; - if (toolComponent.isCorrectForDrops(blockState)){ - int[] blockCount = new int[]{16}; - if(level == 2) blockCount[0] = 64; - else if(level == 3) blockCount[0] = 256; - breakTopLogs(world, playerEntity, blockPos, stack, hardness, blockCount); - } + } else if (level == 1) { + level1Break(world, player, blockPos, stack, hardness); + } else if (level == 2) { + level2Break(world, player, blockPos, stack, hardness); + } else { + level3Break(world, player, blockPos, stack, hardness); + } + } + + private static void applyTreeFeller(Level world, Player player, BlockPos blockPos, BlockState blockState, ItemStack stack) { + Holder enchantment = world.registryAccess().lookupOrThrow(Registries.ENCHANTMENT) + .get(EnchantmentsME.TREE_FELLER).orElseThrow(); + if (!stack.getEnchantments().keySet().contains(enchantment)) { + return; + } + + int level = EnchantmentHelper.getItemEnchantmentLevel(enchantment, stack); + int maxBlocks = level == 2 ? 64 : level >= 3 ? 256 : 16; + breakTopLogs(world, player, blockPos, stack, blockState.getBlock().defaultDestroyTime(), maxBlocks); + } + + private static void breakTopLogs(Level world, Player player, BlockPos blockPos, ItemStack stack, float hardness, int maxBlocks) { + LongOpenHashSet visited = new LongOpenHashSet(maxBlocks * TREE_FELLER_NEIGHBOR_COUNT + 1); + ArrayDeque traversal = new ArrayDeque<>(); + long startPos = blockPos.asLong(); + visited.add(startPos); + traversal.push(new TreeTraversalFrame(startPos)); + int selectedBlocks = 0; + + while (!traversal.isEmpty()) { + TreeTraversalFrame frame = traversal.peek(); + if (selectedBlocks >= maxBlocks || frame.nextNeighborIndex >= TREE_FELLER_NEIGHBOR_COUNT) { + traversal.pop(); + if (frame.packedPos != startPos) { + breakAndDamage(world, player, BlockPos.of(frame.packedPos), stack, hardness); } + continue; } - }); - } - - private static void breakTopLogs(World world, PlayerEntity player, BlockPos blockPos, ItemStack stack, float hardness, int[] attempts) { - BlockPos offsetY = blockPos.offset(Direction.Axis.Y, 1); - for(int z = -2; z < 2; z++) { - BlockPos offsetZ = offsetY.offset(Direction.Axis.Z, z); - for(int x = -2; x < 2; x++) { - BlockPos offset = offsetZ.offset(Direction.Axis.X, x); - if(world.getBlockState(offset).isIn(BlockTags.LOGS)) { - if(attempts[0]-- <= 0) return; - breakTopLogs(world, player, new BlockPos(offset), stack, hardness, attempts); - } + + int neighborIndex = frame.nextNeighborIndex++; + int xOffset = neighborIndex % 4 - 2; + int zOffset = neighborIndex / 4 - 2; + long neighborPos = BlockPos.asLong( + BlockPos.getX(frame.packedPos) + xOffset, + BlockPos.getY(frame.packedPos) + 1, + BlockPos.getZ(frame.packedPos) + zOffset + ); + if (!visited.add(neighborPos) || !world.getBlockState(BlockPos.of(neighborPos)).is(BlockTags.LOGS)) { + continue; } + + selectedBlocks++; + traversal.push(new TreeTraversalFrame(neighborPos)); + } + } + + private static final class TreeTraversalFrame { + private final long packedPos; + private int nextNeighborIndex; + + private TreeTraversalFrame(long packedPos) { + this.packedPos = packedPos; } - breakAndDamage(world, player, blockPos, stack, hardness); } - private static void level1BreakVertical(World world, PlayerEntity player, BlockPos blockPos, ItemStack stack, float hardness){ - float yaw = player.getYaw(); + private static void level1BreakVertical(Level world, Player player, BlockPos blockPos, ItemStack stack, float hardness){ + float yaw = player.getYRot(); if((yaw >= -45 && yaw <= 45) || yaw <= -135 || yaw >= 135){ - breakAndDamage(world, player, blockPos.offset(Direction.NORTH), stack, hardness); - breakAndDamage(world, player, blockPos.offset(Direction.SOUTH), stack, hardness); + breakAndDamage(world, player, blockPos.relative(Direction.NORTH), stack, hardness); + breakAndDamage(world, player, blockPos.relative(Direction.SOUTH), stack, hardness); } else { - breakAndDamage(world, player, blockPos.offset(Direction.WEST), stack, hardness); - breakAndDamage(world, player, blockPos.offset(Direction.EAST), stack, hardness); + breakAndDamage(world, player, blockPos.relative(Direction.WEST), stack, hardness); + breakAndDamage(world, player, blockPos.relative(Direction.EAST), stack, hardness); } } - private static void level2BreakVertical(World world, PlayerEntity player, BlockPos blockPos, ItemStack stack, float hardness){ - breakAndDamage(world, player, blockPos.offset(Direction.NORTH), stack, hardness); - breakAndDamage(world, player, blockPos.offset(Direction.EAST), stack, hardness); - breakAndDamage(world, player, blockPos.offset(Direction.SOUTH), stack, hardness); - breakAndDamage(world, player, blockPos.offset(Direction.WEST), stack, hardness); + private static void level2BreakVertical(Level world, Player player, BlockPos blockPos, ItemStack stack, float hardness){ + breakAndDamage(world, player, blockPos.relative(Direction.NORTH), stack, hardness); + breakAndDamage(world, player, blockPos.relative(Direction.EAST), stack, hardness); + breakAndDamage(world, player, blockPos.relative(Direction.SOUTH), stack, hardness); + breakAndDamage(world, player, blockPos.relative(Direction.WEST), stack, hardness); } - private static void level3BreakVertical(World world, PlayerEntity player, BlockPos blockPos, ItemStack stack, float hardness){ - BlockPos blockPosNorth = blockPos.offset(Direction.NORTH); - BlockPos blockPosSouth = blockPos.offset(Direction.SOUTH); + private static void level3BreakVertical(Level world, Player player, BlockPos blockPos, ItemStack stack, float hardness){ + BlockPos blockPosNorth = blockPos.relative(Direction.NORTH); + BlockPos blockPosSouth = blockPos.relative(Direction.SOUTH); breakAndDamage(world, player, blockPosNorth, stack, hardness); - breakAndDamage(world, player, blockPosNorth.offset(Direction.EAST), stack, hardness); - breakAndDamage(world, player, blockPosNorth.offset(Direction.WEST), stack, hardness); + breakAndDamage(world, player, blockPosNorth.relative(Direction.EAST), stack, hardness); + breakAndDamage(world, player, blockPosNorth.relative(Direction.WEST), stack, hardness); - breakAndDamage(world, player, blockPos.offset(Direction.EAST), stack, hardness); + breakAndDamage(world, player, blockPos.relative(Direction.EAST), stack, hardness); breakAndDamage(world, player, blockPosSouth, stack, hardness); - breakAndDamage(world, player, blockPosSouth.offset(Direction.EAST), stack, hardness); - breakAndDamage(world, player, blockPosSouth.offset(Direction.WEST), stack, hardness); + breakAndDamage(world, player, blockPosSouth.relative(Direction.EAST), stack, hardness); + breakAndDamage(world, player, blockPosSouth.relative(Direction.WEST), stack, hardness); - breakAndDamage(world, player, blockPos.offset(Direction.WEST), stack, hardness); + breakAndDamage(world, player, blockPos.relative(Direction.WEST), stack, hardness); } - private static void level1Break(World world, PlayerEntity player, BlockPos blockPos, ItemStack stack, float hardness){ - BlockPos blockPosUp = blockPos.up(); - BlockPos blockPosDown = blockPos.down(); + private static void level1Break(Level world, Player player, BlockPos blockPos, ItemStack stack, float hardness){ + BlockPos blockPosUp = blockPos.above(); + BlockPos blockPosDown = blockPos.below(); breakAndDamage(world, player, blockPosUp, stack, hardness); breakAndDamage(world, player, blockPosDown, stack, hardness); } - private static void level2Break(World world, PlayerEntity player, BlockPos blockPos, ItemStack stack, float hardness){ - BlockPos blockPosUp = blockPos.up(); - BlockPos blockPosDown = blockPos.down(); + private static void level2Break(Level world, Player player, BlockPos blockPos, ItemStack stack, float hardness){ + BlockPos blockPosUp = blockPos.above(); + BlockPos blockPosDown = blockPos.below(); breakAndDamage(world, player, blockPosUp, stack, hardness); - breakAndDamage(world, player, blockPos.offset(player.getFacing().rotateYClockwise()), stack, hardness); - breakAndDamage(world, player, blockPos.offset(player.getFacing().rotateYCounterclockwise()), stack, hardness); + breakAndDamage(world, player, blockPos.relative(player.getNearestViewDirection().getClockWise()), stack, hardness); + breakAndDamage(world, player, blockPos.relative(player.getNearestViewDirection().getCounterClockWise()), stack, hardness); breakAndDamage(world, player, blockPosDown, stack, hardness); } - private static void level3Break(World world, PlayerEntity player, BlockPos blockPos, ItemStack stack, float hardness){ - BlockPos blockPosUp = blockPos.up(); - BlockPos blockPosDown = blockPos.down(); + private static void level3Break(Level world, Player player, BlockPos blockPos, ItemStack stack, float hardness){ + BlockPos blockPosUp = blockPos.above(); + BlockPos blockPosDown = blockPos.below(); breakAndDamage(world, player, blockPosUp, stack, hardness); - breakAndDamage(world, player, blockPosUp.offset(player.getFacing().rotateYClockwise()), stack, hardness); - breakAndDamage(world, player, blockPosUp.offset(player.getFacing().rotateYCounterclockwise()), stack, hardness); + breakAndDamage(world, player, blockPosUp.relative(player.getNearestViewDirection().getClockWise()), stack, hardness); + breakAndDamage(world, player, blockPosUp.relative(player.getNearestViewDirection().getCounterClockWise()), stack, hardness); - breakAndDamage(world, player, blockPos.offset(player.getFacing().rotateYClockwise()), stack, hardness); - breakAndDamage(world, player, blockPos.offset(player.getFacing().rotateYCounterclockwise()), stack, hardness); + breakAndDamage(world, player, blockPos.relative(player.getNearestViewDirection().getClockWise()), stack, hardness); + breakAndDamage(world, player, blockPos.relative(player.getNearestViewDirection().getCounterClockWise()), stack, hardness); breakAndDamage(world, player, blockPosDown, stack, hardness); - breakAndDamage(world, player, blockPosDown.offset(player.getFacing().rotateYClockwise()), stack, hardness); - breakAndDamage(world, player, blockPosDown.offset(player.getFacing().rotateYCounterclockwise()), stack, hardness); + breakAndDamage(world, player, blockPosDown.relative(player.getNearestViewDirection().getClockWise()), stack, hardness); + breakAndDamage(world, player, blockPosDown.relative(player.getNearestViewDirection().getCounterClockWise()), stack, hardness); } - private static void breakAndDamage(World world, PlayerEntity player, BlockPos blockpos, ItemStack stack, float hardness){ - ToolComponent toolComponent = stack.get(DataComponentTypes.TOOL); + private static void breakAndDamage(Level world, Player player, BlockPos blockpos, ItemStack stack, float hardness){ + Tool toolComponent = stack.get(DataComponents.TOOL); BlockState blockState = world.getBlockState(blockpos); + if (!(player instanceof ServerPlayer serverPlayer) + || toolComponent == null || blockState.isAir() + || !toolComponent.isCorrectForDrops(blockState) + || blockState.getBlock().defaultDestroyTime() > hardness) { + return; + } - if (!blockState.isAir() && toolComponent != null) { - if (toolComponent.isCorrectForDrops(blockState)) { - if (blockState.getBlock().getHardness() <= hardness) { - BlockEntity blockEntity = blockState.hasBlockEntity() - ? world.getBlockEntity(blockpos) - : null; + if (CommonHooks.fireBlockBreak( + world, + serverPlayer.gameMode.getGameModeForPlayer(), + serverPlayer, + blockpos, + blockState + ).isCanceled()) { + return; + } - Block.dropStacks(blockState, world, blockpos, blockEntity, player, stack); - world.breakBlock(blockpos, false, player); - stack.postMine(world, blockState, blockpos, player); - } + Block block = blockState.getBlock(); + BlockEntity blockEntity = blockState.hasBlockEntity() ? world.getBlockEntity(blockpos) : null; + BlockState destroyedState = block.playerWillDestroy(world, blockpos, blockState, serverPlayer); + ItemStack dropTool = stack.copy(); + boolean canHarvest = destroyedState.canHarvestBlock(world, blockpos, serverPlayer); + + stack.mineBlock(world, destroyedState, blockpos, serverPlayer); + boolean removed = destroyedState.onDestroyedByPlayer( + world, + blockpos, + serverPlayer, + canHarvest, + world.getFluidState(blockpos) + ); + if (removed) { + destroyedState.getBlock().destroy(world, blockpos, destroyedState); + if (canHarvest) { + block.playerDestroy(world, serverPlayer, blockpos, destroyedState, blockEntity, dropTool); } } + + if (stack.isEmpty() && !dropTool.isEmpty()) { + EventHooks.onPlayerDestroyItem(serverPlayer, dropTool, InteractionHand.MAIN_HAND); + } } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/event/NeoForgeCommonEvents.java b/middle-earth/src/main/java/net/sevenstars/middleearth/event/NeoForgeCommonEvents.java new file mode 100644 index 0000000000..2eded80d66 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/event/NeoForgeCommonEvents.java @@ -0,0 +1,259 @@ +package net.sevenstars.middleearth.event; + +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.Registries; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.MobSpawnType; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.level.GameRules; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.bus.api.EventPriority; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.common.ItemAbilities; +import net.neoforged.neoforge.event.entity.EntityAttributeModificationEvent; +import net.neoforged.neoforge.event.entity.EntityJoinLevelEvent; +import net.neoforged.neoforge.event.entity.EntityLeaveLevelEvent; +import net.neoforged.neoforge.event.entity.living.LivingDeathEvent; +import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent; +import net.neoforged.neoforge.event.entity.living.MobSpawnEvent; +import net.neoforged.neoforge.event.level.BlockEvent; +import net.neoforged.neoforge.event.level.LevelEvent; +import net.neoforged.neoforge.event.level.ModifyCustomSpawnersEvent; +import net.neoforged.neoforge.event.level.SleepFinishedTimeEvent; +import net.neoforged.neoforge.event.server.ServerStoppedEvent; +import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.middleearth.block.registration.ModBlocks; +import net.sevenstars.middleearth.block.special.structureManager.features.StructureManagedEntityData; +import net.sevenstars.middleearth.block.special.structureManager.features.StructureManagerService; +import net.sevenstars.middleearth.enchantments.EnchantmentsME; +import net.sevenstars.middleearth.entity.EntityAttributesME; +import net.sevenstars.middleearth.entity.EntitiesME; +import net.sevenstars.middleearth.entity.npcs.NpcEntity; +import net.sevenstars.middleearth.item.items.weapons.CustomDaggerWeaponItem; +import net.sevenstars.middleearth.resources.datas.biome_events.BiomeEventDataLookup; +import net.sevenstars.middleearth.world.dimension.ModDimensions; +import net.sevenstars.middleearth.world.spawners.ModEntitySpawning; +import net.sevenstars.middleearth.world.spawners.SpawnerNPCs; + +public final class NeoForgeCommonEvents { + private NeoForgeCommonEvents() { + } + + @EventBusSubscriber(modid = MiddleEarth.NEOFORGE_MOD_ID) + public static final class ModBus { + private ModBus() { + } + + @SubscribeEvent + public static void addPlayerAttributes(EntityAttributeModificationEvent event) { + event.add(EntityType.PLAYER, EntityAttributesME.POWDERED_SNOW_IMMUNITY); + event.add(EntityType.PLAYER, EntityAttributesME.DELVERS_FEAR_STRENGTH); + event.add(EntityType.PLAYER, EntityAttributesME.CLIMBING_STRENGTH); + event.add(EntityType.PLAYER, EntityAttributesME.DETECTION_RANGE); + } + } + + @EventBusSubscriber(modid = MiddleEarth.NEOFORGE_MOD_ID) + public static final class GameBus { + private GameBus() { + } + + @SubscribeEvent(priority = EventPriority.LOWEST) + public static void checkNaturalSpawn(MobSpawnEvent.SpawnPlacementCheck event) { + if (event.getSpawnType() != MobSpawnType.NATURAL + || !event.getPlacementCheckResult() + || !(event.getLevel() instanceof Level level) + || !ModDimensions.isInMiddleEarth(level) + || event.getEntityType() == EntitiesME.NPC) { + return; + } + + if (!BiomeEventDataLookup.canEntitySpawn( + level, + level.getBiome(event.getPos()), + event.getPos(), + event.getEntityType(), + event.getRandom() + )) { + event.setResult(MobSpawnEvent.SpawnPlacementCheck.Result.FAIL); + } + } + + @SubscribeEvent + public static void clearStructureManagers(LevelEvent.Unload event) { + if (event.getLevel() instanceof Level level && !level.isClientSide) { + StructureManagerService.clear(level); + } + } + + @SubscribeEvent + public static void clearStructureManagers(ServerStoppedEvent event) { + StructureManagerService.clearAll(); + } + + @SubscribeEvent + public static void applyPlayerMeleeBonuses(LivingIncomingDamageEvent event) { + if (event.getEntity().level().isClientSide + || !(event.getSource().getDirectEntity() instanceof Player player)) { + return; + } + + ItemStack weapon = player.getMainHandItem(); + float amount = event.getAmount(); + if (!weapon.isEmpty()) { + Holder firstStrike = player.level() + .registryAccess() + .lookupOrThrow(Registries.ENCHANTMENT) + .getOrThrow(EnchantmentsME.FIRST_STRIKE); + if (EnchantmentHelper.getItemEnchantmentLevel(firstStrike, weapon) > 0 + && event.getEntity().getHealth() / event.getEntity().getMaxHealth() > 0.9F) { + amount *= 1.5F; + } + } + + if (weapon.getItem() instanceof CustomDaggerWeaponItem) { + if (CustomDaggerWeaponItem.canBackStab(event.getEntity(), player)) { + amount *= 1.75F; + } + if (CustomDaggerWeaponItem.canSneakAttack(weapon)) { + amount *= 1.5F; + } + } + + event.setAmount(amount); + } + + @SubscribeEvent + public static void addNpcSpawner(ModifyCustomSpawnersEvent event) { + if (ModEntitySpawning.hasSpawns()) { + event.addCustomSpawner(new SpawnerNPCs()); + } + } + + @SubscribeEvent(priority = EventPriority.LOWEST) + public static void handleManagedEntityDeath(LivingDeathEvent event) { + if (event.isCanceled()) { + return; + } + if (event.getEntity() instanceof NpcEntity npc + && npc.getStructureManagerHostPos() != null) { + StructureManagerService.signalManagedEntityDeath( + npc, npc.getStructureManagerHostPos()); + } else { + StructureManagerService.signalManagedEntityDeath(event.getEntity()); + } + } + + @SubscribeEvent + public static void trackManagedEntityJoin(EntityJoinLevelEvent event) { + if (!(event.getLevel() instanceof ServerLevel) + || !(event.getEntity() instanceof LivingEntity living)) { + return; + } + BlockPos managerPos = getManagedEntityManagerPos(living); + if (managerPos != null) { + StructureManagedEntityData.Entry tracked = + StructureManagedEntityData.get((ServerLevel) event.getLevel()) + .get(living.getUUID()); + if (tracked != null && tracked.dead()) { + event.setCanceled(true); + StructureManagerService.clearBoundManager(living); + return; + } + StructureManagerService.bindManagedEntity(living, managerPos); + } + } + + @SubscribeEvent + public static void trackManagedEntityLeave(EntityLeaveLevelEvent event) { + if (!(event.getLevel() instanceof ServerLevel) + || !(event.getEntity() instanceof LivingEntity living)) { + return; + } + BlockPos managerPos = getManagedEntityManagerPos(living); + if (managerPos == null || living.getRemovalReason() == null) { + return; + } + Entity.RemovalReason removalReason = living.getRemovalReason(); + if (removalReason == Entity.RemovalReason.KILLED) { + return; + } + if (removalReason == Entity.RemovalReason.UNLOADED_TO_CHUNK + || removalReason == Entity.RemovalReason.UNLOADED_WITH_PLAYER) { + StructureManagerService.recordManagedEntityPosition(living, managerPos); + } else { + StructureManagerService.signalManagedEntityDeath(living, managerPos); + if (removalReason == Entity.RemovalReason.CHANGED_DIMENSION) { + StructureManagerService.clearBoundManager(living); + } + } + } + + private static BlockPos getManagedEntityManagerPos(LivingEntity entity) { + if (entity instanceof NpcEntity npc + && npc.getStructureManagerHostPos() != null) { + return npc.getStructureManagerHostPos(); + } + return StructureManagerService.getBoundManagerPos(entity); + } + + @SubscribeEvent + public static void advanceOverworldAfterSleep(SleepFinishedTimeEvent event) { + if (!(event.getLevel() instanceof ServerLevel sleepingLevel)) { + return; + } + + ServerLevel overworld = sleepingLevel.getServer().overworld(); + if (sleepingLevel != overworld + && overworld.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) { + long currentTimeOfDay = overworld.getDayTime() + 24000L; + overworld.setDayTime(currentTimeOfDay - currentTimeOfDay % 24000L); + } + } + + @SubscribeEvent + public static void addShovelFlattening(BlockEvent.BlockToolModificationEvent event) { + if (event.getItemAbility() != ItemAbilities.SHOVEL_FLATTEN) { + return; + } + + BlockState state = event.getState(); + if (state.is(ModBlocks.DRY_DIRT) + || state.is(ModBlocks.DIRTY_ROOTS) + || state.is(ModBlocks.GRASSY_DIRT) + || state.is(ModBlocks.TURF)) { + event.setFinalState(Blocks.DIRT_PATH.defaultBlockState()); + } else if (state.is(ModBlocks.CHALKSOIL_GRASS_BLOCK) + || state.is(ModBlocks.CHALKSOIL) + || state.is(ModBlocks.GRASSY_CHALKSOIL) + || state.is(ModBlocks.COARSE_CHALKSOIL)) { + event.setFinalState(ModBlocks.CHALKSOIL_PATH.defaultBlockState()); + } else if (state.is(ModBlocks.LOAM_GRASS_BLOCK) + || state.is(ModBlocks.LOAM) + || state.is(ModBlocks.GRASSY_LOAM) + || state.is(ModBlocks.COARSE_LOAM)) { + event.setFinalState(ModBlocks.LOAM_PATH.defaultBlockState()); + } else if (state.is(ModBlocks.PEAT_GRASS_BLOCK) + || state.is(ModBlocks.PEAT) + || state.is(ModBlocks.GRASSY_PEAT) + || state.is(ModBlocks.COARSE_PEAT)) { + event.setFinalState(ModBlocks.PEAT_PATH.defaultBlockState()); + } else if (state.is(ModBlocks.SILT_GRASS_BLOCK) + || state.is(ModBlocks.SILT) + || state.is(ModBlocks.GRASSY_SILT) + || state.is(ModBlocks.COARSE_SILT)) { + event.setFinalState(ModBlocks.SILT_PATH.defaultBlockState()); + } + } + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/event/PlayerRespawnEvents.java b/middle-earth/src/main/java/net/sevenstars/middleearth/event/PlayerRespawnEvents.java new file mode 100644 index 0000000000..2a32dbca21 --- /dev/null +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/event/PlayerRespawnEvents.java @@ -0,0 +1,84 @@ +package net.sevenstars.middleearth.event; + +import net.minecraft.core.BlockPos; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.level.TicketType; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.portal.DimensionTransition; +import net.minecraft.world.phys.Vec3; +import net.neoforged.bus.api.SubscribeEvent; +import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.event.entity.player.PlayerRespawnPositionEvent; +import net.sevenstars.middleearth.MiddleEarth; +import net.sevenstars.middleearth.resources.datas.factions.data.SpawnData; +import net.sevenstars.middleearth.resources.persistent_datas.PlayerDataService; +import net.sevenstars.middleearth.world.dimension.ModDimensions; + +@EventBusSubscriber(modid = MiddleEarth.NEOFORGE_MOD_ID) +public final class PlayerRespawnEvents { + private PlayerRespawnEvents() { + } + + @SubscribeEvent + public static void useMiddleEarthFactionSpawn(PlayerRespawnPositionEvent event) { + if (!(event.getEntity() instanceof ServerPlayer player) + || !ModDimensions.isInMiddleEarth(player.level())) { + return; + } + + DimensionTransition originalTransition = event.getOriginalDimensionTransition(); + if (!originalTransition.missingRespawnBlock() + && player.getRespawnPosition() != null) { + return; + } + + SpawnData spawnData = PlayerDataService.getPlayerSpawnData(player, player.level()); + if (spawnData == null || spawnData.getIdentifier() == null || spawnData.getCoordinates() == null) { + return; + } + + MinecraftServer server = player.getServer(); + if (server == null) { + return; + } + + ServerLevel middleEarth = server.getLevel(ModDimensions.ME_WORLD_KEY); + if (middleEarth == null) { + return; + } + + BlockPos spawnCoordinates = spawnData.getWorldCoordinateBlockPos(); + var safeTarget = ModDimensions.findSafeMiddleEarthTeleportTarget( + middleEarth, + new Vec3(spawnCoordinates.getX(), spawnCoordinates.getY() + 1, spawnCoordinates.getZ()), + player + ); + if (safeTarget.isEmpty()) { + MiddleEarth.LOGGER.logError("No safe Middle-earth respawn position was found; keeping the original respawn transition."); + return; + } + Vec3 target = safeTarget.get(); + BlockPos targetPos = BlockPos.containing(target); + DimensionTransition transition = event.getDimensionTransition(); + + middleEarth.getChunkSource().addRegionTicket( + TicketType.POST_TELEPORT, + new ChunkPos(targetPos), + 1, + player.getId() + ); + player.setRespawnPosition(ModDimensions.ME_WORLD_KEY, targetPos, transition.yRot(), true, true); + event.setCopyOriginalSpawnPosition(true); + event.setDimensionTransition(new DimensionTransition( + middleEarth, + target, + transition.speed(), + transition.yRot(), + transition.xRot(), + false, + transition.postDimensionTransition() + )); + } +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/ModScreenHandlers.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/ModScreenHandlers.java index aea14015b6..443be3fb29 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/ModScreenHandlers.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/ModScreenHandlers.java @@ -1,6 +1,12 @@ package net.sevenstars.middleearth.gui; -import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerType; +import net.minecraft.core.BlockPos; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.world.flag.FeatureFlags; +import net.minecraft.world.inventory.MenuType; +import net.neoforged.neoforge.common.extensions.IMenuTypeExtension; +import net.sevenstars.api.registries.RegistrationBridge; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.crockpot.CrockpotScreenHandler; import net.sevenstars.middleearth.gui.artisantable.ArtisanTableScreenHandler; @@ -8,42 +14,41 @@ import net.sevenstars.middleearth.gui.shapinganvil.ShapingAnvilScreenHandler; import net.sevenstars.middleearth.gui.structuremanager.StructureManagerScreenHandler; import net.sevenstars.middleearth.gui.wood_pile.WoodPileScreenHandler; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.registry.Registries; -import net.minecraft.registry.Registry; -import net.minecraft.resource.featuretoggle.FeatureFlags; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; import net.sevenstars.middleearth.gui.inscriptiontable.InscriptionTableScreenHandler; import net.sevenstars.middleearth.gui.structuremanager.StructureManagerScreenData; import net.sevenstars.middleearth.gui.structuremanager.structurenest.StructureNestScreenData; import net.sevenstars.middleearth.gui.structuremanager.structurenest.StructureNestScreenHandler; public class ModScreenHandlers { - public static ScreenHandlerType WOOD_PILE_SCREEN_HANDLER - = new ScreenHandlerType<>(WoodPileScreenHandler::new, FeatureFlags.VANILLA_FEATURES); + public static MenuType WOOD_PILE_SCREEN_HANDLER + = new MenuType<>(WoodPileScreenHandler::new, FeatureFlags.VANILLA_SET); - public static final ScreenHandlerType CROCKPOT_SCREEN_HANDLER - = new ExtendedScreenHandlerType<>(CrockpotScreenHandler::new, BlockPos.PACKET_CODEC.cast()); + public static final MenuType CROCKPOT_SCREEN_HANDLER + = IMenuTypeExtension.create((syncId, inventory, buffer) -> + new CrockpotScreenHandler(syncId, inventory, BlockPos.STREAM_CODEC.decode(buffer))); - public static ScreenHandlerType ARTISAN_SCREEN_HANDLER - = new ExtendedScreenHandlerType<>(ArtisanTableScreenHandler::new, PacketCodecs.STRING.cast()); + public static MenuType ARTISAN_SCREEN_HANDLER + = IMenuTypeExtension.create((syncId, inventory, buffer) -> + new ArtisanTableScreenHandler(syncId, inventory, ByteBufCodecs.STRING_UTF8.decode(buffer))); - public static ScreenHandlerType INSCRIPTION_SCREEN_HANDLER - = new ScreenHandlerType<>(InscriptionTableScreenHandler::new, FeatureFlags.VANILLA_FEATURES); + public static MenuType INSCRIPTION_SCREEN_HANDLER + = new MenuType<>(InscriptionTableScreenHandler::new, FeatureFlags.VANILLA_SET); - public static ScreenHandlerType TREATED_ANVIL_SCREEN_HANDLER - = new ExtendedScreenHandlerType<>(ShapingAnvilScreenHandler::new, BlockPos.PACKET_CODEC.cast()); + public static MenuType TREATED_ANVIL_SCREEN_HANDLER + = IMenuTypeExtension.create((syncId, inventory, buffer) -> + new ShapingAnvilScreenHandler(syncId, inventory, BlockPos.STREAM_CODEC.decode(buffer))); - public static final ScreenHandlerType FORGE_ALLOYING_SCREEN_HANDLER - = new ExtendedScreenHandlerType<>(ForgeAlloyingScreenHandler::new, BlockPos.PACKET_CODEC.cast()); + public static final MenuType FORGE_ALLOYING_SCREEN_HANDLER + = IMenuTypeExtension.create((syncId, inventory, buffer) -> + new ForgeAlloyingScreenHandler(syncId, inventory, BlockPos.STREAM_CODEC.decode(buffer))); - public static final ScreenHandlerType STRUCTURE_MANAGER_SCREEN_HANDLER - = new ExtendedScreenHandlerType<>(StructureManagerScreenHandler::new, StructureManagerScreenData.PACKET_CODEC.cast()); + public static final MenuType STRUCTURE_MANAGER_SCREEN_HANDLER + = IMenuTypeExtension.create((syncId, inventory, buffer) -> + new StructureManagerScreenHandler(syncId, inventory, StructureManagerScreenData.PACKET_CODEC.decode(buffer))); - public static final ScreenHandlerType STRUCTURE_NEST_SCREEN_HANDLER - = new ExtendedScreenHandlerType<>(StructureNestScreenHandler::new, StructureNestScreenData.PACKET_CODEC.cast()); + public static final MenuType STRUCTURE_NEST_SCREEN_HANDLER + = IMenuTypeExtension.create((syncId, inventory, buffer) -> + new StructureNestScreenHandler(syncId, inventory, StructureNestScreenData.PACKET_CODEC.decode(buffer))); public static void registerAllScreenHandlers() { @@ -57,7 +62,7 @@ public static void registerAllScreenHandlers() { register("crockpot",CROCKPOT_SCREEN_HANDLER ); } - private static void register(String name, ScreenHandlerType handlerType) { - Registry.register(Registries.SCREEN_HANDLER, Identifier.of(MiddleEarth.MOD_ID, name), handlerType); + private static void register(String name, MenuType handlerType) { + RegistrationBridge.register(BuiltInRegistries.MENU, MiddleEarth.of(name), handlerType); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableScreen.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableScreen.java index 3674d88b8e..f461aef479 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableScreen.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableScreen.java @@ -1,36 +1,33 @@ package net.sevenstars.middleearth.gui.artisantable; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.EquippableComponent; -import net.minecraft.inventory.CraftingResultInventory; +import net.neoforged.neoforge.network.PacketDistributor; + +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.gui.screens.inventory.InventoryScreen; +import net.minecraft.client.resources.sounds.SimpleSoundInstance; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.decoration.ArmorStand; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerListener; +import net.minecraft.world.inventory.ResultContainer; +import net.minecraft.world.item.Equipable; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.item.EquipmentItemsME; import net.sevenstars.middleearth.item.ToolItemsME; import net.sevenstars.middleearth.item.WeaponItemsME; import net.sevenstars.middleearth.network.packets.C2S.ArtisanTableTabPacket; import net.sevenstars.middleearth.recipe.ArtisanRecipe; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.client.gui.screen.ingame.InventoryScreen; -import net.minecraft.client.sound.PositionedSoundInstance; -import net.minecraft.entity.EquipmentSlot; -import net.minecraft.entity.decoration.ArmorStandEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.recipe.RecipeEntry; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerListener; -import net.minecraft.sound.SoundEvents; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.MathHelper; import org.jetbrains.annotations.Nullable; import org.joml.Quaternionf; import org.joml.Vector3f; @@ -39,9 +36,9 @@ import java.util.HashMap; import java.util.List; -@Environment(value= EnvType.CLIENT) -public class ArtisanTableScreen extends HandledScreen implements ScreenHandlerListener { - private static final Identifier TEXTURE = Identifier.of(MiddleEarth.MOD_ID, "textures/gui/artisan_table.png"); +@OnlyIn(Dist.CLIENT) +public class ArtisanTableScreen extends AbstractContainerScreen implements ContainerListener { + private static final ResourceLocation TEXTURE = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "textures/gui/artisan_table.png"); public static final int SLOT_SCALE = 18; public static final int SLOT_OFFSET_X = 12; public static final int SLOT_OFFSET_Y = 15; @@ -55,59 +52,59 @@ public class ArtisanTableScreen extends HandledScreen private static final Vector3f ARMOR_STAND_TRANSLATION = new Vector3f(); private static final Quaternionf ARMOR_STAND_ROTATION = new Quaternionf().rotationXYZ(0.43633232f, 0.0f, (float)Math.PI); - private ArmorStandEntity armorStand; + private ArmorStand armorStand; private final List categories = new ArrayList<>(); private final HashMap> tabs = new HashMap<>(); @Nullable private ArtisanTableTab selectedCategory; private ArtisanTableTab selectedTab; - public ArtisanTableScreen(ArtisanTableScreenHandler handler, PlayerInventory inventory, Text title) { + public ArtisanTableScreen(ArtisanTableScreenHandler handler, Inventory inventory, Component title) { super(handler, inventory, title); - this.backgroundWidth = 232; - this.backgroundHeight = 166; + this.imageWidth = 232; + this.imageHeight = 166; handler.setContentsChangedListener(this::onInventoryChange); int index = 0; - categories.add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.LEFT, index, getTabTranslation("weapons"), WeaponItemsME.GONDORIAN_NOBLE_LONGSWORD.getDefaultStack())); + categories.add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.LEFT, index, getTabTranslation("weapons"), WeaponItemsME.GONDORIAN_NOBLE_LONGSWORD.getDefaultInstance())); tabs.put(index, new ArrayList<>()); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 0, getTabTranslation("sword"), WeaponItemsME.STEEL_SWORD.getDefaultStack(), ArtisanTableInputsShape.SWORD)); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 1, getTabTranslation("axe"), ToolItemsME.STEEL_AXE.getDefaultStack(), ArtisanTableInputsShape.AXE)); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 2, getTabTranslation("spear"), WeaponItemsME.STEEL_SPEAR.getDefaultStack(), ArtisanTableInputsShape.SPEAR)); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 3, getTabTranslation("bow"), WeaponItemsME.GONDORIAN_BOW.getDefaultStack(), ArtisanTableInputsShape.BOW)); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 4, getTabTranslation("crossbow"), Items.CROSSBOW.getDefaultStack(), ArtisanTableInputsShape.CROSSBOW)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 0, getTabTranslation("sword"), WeaponItemsME.STEEL_SWORD.getDefaultInstance(), ArtisanTableInputsShape.SWORD)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 1, getTabTranslation("axe"), ToolItemsME.STEEL_AXE.getDefaultInstance(), ArtisanTableInputsShape.AXE)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 2, getTabTranslation("spear"), WeaponItemsME.STEEL_SPEAR.getDefaultInstance(), ArtisanTableInputsShape.SPEAR)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 3, getTabTranslation("bow"), WeaponItemsME.GONDORIAN_BOW.getDefaultInstance(), ArtisanTableInputsShape.BOW)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 4, getTabTranslation("crossbow"), Items.CROSSBOW.getDefaultInstance(), ArtisanTableInputsShape.CROSSBOW)); index++; - categories.add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.LEFT, index, getTabTranslation("tools"), ToolItemsME.MITHRIL_PICKAXE.getDefaultStack())); + categories.add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.LEFT, index, getTabTranslation("tools"), ToolItemsME.MITHRIL_PICKAXE.getDefaultInstance())); tabs.put(index, new ArrayList<>()); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 0, getTabTranslation("pickaxe"), ToolItemsME.STEEL_PICKAXE.getDefaultStack(), ArtisanTableInputsShape.PICKAXE)); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 1, getTabTranslation("shovel"), ToolItemsME.STEEL_SHOVEL.getDefaultStack(), ArtisanTableInputsShape.SHOVEL)); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 2, getTabTranslation("hoe"), ToolItemsME.STEEL_HOE.getDefaultStack(), ArtisanTableInputsShape.HOE)); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 3, getTabTranslation("chisel"), ToolItemsME.STEEL_CHISEL.getDefaultStack(), ArtisanTableInputsShape.CHISEL)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 0, getTabTranslation("pickaxe"), ToolItemsME.STEEL_PICKAXE.getDefaultInstance(), ArtisanTableInputsShape.PICKAXE)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 1, getTabTranslation("shovel"), ToolItemsME.STEEL_SHOVEL.getDefaultInstance(), ArtisanTableInputsShape.SHOVEL)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 2, getTabTranslation("hoe"), ToolItemsME.STEEL_HOE.getDefaultInstance(), ArtisanTableInputsShape.HOE)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 3, getTabTranslation("chisel"), ToolItemsME.STEEL_CHISEL.getDefaultInstance(), ArtisanTableInputsShape.CHISEL)); index++; - categories.add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.LEFT, index, getTabTranslation("armors"), EquipmentItemsME.GONDORIAN_FOUNTAIN_GUARD_CHESTPLATE.getDefaultStack())); + categories.add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.LEFT, index, getTabTranslation("armors"), EquipmentItemsME.GONDORIAN_FOUNTAIN_GUARD_CHESTPLATE.getDefaultInstance())); tabs.put(index, new ArrayList<>()); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 0, getTabTranslation("helmet"), EquipmentItemsME.RAVENHILL_WATCHWARDEN_HELMET.getDefaultStack(), ArtisanTableInputsShape.HELMET)); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 1, getTabTranslation("chestplate"), EquipmentItemsME.RAVENHILL_WATCHWARDEN_CHESTPLATE.getDefaultStack(), ArtisanTableInputsShape.CHESTPLATE)); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 2, getTabTranslation("leggings"), EquipmentItemsME.RAVENHILL_WATCHWARDEN_LEGGINGS.getDefaultStack(), ArtisanTableInputsShape.LEGGINGS)); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 3, getTabTranslation("boots"), EquipmentItemsME.RAVENHILL_WATCHWARDEN_BOOTS.getDefaultStack(), ArtisanTableInputsShape.BOOTS)); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 4, getTabTranslation("mount_armor"), EquipmentItemsME.ROHIRRIC_HORSE_ARMOR.getDefaultStack(), ArtisanTableInputsShape.MOUNT_ARMOR)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 0, getTabTranslation("helmet"), EquipmentItemsME.RAVENHILL_WATCHWARDEN_HELMET.getDefaultInstance(), ArtisanTableInputsShape.HELMET)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 1, getTabTranslation("chestplate"), EquipmentItemsME.RAVENHILL_WATCHWARDEN_CHESTPLATE.getDefaultInstance(), ArtisanTableInputsShape.CHESTPLATE)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 2, getTabTranslation("leggings"), EquipmentItemsME.RAVENHILL_WATCHWARDEN_LEGGINGS.getDefaultInstance(), ArtisanTableInputsShape.LEGGINGS)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 3, getTabTranslation("boots"), EquipmentItemsME.RAVENHILL_WATCHWARDEN_BOOTS.getDefaultInstance(), ArtisanTableInputsShape.BOOTS)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 4, getTabTranslation("mount_armor"), EquipmentItemsME.ROHIRRIC_HORSE_ARMOR.getDefaultInstance(), ArtisanTableInputsShape.MOUNT_ARMOR)); index++; - categories.add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.LEFT, index, getTabTranslation("shields"), Items.SHIELD.getDefaultStack())); + categories.add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.LEFT, index, getTabTranslation("shields"), Items.SHIELD.getDefaultInstance())); tabs.put(index, new ArrayList<>()); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 0, getTabTranslation("light_shield"), WeaponItemsME.GUNDABAD_WOODEN_SHIELD.getDefaultStack(), ArtisanTableInputsShape.LIGHT_SHIELD)); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 1, getTabTranslation("medium_shield"), WeaponItemsME.ROUND_SHIELD.getDefaultStack(), ArtisanTableInputsShape.MEDIUM_SHIELD)); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 2, getTabTranslation("heavy_shield"), WeaponItemsME.URUK_HAI_WHITE_HAND_SHIELD.getDefaultStack(), ArtisanTableInputsShape.HEAVY_SHIELD)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 0, getTabTranslation("light_shield"), WeaponItemsME.GUNDABAD_WOODEN_SHIELD.getDefaultInstance(), ArtisanTableInputsShape.LIGHT_SHIELD)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 1, getTabTranslation("medium_shield"), WeaponItemsME.ROUND_SHIELD.getDefaultInstance(), ArtisanTableInputsShape.MEDIUM_SHIELD)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 2, getTabTranslation("heavy_shield"), WeaponItemsME.URUK_HAI_WHITE_HAND_SHIELD.getDefaultInstance(), ArtisanTableInputsShape.HEAVY_SHIELD)); index++; - categories.add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.LEFT, index, getTabTranslation("misc"), EquipmentItemsME.STRAW_HAT.getDefaultStack())); + categories.add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.LEFT, index, getTabTranslation("misc"), EquipmentItemsME.STRAW_HAT.getDefaultInstance())); tabs.put(index, new ArrayList<>()); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 0, getTabTranslation("hat"), EquipmentItemsME.STRAW_HAT.getDefaultStack(), ArtisanTableInputsShape.HAT)); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 1, getTabTranslation("helmet_attachment"), EquipmentItemsME.HOOD.getDefaultStack(), ArtisanTableInputsShape.HELMET_ATTACHMENT)); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 2, getTabTranslation("back_attachment"), EquipmentItemsME.CAPE.getDefaultStack(), ArtisanTableInputsShape.BACK_ATTACHMENT)); - tabs.get(index).add(new ArtisanTableTab(this.client, this, ArtisanTableTabType.ABOVE, 3, getTabTranslation("pipe"), ToolItemsME.CLAY_PIPE.getDefaultStack(), ArtisanTableInputsShape.PIPE)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 0, getTabTranslation("hat"), EquipmentItemsME.STRAW_HAT.getDefaultInstance(), ArtisanTableInputsShape.HAT)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 1, getTabTranslation("helmet_attachment"), EquipmentItemsME.HOOD.getDefaultInstance(), ArtisanTableInputsShape.HELMET_ATTACHMENT)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 2, getTabTranslation("back_attachment"), EquipmentItemsME.CAPE.getDefaultInstance(), ArtisanTableInputsShape.BACK_ATTACHMENT)); + tabs.get(index).add(new ArtisanTableTab(this.minecraft, this, ArtisanTableTabType.ABOVE, 3, getTabTranslation("pipe"), ToolItemsME.CLAY_PIPE.getDefaultInstance(), ArtisanTableInputsShape.PIPE)); index++; selectedCategory = categories.getFirst(); @@ -117,45 +114,45 @@ public ArtisanTableScreen(ArtisanTableScreenHandler handler, PlayerInventory inv @Override protected void init() { super.init(); - titleX = (backgroundWidth - textRenderer.getWidth(title)) / 2; - titleY -= 1; + titleLabelX = (imageWidth - font.width(title)) / 2; + titleLabelY -= 1; - (this.handler).addListener(this); + (this.menu).addSlotListener(this); changeTab(); - this.armorStand = new ArmorStandEntity(this.client.world, 0.0, 0.0, 0.0); - this.armorStand.setHideBasePlate(true); + this.armorStand = new ArmorStand(this.minecraft.level, 0.0, 0.0, 0.0); + this.armorStand.setNoBasePlate(true); this.armorStand.setShowArms(true); - this.armorStand.bodyYaw = 210.0f; - this.armorStand.setPitch(25.0f); - this.armorStand.headYaw = this.armorStand.getYaw(); - this.armorStand.lastHeadYaw = this.armorStand.getYaw(); - this.equipArmorStand((this.handler).getSlot(9).getStack()); + this.armorStand.yBodyRot = 210.0f; + this.armorStand.setXRot(25.0f); + this.armorStand.yHeadRot = this.armorStand.getYRot(); + this.armorStand.yHeadRotO = this.armorStand.getYRot(); + this.equipArmorStand((this.menu).getSlot(9).getItem()); } @Override - public void onSlotUpdate(ScreenHandler handler, int slotId, ItemStack stack) { + public void slotChanged(AbstractContainerMenu handler, int slotId, ItemStack stack) { if (slotId == 9) { this.equipArmorStand(stack); } } @Override - public void onPropertyUpdate(ScreenHandler handler, int property, int value) { + public void dataChanged(AbstractContainerMenu handler, int property, int value) { } private boolean canCraft() { - return !handler.getAvailableOutputs().isEmpty(); + return !menu.getAvailableOutputs().isEmpty(); } @Override - protected void handledScreenTick() { - super.handledScreenTick(); - CraftingResultInventory resultInventory = this.handler.output; - if(resultInventory != null && resultInventory.getStack(0) != ItemStack.EMPTY) { - equipArmorStand(resultInventory.getStack(0)); + protected void containerTick() { + super.containerTick(); + ResultContainer resultInventory = this.menu.output; + if(resultInventory != null && resultInventory.getItem(0) != ItemStack.EMPTY) { + equipArmorStand(resultInventory.getItem(0)); } } @@ -164,48 +161,46 @@ public void equipArmorStand(ItemStack stack) { return; } for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) { - this.armorStand.equipStack(equipmentSlot, ItemStack.EMPTY); + this.armorStand.setItemSlot(equipmentSlot, ItemStack.EMPTY); } if (!stack.isEmpty()) { ItemStack itemStack = stack.copy(); - Item item = stack.getItem(); - if (itemStack.getComponents().contains(DataComponentTypes.EQUIPPABLE)) { - EquippableComponent equippableComponent = (EquippableComponent)stack.get(DataComponentTypes.EQUIPPABLE); - EquipmentSlot equipmentSlot = equippableComponent != null ? equippableComponent.slot() : EquipmentSlot.OFFHAND; - this.armorStand.equipStack(equipmentSlot, stack.copy()); + Equipable equipable = Equipable.get(itemStack); + if (equipable != null) { + this.armorStand.setItemSlot(equipable.getEquipmentSlot(), itemStack); } else { - this.armorStand.equipStack(EquipmentSlot.OFFHAND, itemStack); + this.armorStand.setItemSlot(EquipmentSlot.OFFHAND, itemStack); } } } @Override - protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) { - int i = this.x; - int j = this.y; - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, x, y, 0, 0, backgroundWidth, backgroundHeight, 256, 256); + protected void renderBg(GuiGraphics context, float delta, int mouseX, int mouseY) { + int i = this.leftPos; + int j = this.topPos; + context.blit(TEXTURE, leftPos, topPos, 0, 0, imageWidth, imageHeight, 256, 256); int k = (int)(41.0F * this.scrollAmount); - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, i + 143, j + 15 + k, 232 + (this.shouldScroll() ? 0 : 12), 0, 12, 15, 256, 256); + context.blit(TEXTURE, i + 143, j + 15 + k, 232 + (this.shouldScroll() ? 0 : 12), 0, 12, 15, 256, 256); - int l = this.x + 76; - int m = this.y + 14; + int l = this.leftPos + 76; + int m = this.topPos + 14; int n = this.scrollOffset + 12; ArtisanTableInputsShape shape = selectedTab.getInputShape(); for(int w = 0; w < 3; w++) { for(int z = 0; z < 3; z++) { - if(handler.slots.get(w*3 + z).isEnabled()) { - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE,x + SLOT_OFFSET_X + SLOT_SCALE*z,y + SLOT_OFFSET_Y + SLOT_SCALE*w, 232, 15, SLOT_SCALE, SLOT_SCALE, 256, 256); + if(menu.slots.get(w*3 + z).isActive()) { + context.blit(TEXTURE,leftPos + SLOT_OFFSET_X + SLOT_SCALE*z,topPos + SLOT_OFFSET_Y + SLOT_SCALE*w, 232, 15, SLOT_SCALE, SLOT_SCALE, 256, 256); InputType inputType = shape.getInputType(z, w); - if(!handler.slots.get(w*3 + z).hasStack()) { + if(!menu.slots.get(w*3 + z).hasItem()) { switch (inputType){ - case HANDLE -> context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE,x + SPRITE_OFFSET_X + SLOT_SCALE*z,y + SPRITE_OFFSET_Y + SLOT_SCALE*w, 232, 87, 16, 16, 256, 256); - case HILT -> context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE,x + SPRITE_OFFSET_X + SLOT_SCALE*z,y + SPRITE_OFFSET_Y + SLOT_SCALE*w, 232, 103, 16, 16, 256, 256); - case BLADE -> context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE,x + SPRITE_OFFSET_X + SLOT_SCALE*z,y + SPRITE_OFFSET_Y + SLOT_SCALE*w, 232, 119, 16, 16, 256, 256); - case AXE -> context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE,x + SPRITE_OFFSET_X + SLOT_SCALE*z,y + SPRITE_OFFSET_Y + SLOT_SCALE*w, 232, 135, 16, 16, 256, 256); - case PICKAXE -> context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE,x + SPRITE_OFFSET_X + SLOT_SCALE*z,y + SPRITE_OFFSET_Y + SLOT_SCALE*w, 232, 151, 16, 16, 256, 256); - case SHOVEL -> context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE,x + SPRITE_OFFSET_X + SLOT_SCALE*z,y + SPRITE_OFFSET_Y + SLOT_SCALE*w, 232, 167, 16, 16, 256, 256); - case HOE -> context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE,x + SPRITE_OFFSET_X + SLOT_SCALE*z,y + SPRITE_OFFSET_Y + SLOT_SCALE*w, 232, 183, 16, 16, 256, 256); + case HANDLE -> context.blit(TEXTURE,leftPos + SPRITE_OFFSET_X + SLOT_SCALE*z,topPos + SPRITE_OFFSET_Y + SLOT_SCALE*w, 232, 87, 16, 16, 256, 256); + case HILT -> context.blit(TEXTURE,leftPos + SPRITE_OFFSET_X + SLOT_SCALE*z,topPos + SPRITE_OFFSET_Y + SLOT_SCALE*w, 232, 103, 16, 16, 256, 256); + case BLADE -> context.blit(TEXTURE,leftPos + SPRITE_OFFSET_X + SLOT_SCALE*z,topPos + SPRITE_OFFSET_Y + SLOT_SCALE*w, 232, 119, 16, 16, 256, 256); + case AXE -> context.blit(TEXTURE,leftPos + SPRITE_OFFSET_X + SLOT_SCALE*z,topPos + SPRITE_OFFSET_Y + SLOT_SCALE*w, 232, 135, 16, 16, 256, 256); + case PICKAXE -> context.blit(TEXTURE,leftPos + SPRITE_OFFSET_X + SLOT_SCALE*z,topPos + SPRITE_OFFSET_Y + SLOT_SCALE*w, 232, 151, 16, 16, 256, 256); + case SHOVEL -> context.blit(TEXTURE,leftPos + SPRITE_OFFSET_X + SLOT_SCALE*z,topPos + SPRITE_OFFSET_Y + SLOT_SCALE*w, 232, 167, 16, 16, 256, 256); + case HOE -> context.blit(TEXTURE,leftPos + SPRITE_OFFSET_X + SLOT_SCALE*z,topPos + SPRITE_OFFSET_Y + SLOT_SCALE*w, 232, 183, 16, 16, 256, 256); } } } @@ -214,81 +209,88 @@ protected void drawBackground(DrawContext context, float delta, int mouseX, int this.renderRecipeBackground(context, mouseX, mouseY, l, m, n); this.renderRecipeIcons(context, l, m, n); - InventoryScreen.drawEntity(context, i, j, this.x + 412, this.y + 128, 27.5F, ARMOR_STAND_TRANSLATION, ARMOR_STAND_ROTATION, (Quaternionf)null, this.armorStand); + InventoryScreen.renderEntityInInventory( + context, + this.leftPos + 206, + this.topPos + 128, + 27.5F, + ARMOR_STAND_TRANSLATION, + ARMOR_STAND_ROTATION, + null, + this.armorStand + ); } @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) { - renderBackground(context, mouseX, mouseY, delta); - + public void render(GuiGraphics context, int mouseX, int mouseY, float delta) { super.render(context, mouseX, mouseY, delta); for (ArtisanTableTab category : this.categories) { - category.drawBackground(context, x, y + 3, category == this.selectedCategory); - category.drawIcon(context, x, y + 3); + category.drawBackground(context, leftPos, topPos + 3, category == this.selectedCategory); + category.drawIcon(context, leftPos, topPos + 3); } for (ArtisanTableTab tab : this.tabs.get(selectedCategory.getIndex())) { - tab.drawBackground(context, x + 3, y, tab == this.selectedTab); - tab.drawIcon(context, x + 3, y); + tab.drawBackground(context, leftPos + 3, topPos, tab == this.selectedTab); + tab.drawIcon(context, leftPos + 3, topPos); } for (ArtisanTableTab category : this.categories) { - if (category.isClickOnTab(x, y + 3, mouseX, mouseY)) continue; - context.drawTooltip(this.textRenderer, category.getTitle(), mouseX, mouseY); + if (category.isClickOnTab(leftPos, topPos + 3, mouseX, mouseY)) continue; + context.renderTooltip(this.font, category.getTitle(), mouseX, mouseY); } for (ArtisanTableTab tab : this.tabs.get(selectedCategory.getIndex())) { - if (tab.isClickOnTab(x + 3, y, mouseX, mouseY)) continue; - context.drawTooltip(this.textRenderer, tab.getTitle(), mouseX, mouseY); + if (tab.isClickOnTab(leftPos + 3, topPos, mouseX, mouseY)) continue; + context.renderTooltip(this.font, tab.getTitle(), mouseX, mouseY); } - drawMouseoverTooltip(context, mouseX, mouseY); + renderTooltip(context, mouseX, mouseY); } - protected void drawMouseoverTooltip(DrawContext context, int x, int y) { - super.drawMouseoverTooltip(context, x, y); + protected void renderTooltip(GuiGraphics context, int x, int y) { + super.renderTooltip(context, x, y); if (canCraft()) { - int i = this.x + 76; - int j = this.y + 14; + int i = this.leftPos + 76; + int j = this.topPos + 14; int k = this.scrollOffset + 12; - List list = (this.handler).getAvailableOutputs(); + List list = (this.menu).getAvailableOutputs(); - for(int l = this.scrollOffset; l < k && l < (this.handler).getAvailableOutputs().size(); ++l) { + for(int l = this.scrollOffset; l < k && l < (this.menu).getAvailableOutputs().size(); ++l) { int m = l - this.scrollOffset; int n = i + m % 4 * 16; int o = j + m / 4 * 18 + 2; if (x >= n && x < n + 16 && y >= o && y < o + 18) { - context.drawItemTooltip(this.textRenderer, list.get(l), x, y); + context.renderTooltip(this.font, list.get(l), x, y); } } } } - private void renderRecipeBackground(DrawContext context, int mouseX, int mouseY, int x, int y, int scrollOffset) { - for(int i = this.scrollOffset; i < scrollOffset && i < ((ArtisanTableScreenHandler)this.handler).getAvailableOutputs().size(); ++i) { + private void renderRecipeBackground(GuiGraphics context, int mouseX, int mouseY, int x, int y, int scrollOffset) { + for(int i = this.scrollOffset; i < scrollOffset && i < ((ArtisanTableScreenHandler)this.menu).getAvailableOutputs().size(); ++i) { int j = i - this.scrollOffset; int k = x + j % 4 * 16; int l = j / 4; int m = y + l * 18 + 2; - int n = this.backgroundHeight; - if (i == (this.handler).getSelectedRecipe()) { + int n = this.imageHeight; + if (i == (this.menu).getSelectedRecipe()) { n += 18; } else if (mouseX >= k && mouseY >= m && mouseX < k + 16 && mouseY < m + 18) { n += 36; } - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, k, m - 1, 0, n, 16, 18, 256,256); + context.blit(TEXTURE, k, m - 1, 0, n, 16, 18, 256,256); } } - private void renderRecipeIcons(DrawContext context, int x, int y, int scrollOffset) { - List list = this.handler.getAvailableOutputs(); - for (int i = this.scrollOffset; i < scrollOffset && i < (this.handler).getAvailableOutputs().size(); ++i) { + private void renderRecipeIcons(GuiGraphics context, int x, int y, int scrollOffset) { + List list = this.menu.getAvailableOutputs(); + for (int i = this.scrollOffset; i < scrollOffset && i < (this.menu).getAvailableOutputs().size(); ++i) { int j = i - this.scrollOffset; int k = x + j % 4 * 16; int l = j / 4; int m = y + l * 18 + 2; - context.drawItem(list.get(i), k, m); + context.renderItem(list.get(i), k, m); } } @@ -297,39 +299,39 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { this.mouseClicked = false; if (button == 0) { for (ArtisanTableTab category : this.categories) { - if (category.isClickOnTab(x, y, mouseX, mouseY)) continue; + if (category.isClickOnTab(leftPos, topPos, mouseX, mouseY)) continue; this.selectedCategory = category; selectedTab = tabs.get(selectedCategory.getIndex()).getFirst(); - MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); changeTab(); break; } for (ArtisanTableTab tab : tabs.get(selectedCategory.getIndex())) { - if (tab.isClickOnTab(x, y, mouseX, mouseY)) continue; + if (tab.isClickOnTab(leftPos, topPos, mouseX, mouseY)) continue; this.selectedTab = tab; - MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); changeTab(); break; } } if (canCraft()) { - int i = this.x + 76; - int j = this.y + 14; + int i = this.leftPos + 76; + int j = this.topPos + 14; int k = this.scrollOffset + 12; for(int l = this.scrollOffset; l < k; ++l) { int m = l - this.scrollOffset; double d = mouseX - (double)(i + m % 4 * 16); double e = mouseY - (double)(j + m / 4 * 18); - if (d >= 0.0 && e >= 0.0 && d < 16.0 && e < 18.0 && (this.handler).onButtonClick(this.client.player, l)) { - MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F)); - this.handler.setSelectedRecipe(l); + if (d >= 0.0 && e >= 0.0 && d < 16.0 && e < 18.0 && (this.menu).clickMenuButton(this.minecraft.player, l)) { + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + this.menu.setSelectedRecipe(l); return true; } } - i = this.x + 119; - j = this.y + 9; + i = this.leftPos + 119; + j = this.topPos + 9; if (mouseX >= (double)i && mouseX < (double)(i + 12) && mouseY >= (double)j && mouseY < (double)(j + 54)) { this.mouseClicked = true; } @@ -340,10 +342,10 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) { if (this.mouseClicked && this.shouldScroll()) { - int i = this.y + 14; + int i = this.topPos + 14; int j = i + 54; this.scrollAmount = ((float)mouseY - (float)i - 7.5F) / ((float)(j - i) - 15.0F); - this.scrollAmount = MathHelper.clamp(this.scrollAmount, 0.0F, 1.0F); + this.scrollAmount = Mth.clamp(this.scrollAmount, 0.0F, 1.0F); this.scrollOffset = (int)((double)(this.scrollAmount * (float)this.getMaxScroll()) + 0.5) * 4; return true; } else { @@ -356,7 +358,7 @@ public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmou if (this.shouldScroll()) { int i = this.getMaxScroll(); float f = (float)verticalAmount / (float)i; - this.scrollAmount = MathHelper.clamp(this.scrollAmount - f, 0.0F, 1.0F); + this.scrollAmount = Mth.clamp(this.scrollAmount - f, 0.0F, 1.0F); this.scrollOffset = (int)((double)(this.scrollAmount * (float)i) + 0.5) * 4; } @@ -364,11 +366,11 @@ public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmou } private boolean shouldScroll() { - return canCraft() && this.handler.getAvailableOutputs().size() > 12; + return canCraft() && this.menu.getAvailableOutputs().size() > 12; } protected int getMaxScroll() { - return (this.handler.getAvailableOutputs().size() + 4 - 1) / 4 - 3; + return (this.menu.getAvailableOutputs().size() + 4 - 1) / 4 - 3; } private void onInventoryChange() { @@ -379,11 +381,11 @@ private void onInventoryChange() { } private void changeTab() { - handler.changeTab(selectedTab.getInputShape().getId()); - ClientPlayNetworking.send(new ArtisanTableTabPacket(selectedTab.getInputShape().getId(), handler.syncId)); + menu.changeTab(selectedTab.getInputShape().getId()); + PacketDistributor.sendToServer(new ArtisanTableTabPacket(selectedTab.getInputShape().getId(), menu.containerId)); } - private static Text getTabTranslation(String tab) { - return Text.translatable("screen." + MiddleEarth.MOD_ID + ".artisan_table." + tab); + private static Component getTabTranslation(String tab) { + return Component.translatable("screen." + MiddleEarth.MOD_ID + ".artisan_table." + tab); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableScreenHandler.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableScreenHandler.java index 05bda8adf5..11067683fa 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableScreenHandler.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableScreenHandler.java @@ -1,15 +1,28 @@ package net.sevenstars.middleearth.gui.artisantable; +import net.neoforged.neoforge.network.PacketDistributor; + import com.google.common.collect.Lists; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; -import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; -import net.minecraft.entity.ExperienceOrbEntity; -import net.minecraft.recipe.ServerRecipeManager; -import net.minecraft.screen.*; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.WorldEvents; +import net.minecraft.core.BlockPos; +import net.minecraft.core.component.DataComponents; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.sounds.SoundSource; +import net.minecraft.world.Container; +import net.minecraft.world.SimpleContainer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerLevelAccess; +import net.minecraft.world.inventory.DataSlot; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.inventory.ResultContainer; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import net.sevenstars.middleearth.block.special.forge.MultipleStackRecipeInput; import net.sevenstars.middleearth.gui.ModScreenHandlers; @@ -20,59 +33,53 @@ import net.sevenstars.middleearth.recipe.ArtisanRecipe; import net.sevenstars.middleearth.recipe.RecipesME; import net.sevenstars.middleearth.resources.datas.common.DispositionType; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.CraftingResultInventory; -import net.minecraft.inventory.Inventory; -import net.minecraft.inventory.SimpleInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.RecipeEntry; -import net.minecraft.screen.slot.Slot; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvents; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; -public class ArtisanTableScreenHandler extends ScreenHandler { - private final ScreenHandlerContext context; - private final Property selectedRecipe; - private final Property recipesSize; - private final World world; - private List> availableRecipes; +public class ArtisanTableScreenHandler extends AbstractContainerMenu { + private final ContainerLevelAccess context; + private final DataSlot selectedRecipe; + private final DataSlot recipesSize; + private final Level world; + private List> availableRecipes; private List outputs; private ItemStack inputStack; long lastTakeTime; private ArtisanTableSlot[][] inputSlots; final Slot outputSlot; Runnable contentsChangedListener; - public final Inventory input; - final CraftingResultInventory output; - private PlayerEntity playerEntity; + public final Container input; + final ResultContainer output; + private Player playerEntity; private ArtisanTableInputsShape inputsShape = null; private int xp = 0; private String disposition; private boolean isCreative; - public ArtisanTableScreenHandler(int syncId, PlayerInventory playerInventory, String disposition) { - this(syncId, playerInventory, ScreenHandlerContext.EMPTY); + public ArtisanTableScreenHandler(int syncId, Inventory playerInventory, String disposition) { + this(syncId, playerInventory, ContainerLevelAccess.NULL); + applyOpeningData(disposition); + } + + public ArtisanTableScreenHandler(int syncId, Inventory playerInventory, + ContainerLevelAccess context, String disposition) { + this(syncId, playerInventory, context); + applyOpeningData(disposition); + } - String[] splited = disposition.split("/"); - this.disposition = splited[0]; - this.isCreative = Boolean.parseBoolean(splited[1]); + private void applyOpeningData(String openingData) { + String[] values = openingData.split("/", 2); + this.disposition = values.length > 0 && !values[0].isBlank() ? values[0] : "neutral"; + this.isCreative = values.length > 1 && Boolean.parseBoolean(values[1]); } - public ArtisanTableScreenHandler(int syncId, PlayerInventory playerInventory, final ScreenHandlerContext context) { + public ArtisanTableScreenHandler(int syncId, Inventory playerInventory, final ContainerLevelAccess context) { super(ModScreenHandlers.ARTISAN_SCREEN_HANDLER, syncId); - this.selectedRecipe = Property.create(); - this.recipesSize = Property.create(); + this.selectedRecipe = DataSlot.standalone(); + this.recipesSize = DataSlot.standalone(); this.availableRecipes = Lists.newArrayList(); this.outputs = new ArrayList<>(); this.inputStack = ItemStack.EMPTY; @@ -82,17 +89,17 @@ public ArtisanTableScreenHandler(int syncId, PlayerInventory playerInventory, fi this.disposition = "neutral"; this.isCreative = false; - this.input = new SimpleInventory(9) { - public void markDirty() { - super.markDirty(); + this.input = new SimpleContainer(9) { + public void setChanged() { + super.setChanged(); outputs.clear(); - ArtisanTableScreenHandler.this.onContentChanged(this); + ArtisanTableScreenHandler.this.slotsChanged(this); ArtisanTableScreenHandler.this.contentsChangedListener.run(); } }; - this.output = new CraftingResultInventory(); + this.output = new ResultContainer(); this.context = context; - this.world = playerInventory.player.getWorld(); + this.world = playerInventory.player.level(); inputSlots = new ArtisanTableSlot[3][3]; int index = 0; @@ -104,22 +111,22 @@ public void markDirty() { this.outputSlot = this.addSlot(new Slot(this.output, 9, 165, 33) { @Override - public boolean canInsert(ItemStack stack) { + public boolean mayPlace(ItemStack stack) { return false; } @Override - public void onTakeItem(PlayerEntity player, ItemStack itemStack) { - itemStack.onCraftByPlayer(player, itemStack.getCount()); - ArtisanTableScreenHandler.this.output.unlockLastRecipe(player, this.getInputStacks()); - player.addExperience(getExperience(world)); + public void onTake(Player player, ItemStack itemStack) { + itemStack.onCraftedBy(world, player, itemStack.getCount()); + ArtisanTableScreenHandler.this.output.awardUsedRecipes(player, this.getInputStacks()); + player.giveExperiencePoints(getExperience(world)); ArtisanTableScreenHandler.this.xp = 0; for(int y = 0; y < 3; y++) { for(int x = 0; x < 3; x++) { ArtisanTableSlot slot = inputSlots[y][x]; - if(x == 0 && y == 0) itemStack = slot.takeStack(1); - else slot.takeStack(1); + if(x == 0 && y == 0) itemStack = slot.remove(1); + else slot.remove(1); } } @@ -127,18 +134,18 @@ public void onTakeItem(PlayerEntity player, ItemStack itemStack) { ArtisanTableScreenHandler.this.populateResult(player); } - long l = world.getTime(); + long l = world.getGameTime(); if (ArtisanTableScreenHandler.this.lastTakeTime != l) { - world.playSound(null, (BlockPos)player.getBlockPos(), SoundEvents.ENTITY_VILLAGER_WORK_TOOLSMITH, SoundCategory.BLOCKS, 1.0f, 1.0f); + world.playSound(null, (BlockPos)player.blockPosition(), SoundEvents.VILLAGER_WORK_TOOLSMITH, SoundSource.BLOCKS, 1.0f, 1.0f); ArtisanTableScreenHandler.this.lastTakeTime = l; } - super.onTakeItem(player, itemStack); + super.onTake(player, itemStack); } private List getInputStacks() { return Arrays.stream(inputSlots) - .flatMap(slots -> Arrays.stream(slots).map(Slot::getStack)) + .flatMap(slots -> Arrays.stream(slots).map(Slot::getItem)) .collect(Collectors.toList()); } }); @@ -146,14 +153,14 @@ private List getInputStacks() { addPlayerInventory(playerInventory); addPlayerHotbar(playerInventory); - this.addProperty(this.selectedRecipe); + this.addDataSlot(this.selectedRecipe); } public int getSelectedRecipe() { return this.selectedRecipe.get(); } - public List> getAvailableRecipes() { + public List> getAvailableRecipes() { return this.availableRecipes; } @@ -177,11 +184,11 @@ public void addRecipeOutput(int index, ItemStack itemStack) { public void setSelectedRecipe(int index) { selectedRecipe.set(index); - ArtisanIndexPacket anvilIndexPacket = new ArtisanIndexPacket(index, this.syncId); - ClientPlayNetworking.send(anvilIndexPacket); + ArtisanIndexPacket anvilIndexPacket = new ArtisanIndexPacket(index, this.containerId); + PacketDistributor.sendToServer(anvilIndexPacket); } - private int getExperience(World world) { + private int getExperience(Level world) { return ArtisanTableScreenHandler.this.xp; } @@ -193,12 +200,12 @@ public boolean canCraft() { return !this.availableRecipes.isEmpty(); } - public boolean canUse(PlayerEntity player) { + public boolean stillValid(Player player) { this.playerEntity = player; - return canUse(this.context, player, ModDecorativeBlocks.ARTISAN_TABLE); + return stillValid(this.context, player, ModDecorativeBlocks.ARTISAN_TABLE); } - public boolean onButtonClick(PlayerEntity player, int id) { + public boolean clickMenuButton(Player player, int id) { this.playerEntity = player; if (this.isInBounds(id)) { this.selectedRecipe.set(id); @@ -208,15 +215,15 @@ public boolean onButtonClick(PlayerEntity player, int id) { } private boolean isInBounds(int id) { - if(this.playerEntity.getWorld().isClient()) { + if(this.playerEntity.level().isClientSide()) { return id >= 0 && id < this.outputs.size(); } else { return id >= 0 && id < this.availableRecipes.size(); } } - public void onContentChanged(Inventory inventory) { - ItemStack itemStack = this.inputSlots[0][0].getStack(); + public void slotsChanged(Container inventory) { + ItemStack itemStack = this.inputSlots[0][0].getItem(); this.inputStack = itemStack.copy(); this.updateInput(inventory); } @@ -228,8 +235,8 @@ public void updateIndex(int index){ public void changeTab(String shapeId) { if(playerEntity != null) { - this.dropInventory(this.playerEntity, this.input); - this.outputSlot.setStack(ItemStack.EMPTY); + this.clearContainer(this.playerEntity, this.input); + this.outputSlot.setByPlayer(ItemStack.EMPTY); } ArtisanTableInputsShape inputsShape = ArtisanTableInputsShape.getShape(shapeId); @@ -247,29 +254,33 @@ public void changeTab(String shapeId) { } } - private void updateInput(Inventory inventory) { + private void updateInput(Container inventory) { String currentCategory = this.inputsShape.getId(); if(currentCategory == null) return; List inputs = new ArrayList<>(); - for (int i = 0; i < inventory.size(); i++) { + for (int i = 0; i < inventory.getContainerSize(); i++) { ArtisanTableSlot slot = inputSlots[i / 3][i % 3]; - if(slot.isEnabled()) { - inputs.add(inventory.getStack(i)); + if(slot.isActive()) { + inputs.add(inventory.getItem(i)); } } this.availableRecipes.clear(); this.selectedRecipe.set(-1); - this.outputSlot.setStackNoCallbacks(ItemStack.EMPTY); + this.outputSlot.set(ItemStack.EMPTY); if (!inputs.isEmpty()) { - if (!this.world.isClient){ - ServerRecipeManager serverRecipeManager = (ServerRecipeManager) this.world.getRecipeManager(); - this.availableRecipes = serverRecipeManager.getAllMatches(RecipesME.ARTISAN_TABLE_SUPPLIER.get(), new MultipleStackRecipeInput(inputs), this.world).toList(); + if (!this.world.isClientSide){ + RecipeManager serverRecipeManager = this.world.getRecipeManager(); + this.availableRecipes = serverRecipeManager.getRecipesFor( + RecipesME.ARTISAN_TABLE_SUPPLIER.get(), + new MultipleStackRecipeInput(inputs), + this.world + ); } } - ArrayList> filteredRecipes = new ArrayList<>(); - for(RecipeEntry recipeEntry : this.availableRecipes) { + ArrayList> filteredRecipes = new ArrayList<>(); + for(RecipeHolder recipeEntry : this.availableRecipes) { if (recipeEntry.value().category.equals(currentCategory)){ if (DispositionType.valueOf(recipeEntry.value().disposition.toUpperCase()) == DispositionType.NEUTRAL){ filteredRecipes.add(recipeEntry); @@ -280,45 +291,45 @@ private void updateInput(Inventory inventory) { } this.availableRecipes = filteredRecipes; int index = 0; - for(RecipeEntry recipe : availableRecipes) { + for(RecipeHolder recipe : availableRecipes) { ArtisanRecipePacket artisanRecipePacket = new ArtisanRecipePacket(index++, recipe.value().getOutput()); - ServerPlayNetworking.send((ServerPlayerEntity) this.playerEntity, artisanRecipePacket); + PacketDistributor.sendToPlayer((ServerPlayer) this.playerEntity, artisanRecipePacket); } this.recipesSize.set(availableRecipes.size()); } - void populateResult(PlayerEntity player) { + void populateResult(Player player) { this.playerEntity = player; if (!this.availableRecipes.isEmpty() && this.isInBounds(this.selectedRecipe.get())) { List inputs = new ArrayList<>(); - for (int i = 0; i < this.input.size(); i++) { - inputs.add(this.input.getStack(i)); + for (int i = 0; i < this.input.getContainerSize(); i++) { + inputs.add(this.input.getItem(i)); } - RecipeEntry recipeEntry = this.availableRecipes.get(this.selectedRecipe.get()); + RecipeHolder recipeEntry = this.availableRecipes.get(this.selectedRecipe.get()); - ItemStack itemStack = recipeEntry.value().craft(new MultipleStackRecipeInput(inputs), this.world.getRegistryManager()); - itemStack.set(DataComponentTypesME.ARTISAN_DATA, new ArtisanDataComponent(player.getUuid())); + ItemStack itemStack = recipeEntry.value().assemble(new MultipleStackRecipeInput(inputs), this.world.registryAccess()); + itemStack.set(DataComponentTypesME.ARTISAN_DATA, new ArtisanDataComponent(player.getUUID())); this.xp = recipeEntry.value().xp; - if (itemStack.get(DataComponentTypes.MAX_DAMAGE) != null){ + if (itemStack.get(DataComponents.MAX_DAMAGE) != null){ int maxDamage = (int) (itemStack.getMaxDamage() + itemStack.getMaxDamage() * 0.25); - itemStack.set(DataComponentTypes.MAX_DAMAGE, maxDamage); + itemStack.set(DataComponents.MAX_DAMAGE, maxDamage); } - if (itemStack.isItemEnabled(this.world.getEnabledFeatures())) { - this.output.setLastRecipe(recipeEntry); - this.outputSlot.setStackNoCallbacks(itemStack); + if (itemStack.isItemEnabled(this.world.enabledFeatures())) { + this.output.setRecipeUsed(recipeEntry); + this.outputSlot.set(itemStack); } else { - this.outputSlot.setStackNoCallbacks(ItemStack.EMPTY); + this.outputSlot.set(ItemStack.EMPTY); } } else { - this.outputSlot.setStackNoCallbacks(ItemStack.EMPTY); + this.outputSlot.set(ItemStack.EMPTY); this.xp = 0; } - this.sendContentUpdates(); + this.broadcastChanges(); } - public ScreenHandlerType getType() { + public MenuType getType() { return ModScreenHandlers.ARTISAN_SCREEN_HANDLER; } @@ -326,50 +337,50 @@ public void setContentsChangedListener(Runnable contentsChangedListener) { this.contentsChangedListener = contentsChangedListener; } - public boolean canInsertIntoSlot(ItemStack stack, Slot slot) { - return slot.inventory != this.output && super.canInsertIntoSlot(stack, slot); + public boolean canTakeItemForPickAll(ItemStack stack, Slot slot) { + return slot.container != this.output && super.canTakeItemForPickAll(stack, slot); } - public ItemStack quickMove(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { this.playerEntity = player; ItemStack stack = ItemStack.EMPTY; Slot invSlot = this.slots.get(slot); - if(invSlot.hasStack()) { - ItemStack originalStack = invSlot.getStack(); + if(invSlot.hasItem()) { + ItemStack originalStack = invSlot.getItem(); Item item = originalStack.getItem(); stack = originalStack.copy(); if (slot == 6){ - item.onCraft(originalStack, player.getWorld()); - if (!this.insertItem(originalStack, 7, this.slots.size(), true)) { + item.onCraftedPostProcess(originalStack, player.level()); + if (!this.moveItemStackTo(originalStack, 7, this.slots.size(), true)) { return ItemStack.EMPTY; } - invSlot.onQuickTransfer(originalStack, stack); - } else if(slot < this.input.size()) { - if(!this.insertItem(originalStack, this.input.size(), this.slots.size(), true)) { + invSlot.onQuickCraft(originalStack, stack); + } else if(slot < this.input.getContainerSize()) { + if(!this.moveItemStackTo(originalStack, this.input.getContainerSize(), this.slots.size(), true)) { return ItemStack.EMPTY; } - } else if (!this.insertItem(originalStack, 0, this.input.size(), false)) { + } else if (!this.moveItemStackTo(originalStack, 0, this.input.getContainerSize(), false)) { return ItemStack.EMPTY; } if (originalStack.isEmpty()) { - invSlot.setStack(ItemStack.EMPTY); + invSlot.setByPlayer(ItemStack.EMPTY); } else { - invSlot.markDirty(); + invSlot.setChanged(); } - invSlot.onTakeItem(player, originalStack); - this.sendContentUpdates(); + invSlot.onTake(player, originalStack); + this.broadcastChanges(); } return stack; } - public void onClosed(PlayerEntity player) { - super.onClosed(player); - this.output.removeStack(6); - this.dropInventory(player, this.input); + public void removed(Player player) { + super.removed(player); + this.output.removeItemNoUpdate(6); + this.clearContainer(player, this.input); } - private void addPlayerInventory(PlayerInventory playerInventory) { + private void addPlayerInventory(Inventory playerInventory) { for (int i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 36 + j * 18, 84 + i * 18)); @@ -377,7 +388,7 @@ private void addPlayerInventory(PlayerInventory playerInventory) { } } - private void addPlayerHotbar(PlayerInventory playerInventory) { + private void addPlayerHotbar(Inventory playerInventory) { for (int i = 0; i < 9; ++i) { this.addSlot(new Slot(playerInventory, i, 36 + i * 18, 142)); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableSlot.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableSlot.java index abe893d69c..0f717b19cb 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableSlot.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableSlot.java @@ -1,21 +1,21 @@ package net.sevenstars.middleearth.gui.artisantable; +import net.minecraft.world.Container; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; import net.sevenstars.middleearth.item.ResourceItemsME; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.screen.slot.Slot; public class ArtisanTableSlot extends Slot { private boolean enabled = true; private InputType inputType = InputType.ANY; - public ArtisanTableSlot(Inventory inventory, int index, int x, int y) { + public ArtisanTableSlot(Container inventory, int index, int x, int y) { super(inventory, index, x, y); } @Override - public boolean isEnabled() { + public boolean isActive() { return enabled; } @@ -28,34 +28,34 @@ public void setInputType(InputType inputType) { } @Override - public boolean canInsert(ItemStack stack) { - if(!isEnabled()) return false; - if(inputType == InputType.ANY) return super.canInsert(stack); + public boolean mayPlace(ItemStack stack) { + if(!isActive()) return false; + if(inputType == InputType.ANY) return super.mayPlace(stack); - else if(inputType == InputType.HANDLE && !(stack.isOf(Items.STICK) || stack.isOf(ResourceItemsME.ROD) - || stack.isOf(Items.BONE) || stack.isOf(ResourceItemsME.DIRTY_BONE))) { + else if(inputType == InputType.HANDLE && !(stack.is(Items.STICK) || stack.is(ResourceItemsME.ROD) + || stack.is(Items.BONE) || stack.is(ResourceItemsME.DIRTY_BONE))) { return false; } - else if(inputType == InputType.HILT && !(stack.isOf(ResourceItemsME.SWORD_HILT))) { + else if(inputType == InputType.HILT && !(stack.is(ResourceItemsME.SWORD_HILT))) { return false; } - else if(inputType == InputType.BLADE && !(stack.isOf(ResourceItemsME.SHORT_BLADE) || - stack.isOf(ResourceItemsME.BLADE) || stack.isOf(ResourceItemsME.LONG_BLADE))) { + else if(inputType == InputType.BLADE && !(stack.is(ResourceItemsME.SHORT_BLADE) || + stack.is(ResourceItemsME.BLADE) || stack.is(ResourceItemsME.LONG_BLADE))) { return false; } - else if(inputType == InputType.AXE && !(stack.isOf(ResourceItemsME.AXE_HEAD))) { + else if(inputType == InputType.AXE && !(stack.is(ResourceItemsME.AXE_HEAD))) { return false; } - else if(inputType == InputType.PICKAXE && !(stack.isOf(ResourceItemsME.PICKAXE_HEAD))) { + else if(inputType == InputType.PICKAXE && !(stack.is(ResourceItemsME.PICKAXE_HEAD))) { return false; } - else if(inputType == InputType.SHOVEL && !(stack.isOf(ResourceItemsME.SHOVEL_HEAD))) { + else if(inputType == InputType.SHOVEL && !(stack.is(ResourceItemsME.SHOVEL_HEAD))) { return false; } - else if(inputType == InputType.HOE && !(stack.isOf(ResourceItemsME.HOE_HEAD))) { + else if(inputType == InputType.HOE && !(stack.is(ResourceItemsME.HOE_HEAD))) { return false; } - return super.canInsert(stack); + return super.mayPlace(stack); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableTab.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableTab.java index 50ba739821..d675f93229 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableTab.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableTab.java @@ -1,28 +1,27 @@ package net.sevenstars.middleearth.gui.artisantable; import com.google.common.collect.Maps; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.advancement.AdvancementEntry; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.advancement.AdvancementWidget; -import net.minecraft.item.ItemStack; -import net.minecraft.text.Text; -import net.minecraft.util.math.MathHelper; - +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.minecraft.advancements.AdvancementHolder; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.advancements.AdvancementWidget; +import net.minecraft.network.chat.Component; +import net.minecraft.util.Mth; +import net.minecraft.world.item.ItemStack; import java.util.Map; -@Environment(value= EnvType.CLIENT) +@OnlyIn(Dist.CLIENT) public class ArtisanTableTab { - private final MinecraftClient client; + private final Minecraft client; private final ArtisanTableScreen screen; private final ArtisanTableTabType type; private final int index; private final ItemStack icon; - private final Text title; + private final Component title; private final ArtisanTableInputsShape inputShape; - private final Map widgets = Maps.newLinkedHashMap(); + private final Map widgets = Maps.newLinkedHashMap(); private double originX; private double originY; private int minPanX = Integer.MAX_VALUE; @@ -31,8 +30,8 @@ public class ArtisanTableTab { private int maxPanY = Integer.MIN_VALUE; private boolean initialized; - public ArtisanTableTab(MinecraftClient client, ArtisanTableScreen screen, ArtisanTableTabType type, int index, - Text title, ItemStack icon, ArtisanTableInputsShape inputShape) { + public ArtisanTableTab(Minecraft client, ArtisanTableScreen screen, ArtisanTableTabType type, int index, + Component title, ItemStack icon, ArtisanTableInputsShape inputShape) { this.client = client; this.screen = screen; this.type = type; @@ -42,8 +41,8 @@ public ArtisanTableTab(MinecraftClient client, ArtisanTableScreen screen, Artisa this.inputShape = inputShape; } - public ArtisanTableTab(MinecraftClient client, ArtisanTableScreen screen, ArtisanTableTabType type, int index, - Text title, ItemStack icon) { + public ArtisanTableTab(Minecraft client, ArtisanTableScreen screen, ArtisanTableTabType type, int index, + Component title, ItemStack icon) { this(client, screen, type, index, title, icon, ArtisanTableInputsShape.ANY); } @@ -56,7 +55,7 @@ public int getIndex() { } - public Text getTitle() { + public Component getTitle() { return this.title; } @@ -64,15 +63,15 @@ public ArtisanTableInputsShape getInputShape() { return this.inputShape; } - public void drawBackground(DrawContext context, int x, int y, boolean selected) { + public void drawBackground(GuiGraphics context, int x, int y, boolean selected) { this.type.drawBackground(context, x, y, selected, this.index); } - public void drawIcon(DrawContext context, int x, int y) { + public void drawIcon(GuiGraphics context, int x, int y) { this.type.drawIcon(context, x, y, this.index, this.icon); } - public void render(DrawContext context, int x, int y) { + public void render(GuiGraphics context, int x, int y) { if (!this.initialized) { this.originX = 117 - (double) (this.maxPanX + this.minPanX) / 2; this.originY = 56 - (double) (this.maxPanY + this.minPanY) / 2; @@ -86,10 +85,10 @@ public boolean isClickOnTab(int screenX, int screenY, double mouseX, double mous public void move(double offsetX, double offsetY) { if (this.maxPanX - this.minPanX > 234) { - this.originX = MathHelper.clamp(this.originX + offsetX, (double)(-(this.maxPanX - 234)), 0.0); + this.originX = Mth.clamp(this.originX + offsetX, (double)(-(this.maxPanX - 234)), 0.0); } if (this.maxPanY - this.minPanY > 113) { - this.originY = MathHelper.clamp(this.originY + offsetY, (double)(-(this.maxPanY - 113)), 0.0); + this.originY = Mth.clamp(this.originY + offsetY, (double)(-(this.maxPanY - 113)), 0.0); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableTabType.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableTabType.java index ac43ca7755..73a7f6037c 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableTabType.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/artisantable/ArtisanTableTabType.java @@ -1,18 +1,16 @@ package net.sevenstars.middleearth.gui.artisantable; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Identifier; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; enum ArtisanTableTabType { - ABOVE(new Textures(Identifier.ofVanilla("advancements/tab_above_left_selected"), Identifier.ofVanilla("advancements/tab_above_middle_selected"), Identifier.ofVanilla("advancements/tab_above_right_selected")), new Textures(Identifier.ofVanilla("advancements/tab_above_left"), Identifier.ofVanilla("advancements/tab_above_middle"), Identifier.ofVanilla("advancements/tab_above_right")), 28, 32, 8), - BELOW(new Textures(Identifier.ofVanilla("advancements/tab_below_left_selected"), Identifier.ofVanilla("advancements/tab_below_middle_selected"), Identifier.ofVanilla("advancements/tab_below_right_selected")), new Textures(Identifier.ofVanilla("advancements/tab_below_left"), Identifier.ofVanilla("advancements/tab_below_middle"), Identifier.ofVanilla("advancements/tab_below_right")), 28, 32, 8), - LEFT(new Textures(Identifier.ofVanilla("advancements/tab_left_top_selected"), Identifier.ofVanilla("advancements/tab_left_middle_selected"), Identifier.ofVanilla("advancements/tab_left_bottom_selected")), new Textures(Identifier.ofVanilla("advancements/tab_left_top"), Identifier.ofVanilla("advancements/tab_left_middle"), Identifier.ofVanilla("advancements/tab_left_bottom")), 32, 28, 5), - RIGHT(new Textures(Identifier.ofVanilla("advancements/tab_right_top_selected"), Identifier.ofVanilla("advancements/tab_right_middle_selected"), Identifier.ofVanilla("advancements/tab_right_bottom_selected")), new Textures(Identifier.ofVanilla("advancements/tab_right_top"), Identifier.ofVanilla("advancements/tab_right_middle"), Identifier.ofVanilla("advancements/tab_right_bottom")), 32, 28, 5); + ABOVE(new Textures(ResourceLocation.withDefaultNamespace("advancements/tab_above_left_selected"), ResourceLocation.withDefaultNamespace("advancements/tab_above_middle_selected"), ResourceLocation.withDefaultNamespace("advancements/tab_above_right_selected")), new Textures(ResourceLocation.withDefaultNamespace("advancements/tab_above_left"), ResourceLocation.withDefaultNamespace("advancements/tab_above_middle"), ResourceLocation.withDefaultNamespace("advancements/tab_above_right")), 28, 32, 8), + BELOW(new Textures(ResourceLocation.withDefaultNamespace("advancements/tab_below_left_selected"), ResourceLocation.withDefaultNamespace("advancements/tab_below_middle_selected"), ResourceLocation.withDefaultNamespace("advancements/tab_below_right_selected")), new Textures(ResourceLocation.withDefaultNamespace("advancements/tab_below_left"), ResourceLocation.withDefaultNamespace("advancements/tab_below_middle"), ResourceLocation.withDefaultNamespace("advancements/tab_below_right")), 28, 32, 8), + LEFT(new Textures(ResourceLocation.withDefaultNamespace("advancements/tab_left_top_selected"), ResourceLocation.withDefaultNamespace("advancements/tab_left_middle_selected"), ResourceLocation.withDefaultNamespace("advancements/tab_left_bottom_selected")), new Textures(ResourceLocation.withDefaultNamespace("advancements/tab_left_top"), ResourceLocation.withDefaultNamespace("advancements/tab_left_middle"), ResourceLocation.withDefaultNamespace("advancements/tab_left_bottom")), 32, 28, 5), + RIGHT(new Textures(ResourceLocation.withDefaultNamespace("advancements/tab_right_top_selected"), ResourceLocation.withDefaultNamespace("advancements/tab_right_middle_selected"), ResourceLocation.withDefaultNamespace("advancements/tab_right_bottom_selected")), new Textures(ResourceLocation.withDefaultNamespace("advancements/tab_right_top"), ResourceLocation.withDefaultNamespace("advancements/tab_right_middle"), ResourceLocation.withDefaultNamespace("advancements/tab_right_bottom")), 32, 28, 5); private final Textures selectedTextures; private final Textures unselectedTextures; @@ -32,14 +30,14 @@ public int getTabCount() { return this.tabCount; } - public void drawBackground(DrawContext context, int x, int y, boolean selected, int index) { + public void drawBackground(GuiGraphics context, int x, int y, boolean selected, int index) { Textures textures; Textures textures2 = textures = selected ? this.selectedTextures : this.unselectedTextures; - Identifier identifier = index == 0 ? textures.first() : (index == this.tabCount - 1 ? textures.last() : textures.middle()); - context.drawGuiTexture(RenderPipelines.GUI_TEXTURED, identifier, x + this.getTabX(index), y + this.getTabY(index), this.width, this.height); + ResourceLocation identifier = index == 0 ? textures.first() : (index == this.tabCount - 1 ? textures.last() : textures.middle()); + context.blitSprite(identifier, x + this.getTabX(index), y + this.getTabY(index), this.width, this.height); } - public void drawIcon(DrawContext context, int x, int y, int index, ItemStack stack) { + public void drawIcon(GuiGraphics context, int x, int y, int index, ItemStack stack) { int i = x + this.getTabX(index); int j = y + this.getTabY(index); switch (this.ordinal()) { @@ -63,7 +61,7 @@ public void drawIcon(DrawContext context, int x, int y, int index, ItemStack sta j += 5; } } - context.drawItemWithoutEntity(stack, i, j); + context.renderFakeItem(stack, i, j); } public int getTabX(int index) { @@ -92,8 +90,8 @@ public boolean isClickOnTab(int screenX, int screenY, int index, double mouseX, return mouseX > (double)i && mouseX < (double)(i + this.width) && mouseY > (double)j && mouseY < (double)(j + this.height); } - @Environment(value=EnvType.CLIENT) - record Textures(Identifier first, Identifier middle, Identifier last) { + @OnlyIn(Dist.CLIENT) + record Textures(ResourceLocation first, ResourceLocation middle, ResourceLocation last) { } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeAlloyingFuelSlot.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeAlloyingFuelSlot.java index 71e93bbf2f..1096ec5733 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeAlloyingFuelSlot.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeAlloyingFuelSlot.java @@ -1,25 +1,25 @@ package net.sevenstars.middleearth.gui.forge; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.slot.Slot; +import net.minecraft.world.Container; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity; public class ForgeAlloyingFuelSlot extends Slot { private final ForgeAlloyingScreenHandler handler; - public ForgeAlloyingFuelSlot(Inventory inventory, ForgeAlloyingScreenHandler handler, int index, int x, int y) { + public ForgeAlloyingFuelSlot(Container inventory, ForgeAlloyingScreenHandler handler, int index, int x, int y) { super(inventory, index, x, y); this.handler = handler; } @Override - public boolean canInsert(ItemStack stack) { - return handler.world.getFuelRegistry().isFuel(stack); + public boolean mayPlace(ItemStack stack) { + return AbstractFurnaceBlockEntity.isFuel(stack); } @Override - public int getMaxItemCount(ItemStack stack) { - return super.getMaxItemCount(stack); + public int getMaxStackSize(ItemStack stack) { + return super.getMaxStackSize(stack); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeAlloyingScreen.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeAlloyingScreen.java index 73c4fecc1e..4b7ed39b75 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeAlloyingScreen.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeAlloyingScreen.java @@ -1,17 +1,17 @@ package net.sevenstars.middleearth.gui.forge; +import net.neoforged.neoforge.network.PacketDistributor; + import com.google.common.collect.Lists; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.ButtonTextures; -import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.client.gui.tooltip.Tooltip; -import net.minecraft.client.gui.widget.TexturedButtonWidget; -import net.minecraft.client.gui.widget.ToggleButtonWidget; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.ImageButton; +import net.minecraft.client.gui.components.StateSwitchingButton; +import net.minecraft.client.gui.components.Tooltip; +import net.minecraft.client.gui.components.WidgetSprites; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.special.forge.MetalTypes; import net.sevenstars.middleearth.network.packets.C2S.ForgeModeSwitchPacket; @@ -19,28 +19,28 @@ import java.util.List; -public class ForgeAlloyingScreen extends HandledScreen { - private static final Identifier TEXTURE = MiddleEarth.ofPath( "textures", "gui", "forge.png"); +public class ForgeAlloyingScreen extends AbstractContainerScreen { + private static final ResourceLocation TEXTURE = MiddleEarth.ofPath( "textures", "gui", "forge.png"); - private static final Identifier EXTRACT_BUTTON = MiddleEarth.of("extract"); - private static final Identifier EXTRACT_BUTTON_DISABLED = MiddleEarth.of("extract_disabled"); - private static final Identifier EXTRACT_BUTTON_FOCUSED = MiddleEarth.of("extract_focused"); - private static final ButtonTextures EXTRACT_BUTTON_TEXTURES = new ButtonTextures(EXTRACT_BUTTON, EXTRACT_BUTTON_DISABLED, EXTRACT_BUTTON_FOCUSED); + private static final ResourceLocation EXTRACT_BUTTON = MiddleEarth.of("extract"); + private static final ResourceLocation EXTRACT_BUTTON_DISABLED = MiddleEarth.of("extract_disabled"); + private static final ResourceLocation EXTRACT_BUTTON_FOCUSED = MiddleEarth.of("extract_focused"); + private static final WidgetSprites EXTRACT_BUTTON_TEXTURES = new WidgetSprites(EXTRACT_BUTTON, EXTRACT_BUTTON_DISABLED, EXTRACT_BUTTON_FOCUSED); - private static final Identifier LEFT_CYCLE_EXTRACT_BUTTON = MiddleEarth.of("left_cycle_arrow"); - private static final Identifier LEFT_CYCLE_EXTRACT_BUTTON_FOCUSED = MiddleEarth.of("left_cycle_arrow_focused"); - private static final ButtonTextures LEFT_CYCLE_EXTRACT_BUTTON_TEXTURES = new ButtonTextures(LEFT_CYCLE_EXTRACT_BUTTON, LEFT_CYCLE_EXTRACT_BUTTON_FOCUSED); + private static final ResourceLocation LEFT_CYCLE_EXTRACT_BUTTON = MiddleEarth.of("left_cycle_arrow"); + private static final ResourceLocation LEFT_CYCLE_EXTRACT_BUTTON_FOCUSED = MiddleEarth.of("left_cycle_arrow_focused"); + private static final WidgetSprites LEFT_CYCLE_EXTRACT_BUTTON_TEXTURES = new WidgetSprites(LEFT_CYCLE_EXTRACT_BUTTON, LEFT_CYCLE_EXTRACT_BUTTON_FOCUSED); - private static final Identifier RIGHT_CYCLE_EXTRACT_BUTTON = MiddleEarth.of("right_cycle_arrow"); - private static final Identifier RIGHT_CYCLE_EXTRACT_BUTTON_FOCUSED = MiddleEarth.of("right_cycle_arrow_focused"); - private static final ButtonTextures RIGHT_CYCLE_EXTRACT_BUTTON_TEXTURES = new ButtonTextures(RIGHT_CYCLE_EXTRACT_BUTTON, RIGHT_CYCLE_EXTRACT_BUTTON_FOCUSED); + private static final ResourceLocation RIGHT_CYCLE_EXTRACT_BUTTON = MiddleEarth.of("right_cycle_arrow"); + private static final ResourceLocation RIGHT_CYCLE_EXTRACT_BUTTON_FOCUSED = MiddleEarth.of("right_cycle_arrow_focused"); + private static final WidgetSprites RIGHT_CYCLE_EXTRACT_BUTTON_TEXTURES = new WidgetSprites(RIGHT_CYCLE_EXTRACT_BUTTON, RIGHT_CYCLE_EXTRACT_BUTTON_FOCUSED); - private static final Identifier ALLOYING_SWITCH_BUTTON = MiddleEarth.of("alloying_mode"); - private static final Identifier ALLOYING_SWITCH_BUTTON_FOCUSED = MiddleEarth.of("alloying_mode_highlighted"); - private static final ButtonTextures ALLOYING_SWITCH_BUTTON_TEXTURES = new ButtonTextures(ALLOYING_SWITCH_BUTTON, ALLOYING_SWITCH_BUTTON_FOCUSED); - private static final Identifier HEATING_SWITCH_BUTTON = MiddleEarth.of("heating_mode"); - private static final Identifier HEATING_SWITCH_BUTTON_FOCUSED = MiddleEarth.of("heating_mode_highlighted"); - private static final ButtonTextures HEATING_SWITCH_BUTTON_TEXTURES = new ButtonTextures(HEATING_SWITCH_BUTTON, HEATING_SWITCH_BUTTON_FOCUSED); + private static final ResourceLocation ALLOYING_SWITCH_BUTTON = MiddleEarth.of("alloying_mode"); + private static final ResourceLocation ALLOYING_SWITCH_BUTTON_FOCUSED = MiddleEarth.of("alloying_mode_highlighted"); + private static final WidgetSprites ALLOYING_SWITCH_BUTTON_TEXTURES = new WidgetSprites(ALLOYING_SWITCH_BUTTON, ALLOYING_SWITCH_BUTTON_FOCUSED); + private static final ResourceLocation HEATING_SWITCH_BUTTON = MiddleEarth.of("heating_mode"); + private static final ResourceLocation HEATING_SWITCH_BUTTON_FOCUSED = MiddleEarth.of("heating_mode_highlighted"); + private static final WidgetSprites HEATING_SWITCH_BUTTON_TEXTURES = new WidgetSprites(HEATING_SWITCH_BUTTON, HEATING_SWITCH_BUTTON_FOCUSED); private static final int PROGRESS_ARROW_SIZE = 27; private static final int COOKING_FIRE_SIZE = 14; @@ -52,37 +52,37 @@ public class ForgeAlloyingScreen extends HandledScreen { + this.extractButton = new ImageButton(x + 131, y + 12, 28 ,36, EXTRACT_BUTTON_TEXTURES, (button)-> { int amount = 0; switch (outputMode){ case 1 -> amount = 16; @@ -91,71 +91,71 @@ protected void init() { case 5 -> amount = 432; } - ClientPlayNetworking.send(new ForgeOutputPacket(amount, handler.getPos().getX(),handler.getPos().getY(),handler.getPos().getZ(), outputMode)); - }, Text.translatable("button." + MiddleEarth.MOD_ID + ".extract_metal") + PacketDistributor.sendToServer(new ForgeOutputPacket(amount, menu.getPos().getX(),menu.getPos().getY(),menu.getPos().getZ(), outputMode)); + }, Component.translatable("button." + MiddleEarth.MOD_ID + ".extract_metal") ); - if(this.outputMode == 0 && handler.checkMaxOutput() > 0) { - this.extractButton.setTooltip(Tooltip.of(Text.translatable("tooltip." + MiddleEarth.MOD_ID + ".forge_output_mode_await"))); + if(this.outputMode == 0 && menu.checkMaxOutput() > 0) { + this.extractButton.setTooltip(Tooltip.create(Component.translatable("tooltip." + MiddleEarth.MOD_ID + ".forge_output_mode_await"))); } else { setExtractButtonTooltip(); } - this.modeSwitchToAlloyButton = new TexturedButtonWidget(x + 23, y + 68, 10 ,10, HEATING_SWITCH_BUTTON_TEXTURES, (button)-> { - ClientPlayNetworking.send(new ForgeModeSwitchPacket(handler.getPos().getX(),handler.getPos().getY(),handler.getPos().getZ())); + this.modeSwitchToAlloyButton = new ImageButton(x + 23, y + 68, 10 ,10, HEATING_SWITCH_BUTTON_TEXTURES, (button)-> { + PacketDistributor.sendToServer(new ForgeModeSwitchPacket(menu.getPos().getX(),menu.getPos().getY(),menu.getPos().getZ())); this.modeSwitchToAlloyButton.visible = false; this.modeSwitchToAlloyButton.active = false; this.modeSwitchToHeatingButton.visible = true; this.modeSwitchToHeatingButton.active = true; - }, Text.translatable("button." + MiddleEarth.MOD_ID + ".switch_mode")); - this.modeSwitchToHeatingButton = new TexturedButtonWidget(x + 23, y + 60, 10 ,10, ALLOYING_SWITCH_BUTTON_TEXTURES, (button)-> { - ClientPlayNetworking.send(new ForgeModeSwitchPacket(handler.getPos().getX(),handler.getPos().getY(),handler.getPos().getZ())); + }, Component.translatable("button." + MiddleEarth.MOD_ID + ".switch_mode")); + this.modeSwitchToHeatingButton = new ImageButton(x + 23, y + 60, 10 ,10, ALLOYING_SWITCH_BUTTON_TEXTURES, (button)-> { + PacketDistributor.sendToServer(new ForgeModeSwitchPacket(menu.getPos().getX(),menu.getPos().getY(),menu.getPos().getZ())); this.modeSwitchToHeatingButton.visible = false; this.modeSwitchToHeatingButton.active = false; this.modeSwitchToAlloyButton.visible = true; this.modeSwitchToAlloyButton.active = true; - }, Text.translatable("button." + MiddleEarth.MOD_ID + ".switch_mode")); + }, Component.translatable("button." + MiddleEarth.MOD_ID + ".switch_mode")); - this.modeSwitchToHeatingButton.setTooltip(Tooltip.of(Text.translatable("tooltip." + MiddleEarth.MOD_ID +".forge_mode_switch_heating"))); - this.modeSwitchToAlloyButton.setTooltip(Tooltip.of(Text.translatable("tooltip." + MiddleEarth.MOD_ID +".forge_mode_switch_alloying"))); + this.modeSwitchToHeatingButton.setTooltip(Tooltip.create(Component.translatable("tooltip." + MiddleEarth.MOD_ID +".forge_mode_switch_heating"))); + this.modeSwitchToAlloyButton.setTooltip(Tooltip.create(Component.translatable("tooltip." + MiddleEarth.MOD_ID +".forge_mode_switch_alloying"))); - addDrawableChild(leftExtractCycleButton); - addDrawableChild(extractButton); - addDrawableChild(rightExtractCycleButton); + addRenderableWidget(leftExtractCycleButton); + addRenderableWidget(extractButton); + addRenderableWidget(rightExtractCycleButton); - addDrawableChild(modeSwitchToHeatingButton); - addDrawableChild(modeSwitchToAlloyButton); + addRenderableWidget(modeSwitchToHeatingButton); + addRenderableWidget(modeSwitchToAlloyButton); } @Override - protected void handledScreenTick() { - super.handledScreenTick(); - heatingMode = handler.heatingMode(); + protected void containerTick() { + super.containerTick(); + heatingMode = menu.heatingMode(); updateSwitchState(); this.leftExtractCycleButton.visible = true; this.rightExtractCycleButton.visible = true; this.extractButton.visible = true; - if(handler.checkMaxOutput() == 4 && outputMode >= 5){ + if(menu.checkMaxOutput() == 4 && outputMode >= 5){ outputMode = 5; } - if(handler.checkMaxOutput() == 3 && outputMode >= 4){ + if(menu.checkMaxOutput() == 3 && outputMode >= 4){ outputMode = 4; } - if(handler.checkMaxOutput() == 2 && outputMode >= 2){ + if(menu.checkMaxOutput() == 2 && outputMode >= 2){ outputMode = 2; } - if(handler.checkMaxOutput() == 1 && outputMode >= 1){ + if(menu.checkMaxOutput() == 1 && outputMode >= 1){ outputMode = 1; } - if(handler.checkMaxOutput() == 0 && outputMode >= 1) { + if(menu.checkMaxOutput() == 0 && outputMode >= 1) { outputMode = 0; } - extractButton.active = handler.checkMaxOutput() > 0 && outputMode != 0; + extractButton.active = menu.checkMaxOutput() > 0 && outputMode != 0; - if(handler.checkMaxOutput() <= 1){ + if(menu.checkMaxOutput() <= 1){ this.leftExtractCycleButton.visible = false; this.rightExtractCycleButton.visible = false; } else { @@ -163,8 +163,8 @@ protected void handledScreenTick() { this.rightExtractCycleButton.visible = true; } - if(this.outputMode == 0 && handler.checkMaxOutput() > 0) { - this.extractButton.setTooltip(Tooltip.of(Text.translatable("tooltip." + MiddleEarth.MOD_ID + ".forge_output_mode_await"))); + if(this.outputMode == 0 && menu.checkMaxOutput() > 0) { + this.extractButton.setTooltip(Tooltip.create(Component.translatable("tooltip." + MiddleEarth.MOD_ID + ".forge_output_mode_await"))); } else { setExtractButtonTooltip(); } @@ -174,7 +174,7 @@ protected void handledScreenTick() { public boolean mouseClicked(double mouseX, double mouseY, int button) { if (this.leftExtractCycleButton.mouseClicked(mouseX, mouseY, button)) { if(outputMode == 1){ - outputMode = handler.checkMaxOutput(); + outputMode = menu.checkMaxOutput(); } else if(outputMode > 1){ outputMode--; } @@ -184,7 +184,7 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { } if (this.rightExtractCycleButton.mouseClicked(mouseX, mouseY, button)) { - if(outputMode == handler.checkMaxOutput()){ + if(outputMode == menu.checkMaxOutput()){ outputMode = 1; } else if(outputMode < 5){ outputMode++; @@ -199,11 +199,11 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { protected void setExtractButtonTooltip() { int id = outputMode; if(outputMode == 4) id = 3; - this.extractButton.setTooltip(Tooltip.of(Text.translatable("tooltip." + MiddleEarth.MOD_ID + ".forge_output_mode" + id))); + this.extractButton.setTooltip(Tooltip.create(Component.translatable("tooltip." + MiddleEarth.MOD_ID + ".forge_output_mode" + id))); } protected void updateSwitchState() { - if(!handler.heatingMode()) { + if(!menu.heatingMode()) { this.modeSwitchToHeatingButton.visible = false; this.modeSwitchToHeatingButton.active = false; this.modeSwitchToAlloyButton.visible = true; @@ -217,72 +217,71 @@ protected void updateSwitchState() { } @Override - protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) { - int x = (width - backgroundWidth) / 2; - int y = (height - backgroundHeight) / 2; + protected void renderBg(GuiGraphics context, float delta, int mouseX, int mouseY) { + int x = (width - imageWidth) / 2; + int y = (height - imageHeight) / 2; - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, this.x, this.y, 0, 0, this.backgroundWidth, this.backgroundHeight + 6, TEXTURE_SIZE, TEXTURE_SIZE); + context.blit(TEXTURE, this.leftPos, this.topPos, 0, 0, this.imageWidth, this.imageHeight + 6, TEXTURE_SIZE, TEXTURE_SIZE); - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, this.x + 26, this.y + 61, 209, 116, 4, 16, TEXTURE_SIZE, TEXTURE_SIZE); + context.blit(TEXTURE, this.leftPos + 26, this.topPos + 61, 209, 116, 4, 16, TEXTURE_SIZE, TEXTURE_SIZE); renderProgressArrow(context, x, y); renderLiquidStorage(context, x, y); } - private void renderProgressArrow(DrawContext context, int x, int y) { + private void renderProgressArrow(GuiGraphics context, int x, int y) { if(heatingMode) { - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, x + 36, y + 45, 202, 0, COOKING_FIRE_SIZE, COOKING_FIRE_SIZE, TEXTURE_SIZE, TEXTURE_SIZE); - if(handler.isCooking()) { - int cookingTime = (int) (handler.getScaledCooking() * COOKING_FIRE_SIZE); - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, x + 36, y + COOKING_FIRE_SIZE + 46 - cookingTime, 202, 15 + COOKING_FIRE_SIZE - cookingTime, COOKING_FIRE_SIZE, cookingTime, TEXTURE_SIZE, TEXTURE_SIZE); + context.blit(TEXTURE, x + 36, y + 45, 202, 0, COOKING_FIRE_SIZE, COOKING_FIRE_SIZE, TEXTURE_SIZE, TEXTURE_SIZE); + if(menu.isCooking()) { + int cookingTime = (int) (menu.getScaledCooking() * COOKING_FIRE_SIZE); + context.blit(TEXTURE, x + 36, y + COOKING_FIRE_SIZE + 46 - cookingTime, 202, 15 + COOKING_FIRE_SIZE - cookingTime, COOKING_FIRE_SIZE, cookingTime, TEXTURE_SIZE, TEXTURE_SIZE); } } else { - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, x + 33, y + 45, 218, 0, 20, 13, TEXTURE_SIZE, TEXTURE_SIZE); - if(handler.isCooking()) { - int cookingTime = (int) (handler.getScaledCooking() * 15); - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, x + 33, y + 59 - cookingTime, 218, 15 + 14 - cookingTime, 20, cookingTime, TEXTURE_SIZE, TEXTURE_SIZE); + context.blit(TEXTURE, x + 33, y + 45, 218, 0, 20, 13, TEXTURE_SIZE, TEXTURE_SIZE); + if(menu.isCooking()) { + int cookingTime = (int) (menu.getScaledCooking() * 15); + context.blit(TEXTURE, x + 33, y + 59 - cookingTime, 218, 15 + 14 - cookingTime, 20, cookingTime, TEXTURE_SIZE, TEXTURE_SIZE); } } - if(handler.isCrafting()) { - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, x + 90, y + 16, 212, 83, 7, (int) (handler.getScaledProgress() * PROGRESS_ARROW_SIZE), TEXTURE_SIZE, TEXTURE_SIZE); + if(menu.isCrafting()) { + context.blit(TEXTURE, x + 90, y + 16, 212, 83, 7, (int) (menu.getScaledProgress() * PROGRESS_ARROW_SIZE), TEXTURE_SIZE, TEXTURE_SIZE); } } - private void renderLiquidStorage(DrawContext context, int x, int y) { - int storedLiquid = (int) (handler.getScaledStoredLiquid() * LIQUID_HEIGHT); - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, x + 73, y + 77 - storedLiquid, 211, 76 - storedLiquid, 20, storedLiquid, TEXTURE_SIZE ,TEXTURE_SIZE); + private void renderLiquidStorage(GuiGraphics context, int x, int y) { + int storedLiquid = (int) (menu.getScaledStoredLiquid() * LIQUID_HEIGHT); + context.blit(TEXTURE, x + 73, y + 77 - storedLiquid, 211, 76 - storedLiquid, 20, storedLiquid, TEXTURE_SIZE ,TEXTURE_SIZE); } - private void renderLiquidStorageTooltip(DrawContext context, int mouseX, int mouseY) { - int x = (width - backgroundWidth) / 2; - int y = (height - backgroundHeight) / 2; + private void renderLiquidStorageTooltip(GuiGraphics context, int mouseX, int mouseY) { + int x = (width - imageWidth) / 2; + int y = (height - imageHeight) / 2; if (mouseX >= x + 73 && mouseX <= x + 93 && mouseY >= y + 52 && mouseY <= y + 77){ - MetalTypes metal = MetalTypes.getValue(handler.getCurrentMetal()); + MetalTypes metal = MetalTypes.getValue(menu.getCurrentMetal()); if(metal != MetalTypes.EMPTY){ - context.drawOrderedTooltip(this.client.textRenderer, Lists.transform( - List.of(Text.translatable("tooltip." + MiddleEarth.MOD_ID +".liquid_" + metal.asString().toLowerCase()).withColor(metal.getColor()), - Text.literal(handler.getStoredLiquid() / 144 + " ").append(Text.translatable("tooltip." + MiddleEarth.MOD_ID + ".ingots_number")), - Text.literal(handler.getStoredLiquid() % 144 / 16 + " ").append(Text.translatable("tooltip." + MiddleEarth.MOD_ID + ".nuggets_number")) - ), Text::asOrderedText), mouseX, mouseY); + context.renderTooltip(this.minecraft.font, Lists.transform( + List.of(Component.translatable("tooltip." + MiddleEarth.MOD_ID +".liquid_" + metal.getSerializedName().toLowerCase()).withColor(metal.getColor()), + Component.literal(menu.getStoredLiquid() / 144 + " ").append(Component.translatable("tooltip." + MiddleEarth.MOD_ID + ".ingots_number")), + Component.literal(menu.getStoredLiquid() % 144 / 16 + " ").append(Component.translatable("tooltip." + MiddleEarth.MOD_ID + ".nuggets_number")) + ), Component::getVisualOrderText), mouseX, mouseY); } } } @Override - protected void drawForeground(DrawContext context, int mouseX, int mouseY) { - context.drawText(this.textRenderer, this.title, this.titleX, this.titleY, -12566464, false); - context.drawText(this.textRenderer, this.playerInventoryTitle, this.playerInventoryTitleX, this.playerInventoryTitleY + 7, -12566464, false); + protected void renderLabels(GuiGraphics context, int mouseX, int mouseY) { + context.drawString(this.font, this.title, this.titleLabelX, this.titleLabelY, -12566464, false); + context.drawString(this.font, this.playerInventoryTitle, this.inventoryLabelX, this.inventoryLabelY + 7, -12566464, false); } @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) { - renderBackground(context, mouseX,mouseY,delta); + public void render(GuiGraphics context, int mouseX, int mouseY, float delta) { super.render(context, mouseX, mouseY, delta); - int x = (width - backgroundWidth) / 2; - int y = (height - backgroundHeight) / 2; - drawMouseoverTooltip(context, mouseX, mouseY); + int x = (width - imageWidth) / 2; + int y = (height - imageHeight) / 2; + renderTooltip(context, mouseX, mouseY); renderLiquidStorageTooltip(context, mouseX, mouseY); int v = switch (outputMode) { @@ -293,16 +292,16 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) { case 5 -> 59; default -> -1; }; - if(v >= 0) context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, x + EXTRACT_BUTTON_ITEM_X, y + EXTRACT_BUTTON_ITEM_Y, + if(v >= 0) context.blit(TEXTURE, x + EXTRACT_BUTTON_ITEM_X, y + EXTRACT_BUTTON_ITEM_Y, EXTRACT_BUTTON_ITEM_U, v,18, 24, TEXTURE_SIZE ,TEXTURE_SIZE); else { int u = 0; - if (handler.checkMaxOutput() > 0) { + if (menu.checkMaxOutput() > 0) { u = 16; } - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, x + EXTRACT_BUTTON_ITEM_X + 2, y + EXTRACT_BUTTON_ITEM_Y + 4, + context.blit(TEXTURE, x + EXTRACT_BUTTON_ITEM_X + 2, y + EXTRACT_BUTTON_ITEM_Y + 4, 204 + u, 30,14, 16, TEXTURE_SIZE ,TEXTURE_SIZE); - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, x + 102, y + 57, + context.blit(TEXTURE, x + 102, y + 57, 178, 21,22, 15, TEXTURE_SIZE ,TEXTURE_SIZE); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeAlloyingScreenHandler.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeAlloyingScreenHandler.java index af53eda62f..0c95dcfa34 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeAlloyingScreenHandler.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeAlloyingScreenHandler.java @@ -1,38 +1,38 @@ package net.sevenstars.middleearth.gui.forge; +import net.minecraft.core.BlockPos; +import net.minecraft.world.Container; +import net.minecraft.world.SimpleContainer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.inventory.SimpleContainerData; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.block.special.forge.ForgeBlockEntity; import net.sevenstars.middleearth.gui.ModScreenHandlers; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.Inventory; -import net.minecraft.inventory.SimpleInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.ArrayPropertyDelegate; -import net.minecraft.screen.PropertyDelegate; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.slot.Slot; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -public class ForgeAlloyingScreenHandler extends ScreenHandler { - protected final Inventory inventory; - protected final PropertyDelegate propertyDelegate; - protected final World world; + +public class ForgeAlloyingScreenHandler extends AbstractContainerMenu { + protected final Container inventory; + protected final ContainerData propertyDelegate; + protected final Level world; protected BlockPos pos; - public ForgeAlloyingScreenHandler(int syncId, PlayerInventory playerInventory, BlockPos blockPos) { - this(syncId, playerInventory, new SimpleInventory(6), new ArrayPropertyDelegate(6)); + public ForgeAlloyingScreenHandler(int syncId, Inventory playerInventory, BlockPos blockPos) { + this(syncId, playerInventory, new SimpleContainer(6), new SimpleContainerData(6)); this.pos = blockPos; } - public ForgeAlloyingScreenHandler(int syncId, PlayerInventory playerInventory, Inventory inventory, PropertyDelegate delegate) { + public ForgeAlloyingScreenHandler(int syncId, Inventory playerInventory, Container inventory, ContainerData delegate) { super(ModScreenHandlers.FORGE_ALLOYING_SCREEN_HANDLER, syncId); this.inventory = inventory; this.propertyDelegate = delegate; - this.world = playerInventory.player.getWorld(); - this.pos = BlockPos.ORIGIN; + this.world = playerInventory.player.level(); + this.pos = inventory instanceof ForgeBlockEntity forge ? forge.getBlockPos() : BlockPos.ZERO; int maxItemStack = 64; - checkSize(inventory, 6); + checkContainerSize(inventory, 6); this.addSlot(new ForgeAlloyingFuelSlot(inventory, this, 0, 35, 61)); this.addSlot(new ForgeSlot(inventory, 1, 8, 16, maxItemStack)); @@ -43,8 +43,8 @@ public ForgeAlloyingScreenHandler(int syncId, PlayerInventory playerInventory, I addPlayerInventory(playerInventory); addPlayerHotbar(playerInventory); - inventory.onOpen(playerInventory.player); - addProperties(delegate); + inventory.startOpen(playerInventory.player); + addDataSlots(delegate); } public BlockPos getPos() { @@ -52,31 +52,31 @@ public BlockPos getPos() { } @Override - public ItemStack quickMove(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { ItemStack stack = ItemStack.EMPTY; Slot invSlot = this.slots.get(slot); - if(invSlot.hasStack()) { - ItemStack originalStack = invSlot.getStack(); - if(slot < this.inventory.size()) { - if(!this.insertItem(originalStack, this.inventory.size(), this.slots.size(), true)) { + if(invSlot.hasItem()) { + ItemStack originalStack = invSlot.getItem(); + if(slot < this.inventory.getContainerSize()) { + if(!this.moveItemStackTo(originalStack, this.inventory.getContainerSize(), this.slots.size(), true)) { return ItemStack.EMPTY; } - } else if (!this.insertItem(originalStack, 0, this.inventory.size() - 1, false)) { + } else if (!this.moveItemStackTo(originalStack, 0, this.inventory.getContainerSize() - 1, false)) { return ItemStack.EMPTY; } if (originalStack.isEmpty()) { - invSlot.setStack(ItemStack.EMPTY); + invSlot.setByPlayer(ItemStack.EMPTY); } else { - invSlot.markDirty(); + invSlot.setChanged(); } } return stack; } @Override - public boolean canUse(PlayerEntity player) { - return this.inventory.canPlayerUse(player); + public boolean stillValid(Player player) { + return this.inventory.stillValid(player); } public boolean isCooking() { @@ -135,7 +135,7 @@ public float getScaledProgress() { return (float) progress / ForgeBlockEntity.MAX_PROGRESS; } - private void addPlayerInventory(PlayerInventory playerInventory) { + private void addPlayerInventory(Inventory playerInventory) { for (int i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 91 + i * 18)); @@ -143,7 +143,7 @@ private void addPlayerInventory(PlayerInventory playerInventory) { } } - private void addPlayerHotbar(PlayerInventory playerInventory) { + private void addPlayerHotbar(Inventory playerInventory) { for (int i = 0; i < 9; ++i) { this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 149)); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeOutputSlot.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeOutputSlot.java index e048d5f29e..31cd0dcad1 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeOutputSlot.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeOutputSlot.java @@ -1,54 +1,54 @@ package net.sevenstars.middleearth.gui.forge; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.slot.Slot; +import net.minecraft.world.Container; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; public class ForgeOutputSlot extends Slot { - private final PlayerEntity player; + private final Player player; private int amount; private final boolean isEnabled; - public ForgeOutputSlot(PlayerEntity player, Inventory inventory, int index, int x, int y, boolean isEnabled) { + public ForgeOutputSlot(Player player, Container inventory, int index, int x, int y, boolean isEnabled) { super(inventory, index, x, y); this.player = player; this.isEnabled = isEnabled; } @Override - public boolean canInsert(ItemStack stack) { + public boolean mayPlace(ItemStack stack) { return false; } @Override - public ItemStack takeStack(int amount) { - if (this.hasStack()) { - this.amount += Math.min(amount, this.getStack().getCount()); + public ItemStack remove(int amount) { + if (this.hasItem()) { + this.amount += Math.min(amount, this.getItem().getCount()); } - return super.takeStack(amount); + return super.remove(amount); } @Override - public void onTakeItem(PlayerEntity player, ItemStack stack) { - this.onCrafted(stack); - super.onTakeItem(player, stack); + public void onTake(Player player, ItemStack stack) { + this.checkTakeAchievements(stack); + super.onTake(player, stack); } @Override - protected void onCrafted(ItemStack stack, int amount) { + protected void onQuickCraft(ItemStack stack, int amount) { this.amount += amount; - this.onCrafted(stack); + this.checkTakeAchievements(stack); } @Override - public boolean isEnabled() { + public boolean isActive() { return isEnabled; } @Override - public boolean canTakeItems(PlayerEntity playerEntity) { + public boolean mayPickup(Player playerEntity) { return isEnabled; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeSlot.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeSlot.java index 7dc9e43f11..dfa574a877 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeSlot.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/forge/ForgeSlot.java @@ -1,21 +1,21 @@ package net.sevenstars.middleearth.gui.forge; -import net.minecraft.inventory.Inventory; -import net.minecraft.screen.slot.Slot; +import net.minecraft.world.Container; +import net.minecraft.world.inventory.Slot; public class ForgeSlot extends Slot { private final int MAX_ITEM_COUNT; - public ForgeSlot(Inventory inventory, int index, int x, int y) { + public ForgeSlot(Container inventory, int index, int x, int y) { this(inventory, index, x, y, 1); } - public ForgeSlot(Inventory inventory, int index, int x, int y, int itemCount) { + public ForgeSlot(Container inventory, int index, int x, int y, int itemCount) { super(inventory, index, x, y); MAX_ITEM_COUNT = itemCount; } @Override - public int getMaxItemCount() { + public int getMaxStackSize() { return MAX_ITEM_COUNT; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/inscriptiontable/InscriptionTableScreen.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/inscriptiontable/InscriptionTableScreen.java index 3a55c16175..602acbd799 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/inscriptiontable/InscriptionTableScreen.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/inscriptiontable/InscriptionTableScreen.java @@ -1,93 +1,105 @@ package net.sevenstars.middleearth.gui.inscriptiontable; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.ingame.CyclingSlotIcon; -import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.sound.SoundManager; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.screen.ScreenTexts; -import net.minecraft.text.StringVisitable; -import net.minecraft.text.Style; -import net.minecraft.text.Text; -import net.minecraft.util.Colors; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.ColorHelper; -import net.minecraft.util.math.MathHelper; +import net.neoforged.neoforge.network.PacketDistributor; + +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.gui.screens.inventory.CyclingSlotBackground; +import net.minecraft.client.sounds.SoundManager; +import net.minecraft.network.chat.CommonComponents; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.FormattedText; +import net.minecraft.network.chat.Style; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.CommonColors; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.player.Inventory; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.network.packets.C2S.InscriptionConfirmationPacket; import net.sevenstars.middleearth.network.packets.C2S.InscriptionWordUpdatePacket; -import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -@Environment(value= EnvType.CLIENT) -public class InscriptionTableScreen extends HandledScreen { - private static final Identifier TEXTURE = MiddleEarth.ofPath( "textures", "gui", "inscription_table.png"); +@OnlyIn(Dist.CLIENT) +public class InscriptionTableScreen extends AbstractContainerScreen { + private static final ResourceLocation TEXTURE = MiddleEarth.ofPath( "textures", "gui", "inscription_table.png"); - private static final Identifier SCROLLER_TEXTURE = Identifier.ofVanilla("container/villager/scroller"); - private static final Identifier SCROLLER_DISABLED_TEXTURE = Identifier.ofVanilla("container/villager/scroller_disabled"); + private static final ResourceLocation SCROLLER_TEXTURE = ResourceLocation.withDefaultNamespace("container/villager/scroller"); + private static final ResourceLocation SCROLLER_DISABLED_TEXTURE = ResourceLocation.withDefaultNamespace("container/villager/scroller_disabled"); - private static final Identifier EMPTY_SLOT_EMERALD_TEXTURE = Identifier.ofVanilla("container/slot/emerald"); - private static final Identifier EMPTY_SLOT_LAPIS_LAZULI_TEXTURE = Identifier.ofVanilla("container/slot/lapis_lazuli"); - private static final Identifier EMPTY_SLOT_ADAMANT_TEXTURE = MiddleEarth.ofPath( "container", "slot", "adamant"); - private static final Identifier EMPTY_SLOT_RUBY_TEXTURE = MiddleEarth.ofPath( "container", "slot", "ruby"); - private static final Identifier EMPTY_SLOT_SAPPHIRE_TEXTURE = MiddleEarth.ofPath( "container", "slot", "sapphire"); + private static final ResourceLocation EMPTY_SLOT_EMERALD_TEXTURE = ResourceLocation.withDefaultNamespace("item/empty_slot_emerald"); + private static final ResourceLocation EMPTY_SLOT_LAPIS_LAZULI_TEXTURE = ResourceLocation.withDefaultNamespace("item/empty_slot_lapis_lazuli"); + private static final ResourceLocation EMPTY_SLOT_ADAMANT_TEXTURE = MiddleEarth.ofPath( "container", "slot", "adamant"); + private static final ResourceLocation EMPTY_SLOT_RUBY_TEXTURE = MiddleEarth.ofPath( "container", "slot", "ruby"); + private static final ResourceLocation EMPTY_SLOT_SAPPHIRE_TEXTURE = MiddleEarth.ofPath( "container", "slot", "sapphire"); - private static final Identifier FONT_ID = Identifier.ofVanilla("alt"); + private static final ResourceLocation FONT_ID = ResourceLocation.withDefaultNamespace("alt"); private static final Style STYLE = Style.EMPTY.withFont(FONT_ID); + private static int withAlpha(float alpha, int color) { + return Mth.ceil(alpha * 255.0F) << 24 | color & 0xFFFFFF; + } + int indexStartOffset; private boolean scrolling; private String enchant; private int level; private int maxLevel; - private Text enchantText; + private Component enchantText; - private final CyclingSlotIcon catalystSlotIcon = new CyclingSlotIcon(0); + private final CyclingSlotBackground catalystSlotIcon = new CyclingSlotBackground(0); private WidgetArrowButtonPage confirmationButton; private final WidgetInscriptionButtonPage[] words = new WidgetInscriptionButtonPage[11]; private final List selectedWords = new ArrayList<>(); private final List selectedButtons = new ArrayList<>(); + private int lastSelectionRevision; - public InscriptionTableScreen(InscriptionTableScreenHandler handler, PlayerInventory inventory, Text title) { + public InscriptionTableScreen(InscriptionTableScreenHandler handler, Inventory inventory, Component title) { super(handler, inventory, title); - this.backgroundWidth = 275; - this.backgroundHeight = 183; + this.imageWidth = 275; + this.imageHeight = 183; + this.lastSelectionRevision = handler.getSelectionRevision(); } @Override - protected void handledScreenTick() { - super.handledScreenTick(); - this.catalystSlotIcon.updateTexture(List.of( + protected void containerTick() { + super.containerTick(); + this.catalystSlotIcon.tick(List.of( EMPTY_SLOT_LAPIS_LAZULI_TEXTURE, EMPTY_SLOT_ADAMANT_TEXTURE, EMPTY_SLOT_EMERALD_TEXTURE, EMPTY_SLOT_RUBY_TEXTURE, EMPTY_SLOT_SAPPHIRE_TEXTURE)); + int selectionRevision = this.menu.getSelectionRevision(); + if (selectionRevision != this.lastSelectionRevision || !this.menu.hasAll()) { + this.clearLocalSelection(); + this.lastSelectionRevision = selectionRevision; + } + for (WidgetInscriptionButtonPage button : this.words){ button.setSelected(this.selectedButtons.contains(button.index + this.indexStartOffset)); button.setSelectedIndex(this.selectedButtons.contains(button.index + this.indexStartOffset) ? this.selectedButtons.indexOf(button.index + this.indexStartOffset) : -1); } - if (!this.handler.hasAll()){ - this.selectedWords.clear(); - this.selectedButtons.clear(); - this.enchant = null; - this.level = 0; - this.maxLevel = 0; - } + } + + private void clearLocalSelection() { + this.selectedWords.clear(); + this.selectedButtons.clear(); + this.indexStartOffset = 0; + this.enchant = null; + this.level = 0; + this.maxLevel = 0; } public void updateInfo(String enchant, int level, int maxLevel){ @@ -99,35 +111,40 @@ public void updateInfo(String enchant, int level, int maxLevel){ @Override protected void init() { super.init(); - titleX = 6; - playerInventoryTitleX = 108; - playerInventoryTitleY = 92; + titleLabelX = 6; + inventoryLabelX = 108; + inventoryLabelY = 92; - int i = (this.width - this.backgroundWidth) / 2; - int j = (this.height - this.backgroundHeight) / 2; + int i = (this.width - this.imageWidth) / 2; + int j = (this.height - this.imageHeight) / 2; int k = j + 22; for(int l = 0; l < 11; ++l) { - this.words[l] = this.addDrawableChild(new WidgetInscriptionButtonPage(i + 5, k, l, button -> { + this.words[l] = this.addRenderableWidget(new WidgetInscriptionButtonPage(i + 5, k, l, button -> { if (button instanceof WidgetInscriptionButtonPage wordButton) { - if (button.isSelected() && !wordButton.hidden){ + if (button.isHoveredOrFocused() && !wordButton.hidden){ + int wordIndex = wordButton.index + this.indexStartOffset; + List currentWords = this.menu.getWords(); + if (wordIndex < 0 || wordIndex >= currentWords.size()) { + return; + } + String word = currentWords.get(wordIndex); if (!((WidgetInscriptionButtonPage) button).selected){ if (this.selectedWords.size() == 3){ - this.selectedWords.remove(this.selectedWords.getLast()); - ClientPlayNetworking.send(new InscriptionWordUpdatePacket(false, this.selectedWords.getLast())); - this.selectedButtons.remove(this.selectedButtons.getLast()); + String removedWord = this.selectedWords.removeLast(); + this.selectedButtons.removeLast(); + this.sendWordUpdate(false, removedWord); } - this.selectedWords.add(handler.getWords().get(((WidgetInscriptionButtonPage) button).index + this.indexStartOffset)); - ClientPlayNetworking.send(new InscriptionWordUpdatePacket(true, handler.getWords().get(((WidgetInscriptionButtonPage) button).index + this.indexStartOffset))); - this.selectedButtons.add(((WidgetInscriptionButtonPage) button).index + this.indexStartOffset); + this.selectedWords.add(word); + this.sendWordUpdate(true, word); + this.selectedButtons.add(wordIndex); } else { - this.selectedWords.remove(handler.getWords().get(((WidgetInscriptionButtonPage) button).index + this.indexStartOffset)); - ClientPlayNetworking.send(new InscriptionWordUpdatePacket(false, handler.getWords().get(((WidgetInscriptionButtonPage) button).index + this.indexStartOffset))); - Object buttonIndex = ((WidgetInscriptionButtonPage) button).index + this.indexStartOffset; - this.selectedButtons.remove(buttonIndex); + this.selectedWords.remove(word); + this.sendWordUpdate(false, word); + this.selectedButtons.remove((Integer) wordIndex); } } - this.enchantText = Text.literal("awaiting runes").fillStyle(STYLE.withObfuscated(true)); + this.enchantText = Component.literal("awaiting runes").withStyle(STYLE.withObfuscated(true)); } })); k += 14; @@ -135,58 +152,70 @@ protected void init() { this.confirmationButton = new WidgetArrowButtonPage(i + 204, j + 50, button -> { if (button instanceof WidgetArrowButtonPage){ - ClientPlayNetworking.send(new InscriptionConfirmationPacket()); - this.enchantText = Text.of(this.enchant); + PacketDistributor.sendToServer(new InscriptionConfirmationPacket( + this.menu.containerId, + this.menu.getSelectionRevision() + )); + this.enchantText = Component.nullToEmpty(this.enchant); } }); this.confirmationButton.active = false; - this.addDrawableChild(this.confirmationButton); + this.addRenderableWidget(this.confirmationButton); + } + + private void sendWordUpdate(boolean add, String word) { + PacketDistributor.sendToServer(new InscriptionWordUpdatePacket( + this.menu.containerId, + this.menu.getSelectionRevision(), + add, + word + )); } @Override - protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) { - int i = (this.width - this.backgroundWidth) / 2; - int j = (this.height - this.backgroundHeight) / 2; + protected void renderBg(GuiGraphics context, float delta, int mouseX, int mouseY) { + int i = (this.width - this.imageWidth) / 2; + int j = (this.height - this.imageHeight) / 2; - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, this.x, this.y, 0, 0, this.backgroundWidth, this.backgroundHeight, 512, 256); + context.blit(TEXTURE, this.leftPos, this.topPos, 0, 0, this.imageWidth, this.imageHeight, 512, 256); if (this.selectedWords.isEmpty()){ - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, i + 104, j + 7, 347, 1, 164, 16, 512, 256); + context.blit(TEXTURE, i + 104, j + 7, 347, 1, 164, 16, 512, 256); } else { - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, i + 104, j + 7, 347, 19, 164, 16, 512, 256); + context.blit(TEXTURE, i + 104, j + 7, 347, 19, 164, 16, 512, 256); } if (!(enchant == null || enchant.isEmpty())){ int m = 19; if (this.maxLevel == 1) m = 21; - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, + context.blit(TEXTURE, i + 188 - m * this.maxLevel /2, j + 81, 282, 33 * (this.maxLevel - 1) + 1, m * this.maxLevel, 12, 512, 256); - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, + context.blit(TEXTURE, i + 188 - m * this.maxLevel /2, j + 81, 282, 33 * (this.maxLevel - 1) + 21, m * this.level, 12, 512, 256); - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, + context.blit(TEXTURE, i + 188 + (m * (this.level - 1)) - m * this.maxLevel /2, j + 81, 282 + (m * (this.level - 1)), 33 * (this.maxLevel - 1) + 14, m, 6, 512, 256); - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, i + 123, j + 25, 347, 39, 130, 16, 512, 256); - context.drawText(this.textRenderer, enchant, i + 188 - textRenderer.getWidth(enchant) / 2, j + 29, ColorHelper.fullAlpha(0xad6b3f), false); + context.blit(TEXTURE, i + 123, j + 25, 347, 39, 130, 16, 512, 256); + context.drawString(this.font, enchant, i + 188 - font.width(enchant) / 2, j + 29, 0xFFAD6B3F, false); - int k = this.handler.getLevelCost(); - int l = this.handler.getPlayerLevels(); + int k = this.menu.getLevelCost(); + int l = this.menu.getPlayerLevels(); int color; - String levelKey = (k == 1) ? ".level" : ".levels"; - Text text = Text.translatable("inscription." + MiddleEarth.MOD_ID + levelKey, k); + String levelKey = k == 1 ? ".level" : ".levels"; + Component text = Component.translatable("inscription." + MiddleEarth.MOD_ID + levelKey, k); - if (this.client.player.isInCreativeMode() || (l >= k && k != 0)){ + if (this.minecraft.player.hasInfiniteMaterials() || (l >= k && k != 0)){ color = -8323296; this.confirmationButton.active = true; } else{ @@ -196,50 +225,52 @@ protected void drawBackground(DrawContext context, float delta, int mouseX, int context.fill(i + 156, j + 71, i + 221, j + 79, 1325400064); - context.drawText(this.textRenderer, text, i + 188 - textRenderer.getWidth(text) / 2, j + 71, color, true); + context.drawString(this.font, text, i + 188 - font.width(text) / 2, j + 71, color, true); } else { this.confirmationButton.active = false; if(!this.selectedWords.isEmpty()){ - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, i + 123, j + 25, 347, 39, 130, 16, 512, 256); - StringVisitable stringVisitable = textRenderer.getTextHandler().trimToWidth(this.enchantText, 159, Style.EMPTY); - context.drawWrappedText(this.textRenderer, stringVisitable, i + 188 - textRenderer.getWidth(stringVisitable.getString()) / 2, j + 29, 159, ColorHelper.fullAlpha(0xad6b3f),false); + context.blit(TEXTURE, i + 123, j + 25, 347, 39, 130, 16, 512, 256); + FormattedText stringVisitable = font.getSplitter().headByWidth(this.enchantText, 159, Style.EMPTY); + context.drawWordWrap(this.font, stringVisitable, i + 188 - font.width(stringVisitable.getString()) / 2, j + 29, 159, 0xFFAD6B3F); } } - if (this.handler.hasGem()){ - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, i + 130, j + 43, 282, 166, 26, 26, 512, 256); + if (this.menu.hasGem()){ + context.blit(TEXTURE, i + 130, j + 43, 282, 166, 26, 26, 512, 256); } - this.catalystSlotIcon.render(this.handler, context, delta, this.x, this.y); + this.catalystSlotIcon.render(this.menu, context, delta, this.leftPos, this.topPos); StringBuilder stringBuilder = new StringBuilder(); int m = 0; for(String word : this.selectedWords){ if (m != 0){ - stringBuilder.append(Text.translatable("inscription." + MiddleEarth.MOD_ID + ".linking_dash").getString()); + stringBuilder.append(Component.translatable( + "inscription." + MiddleEarth.MOD_ID + ".linking_dash").getString()); } - stringBuilder.append(Text.translatable("inscription." + MiddleEarth.MOD_ID + "." + word).getString()); + stringBuilder.append(Component.translatable( + "inscription." + MiddleEarth.MOD_ID + "." + word).getString()); m++; } - StringVisitable stringVisitable = textRenderer.getTextHandler().trimToWidth(Text.literal(stringBuilder.toString()), 159, Style.EMPTY); - context.drawCenteredTextWithShadow(this.textRenderer, stringVisitable.getString(), i + 186, j + 11, Colors.WHITE); + + FormattedText stringVisitable = font.getSplitter().headByWidth(Component.literal(stringBuilder.toString()), 159, Style.EMPTY); + context.drawCenteredString(this.font, stringVisitable.getString(), i + 186, j + 11, CommonColors.WHITE); } @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) { - renderBackground(context, mouseX, mouseY, delta); + public void render(GuiGraphics context, int mouseX, int mouseY, float delta) { super.render(context, mouseX, mouseY, delta); - int i = (this.width - this.backgroundWidth) / 2; - int j = (this.height - this.backgroundHeight) / 2; + int i = (this.width - this.imageWidth) / 2; + int j = (this.height - this.imageHeight) / 2; this.renderScrollbar(context, i, j); - Iterator words = this.handler.getWords().iterator(); + Iterator words = this.menu.getWords().iterator(); - byte[] enabledWords = this.handler.getAvailableWords(); + byte[] enabledWords = this.menu.getAvailableWords(); for (WidgetInscriptionButtonPage widgetButtonPage : this.words) { - widgetButtonPage.visible = widgetButtonPage.index < this.handler.getWords().size(); + widgetButtonPage.visible = widgetButtonPage.index < this.menu.getWords().size(); if(enabledWords != null && widgetButtonPage.index + indexStartOffset < enabledWords.length) { widgetButtonPage.setHidden(enabledWords[widgetButtonPage.index + indexStartOffset] != 1); } @@ -251,18 +282,21 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) { int n = j + 25; while(words.hasNext()) { word = words.next(); - if (!this.canScroll(this.handler.getWords().size()) || (m >= this.indexStartOffset && m < 11 + this.indexStartOffset)) { + if (!this.canScroll(this.menu.getWords().size()) || (m >= this.indexStartOffset && m < 11 + this.indexStartOffset)) { if(index - indexStartOffset >= 0 && index - indexStartOffset < this.words.length) { WidgetInscriptionButtonPage widgetButtonPage = this.words[index - indexStartOffset]; if(widgetButtonPage.hidden) { -// Text text = Text.literal(StringUtils.capitalize(word)).setStyle(Style.EMPTY.withStrikethrough(widgetButtonPage.hidden)); - Text text = Text.translatable("inscription." + MiddleEarth.MOD_ID + "." + word).setStyle(Style.EMPTY.withStrikethrough(widgetButtonPage.hidden)); - context.drawText(this.textRenderer, text, i + 11, n, Colors.LIGHT_GRAY, false); + Component text = Component.translatable( + "inscription." + MiddleEarth.MOD_ID + "." + word) + .setStyle(Style.EMPTY.withStrikethrough(true)); + context.drawString(this.font, text, i + 11, n, CommonColors.LIGHT_GRAY, false); } else { - context.drawText(this.textRenderer, Text.translatable("inscription." + MiddleEarth.MOD_ID + "." + word), i + 11, n, Colors.WHITE, false); + context.drawString(this.font, Component.translatable( + "inscription." + MiddleEarth.MOD_ID + "." + word), i + 11, n, CommonColors.WHITE, false); } } else { - context.drawText(this.textRenderer, Text.translatable("inscription." + MiddleEarth.MOD_ID + "." + word), i + 11, n, Colors.WHITE, false); + context.drawString(this.font, Component.translatable( + "inscription." + MiddleEarth.MOD_ID + "." + word), i + 11, n, CommonColors.WHITE, false); } n += 14; } @@ -270,15 +304,15 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) { ++m; } - drawMouseoverTooltip(context, mouseX, mouseY); + renderTooltip(context, mouseX, mouseY); } private boolean canScroll(int listSize) { return listSize > 11; } - private void renderScrollbar(DrawContext context, int x, int y) { - int i = this.handler.getWords().size() + 1 - 11; + private void renderScrollbar(GuiGraphics context, int x, int y) { + int i = this.menu.getWords().size() + 1 - 11; if (i > 1) { int j = 153 - (27 + (i - 1) * 153 / i); int k = 1 + j / i + 153 / i; @@ -286,18 +320,18 @@ private void renderScrollbar(DrawContext context, int x, int y) { if (this.indexStartOffset == i - 1) { m = 127; } - context.drawGuiTexture(RenderPipelines.GUI_TEXTURED, SCROLLER_TEXTURE, x + 94, y + 22 + m, 6, 27); + context.blitSprite(SCROLLER_TEXTURE, x + 94, y + 22 + m, 6, 27); } else { - context.drawGuiTexture(RenderPipelines.GUI_TEXTURED, SCROLLER_DISABLED_TEXTURE, x + 94, y + 22, 6, 27); + context.blitSprite(SCROLLER_DISABLED_TEXTURE, x + 94, y + 22, 6, 27); } } public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) { if (!super.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount)) { - int i = this.handler.getWords().size(); + int i = this.menu.getWords().size(); if (this.canScroll(i)) { int j = i - 11; - this.indexStartOffset = MathHelper.clamp((int) ((double) this.indexStartOffset - verticalAmount), 0, j); + this.indexStartOffset = Mth.clamp((int) ((double) this.indexStartOffset - verticalAmount), 0, j); } } @@ -305,14 +339,14 @@ public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmou } public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) { - int i = this.handler.getWords().size(); + int i = this.menu.getWords().size(); if (this.scrolling) { - int j = this.y + 18; + int j = this.topPos + 18; int k = j + 153; int l = i - 11; float f = ((float)mouseY - (float)j - 13.5F) / ((float)(k - j) - 27.0F); f = f * (float)l + 0.5F; - this.indexStartOffset = MathHelper.clamp((int)f, 0, l); + this.indexStartOffset = Mth.clamp((int)f, 0, l); return true; } else { return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY); @@ -321,29 +355,29 @@ public boolean mouseDragged(double mouseX, double mouseY, int button, double del public boolean mouseClicked(double mouseX, double mouseY, int button) { this.scrolling = false; - int i = (this.width - this.backgroundWidth) / 2; - int j = (this.height - this.backgroundHeight) / 2; - if (this.canScroll((this.handler).getWords().size()) && mouseX > (double)(i + 94) && mouseX < (double)(i + 94 + 6) && mouseY > (double)(j + 22) && mouseY <= (double)(j + 22 + 153 + 1)) { + int i = (this.width - this.imageWidth) / 2; + int j = (this.height - this.imageHeight) / 2; + if (this.canScroll((this.menu).getWords().size()) && mouseX > (double)(i + 94) && mouseX < (double)(i + 94 + 6) && mouseY > (double)(j + 22) && mouseY <= (double)(j + 22 + 153 + 1)) { this.scrolling = true; } return super.mouseClicked(mouseX, mouseY, button); } - static class WidgetInscriptionButtonPage extends ButtonWidget { + static class WidgetInscriptionButtonPage extends Button { final int index; boolean selected; int selectedIndex = -1; boolean hidden; - private static final Identifier BUTTON_TEXTURE = MiddleEarth.of("word_button"); - private static final Identifier DISABLED_BUTTON_TEXTURE = MiddleEarth.of("word_button_disabled"); - private static final Identifier SELECTED_BUTTON_TEXTURE = MiddleEarth.of("word_button_selected"); - private static final Identifier HIGHLIGHTED_BUTTON_TEXTURE = MiddleEarth.of("word_button_highlighted"); - private static final Identifier BUTTON_MARKERS = MiddleEarth.of("inscription_table_markers"); + private static final ResourceLocation BUTTON_TEXTURE = MiddleEarth.of("word_button"); + private static final ResourceLocation DISABLED_BUTTON_TEXTURE = MiddleEarth.of("word_button_disabled"); + private static final ResourceLocation SELECTED_BUTTON_TEXTURE = MiddleEarth.of("word_button_selected"); + private static final ResourceLocation HIGHLIGHTED_BUTTON_TEXTURE = MiddleEarth.of("word_button_highlighted"); + private static final ResourceLocation BUTTON_MARKERS = MiddleEarth.of("inscription_table_markers"); - public WidgetInscriptionButtonPage(final int x, final int y, final int index, final ButtonWidget.PressAction onPress) { - super(x, y, 86, 14, ScreenTexts.EMPTY, onPress, DEFAULT_NARRATION_SUPPLIER); + public WidgetInscriptionButtonPage(final int x, final int y, final int index, final Button.OnPress onPress) { + super(x, y, 86, 14, CommonComponents.EMPTY, onPress, DEFAULT_NARRATION); this.index = index; this.visible = false; } @@ -365,29 +399,31 @@ public int getIndex() { } @Override - protected void renderWidget(DrawContext context, int mouseX, int mouseY, float deltaTicks) { - MinecraftClient minecraftClient = MinecraftClient.getInstance(); + protected void renderWidget(GuiGraphics context, int mouseX, int mouseY, float deltaTicks) { + Minecraft minecraftClient = Minecraft.getInstance(); final int x = getX(); final int y = getY(); final int width = getWidth(); final int height = getHeight(); + context.setColor(1.0F, 1.0F, 1.0F, this.alpha); if (this.hidden){ - context.drawGuiTexture(RenderPipelines.GUI_TEXTURED, DISABLED_BUTTON_TEXTURE, x, y, width, height, ColorHelper.getWhite(this.alpha)); + context.blitSprite(DISABLED_BUTTON_TEXTURE, x, y, width, height); } else if (this.selected){ - context.drawGuiTexture(RenderPipelines.GUI_TEXTURED, SELECTED_BUTTON_TEXTURE, x, y, width, height, ColorHelper.getWhite(this.alpha)); + context.blitSprite(SELECTED_BUTTON_TEXTURE, x, y, width, height); } else if (this.isHovered()) { - context.drawGuiTexture(RenderPipelines.GUI_TEXTURED, HIGHLIGHTED_BUTTON_TEXTURE, x, y, width, height, ColorHelper.getWhite(this.alpha)); + context.blitSprite(HIGHLIGHTED_BUTTON_TEXTURE, x, y, width, height); } else { - context.drawGuiTexture(RenderPipelines.GUI_TEXTURED, BUTTON_TEXTURE, x, y, width, height, ColorHelper.getWhite(this.alpha)); + context.blitSprite(BUTTON_TEXTURE, x, y, width, height); } if(selectedIndex >= 0 && selectedIndex < 3) { - context.drawGuiTexture(RenderPipelines.GUI_TEXTURED, BUTTON_MARKERS, 16, 4, - 4 * selectedIndex, 0, x + width - 8, y + 5, 4, 4, ColorHelper.getWhite(this.alpha)); + context.blitSprite(BUTTON_MARKERS, 16, 4, + 4 * selectedIndex, 0, x + width - 8, y + 5, 0, 4, 4); } + context.setColor(1.0F, 1.0F, 1.0F, 1.0F); - int i = ColorHelper.withAlpha(this.alpha, this.active ? -1 : -6250336); - this.drawMessage(context, minecraftClient.textRenderer, i); + int i = withAlpha(this.alpha, this.active ? -1 : -6250336); + this.renderString(context, minecraftClient.font, i); } @Override @@ -396,28 +432,30 @@ public void playDownSound(SoundManager soundManager) { } } - static class WidgetArrowButtonPage extends ButtonWidget { + static class WidgetArrowButtonPage extends Button { - private static final Identifier BUTTON_TEXTURE = MiddleEarth.of("arrow_button"); - private static final Identifier BUTTON_UNAVAILABLE = MiddleEarth.of("arrow_button_unavailable"); - private static final Identifier HIGHLIGHTED_BUTTON_TEXTURE = MiddleEarth.of("arrow_button_highlighted"); + private static final ResourceLocation BUTTON_TEXTURE = MiddleEarth.of("arrow_button"); + private static final ResourceLocation BUTTON_UNAVAILABLE = MiddleEarth.of("arrow_button_unavailable"); + private static final ResourceLocation HIGHLIGHTED_BUTTON_TEXTURE = MiddleEarth.of("arrow_button_highlighted"); - public WidgetArrowButtonPage(final int x, final int y, final ButtonWidget.PressAction onPress) { - super(x, y, 16, 11, ScreenTexts.EMPTY, onPress, DEFAULT_NARRATION_SUPPLIER); + public WidgetArrowButtonPage(final int x, final int y, final Button.OnPress onPress) { + super(x, y, 16, 11, CommonComponents.EMPTY, onPress, DEFAULT_NARRATION); } @Override - protected void renderWidget(DrawContext context, int mouseX, int mouseY, float deltaTicks) { - MinecraftClient minecraftClient = MinecraftClient.getInstance(); + protected void renderWidget(GuiGraphics context, int mouseX, int mouseY, float deltaTicks) { + Minecraft minecraftClient = Minecraft.getInstance(); + context.setColor(1.0F, 1.0F, 1.0F, this.alpha); if (this.isHovered() && this.active){ - context.drawGuiTexture(RenderPipelines.GUI_TEXTURED, HIGHLIGHTED_BUTTON_TEXTURE, this.getX(), this.getY(), this.getWidth(), this.getHeight(), ColorHelper.getWhite(this.alpha)); + context.blitSprite(HIGHLIGHTED_BUTTON_TEXTURE, this.getX(), this.getY(), this.getWidth(), this.getHeight()); } else if (this.active) { - context.drawGuiTexture(RenderPipelines.GUI_TEXTURED, BUTTON_TEXTURE, this.getX(), this.getY(), this.getWidth(), this.getHeight(), ColorHelper.getWhite(this.alpha)); + context.blitSprite(BUTTON_TEXTURE, this.getX(), this.getY(), this.getWidth(), this.getHeight()); } else { - context.drawGuiTexture(RenderPipelines.GUI_TEXTURED, BUTTON_UNAVAILABLE, this.getX(), this.getY(), this.getWidth(), this.getHeight(), ColorHelper.getWhite(this.alpha)); + context.blitSprite(BUTTON_UNAVAILABLE, this.getX(), this.getY(), this.getWidth(), this.getHeight()); } - int i = ColorHelper.withAlpha(this.alpha, this.active ? -1 : -6250336); - this.drawMessage(context, minecraftClient.textRenderer, i); + context.setColor(1.0F, 1.0F, 1.0F, 1.0F); + int i = withAlpha(this.alpha, this.active ? -1 : -6250336); + this.renderString(context, minecraftClient.font, i); } } -} \ No newline at end of file +} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/inscriptiontable/InscriptionTableScreenHandler.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/inscriptiontable/InscriptionTableScreenHandler.java index fa24159263..d35f921cfe 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/inscriptiontable/InscriptionTableScreenHandler.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/inscriptiontable/InscriptionTableScreenHandler.java @@ -1,29 +1,34 @@ package net.sevenstars.middleearth.gui.inscriptiontable; -import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; -import net.minecraft.component.DataComponentTypes; -import net.minecraft.component.type.ItemEnchantmentsComponent; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.Inventory; -import net.minecraft.inventory.SimpleInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.recipe.RecipeEntry; -import net.minecraft.recipe.ServerRecipeManager; -import net.minecraft.recipe.input.SingleStackRecipeInput; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.registry.tag.TagKey; -import net.minecraft.screen.*; -import net.minecraft.screen.slot.Slot; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.sound.SoundCategory; -import net.minecraft.util.Identifier; -import net.minecraft.world.World; +import com.mojang.datafixers.util.Pair; +import net.neoforged.neoforge.network.PacketDistributor; + +import net.minecraft.core.Holder; +import net.minecraft.core.component.DataComponents; +import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.sounds.SoundSource; +import net.minecraft.tags.TagKey; +import net.minecraft.world.Container; +import net.minecraft.world.SimpleContainer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerLevelAccess; +import net.minecraft.world.inventory.DataSlot; +import net.minecraft.world.inventory.InventoryMenu; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.world.item.crafting.SingleRecipeInput; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.item.enchantment.ItemEnchantments; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.block.registration.ModDecorativeBlocks; import net.sevenstars.middleearth.gui.ModScreenHandlers; @@ -39,27 +44,32 @@ import java.util.List; import java.util.Objects; -public class InscriptionTableScreenHandler extends ScreenHandler { - private final ScreenHandlerContext context; - private final World world; - public List> outputRecipes; - public RegistryEntry enchant; +public class InscriptionTableScreenHandler extends AbstractContainerMenu { + public static final int MAX_SELECTED_WORDS = 3; + public static final int MAX_WORD_LENGTH = 32; + + private final ContainerLevelAccess context; + private final Level world; + public List> outputRecipes; + public Holder enchant; public int level; - public final Inventory input; + public final Container input; - public PlayerEntity player; + public Player player; private byte[] availableWords; + private int availableWordsRevision = -1; public List selectedWords; - private final Property levelCost; + private final DataSlot levelCost; + private final DataSlot selectionRevision; - private static final Identifier EMPTY_SLOT_CHISEL_TEXTURE = MiddleEarth.of("container/slot/chisel"); + private static final ResourceLocation EMPTY_SLOT_CHISEL_TEXTURE = MiddleEarth.of("container/slot/chisel"); - public InscriptionTableScreenHandler(int syncId, PlayerInventory playerInventory) { - this(syncId, playerInventory, ScreenHandlerContext.EMPTY); + public InscriptionTableScreenHandler(int syncId, Inventory playerInventory) { + this(syncId, playerInventory, ContainerLevelAccess.NULL); } - public InscriptionTableScreenHandler(int syncId, PlayerInventory playerInventory, final ScreenHandlerContext context) { + public InscriptionTableScreenHandler(int syncId, Inventory playerInventory, final ContainerLevelAccess context) { super(ModScreenHandlers.INSCRIPTION_SCREEN_HANDLER, syncId); this.outputRecipes = new ArrayList<>(); @@ -67,55 +77,62 @@ public InscriptionTableScreenHandler(int syncId, PlayerInventory playerInventory this.player = playerInventory.player; - this.input = new SimpleInventory(3) { + this.input = new SimpleContainer(3) { @Override - public void markDirty() { - super.markDirty(); + public void setChanged() { + super.setChanged(); InscriptionTableScreenHandler.this.updateInput(input); } }; this.addSlot(new Slot(this.input, 0, 135, 48) { @Override - public boolean canInsert(ItemStack stack) { - return stack.isIn(ItemTagsME.INSCRIPTION_CATALYSTS) && !this.hasStack(); + public boolean mayPlace(ItemStack stack) { + return stack.is(ItemTagsME.INSCRIPTION_CATALYSTS) && !this.hasItem(); } @Override - public int getMaxItemCount() { + public int getMaxStackSize() { return 1; } }); this.addSlot(new Slot(this.input, 1, 225, 48) { @Override - public boolean canInsert(ItemStack stack) { - return stack.isIn(ItemTagsME.EARLY_CHISELS); + public boolean mayPlace(ItemStack stack) { + return stack.is(ItemTagsME.EARLY_CHISELS); } @Override - public int getMaxItemCount() { + public int getMaxStackSize() { return 1; } - public Identifier getBackgroundSprite() { - return EMPTY_SLOT_CHISEL_TEXTURE; + public Pair getNoItemIcon() { + return Pair.of(InventoryMenu.BLOCK_ATLAS, EMPTY_SLOT_CHISEL_TEXTURE); } }); this.addSlot(new Slot(this.input, 2, 180, 48){ @Override - public boolean canInsert(ItemStack stack) { - return (stack.isIn(TagKey.of(RegistryKeys.ITEM, Identifier.of("minecraft", "enchantable/bow"))) || - stack.isIn(TagKey.of(RegistryKeys.ITEM, Identifier.of("minecraft", "enchantable/crossbow"))) - || stack.isEnchantable() || stack.hasEnchantments()) && !stack.isOf(Items.BOOK); + public boolean mayPlace(ItemStack stack) { + return (stack.is(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("minecraft", "enchantable/bow"))) || + stack.is(TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("minecraft", "enchantable/crossbow"))) + || stack.isEnchantable() || stack.isEnchanted()) && !stack.is(Items.BOOK); + } + + @Override + public int getMaxStackSize() { + return 1; } }); this.context = context; - this.world = playerInventory.player.getWorld(); + this.world = playerInventory.player.level(); - this.levelCost = Property.create(); - this.addProperty(this.levelCost); + this.levelCost = DataSlot.standalone(); + this.addDataSlot(this.levelCost); + this.selectionRevision = DataSlot.standalone(); + this.addDataSlot(this.selectionRevision); addPlayerInventory(playerInventory); addPlayerHotbar(playerInventory); @@ -125,32 +142,36 @@ public int getLevelCost() { return this.levelCost.get(); } + public int getSelectionRevision() { + return this.selectionRevision.get(); + } + public int getPlayerLevels(){ return this.player.experienceLevel; } public boolean hasGem(){ - return !this.input.getStack(0).isEmpty(); + return !this.input.getItem(0).isEmpty(); } public boolean hasChisel(){ - return !this.input.getStack(1).isEmpty(); + return !this.input.getItem(1).isEmpty(); } public boolean hasInput(){ - return !this.input.getStack(2).isEmpty(); + return !this.input.getItem(2).isEmpty(); } public boolean hasAll(){ return this.hasGem() && this.hasChisel() && this.hasInput(); } - public boolean canUse(PlayerEntity player) { - return canUse(this.context, player, ModDecorativeBlocks.INSCRIPTION_TABLE); + public boolean stillValid(Player player) { + return stillValid(this.context, player, ModDecorativeBlocks.INSCRIPTION_TABLE); } public List getWords(){ - ItemStack catalyst = this.input.getStack(0); + ItemStack catalyst = this.input.getItem(0); List words = new ArrayList<>(); @@ -165,121 +186,164 @@ public byte[] getAvailableWords() { return this.availableWords; } - public void updateAvailableWords(byte[] wordsIndexes) { - availableWords = wordsIndexes; + public boolean updateAvailableWords(int revision, byte[] wordsIndexes) { + if (revision < this.availableWordsRevision) { + return false; + } + this.availableWordsRevision = revision; + this.availableWords = wordsIndexes.clone(); + return true; + } + + public boolean canApplyWordUpdate(boolean add, String word) { + if (word == null + || word.isBlank() + || word.length() > MAX_WORD_LENGTH + || selectedWords.size() > MAX_SELECTED_WORDS + || !getWords().contains(word)) { + return false; + } + return add + ? selectedWords.size() < MAX_SELECTED_WORDS && !selectedWords.contains(word) + : selectedWords.contains(word); + } + + public boolean canConfirmSelection() { + RecipeHolder recipe = findSelectedRecipe(); + return recipe != null + && (player.hasInfiniteMaterials() + || player.experienceLevel >= getLevelCost(recipe.value().levelCost, recipe.value().enchant)); } public void updateWords(boolean add, String word, boolean reset){ - boolean foundEnchant = false; - RegistryEntry resultEnchant = null; + Holder resultEnchant = null; int resultLevel = 0; int resultMaxLevel = 0; int resultLevelCost = 0; - if (!reset){ + if (reset) { + this.selectedWords.clear(); + } else { if (add){ if (this.selectedWords.isEmpty()){ - world.playSound(null, this.player.getBlockPos(), SoundsME.CHISEL_HIT_FIRST, SoundCategory.BLOCKS, 1.0F, 0.95F + world.random.nextFloat() * 0.1F); + world.playSound(null, this.player.blockPosition(), SoundsME.CHISEL_HIT_FIRST, SoundSource.BLOCKS, 1.0F, 0.95F + world.random.nextFloat() * 0.1F); } else if(this.selectedWords.size() == 1) { - world.playSound(null, this.player.getBlockPos(), SoundsME.CHISEL_HIT_SECOND, SoundCategory.BLOCKS, 1.0F, 0.95F + world.random.nextFloat() * 0.1F); + world.playSound(null, this.player.blockPosition(), SoundsME.CHISEL_HIT_SECOND, SoundSource.BLOCKS, 1.0F, 0.95F + world.random.nextFloat() * 0.1F); }else if(this.selectedWords.size() == 2) { - world.playSound(null, this.player.getBlockPos(), SoundsME.CHISEL_HIT_THIRD, SoundCategory.BLOCKS, 1.0F, 0.95F + world.random.nextFloat() * 0.1F); + world.playSound(null, this.player.blockPosition(), SoundsME.CHISEL_HIT_THIRD, SoundSource.BLOCKS, 1.0F, 0.95F + world.random.nextFloat() * 0.1F); } this.selectedWords.add(word); } else { this.selectedWords.remove(word); } } - if (!this.outputRecipes.isEmpty()){ - for (RecipeEntry recipe : this.outputRecipes){ - if (this.selectedWords.size() == 2 && recipe.value().inputWords.size() == 3 && add){ - if (Objects.equals(this.selectedWords.get(1), recipe.value().inputWords.get(1)) - && recipe.value().enchant.value().isAcceptableItem(input.getStack(2)) - && this.selectedWords.get(0).equals(recipe.value().inputWords.get(0))){ - } - } - if (recipe.value().inputWords.equals(this.selectedWords)){ - if (canEnchant(input.getStack(2), recipe.value().enchant, recipe.value().level)){ - foundEnchant = true; - resultEnchant = recipe.value().enchant; - resultLevel = recipe.value().level; - resultMaxLevel = recipe.value().enchant.value().getMaxLevel(); - resultLevelCost = recipe.value().levelCost; - } - } - } - List words = new ArrayList<>(); - List allowedWords = new ArrayList<>(); - if(this.hasAll()){ - words.addAll(InscriptionWordBank.wordBank.get(this.input.getStack(0).getItem())); - words.addAll(InscriptionWordBank.wordBank.get(null)); + List words = this.getWords(); + List allowedWords = new ArrayList<>(this.selectedWords); + this.availableWords = new byte[words.size()]; + + for (RecipeHolder recipe : this.outputRecipes) { + List recipeWords = recipe.value().inputWords; + if (!words.containsAll(recipeWords) + || !hasSelectedPrefix(recipeWords) + || !canEnchant(this.input.getItem(2), recipe.value().enchant, recipe.value().level)) { + continue; } - availableWords = new byte[words.size() + 1]; - words.add(word); - ServerRecipeManager serverRecipeManager = (ServerRecipeManager) this.world.getRecipeManager(); - List> availableRecipes = serverRecipeManager.getAllOfType(RecipesME.INSCRIPTION_TABLE) - .stream().filter((inscriptionRecipeRecipeEntry -> { - if(!inscriptionRecipeRecipeEntry.value().enchant.value().isAcceptableItem(input.getStack(2))) return false; - if(selectedWords.isEmpty()) return true; - else return inscriptionRecipeRecipeEntry.value().inputWords.getFirst().equals(selectedWords.getFirst()); - })).toList(); - - for(RecipeEntry recipe : availableRecipes) { - List recipeWords = recipe.value().inputWords; - for(String availableWord : recipeWords) { - if(!allowedWords.contains(availableWord)) { - allowedWords.add(availableWord); - } - } + if (recipeWords.equals(this.selectedWords)) { + resultEnchant = recipe.value().enchant; + resultLevel = recipe.value().level; + resultMaxLevel = recipe.value().enchant.value().getMaxLevel(); + resultLevelCost = recipe.value().levelCost; + } else { + allowedWords.add(recipeWords.get(this.selectedWords.size())); } + } - int index = 0; - for(String wordElement : words) { - if(allowedWords.contains(wordElement) || selectedWords.contains(wordElement)) { - availableWords[index] = 1; - } - index++; + for (int index = 0; index < words.size(); index++) { + if (allowedWords.contains(words.get(index))) { + this.availableWords[index] = 1; } + } - InscriptionEnchantInfoPacket newPacket; - if (foundEnchant){ - newPacket = new InscriptionEnchantInfoPacket(resultEnchant.value().description().copy().getString(), resultLevel, resultMaxLevel, availableWords); - this.enchant = resultEnchant; - this.level = resultLevel; - calculateCost(resultLevelCost, resultEnchant); - } else { - newPacket = new InscriptionEnchantInfoPacket("", 0, 0, availableWords); - this.enchant = null; - this.level = 0; - this.levelCost.set(0); + InscriptionEnchantInfoPacket packet; + if (resultEnchant != null) { + packet = new InscriptionEnchantInfoPacket(this.containerId, this.selectionRevision.get(), resultEnchant.value().description().copy().getString(), resultLevel, resultMaxLevel, this.availableWords); + this.enchant = resultEnchant; + this.level = resultLevel; + calculateCost(resultLevelCost, resultEnchant); + } else { + packet = new InscriptionEnchantInfoPacket(this.containerId, this.selectionRevision.get(), "", 0, 0, this.availableWords); + this.enchant = null; + this.level = 0; + this.levelCost.set(0); + } + PacketDistributor.sendToPlayer((ServerPlayer) this.player, packet); + } + + private boolean hasSelectedPrefix(List recipeWords) { + if (this.selectedWords.size() > recipeWords.size()) { + return false; + } + for (int index = 0; index < this.selectedWords.size(); index++) { + if (!Objects.equals(this.selectedWords.get(index), recipeWords.get(index))) { + return false; } - ServerPlayNetworking.send((ServerPlayerEntity) player, newPacket); } + return true; } - private void updateInput(Inventory inventory) { - ItemStack inputChisel = inventory.getStack(1); + private void updateInput(Container inventory) { + if (this.world.isClientSide) { + return; + } + + this.selectionRevision.set(this.selectionRevision.get() + 1); + this.selectedWords.clear(); if (this.hasAll()) { - if (!this.world.isClient){ - updateWords(false, "", true); - ServerRecipeManager serverRecipeManager = (ServerRecipeManager) this.world.getRecipeManager(); - this.outputRecipes = serverRecipeManager.getAllMatches(RecipesME.INSCRIPTION_TABLE, new SingleStackRecipeInput(inputChisel), this.world).toList(); - } + this.outputRecipes = this.world.getRecipeManager().getRecipesFor( + RecipesME.INSCRIPTION_TABLE, + new SingleRecipeInput(inventory.getItem(1)), + this.world + ); } else { - updateWords(false, "", true); this.outputRecipes = new ArrayList<>(); - this.selectedWords = new ArrayList<>(); } + updateWords(false, "", true); } - private boolean canEnchant(ItemStack stack, RegistryEntry enchant, int level) { - boolean acceptableItem = enchant.value().isAcceptableItem(stack); - if (acceptableItem && EnchantmentHelper.isCompatible(stack.getEnchantments().getEnchantments(), enchant)){ + private RecipeHolder findSelectedRecipe() { + if (!this.hasAll() + || this.selectedWords.isEmpty() + || this.selectedWords.size() > MAX_SELECTED_WORDS) { + return null; + } + + List words = this.getWords(); + if (!words.containsAll(this.selectedWords)) { + return null; + } + + for (RecipeHolder recipe : this.world.getRecipeManager().getRecipesFor( + RecipesME.INSCRIPTION_TABLE, + new SingleRecipeInput(this.input.getItem(1)), + this.world + )) { + if (recipe.value().inputWords.equals(this.selectedWords) + && words.containsAll(recipe.value().inputWords) + && canEnchant(this.input.getItem(2), recipe.value().enchant, recipe.value().level)) { + return recipe; + } + } + return null; + } + + private boolean canEnchant(ItemStack stack, Holder enchant, int level) { + boolean acceptableItem = enchant.value().canEnchant(stack); + if (acceptableItem && EnchantmentHelper.isEnchantmentCompatible(stack.getEnchantments().keySet(), enchant)){ return stack.getEnchantments().getLevel(enchant) == level - 1; } else { - if (stack.getEnchantments().getEnchantments().contains(enchant)){ + if (stack.getEnchantments().keySet().contains(enchant)){ return stack.getEnchantments().getLevel(enchant) == level - 1; } else { return false; @@ -288,94 +352,111 @@ private boolean canEnchant(ItemStack stack, RegistryEntry enchant, } public void enchantItem(){ - ItemStack stackCatalyst = this.input.getStack(0); - ItemStack stackChisel = this.input.getStack(1); - ItemStack stack = this.input.getStack(2); - - if(stackCatalyst.get(DataComponentTypes.MAX_DAMAGE) == null){ - if (stackCatalyst.isOf(Items.LAPIS_LAZULI)) this.input.setStack(0, ItemStack.EMPTY); - stackCatalyst.set(DataComponentTypes.MAX_DAMAGE, 2); - stackCatalyst.setDamage(stackCatalyst.getDamage() + 1); - } else { - if (stackCatalyst.getDamage() == stackCatalyst.getMaxDamage()){ - this.input.setStack(0, ItemStack.EMPTY); - } else { - stackCatalyst.setDamage(stackCatalyst.getDamage() + 1); - } + RecipeHolder recipe = findSelectedRecipe(); + if (recipe == null) { + return; } - if ((stackChisel.getDamage() == stackChisel.getMaxDamage()) && !stackChisel.isOf(ToolItemsME.MITHRIL_CHISEL)){ - this.input.setStack(1, ItemStack.EMPTY); - } else { - stackChisel.setDamage(stackChisel.getDamage() + 1); + int cost = getLevelCost(recipe.value().levelCost, recipe.value().enchant); + if (!this.player.hasInfiniteMaterials() && this.player.experienceLevel < cost) { + return; } - if (this.enchant != null && this.level != 0){ - if (!player.isInCreativeMode()) { - player.addExperienceLevels(-this.levelCost.get()); + ItemStack stackCatalyst = this.input.getItem(0); + ItemStack stackChisel = this.input.getItem(1); + ItemStack stack = this.input.getItem(2); + + if (!this.player.hasInfiniteMaterials()) { + if (stackCatalyst.is(Items.LAPIS_LAZULI)) { + this.input.setItem(0, ItemStack.EMPTY); + } else { + if (stackCatalyst.get(DataComponents.MAX_DAMAGE) == null) { + stackCatalyst.set(DataComponents.MAX_DAMAGE, 2); + } + damageOrConsumeInput(0, stackCatalyst); } - this.levelCost.set(0); - stack.addEnchantment(this.enchant, this.level); - world.playSound(null, this.player.getBlockPos(), SoundsME.CHISEL_ENCHANT, SoundCategory.BLOCKS, 1.0F, world.random.nextFloat() * 0.1F + 0.9F); + if (!stackChisel.is(ToolItemsME.MITHRIL_CHISEL)) { + damageOrConsumeInput(1, stackChisel); + } + this.player.giveExperienceLevels(-cost); } - updateWords(false, "", true); + stack.enchant(recipe.value().enchant, recipe.value().level); + this.levelCost.set(0); + this.world.playSound(null, this.player.blockPosition(), SoundsME.CHISEL_ENCHANT, SoundSource.BLOCKS, 1.0F, this.world.random.nextFloat() * 0.1F + 0.9F); + this.input.setChanged(); } - public void calculateCost(int levelCost, RegistryEntry enchant) { - ItemStack itemStack = this.input.getStack(2); + private void damageOrConsumeInput(int slot, ItemStack stack) { + int nextDamage = stack.getDamageValue() + 1; + if (nextDamage >= stack.getMaxDamage()) { + this.input.setItem(slot, ItemStack.EMPTY); + } else { + stack.setDamageValue(nextDamage); + } + } + + public void calculateCost(int levelCost, Holder enchant) { + this.levelCost.set(getLevelCost(levelCost, enchant)); + } + + private int getLevelCost(int baseCost, Holder enchant) { + ItemStack itemStack = this.input.getItem(2); int k = 0; if (!itemStack.isEmpty()){ - ItemEnchantmentsComponent.Builder builder = new ItemEnchantmentsComponent.Builder(EnchantmentHelper.getEnchantments(itemStack)); + ItemEnchantments.Mutable builder = new ItemEnchantments.Mutable(EnchantmentHelper.getEnchantmentsForCrafting(itemStack)); - for (RegistryEntry enchantEntry : builder.getEnchantments()) { - if (enchantEntry != enchant) { + for (Holder enchantEntry : builder.keySet()) { + if (!enchantEntry.equals(enchant)) { k++; } } - this.levelCost.set(levelCost + k); } + return baseCost + k; } - public ScreenHandlerType getType() { + public MenuType getType() { return ModScreenHandlers.INSCRIPTION_SCREEN_HANDLER; } - public ItemStack quickMove(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { + if (slot < 0 || slot >= this.slots.size()) { + return ItemStack.EMPTY; + } + ItemStack stack = ItemStack.EMPTY; Slot invSlot = this.slots.get(slot); - if(invSlot.hasStack()) { - ItemStack originalStack = invSlot.getStack(); - Item item = originalStack.getItem(); + if(invSlot.hasItem()) { + ItemStack originalStack = invSlot.getItem(); stack = originalStack.copy(); - if(slot < this.input.size()) { - if(!this.insertItem(originalStack, this.input.size(), this.slots.size(), true)) { + if(slot < this.input.getContainerSize()) { + if(!this.moveItemStackTo(originalStack, this.input.getContainerSize(), this.slots.size(), true)) { return ItemStack.EMPTY; } - } else if (!this.insertItem(originalStack, 0, this.input.size(), false)) { + } else if (!this.moveItemStackTo(originalStack, 0, this.input.getContainerSize(), false)) { return ItemStack.EMPTY; } if (originalStack.isEmpty()) { - invSlot.setStack(ItemStack.EMPTY); + invSlot.setByPlayer(ItemStack.EMPTY); } else { - invSlot.markDirty(); + invSlot.setChanged(); } - invSlot.onTakeItem(player, originalStack); - this.sendContentUpdates(); + invSlot.onTake(player, originalStack); + this.broadcastChanges(); } return stack; } - public void onClosed(PlayerEntity player) { - super.onClosed(player); - this.dropInventory(player, this.input); + public void removed(Player player) { + super.removed(player); + this.clearContainer(player, this.input); } - private void addPlayerInventory(PlayerInventory playerInventory) { + private void addPlayerInventory(Inventory playerInventory) { for (int i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 108 + j * 18, 102 + i * 18)); @@ -383,7 +464,7 @@ private void addPlayerInventory(PlayerInventory playerInventory) { } } - private void addPlayerHotbar(PlayerInventory playerInventory) { + private void addPlayerHotbar(Inventory playerInventory) { for (int i = 0; i < 9; ++i) { this.addSlot(new Slot(playerInventory, i, 108 + i * 18, 160)); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/map/MapScreen.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/map/MapScreen.java index 58f094068a..18838f5b13 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/map/MapScreen.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/map/MapScreen.java @@ -1,16 +1,14 @@ package net.sevenstars.middleearth.gui.map; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.text.Text; -import net.minecraft.util.Formatting; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.minecraft.ChatFormatting; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.config.ModClientConfigs; import net.sevenstars.middleearth.event.KeyInputHandler; @@ -27,12 +25,12 @@ import java.util.ArrayList; import java.util.List; -@Environment(EnvType.CLIENT) +@OnlyIn(Dist.CLIENT) public class MapScreen extends Screen { - private static final Identifier BACKGROUND_TEXTURE = Identifier.of(MiddleEarth.MOD_ID,"textures/gui/map_background.png"); - private static final Identifier MAP_UI_TEXTURE = Identifier.of(MiddleEarth.MOD_ID,"textures/gui/map_ui.png"); + private static final ResourceLocation BACKGROUND_TEXTURE = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID,"textures/gui/map_background.png"); + private static final ResourceLocation MAP_UI_TEXTURE = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID,"textures/gui/map_ui.png"); - private static final Text MAP_TITLE_TEXT = Text.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.map_title_text"); + private static final Component MAP_TITLE_TEXT = Component.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.map_title_text"); private static final Vector2i NORMAL_BUTTON_SIZE = new Vector2i(15,15); BackgroundContainerWidget backgroundContainerWidget; @@ -46,11 +44,11 @@ public class MapScreen extends Screen { private static int endY = 0; public FullscreenToggeableMapWidget mapWidget; - public ButtonWidget fullscreenButton; - public ButtonWidget overlayToggleButton; - public ButtonWidget zoomInButton; - public ButtonWidget zoomOutButton; - public ButtonWidget recenterButton; + public Button fullscreenButton; + public Button overlayToggleButton; + public Button zoomInButton; + public Button zoomOutButton; + public Button recenterButton; private int mouseX, mouseY; public MapScreenController controller = null; public boolean isFullscreen = false; @@ -68,48 +66,49 @@ protected void init() { mapWidget = new FullscreenToggeableMapWidget(WIDTH - (MARGIN * 2), HEIGHT - (MARGIN * 2)); // Fullscreen toggle button register - fullscreenButton = ButtonWidget.builder(Text.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.button.fullscreen_toggle"), x -> { + fullscreenButton = Button.builder(Component.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.button.fullscreen_toggle"), x -> { isFullscreen = !isFullscreen; }).build(); - fullscreenButton.setDimensions(NORMAL_BUTTON_SIZE.x,NORMAL_BUTTON_SIZE.y); - addDrawableChild(fullscreenButton); + fullscreenButton.setSize(NORMAL_BUTTON_SIZE.x,NORMAL_BUTTON_SIZE.y); + addRenderableWidget(fullscreenButton); // Overlay toggle - overlayToggleButton = ButtonWidget.builder(Text.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.button.map_overlay_toggle"), x -> { + overlayToggleButton = Button.builder(Component.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.button.map_overlay_toggle"), x -> { mapWidget.setOverlayState(!mapWidget.isOverlayEnabled()); }).build(); overlayToggleButton.active = ModClientConfigs.ENABLE_MAP_OVERLAY; - overlayToggleButton.setDimensions(NORMAL_BUTTON_SIZE.x,NORMAL_BUTTON_SIZE.y); - addDrawableChild(overlayToggleButton); + overlayToggleButton.setSize(NORMAL_BUTTON_SIZE.x,NORMAL_BUTTON_SIZE.y); + addRenderableWidget(overlayToggleButton); // Recenter on player - recenterButton = ButtonWidget.builder(Text.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.button.recenter_on_player"), x -> { + recenterButton = Button.builder(Component.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.button.recenter_on_player"), x -> { Vector2d playerCoords = new Vector2d(playerBlockPos.getX(), playerBlockPos.getZ()); playerCoords.x /= MiddleEarthMapConfigs.FULL_MAP_SIZE; playerCoords.y /= MiddleEarthMapConfigs.FULL_MAP_SIZE; mapWidget.instantCenterOnRatio(playerCoords); }).build(); - recenterButton.setDimensions(NORMAL_BUTTON_SIZE.x,NORMAL_BUTTON_SIZE.y); - addDrawableChild(recenterButton); + recenterButton.setSize(NORMAL_BUTTON_SIZE.x,NORMAL_BUTTON_SIZE.y); + addRenderableWidget(recenterButton); // Zoom in button register - zoomInButton = ButtonWidget.builder(Text.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.button.zoom_in"), x -> { + zoomInButton = Button.builder(Component.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.button.zoom_in"), x -> { mapWidget.zoomClick(); }).build(); - zoomInButton.setDimensions(NORMAL_BUTTON_SIZE.x,NORMAL_BUTTON_SIZE.y); - addDrawableChild(zoomInButton); + zoomInButton.setSize(NORMAL_BUTTON_SIZE.x,NORMAL_BUTTON_SIZE.y); + addRenderableWidget(zoomInButton); // Zoom out button register - zoomOutButton = ButtonWidget.builder(Text.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.button.zoom_out"), x -> { + zoomOutButton = Button.builder(Component.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.button.zoom_out"), x -> { mapWidget.dezoomClick(); }).build(); - zoomOutButton.setDimensions(NORMAL_BUTTON_SIZE.x,NORMAL_BUTTON_SIZE.y); - addDrawableChild(zoomOutButton); + zoomOutButton.setSize(NORMAL_BUTTON_SIZE.x,NORMAL_BUTTON_SIZE.y); + addRenderableWidget(zoomOutButton); } @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) { + public void render(GuiGraphics context, int mouseX, int mouseY, float delta) { + renderBackground(context, mouseX, mouseY, delta); if(isFullscreen){ renderFullscreen(context); } else { @@ -121,35 +120,35 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) { showCursorInformationTooltip(context, mouseX, mouseY); } - private void showCursorInformationTooltip(DrawContext context, int mouseX, int mouseY) { + private void showCursorInformationTooltip(GuiGraphics context, int mouseX, int mouseY) { Vector2d mapRatio = mapWidget.getCurrentMapRatio(mouseX, mouseY); if(mapRatio != null) { - List texts = new ArrayList<>(); - texts.add(Text.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.tooltip.coordinates_title").formatted(Formatting.UNDERLINE)); + List texts = new ArrayList<>(); + texts.add(Component.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.tooltip.coordinates_title").withStyle(ChatFormatting.UNDERLINE)); double x = Math.round((mapRatio.x * MiddleEarthMapConfigs.FULL_MAP_SIZE) * 10) / 10.0; double z = Math.round((mapRatio.y * MiddleEarthMapConfigs.FULL_MAP_SIZE) * 10) / 10.0; - texts.add(Text.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.tooltip.coordinates_label").formatted(Formatting.GRAY) - .append(Text.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.tooltip.coordinates_content", x, z).formatted(Formatting.WHITE))); + texts.add(Component.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.tooltip.coordinates_label").withStyle(ChatFormatting.GRAY) + .append(Component.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.tooltip.coordinates_content", x, z).withStyle(ChatFormatting.WHITE))); MapBasedCustomBiome biome = mapWidget.getBiomeAt((int) (mapRatio.x * MiddleEarthMapConfigs.REGION_SIZE), (int) (mapRatio.y * MiddleEarthMapConfigs.REGION_SIZE)); - texts.add(Text.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.tooltip.biome_label").formatted(Formatting.GRAY) - .append(Text.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.tooltip.biome_content", Text.translatable(biome.getBiome().getBiomeRegistryKey().getValue().toTranslationKey("biome"))).formatted(Formatting.WHITE))); + texts.add(Component.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.tooltip.biome_label").withStyle(ChatFormatting.GRAY) + .append(Component.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.tooltip.biome_content", Component.translatable(biome.getBiome().getBiomeRegistryKey().location().toLanguageKey("biome"))).withStyle(ChatFormatting.WHITE))); if(hasTeleportPermission){ - texts.add(Text.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.tooltip.teleport_keybind", KeyInputHandler.mapTeleportKey.getBoundKeyLocalizedText().getString()).formatted(Formatting.ITALIC).withColor(ModColors.PENDING.color)); + texts.add(Component.translatable("ui." + MiddleEarth.MOD_ID + ".map_screen.tooltip.teleport_keybind", KeyInputHandler.mapTeleportKey.getTranslatedKeyMessage().getString()).withStyle(ChatFormatting.ITALIC).withColor(ModColors.PENDING.color)); } - context.drawTooltip(textRenderer, texts, mouseX, mouseY); + context.renderComponentTooltip(font, texts, mouseX, mouseY); } } - private void renderFullscreen(DrawContext context) { + private void renderFullscreen(GuiGraphics context) { startX = MARGIN; - endX = context.getScaledWindowWidth() - MARGIN; + endX = context.guiWidth() - MARGIN; startY = MARGIN; - endY = context.getScaledWindowHeight() - MARGIN; + endY = context.guiHeight() - MARGIN; // TODO : Draw dynamic background : context.drawTexture(BACKGROUND_TEXTURE, startX, startY, 0, 0, WIDTH, HEIGHT); - backgroundContainerWidget.draw(context, 0, 0, context.getScaledWindowWidth(), context.getScaledWindowHeight()); + backgroundContainerWidget.draw(context, 0, 0, context.guiWidth(), context.guiHeight()); mapWidget.drawFullscreen(context, MARGIN); drawFullscreenToggleButton(context); @@ -159,14 +158,14 @@ private void renderFullscreen(DrawContext context) { drawPlayer(context); } - private void renderNormal(DrawContext context) { - int centerX = context.getScaledWindowWidth() / 2; + private void renderNormal(GuiGraphics context) { + int centerX = context.guiWidth() / 2; startX = centerX - (WIDTH / 2); endX = centerX + (WIDTH / 2); - startY = (context.getScaledWindowHeight() / 2) - (HEIGHT / 2); + startY = (context.guiHeight() / 2) - (HEIGHT / 2); endY = startY + HEIGHT; - context.drawTexture(RenderPipelines.GUI_TEXTURED, BACKGROUND_TEXTURE, + context.blit(BACKGROUND_TEXTURE, startX, startY, 0, 0, WIDTH, HEIGHT, 256, 256); @@ -178,7 +177,7 @@ private void renderNormal(DrawContext context) { drawPlayer(context); } - private void drawPlayer(DrawContext context) { + private void drawPlayer(GuiGraphics context) { if(!playerIsInDimension) return; Vector2d playerRatio = mapWidget.getMapPointFromWorldCoordinate(new Vector2d(playerBlockPos.getX(), playerBlockPos.getZ())); int margin = (isFullscreen) ? 0 : MARGIN; @@ -190,32 +189,32 @@ private void drawPlayer(DrawContext context) { //PlayerSkinDrawer.draw(context, player.getSkinTextures(), (int)x, (int)y, 4); //PlayerSkinDrawer.draw(context, minecraft.getSkinProvider().getSkinTexturesSupplier(new GameProfile(UUID.fromString(this.uuid),this.name)).get(),x,y); - context.drawTexture(RenderPipelines.GUI_TEXTURED, MAP_UI_TEXTURE, + context.blit(MAP_UI_TEXTURE, (int)x- 4, (int) y- 4, 154, 1, 8, 8, 256, 256); } - private void drawFullscreenToggleButton(DrawContext context){ + private void drawFullscreenToggleButton(GuiGraphics context){ int fullscreenToggleButtonUvY = ((ModWidget.isMouseOver(fullscreenButton) || fullscreenButton.isFocused()) ? 18 : 1); if(!fullscreenButton.active) fullscreenToggleButtonUvY = 35; if(isFullscreen){ - int x = context.getScaledWindowWidth() - MARGIN - NORMAL_BUTTON_SIZE.x; + int x = context.guiWidth() - MARGIN - NORMAL_BUTTON_SIZE.x; int y = MARGIN; fullscreenButton.setPosition(x, y); - context.drawTexture(RenderPipelines.GUI_TEXTURED, MAP_UI_TEXTURE, + context.blit(MAP_UI_TEXTURE, x, y, 35, fullscreenToggleButtonUvY, NORMAL_BUTTON_SIZE.x, NORMAL_BUTTON_SIZE.y, 256, 256); } else { fullscreenButton.setPosition(endX, startY); - context.drawTexture(RenderPipelines.GUI_TEXTURED, MAP_UI_TEXTURE, + context.blit(MAP_UI_TEXTURE, fullscreenButton.getX(), fullscreenButton.getY(), 35, fullscreenToggleButtonUvY, NORMAL_BUTTON_SIZE.x, NORMAL_BUTTON_SIZE.y, 256, 256); } } - private void drawMapOverlayToggleButton(DrawContext context){ + private void drawMapOverlayToggleButton(GuiGraphics context){ int overlayToggleButtonUvY = (ModWidget.isMouseOver(overlayToggleButton) || overlayToggleButton.isFocused()) ? 69 : 52; if(!overlayToggleButton.active) overlayToggleButtonUvY = 86; @@ -224,12 +223,12 @@ private void drawMapOverlayToggleButton(DrawContext context){ int y = fullscreenButton.getY() + NORMAL_BUTTON_SIZE.y; overlayToggleButton.setPosition(x, y); - context.drawTexture(RenderPipelines.GUI_TEXTURED, MAP_UI_TEXTURE, + context.blit(MAP_UI_TEXTURE, x, y, 1, overlayToggleButtonUvY, NORMAL_BUTTON_SIZE.x, NORMAL_BUTTON_SIZE.y, 256, 256); } - private void drawRecenterButton(DrawContext context){ + private void drawRecenterButton(GuiGraphics context){ recenterButton.active = playerIsInDimension; int recenterButtonUvY = (ModWidget.isMouseOver(recenterButton) || recenterButton.isFocused()) ? 18 : 1; @@ -239,12 +238,12 @@ private void drawRecenterButton(DrawContext context){ int x = fullscreenButton.getX(); int y = zoomInButton.getY() - NORMAL_BUTTON_SIZE.y; recenterButton.setPosition(x, y); - context.drawTexture(RenderPipelines.GUI_TEXTURED, MAP_UI_TEXTURE, - x,x, y, 52, recenterButtonUvY, + context.blit(MAP_UI_TEXTURE, + x, y, 52, recenterButtonUvY, NORMAL_BUTTON_SIZE.x, NORMAL_BUTTON_SIZE.y, 256, 256); } - private void drawZoomButtons(DrawContext context){ + private void drawZoomButtons(GuiGraphics context){ int zoomInButtonUvX = 86; int zoomInButtonUvY = (ModWidget.isMouseOver(zoomInButton) || zoomInButton.isFocused()) ? 18 : 1; zoomInButton.active = mapWidget.canZoomIn(); @@ -258,29 +257,29 @@ private void drawZoomButtons(DrawContext context){ if(isFullscreen){ // Zoom out - int x = context.getScaledWindowWidth() - MARGIN - NORMAL_BUTTON_SIZE.x; - int y = context.getScaledWindowHeight() - MARGIN - NORMAL_BUTTON_SIZE.y; + int x = context.guiWidth() - MARGIN - NORMAL_BUTTON_SIZE.x; + int y = context.guiHeight() - MARGIN - NORMAL_BUTTON_SIZE.y; zoomOutButton.setPosition(x, y); - context.drawTexture(RenderPipelines.GUI_TEXTURED, MAP_UI_TEXTURE, + context.blit(MAP_UI_TEXTURE, x, y, zoomOutButtonUvX, zoomOutButtonUvY, NORMAL_BUTTON_SIZE.x, NORMAL_BUTTON_SIZE.y, 256, 256); // Zoom in y -= NORMAL_BUTTON_SIZE.y; zoomInButton.setPosition(x, y); - context.drawTexture(RenderPipelines.GUI_TEXTURED, MAP_UI_TEXTURE, + context.blit(MAP_UI_TEXTURE, x, y, zoomInButtonUvX, zoomInButtonUvY, NORMAL_BUTTON_SIZE.x, NORMAL_BUTTON_SIZE.y, 256, 256); } else { // Zoom out int y = endY - NORMAL_BUTTON_SIZE.y; zoomOutButton.setPosition(endX, y); - context.drawTexture(RenderPipelines.GUI_TEXTURED, MAP_UI_TEXTURE, + context.blit(MAP_UI_TEXTURE, endX, y, zoomOutButtonUvX, zoomOutButtonUvY, NORMAL_BUTTON_SIZE.x, NORMAL_BUTTON_SIZE.y, 256, 256); // Zoom in y -= NORMAL_BUTTON_SIZE.y; zoomInButton.setPosition(endX, y); - context.drawTexture(RenderPipelines.GUI_TEXTURED, MAP_UI_TEXTURE, + context.blit(MAP_UI_TEXTURE, endX, y, zoomInButtonUvX, zoomInButtonUvY, NORMAL_BUTTON_SIZE.x, NORMAL_BUTTON_SIZE.y, 256, 256); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/map/MapScreenController.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/map/MapScreenController.java index 182b84d2f9..d044100fe4 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/map/MapScreenController.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/map/MapScreenController.java @@ -1,9 +1,10 @@ package net.sevenstars.middleearth.gui.map; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; -import net.minecraft.client.MinecraftClient; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.world.World; +import net.neoforged.neoforge.network.PacketDistributor; + +import net.minecraft.client.Minecraft; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.event.KeyInputHandler; import net.sevenstars.middleearth.gui.utils.widgets.ModWidget; import net.sevenstars.middleearth.network.packets.C2S.PacketTeleportToDynamicWorldCoordinate; @@ -14,23 +15,23 @@ import java.awt.event.KeyEvent; public class MapScreenController { - private World world; - private PlayerEntity player; + private Level world; + private Player player; private MapScreen screen; private boolean isInDimension; private boolean isFullscreen; private boolean hasTeleportPermission; - public MapScreenController(World world, PlayerEntity player) { + public MapScreenController(Level world, Player player) { this.world = world; this.player = player; } public boolean open(boolean canTeleport) { - MinecraftClient mc = MinecraftClient.getInstance(); + Minecraft mc = Minecraft.getInstance(); - if(world.isClient) { - if (mc.currentScreen == null) { + if(world.isClientSide) { + if (mc.screen == null) { screen = new MapScreen(); isInDimension = ModDimensions.isInMiddleEarth(world); @@ -39,7 +40,7 @@ public boolean open(boolean canTeleport) { screen.hasTeleportPermission = hasTeleportPermission; screen.isFullscreen = false; - screen.playerBlockPos = player.getBlockPos(); + screen.playerBlockPos = player.blockPosition(); screen.controller = this; mc.setScreen(screen); return true; @@ -55,8 +56,8 @@ private void teleportToCursor(double mouseX, double mouseY) { double x = mapRatio.x * MiddleEarthMapConfigs.FULL_MAP_SIZE; double y = mapRatio.y * MiddleEarthMapConfigs.FULL_MAP_SIZE; - ClientPlayNetworking.send(new PacketTeleportToDynamicWorldCoordinate(x, y)); - screen.close(); + PacketDistributor.sendToServer(new PacketTeleportToDynamicWorldCoordinate(x, y)); + screen.onClose(); } } @@ -73,11 +74,11 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { } public boolean keyPressed(int keyCode, int scanCode, int modifiers, int mouseX, int mouseY) { - if(KeyInputHandler.mapTeleportKey.matchesKey(keyCode, modifiers)){ + if(KeyInputHandler.mapTeleportKey.matches(keyCode, modifiers)){ teleportToCursor(mouseX, mouseY); return true; } - if(KeyInputHandler.mapFullscreenToggle.matchesKey(keyCode, modifiers)){ + if(KeyInputHandler.mapFullscreenToggle.matches(keyCode, modifiers)){ screen.isFullscreen = !screen.isFullscreen; } if(keyCode == KeyEvent.VK_CODE_INPUT && !ModWidget.getFocusEnabled()){ diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/onboarding/OnboardingSelectionScreen.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/onboarding/OnboardingSelectionScreen.java index 090e95cd9c..90d32bc038 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/onboarding/OnboardingSelectionScreen.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/onboarding/OnboardingSelectionScreen.java @@ -1,18 +1,18 @@ package net.sevenstars.middleearth.gui.onboarding; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.entity.Entity; -import net.minecraft.entity.attribute.EntityAttributeInstance; -import net.minecraft.text.Text; -import net.minecraft.util.Colors; -import net.minecraft.util.Identifier; +import net.neoforged.neoforge.network.PacketDistributor; + +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.CommonColors; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.InteractionHand; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.gui.onboarding.onboarding_faction.OnboardingFactionScreenController; import net.sevenstars.middleearth.network.packets.C2S.PacketTeleportToCurrentSpawn; @@ -22,59 +22,62 @@ import java.awt.event.KeyEvent; import java.util.List; -@Environment(EnvType.CLIENT) +@OnlyIn(Dist.CLIENT) public class OnboardingSelectionScreen extends Screen { -private static final Text ONBOARDING_SELECTION_TITLE = Text.translatable("ui.%s.onboarding_selection.title".formatted(MiddleEarth.MOD_ID)); - private static final Identifier BUTTON_WIDGET = Identifier.of(MiddleEarth.MOD_ID,"textures/gui/widget/button_widget.png"); +private static final Component ONBOARDING_SELECTION_TITLE = Component.translatable("ui.%s.onboarding_selection.title".formatted(MiddleEarth.MOD_ID)); + private static final ResourceLocation BUTTON_WIDGET = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID,"textures/gui/widget/button_widget.png"); private boolean focusEnabled; - public ButtonWidget continueAsCharacterButton; - public ButtonWidget resetCharacterButton; + public Button continueAsCharacterButton; + public Button resetCharacterButton; private int mouseX; private int mouseY; private final boolean canResetCharacter; - private ClientPlayerEntity player; + private LocalPlayer player; float currentDelay; + private final InteractionHand interactionHand; List playerAttributes; - public OnboardingSelectionScreen(float delay, boolean canResetCharacter, List playerAttributes) { + public OnboardingSelectionScreen(float delay, boolean canResetCharacter, List playerAttributes, InteractionHand interactionHand) { super(ONBOARDING_SELECTION_TITLE); this.canResetCharacter = canResetCharacter; this.playerAttributes = playerAttributes; focusEnabled = false; currentDelay = delay; + this.interactionHand = interactionHand; } @Override protected void init() { - ButtonWidget.PressAction continueAsFaction = button -> { + Button.OnPress continueAsFaction = button -> { teleportPlayerToMiddleEarth(); }; - continueAsCharacterButton = ButtonWidget.builder(Text.of("continue_character"), continueAsFaction).build(); - addDrawableChild(continueAsCharacterButton); + continueAsCharacterButton = Button.builder(Component.nullToEmpty("continue_character"), continueAsFaction).build(); + addRenderableWidget(continueAsCharacterButton); if(currentDelay > 0) continueAsCharacterButton.active = false; if(canResetCharacter){ - ButtonWidget.PressAction resetCharacterAction = button -> { - var controller = new OnboardingFactionScreenController(this.player.getWorld(), currentDelay, playerAttributes); + Button.OnPress resetCharacterAction = button -> { + var controller = new OnboardingFactionScreenController(this.player.level(), currentDelay, playerAttributes, interactionHand); controller.open(); }; - resetCharacterButton = ButtonWidget.builder(Text.of("reset_character"), resetCharacterAction).build(); - addDrawableChild(resetCharacterButton); + resetCharacterButton = Button.builder(Component.nullToEmpty("reset_character"), resetCharacterAction).build(); + addRenderableWidget(resetCharacterButton); } } private void teleportPlayerToMiddleEarth() { - ClientPlayNetworking.send(new PacketTeleportToCurrentSpawn(false)); + PacketDistributor.sendToServer(new PacketTeleportToCurrentSpawn(false, interactionHand == InteractionHand.OFF_HAND)); } @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) { - Entity cameraEntity = this.client.getCameraEntity(); + public void render(GuiGraphics context, int mouseX, int mouseY, float delta) { + renderBackground(context, mouseX, mouseY, delta); + Entity cameraEntity = this.minecraft.getCameraEntity(); if (cameraEntity != null) { - if (cameraEntity instanceof ClientPlayerEntity clientPlayerEntity) { + if (cameraEntity instanceof LocalPlayer clientPlayerEntity) { this.player = clientPlayerEntity; this.mouseX = mouseX; this.mouseY = mouseY; @@ -96,7 +99,7 @@ public void tick() { super.tick(); } - private void drawContent(DrawContext context) { + private void drawContent(GuiGraphics context) { int panelSizeX = 102; int panelSizeY = 18; int margin = 5; @@ -105,49 +108,49 @@ private void drawContent(DrawContext context) { int startX = (width / 2) - (panelSizeX / 2); int startY = (height / 2) - (panelSizeY / 2); if(continueAsCharacterButton.active){ - context.drawTexture(RenderPipelines.GUI_TEXTURED, BUTTON_WIDGET, + context.blit(BUTTON_WIDGET, startX, startY, 0, continueAsCharacterButton.isFocused() || isMouseOver(startX, panelSizeX, startY, panelSizeY) ? 19 : 0, panelSizeX, panelSizeY, 256, 256); - Text continueText = Text.translatable("ui.%s.continue_character".formatted(MiddleEarth.MOD_ID)); - context.drawText(textRenderer, continueText, - startX + (int)((panelSizeX - textRenderer.getWidth(continueText)) / 2f), - startY + (int) ((panelSizeY / 2f) - (textRenderer.fontHeight / 2f)) + 1, - Colors.BLACK, false); + Component continueText = Component.translatable("ui.%s.continue_character".formatted(MiddleEarth.MOD_ID)); + context.drawString(font, continueText, + startX + (int)((panelSizeX - font.width(continueText)) / 2f), + startY + (int) ((panelSizeY / 2f) - (font.lineHeight / 2f)) + 1, + CommonColors.BLACK, false); - continueAsCharacterButton.setDimensionsAndPosition(panelSizeX, panelSizeY, startX, startY); + continueAsCharacterButton.setRectangle(panelSizeX, panelSizeY, startX, startY); if(focusEnabled && continueAsCharacterButton.isFocused()){ - context.drawTexture(RenderPipelines.GUI_TEXTURED, BUTTON_WIDGET, + context.blit(BUTTON_WIDGET, startX, startY, 103, 0, panelSizeX, panelSizeY, 256, 256); } } else { - context.drawTexture(RenderPipelines.GUI_TEXTURED, BUTTON_WIDGET, + context.blit(BUTTON_WIDGET, startX, startY, 0, 38, panelSizeX, panelSizeY, 256, 256); - Text delayText = Text.literal(String.valueOf((Math.round(this.currentDelay * 10f) /10f))); - context.drawText(textRenderer, delayText, - startX + (panelSizeX / 2) - (textRenderer.getWidth(delayText) / 2), - startY + 5, Colors.LIGHT_RED, true); + Component delayText = Component.literal(String.valueOf((Math.round(this.currentDelay * 10f) /10f))); + context.drawString(font, delayText, + startX + (panelSizeX / 2) - (font.width(delayText) / 2), + startY + 5, CommonColors.SOFT_RED, true); } if(canResetCharacter) { startY += panelSizeY + margin; - context.drawTexture(RenderPipelines.GUI_TEXTURED, BUTTON_WIDGET, + context.blit(BUTTON_WIDGET, startX, startY,0, resetCharacterButton.isFocused() || isMouseOver(startX, panelSizeX, startY, panelSizeY) ? 19 : 0, panelSizeX, panelSizeY, 256, 256); - Text resetText = Text.translatable("ui.%s.reset_character".formatted(MiddleEarth.MOD_ID)); - context.drawText(textRenderer, resetText, - startX + (int) ((panelSizeX - textRenderer.getWidth(resetText)) / 2f), - startY + (int) ((panelSizeY / 2f) - (textRenderer.fontHeight / 2f)) + 1, - Colors.BLACK, false); - resetCharacterButton.setDimensionsAndPosition(panelSizeX, panelSizeY, startX, startY); + Component resetText = Component.translatable("ui.%s.reset_character".formatted(MiddleEarth.MOD_ID)); + context.drawString(font, resetText, + startX + (int) ((panelSizeX - font.width(resetText)) / 2f), + startY + (int) ((panelSizeY / 2f) - (font.lineHeight / 2f)) + 1, + CommonColors.BLACK, false); + resetCharacterButton.setRectangle(panelSizeX, panelSizeY, startX, startY); if(focusEnabled && resetCharacterButton.isFocused()){ - context.drawTexture(RenderPipelines.GUI_TEXTURED, BUTTON_WIDGET, - startX, startY,0, 103, 0, + context.blit(BUTTON_WIDGET, + startX, startY, 103, 0, panelSizeX, panelSizeY, 256, 256); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/onboarding/onboarding_faction/OnboardingFactionScreen.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/onboarding/onboarding_faction/OnboardingFactionScreen.java index f59f3703a1..145887de8b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/onboarding/onboarding_faction/OnboardingFactionScreen.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/onboarding/onboarding_faction/OnboardingFactionScreen.java @@ -1,26 +1,26 @@ package net.sevenstars.middleearth.gui.onboarding.onboarding_faction; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.block.entity.BannerPattern; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.entity.model.EntityModelLayers; -import net.minecraft.component.type.BannerPatternsComponent; -import net.minecraft.registry.RegistryKeys; -import net.minecraft.registry.entry.RegistryEntry; -import net.minecraft.text.MutableText; -import net.minecraft.text.Text; -import net.minecraft.util.Colors; -import net.minecraft.util.DyeColor; -import net.minecraft.util.Formatting; -import net.minecraft.util.Identifier; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.model.geom.ModelLayers; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.CommonColors; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.level.block.entity.BannerPattern; +import net.minecraft.world.level.block.entity.BannerPatternLayers; import net.sevenstars.middleearth.MiddleEarth; -import net.sevenstars.middleearth.gui.render.states.BannerResultWithScaleGuiElementRenderState; +import net.sevenstars.middleearth.gui.render.BannerResultWithScaleGuiElementRenderer; import net.sevenstars.middleearth.gui.utils.CycledSelectionButtonType; import net.sevenstars.middleearth.gui.utils.widgets.CycledSelectionWidget; import net.sevenstars.middleearth.gui.utils.widgets.ModWidget; @@ -34,10 +34,10 @@ import java.util.Arrays; import java.util.List; -@Environment(EnvType.CLIENT) +@OnlyIn(Dist.CLIENT) public class OnboardingFactionScreen extends Screen { - private static final Identifier MAP_UI_IDENTIFIER = Identifier.of(MiddleEarth.MOD_ID,"textures/gui/faction_selection_map.png"); - private static final Identifier BUTTON_UI_IDENTIFIER = Identifier.of(MiddleEarth.MOD_ID,"textures/gui/faction_selection_buttons.png"); + private static final ResourceLocation MAP_UI_IDENTIFIER = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID,"textures/gui/faction_selection_map.png"); + private static final ResourceLocation BUTTON_UI_IDENTIFIER = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID,"textures/gui/faction_selection_buttons.png"); private static final int TEXT_COLOR = Color.BLACK.getRGB(); public class OnboardingFactionScreenElements { @@ -47,25 +47,25 @@ public class OnboardingFactionScreenElements { public CycledSelectionWidget dispositionSelectionWidget; public CycledSelectionWidget factionSelectionWidget; public CycledSelectionWidget subfactionSelectionWidget; - public ButtonWidget npcRandomizerButton; + public Button npcRandomizerButton; public FactionSelectionMapWidget mapWidget; - public ButtonWidget mapZoomInButton; - public ButtonWidget mapZoomOutButton; - public ButtonWidget mapFocusButton; + public Button mapZoomInButton; + public Button mapZoomOutButton; + public Button mapFocusButton; public CycledSelectionWidget raceSelectionWidget; public CycledSelectionWidget spawnPointSelectionWidget; - public ButtonWidget fullRandomizerButton; - public ButtonWidget spawnConfirmButton; + public Button fullRandomizerButton; + public Button spawnConfirmButton; //endregion //region [Text and Displays] public DrawablePanel informationPanel = - new DrawablePanel(169, 207, 0, 0, Identifier.of(MiddleEarth.MOD_ID,"textures/gui/faction_selection.png")); + new DrawablePanel(169, 207, 0, 0, ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID,"textures/gui/faction_selection.png")); public DrawablePanel mapPanel = new DrawablePanel(124, 124, 0, 0, MAP_UI_IDENTIFIER); public ModelPart bannerField; - public Text factionName; - public Text subfactionName; + public Component factionName; + public Component subfactionName; public TextBlockWidget raceList = new TextBlockWidget(0,0, informationPanel.width - 10, 30); public TextBlockWidget descriptionTextBlock; public List bannerComponents; @@ -78,11 +78,11 @@ private class DrawablePanel{ public final int height; public final int uvX; public final int uvY; - public final Identifier texture; + public final ResourceLocation texture; public int startX; public int startY; - public DrawablePanel(int width, int height, int uvX, int uvY, Identifier texture){ + public DrawablePanel(int width, int height, int uvX, int uvY, ResourceLocation texture){ this.width = width; this.height = height; this.uvX = uvX; @@ -90,14 +90,14 @@ public DrawablePanel(int width, int height, int uvX, int uvY, Identifier texture this.texture = texture; } - public void draw(DrawContext context, int startX, int startY){ + public void draw(GuiGraphics context, int startX, int startY){ this.startX = startX; this.startY = startY; - context.drawTexture(RenderPipelines.GUI_TEXTURED, texture, startX, startY, uvX, uvY, width, height, 256, 256); + context.blit(texture, startX, startY, uvX, uvY, width, height, 256, 256); } } - private static final Text TITLE = Text.translatable("screen." + MiddleEarth.MOD_ID + ".onboarding_faction_screen"); + private static final Component TITLE = Component.translatable("screen." + MiddleEarth.MOD_ID + ".onboarding_faction_screen"); // Public fields @@ -112,7 +112,7 @@ public OnboardingFactionScreen(OnboardingFactionScreenController controller) { } @Override - public boolean shouldPause() { + public boolean isPauseScreen() { return false; } @@ -121,15 +121,15 @@ protected void init() { super.init(); elements = new OnboardingFactionScreenElements(); - elements.bannerField = this.client.getLoadedEntityModels().getModelPart(EntityModelLayers.STANDING_BANNER_FLAG).getChild("flag"); + elements.bannerField = this.minecraft.getEntityModels().bakeLayer(ModelLayers.BANNER).getChild("flag"); elements.searchBarWidget = new SearchBarWidget(9, controller.getAllSearchBarResults(), x -> controller.updateScreenInformation(), CycledSelectionWidget.TOTAL_WIDTH); - addDrawableChild(elements.searchBarWidget.getSearchBarToggleButton()); - elements.searchBarWidget.getAllButtons().forEach(this::addDrawableChild); - addDrawableChild(elements.searchBarWidget.getScreenClickButton()); + addRenderableWidget(elements.searchBarWidget.getSearchBarToggleButton()); + elements.searchBarWidget.getAllButtons().forEach(this::addRenderableWidget); + addRenderableWidget(elements.searchBarWidget.getScreenClickButton()); elements.npcPreviewWidget = new PlayableNpcPreviewWidget(); - elements.npcPreviewWidget.getButtons().forEach(this::addDrawableChild); + elements.npcPreviewWidget.getButtons().forEach(this::addRenderableWidget); // Disposition elements.dispositionSelectionWidget = new CycledSelectionWidget( @@ -137,7 +137,7 @@ protected void init() { x -> this.controller.updateDisposition(1), null, CycledSelectionButtonType.GOLD); - elements.dispositionSelectionWidget.getButtons().forEach(this::addDrawableChild); + elements.dispositionSelectionWidget.getButtons().forEach(this::addRenderableWidget); // PlayerFactionPayload elements.factionSelectionWidget = new CycledSelectionWidget( @@ -145,7 +145,7 @@ protected void init() { x -> this.controller.updateFaction(1), null, CycledSelectionButtonType.SILVER); - elements.factionSelectionWidget.getButtons().forEach(this::addDrawableChild); + elements.factionSelectionWidget.getButtons().forEach(this::addRenderableWidget); // Subfaction elements.subfactionSelectionWidget = new CycledSelectionWidget( @@ -153,26 +153,26 @@ protected void init() { x -> this.controller.updateSubfaction(1), null, CycledSelectionButtonType.NORMAL); - elements.subfactionSelectionWidget.getButtons().forEach(this::addDrawableChild); + elements.subfactionSelectionWidget.getButtons().forEach(this::addRenderableWidget); // PlayerFactionPayload Randomizer - elements.npcRandomizerButton = ButtonWidget.builder(Text.translatable("screen." + MiddleEarth.MOD_ID + ".button.faction_randomizer"), + elements.npcRandomizerButton = Button.builder(Component.translatable("screen." + MiddleEarth.MOD_ID + ".button.faction_randomizer"), x -> this.controller.randomizeNpc()).build(); - addDrawableChild(elements.npcRandomizerButton); + addRenderableWidget(elements.npcRandomizerButton); // Map Widget - elements.mapFocusButton = ButtonWidget.builder(Text.translatable("screen." + MiddleEarth.MOD_ID + ".button.focus_current"), this::mapFocusToggle).build(); // TODO - elements.mapFocusButton.setDimensions(10, 10); - addDrawableChild(elements.mapFocusButton); + elements.mapFocusButton = Button.builder(Component.translatable("screen." + MiddleEarth.MOD_ID + ".button.focus_current"), this::mapFocusToggle).build(); // TODO + elements.mapFocusButton.setSize(10, 10); + addRenderableWidget(elements.mapFocusButton); - elements.mapZoomInButton = ButtonWidget.builder(Text.translatable("screen." + MiddleEarth.MOD_ID + ".button.zoom_in"), this::mapZoomIn).build(); - elements.mapZoomInButton.setDimensions(10, 10); - addDrawableChild(elements.mapZoomInButton); + elements.mapZoomInButton = Button.builder(Component.translatable("screen." + MiddleEarth.MOD_ID + ".button.zoom_in"), this::mapZoomIn).build(); + elements.mapZoomInButton.setSize(10, 10); + addRenderableWidget(elements.mapZoomInButton); - elements.mapZoomOutButton = ButtonWidget.builder(Text.translatable("screen." + MiddleEarth.MOD_ID + ".button.zoom_out"), this::mapZoomOut).build(); + elements.mapZoomOutButton = Button.builder(Component.translatable("screen." + MiddleEarth.MOD_ID + ".button.zoom_out"), this::mapZoomOut).build(); - elements.mapZoomOutButton.setDimensions(10, 10); - addDrawableChild(elements.mapZoomOutButton); + elements.mapZoomOutButton.setSize(10, 10); + addRenderableWidget(elements.mapZoomOutButton); // Race elements.raceSelectionWidget = new CycledSelectionWidget( @@ -180,7 +180,7 @@ protected void init() { x -> this.controller.updateRace(1), null, CycledSelectionButtonType.NORMAL); - elements.raceSelectionWidget.getButtons().forEach(this::addDrawableChild); + elements.raceSelectionWidget.getButtons().forEach(this::addRenderableWidget); // Spawn Point elements.spawnPointSelectionWidget = new CycledSelectionWidget( @@ -188,44 +188,45 @@ protected void init() { x -> this.controller.updateSpawnPoint(1), null, CycledSelectionButtonType.NORMAL); - elements.spawnPointSelectionWidget.getButtons().forEach(this::addDrawableChild); + elements.spawnPointSelectionWidget.getButtons().forEach(this::addRenderableWidget); // Random spawn selection - elements.fullRandomizerButton = ButtonWidget.builder(Text.translatable("screen." + MiddleEarth.MOD_ID + ".button.full_randomizer"), + elements.fullRandomizerButton = Button.builder(Component.translatable("screen." + MiddleEarth.MOD_ID + ".button.full_randomizer"), x -> controller.randomizeAll()).build(); - addDrawableChild(elements.fullRandomizerButton); + addRenderableWidget(elements.fullRandomizerButton); - elements.spawnConfirmButton = ButtonWidget.builder(Text.translatable("screen." + MiddleEarth.MOD_ID + ".button.confirm"), + elements.spawnConfirmButton = Button.builder(Component.translatable("screen." + MiddleEarth.MOD_ID + ".button.confirm"), x -> controller.confirmSelection()).build(); - addDrawableChild(elements.spawnConfirmButton); + addRenderableWidget(elements.spawnConfirmButton); - elements.factionName = ((MutableText)Text.of("N/A")).formatted(Formatting.BOLD).formatted(Formatting.DARK_GRAY); - elements.subfactionName = Text.of("N/A"); - elements.raceList.setText(List.of(Text.of("N/A"))); - elements.descriptionTextBlock = new TextBlockWidget(0,0, elements.informationPanel.width - 9,textRenderer.fontHeight * 10); - elements.descriptionTextBlock.setText(List.of(Text.of("N/A"))); + elements.factionName = ((MutableComponent)Component.nullToEmpty("N/A")).withStyle(ChatFormatting.BOLD).withStyle(ChatFormatting.DARK_GRAY); + elements.subfactionName = Component.nullToEmpty("N/A"); + elements.raceList.setText(List.of(Component.nullToEmpty("N/A"))); + elements.descriptionTextBlock = new TextBlockWidget(0,0, elements.informationPanel.width - 9,font.lineHeight * 10); + elements.descriptionTextBlock.setText(List.of(Component.nullToEmpty("N/A"))); this.elements.mapWidget = new FactionSelectionMapWidget(114, 114, this.controller.getMaxSpawnAmount()); - Arrays.stream(this.elements.mapWidget.getButtons()).forEach(this::addDrawableChild); + Arrays.stream(this.elements.mapWidget.getButtons()).forEach(this::addRenderableWidget); } //region [GUI Render] @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) { + public void render(GuiGraphics context, int mouseX, int mouseY, float delta) { + renderBackground(context, mouseX, mouseY, delta); ModWidget.updateMouse(mouseX, mouseY); this.renderDisplays(context, mouseX, mouseY, delta); } @Override - public void renderBackground(DrawContext context, int mouseX, int mouseY, float deltaTicks) { + public void renderBackground(GuiGraphics context, int mouseX, int mouseY, float deltaTicks) { //DiffuseLighting.disableGuiDepthLighting(); super.renderBackground(context,mouseX,mouseY, deltaTicks); // Display center panel - int centerPanelStartX = (int) ((context.getScaledWindowWidth() / 2f) - (elements.informationPanel.width / 2f)); - int centerPanelStartY = (int) ((context.getScaledWindowHeight() / 2f) - (elements.informationPanel.height / 2f)); + int centerPanelStartX = (int) ((context.guiWidth() / 2f) - (elements.informationPanel.width / 2f)); + int centerPanelStartY = (int) ((context.guiHeight() / 2f) - (elements.informationPanel.height / 2f)); elements.informationPanel.draw(context, centerPanelStartX, centerPanelStartY); @@ -239,37 +240,37 @@ public void renderBackground(DrawContext context, int mouseX, int mouseY, float this.elements.mapPanel.draw(context, rightPanelStartX, rightPanelStartY); } - private void renderDisplays(DrawContext context, int mouseX, int mouseY, float delta) { + private void renderDisplays(GuiGraphics context, int mouseX, int mouseY, float delta) { //DiffuseLighting.disableGuiDepthLighting(); int startX = elements.informationPanel.startX + 5; int startY = elements.informationPanel.startY + 5; - int factionStartX = startX + ((elements.informationPanel.width - 50) / 2 - (textRenderer.getWidth(elements.factionName) / 2)); + int factionStartX = startX + ((elements.informationPanel.width - 50) / 2 - (font.width(elements.factionName) / 2)); - context.drawText(textRenderer, elements.factionName, factionStartX, startY, TEXT_COLOR, false); - if(isMouseOver(factionStartX, textRenderer.getWidth(elements.factionName), startY, textRenderer.fontHeight)){ - context.drawTooltip(textRenderer, List.of(controller.getCurrentFactionFullName()), ModWidget.getMouseX(), ModWidget.getMouseY()); + context.drawString(font, elements.factionName, factionStartX, startY, TEXT_COLOR, false); + if(isMouseOver(factionStartX, font.width(elements.factionName), startY, font.lineHeight)){ + context.renderComponentTooltip(font, List.of(controller.getCurrentFactionFullName()), ModWidget.getMouseX(), ModWidget.getMouseY()); } // Subfaction if(elements.subfactionName != null){ - startY += textRenderer.fontHeight + 3; - Text subfactionTitle = Text.translatable("screen." + MiddleEarth.MOD_ID + ".information.subfaction"); + startY += font.lineHeight + 3; + Component subfactionTitle = Component.translatable("screen." + MiddleEarth.MOD_ID + ".information.subfaction"); - context.drawText(textRenderer, subfactionTitle, startX, startY, TEXT_COLOR, false); - context.drawText(textRenderer, elements.subfactionName, startX + textRenderer.getWidth(subfactionTitle), startY, TEXT_COLOR, false); + context.drawString(font, subfactionTitle, startX, startY, TEXT_COLOR, false); + context.drawString(font, elements.subfactionName, startX + font.width(subfactionTitle), startY, TEXT_COLOR, false); } // Race.s if(elements.raceList != null){ - startY += textRenderer.fontHeight + 3; + startY += font.lineHeight + 3; var text = elements.raceList.getValue().getFirst().getString(); boolean hasManyRaces = text.contains(","); - Text raceTitle = Text.translatable((hasManyRaces) + Component raceTitle = Component.translatable((hasManyRaces) ? "screen." + MiddleEarth.MOD_ID + ".information.races.many" - : "screen." + MiddleEarth.MOD_ID + ".information.races").formatted(Formatting.UNDERLINE); - context.drawText(client.textRenderer, raceTitle, startX, startY, TEXT_COLOR, false); - startY += textRenderer.fontHeight + 3; + : "screen." + MiddleEarth.MOD_ID + ".information.races").withStyle(ChatFormatting.UNDERLINE); + context.drawString(minecraft.font, raceTitle, startX, startY, TEXT_COLOR, false); + startY += font.lineHeight + 3; elements.raceList.setStartX(startX); elements.raceList.setStartY(startY); @@ -279,8 +280,8 @@ private void renderDisplays(DrawContext context, int mouseX, int mouseY, float d startY = elements.informationPanel.startY + 90; - context.drawText(client.textRenderer, Text.translatable("screen." + MiddleEarth.MOD_ID + ".information.description").formatted(Formatting.UNDERLINE), - startX,startY - textRenderer.fontHeight, TEXT_COLOR, false); + context.drawString(minecraft.font, Component.translatable("screen." + MiddleEarth.MOD_ID + ".information.description").withStyle(ChatFormatting.UNDERLINE), + startX,startY - font.lineHeight, TEXT_COLOR, false); startY += 3; elements.descriptionTextBlock.setStartX(startX); elements.descriptionTextBlock.setStartY(startY); @@ -288,16 +289,26 @@ private void renderDisplays(DrawContext context, int mouseX, int mouseY, float d // Banner if(elements.bannerComponents != null && !elements.bannerComponents.isEmpty()) { - var bannerPatternRegistry = this.client.world.getRegistryManager().getOptional(RegistryKeys.BANNER_PATTERN); - BannerPatternsComponent.Builder bannerBuilder = new BannerPatternsComponent.Builder(); + var bannerPatternRegistry = this.minecraft.level.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN); + BannerPatternLayers.Builder bannerBuilder = new BannerPatternLayers.Builder(); for(BannerData.BannerPatternWithColor entry : elements.bannerComponents){ if(entry == null) continue; - RegistryEntry pattern = bannerPatternRegistry.get().getEntry(entry.pattern); + Holder pattern = bannerPatternRegistry.getOrThrow( + ResourceKey.create(Registries.BANNER_PATTERN, entry.id) + ); bannerBuilder.add(pattern, entry.color); } int bannerX = elements.informationPanel.startX + elements.informationPanel.width - 48; int bannerY = elements.informationPanel.startY + 8; - context.state.addSpecialElement(new BannerResultWithScaleGuiElementRenderState(this.elements.bannerField, DyeColor.GRAY, bannerBuilder.build(), bannerX, 0, bannerX + 40, bannerY + 80, 32f, context.scissorStack.peekLast())); + BannerResultWithScaleGuiElementRenderer.render( + context, + this.elements.bannerField, + DyeColor.GRAY, + bannerBuilder.build(), + bannerX + 4, + bannerY + 64, + 32.0F + ); } // Right panel @@ -311,43 +322,43 @@ private void renderDisplays(DrawContext context, int mouseX, int mouseY, float d this.elements.mapFocusButton.setPosition(startX, startY); - context.drawTexture(RenderPipelines.GUI_TEXTURED, MAP_UI_IDENTIFIER, + context.blit(MAP_UI_IDENTIFIER, startX, startY, 235, (this.elements.mapWidget.isForcingTargetMovement) ? 20 : elements.mapFocusButton.isFocused() || elements.mapFocusButton.isMouseOver(mouseX, mouseY) ? 10 : 0, elements.mapFocusButton.getWidth(), elements.mapFocusButton.getHeight(), 256, 256); startX = this.elements.mapPanel.startX + this.elements.mapPanel.width - 16; this.elements.mapZoomInButton.setPosition(startX, startY); - context.drawTexture(RenderPipelines.GUI_TEXTURED, MAP_UI_IDENTIFIER, + context.blit(MAP_UI_IDENTIFIER, startX, startY, 224, !this.elements.mapWidget.canZoomIn() ? 20 : elements.mapZoomInButton.isFocused() || elements.mapZoomInButton.isMouseOver(mouseX, mouseY) ? 10 : 0, elements.mapZoomInButton.getWidth(), elements.mapZoomInButton.getHeight(), 256, 256); startX -= 12; this.elements.mapZoomOutButton.setPosition(startX, startY); - context.drawTexture(RenderPipelines.GUI_TEXTURED, MAP_UI_IDENTIFIER, + context.blit(MAP_UI_IDENTIFIER, startX, startY, 213, !this.elements.mapWidget.canZoomOut() ? 20 : elements.mapZoomOutButton.isFocused() || elements.mapZoomOutButton.isMouseOver(mouseX, mouseY) ? 10 : 0, elements.mapZoomOutButton.getWidth(), elements.mapZoomOutButton.getHeight(), 256, 256); startY = this.elements.mapPanel.startY + this.elements.mapPanel.height + 4; startX = this.elements.mapPanel.startX; - elements.spawnPointSelectionWidget.drawAnchored(context, startX, startY,true, textRenderer); + elements.spawnPointSelectionWidget.drawAnchored(context, startX, startY,true, font); startY += elements.spawnPointSelectionWidget.TOTAL_HEIGHT + 4; - elements.raceSelectionWidget.drawAnchored(context, startX, startY,true, textRenderer); + elements.raceSelectionWidget.drawAnchored(context, startX, startY,true, font); if(isMouseOver(startX, CycledSelectionWidget.TOTAL_WIDTH, startY, CycledSelectionWidget.TOTAL_HEIGHT)){ - controller.drawRaceTooltip(client.player, context, textRenderer, mouseX, mouseY); + controller.drawRaceTooltip(minecraft.player, context, font, mouseX, mouseY); } startX = this.elements.mapPanel.startX + 4; startY = this.elements.informationPanel.startY + this.elements.informationPanel.height - elements.fullRandomizerButton.getHeight(); this.elements.fullRandomizerButton.setPosition(startX, startY); - this.elements.fullRandomizerButton.setDimensions(52, 18); + this.elements.fullRandomizerButton.setSize(52, 18); - context.drawTexture(RenderPipelines.GUI_TEXTURED, BUTTON_UI_IDENTIFIER, + context.blit(BUTTON_UI_IDENTIFIER, this.elements.fullRandomizerButton.getX(), this.elements.fullRandomizerButton.getY(), 103, this.elements.fullRandomizerButton.isFocused() || this.elements.fullRandomizerButton.isMouseOver(mouseX, mouseY) ? 129 : 111, this.elements.fullRandomizerButton.getWidth(), this.elements.fullRandomizerButton.getHeight(), 256, 256); @@ -355,31 +366,31 @@ private void renderDisplays(DrawContext context, int mouseX, int mouseY, float d startX = this.elements.mapPanel.startX + this.elements.mapPanel.width - this.elements.spawnConfirmButton.getWidth() - 4; this.elements.spawnConfirmButton.setPosition(startX, startY); - this.elements.spawnConfirmButton.setDimensions(52, 18); + this.elements.spawnConfirmButton.setSize(52, 18); if(elements.spawnConfirmButton.active){ - context.drawTexture(RenderPipelines.GUI_TEXTURED, BUTTON_UI_IDENTIFIER, + context.blit(BUTTON_UI_IDENTIFIER, this.elements.spawnConfirmButton.getX(), this.elements.spawnConfirmButton.getY(), 103, this.elements.spawnConfirmButton.isFocused() || this.elements.spawnConfirmButton.isMouseOver(mouseX, mouseY) ? 37 : 19, this.elements.spawnConfirmButton.getWidth(), this.elements.spawnConfirmButton.getHeight(), 256, 256); } else { - context.drawTexture(RenderPipelines.GUI_TEXTURED, BUTTON_UI_IDENTIFIER, + context.blit(BUTTON_UI_IDENTIFIER, this.elements.spawnConfirmButton.getX(), this.elements.spawnConfirmButton.getY(), 156, 55, this.elements.spawnConfirmButton.getWidth(), this.elements.spawnConfirmButton.getHeight(), 256, 256); - Text delayText = Text.literal(String.valueOf(controller.getCurrentDelay())); - context.drawText(textRenderer, delayText, - this.elements.spawnConfirmButton.getX() + (52 / 2) - (textRenderer.getWidth(delayText) / 2), - this.elements.spawnConfirmButton.getY() + 5, Colors.LIGHT_RED, true); + Component delayText = Component.literal(String.valueOf(controller.getCurrentDelay())); + context.drawString(font, delayText, + this.elements.spawnConfirmButton.getX() + (52 / 2) - (font.width(delayText) / 2), + this.elements.spawnConfirmButton.getY() + 5, CommonColors.SOFT_RED, true); } // Left panel startX = this.elements.informationPanel.startX - 6; startY = this.elements.informationPanel.startY; - int endY = (int) ((context.getScaledWindowHeight() / 2f) - (this.elements.informationPanel.height / 2f)) + this.elements.informationPanel.height; + int endY = (int) ((context.guiHeight() / 2f) - (this.elements.informationPanel.height / 2f)) + this.elements.informationPanel.height; // Search Bar Widget - startY += elements.searchBarWidget.drawSearchBarCentered(context, startX - (CycledSelectionWidget.TOTAL_WIDTH / 2), startY, textRenderer); + startY += elements.searchBarWidget.drawSearchBarCentered(context, startX - (CycledSelectionWidget.TOTAL_WIDTH / 2), startY, font); elements.searchBarWidget.setEndY(elements.informationPanel.startY + elements.informationPanel.height); if(this.elements.searchBarWidget.searchIsToggled()) { @@ -387,23 +398,23 @@ private void renderDisplays(DrawContext context, int mouseX, int mouseY, float d return; } - this.elements.dispositionSelectionWidget.drawAnchored(context, startX, startY, false, textRenderer); + this.elements.dispositionSelectionWidget.drawAnchored(context, startX, startY, false, font); startY += this.elements.dispositionSelectionWidget.TOTAL_HEIGHT + 2; - this.elements.factionSelectionWidget.drawAnchored(context, startX, startY, false, textRenderer); + this.elements.factionSelectionWidget.drawAnchored(context, startX, startY, false, font); startY += this.elements.factionSelectionWidget.TOTAL_HEIGHT + 2; - this.elements.subfactionSelectionWidget.drawAnchored(context, startX, startY, false, textRenderer); + this.elements.subfactionSelectionWidget.drawAnchored(context, startX, startY, false, font); startY += this.elements.subfactionSelectionWidget.TOTAL_HEIGHT + 2; startX -= this.elements.subfactionSelectionWidget.TOTAL_WIDTH / 2; startY = this.elements.informationPanel.startY + this.elements.informationPanel.height - CycledSelectionWidget.TOTAL_HEIGHT; - this.elements.npcRandomizerButton.setDimensions(52, 18); + this.elements.npcRandomizerButton.setSize(52, 18); this.elements.npcRandomizerButton.setPosition(startX - (this.elements.npcRandomizerButton.getWidth() / 2), startY); - context.drawTexture(RenderPipelines.GUI_TEXTURED, BUTTON_UI_IDENTIFIER, + context.blit(BUTTON_UI_IDENTIFIER, this.elements.npcRandomizerButton.getX(), this.elements.npcRandomizerButton.getY(), 103, this.elements.npcRandomizerButton.isFocused() || this.elements.npcRandomizerButton.isMouseOver(mouseX, mouseY) ? 92 : 74, this.elements.npcRandomizerButton.getWidth(), this.elements.npcRandomizerButton.getHeight(), 256, 256); @@ -414,20 +425,20 @@ private void renderDisplays(DrawContext context, int mouseX, int mouseY, float d //region [Button Events] - private void mapFocusToggle(ButtonWidget buttonWidget) { + private void mapFocusToggle(Button buttonWidget) { elements.mapWidget.isForcingTargetMovement = !elements.mapWidget.isForcingTargetMovement; controller.moveToCurrentSpawn(); } - private void mapZoomIn(ButtonWidget buttonWidget) { + private void mapZoomIn(Button buttonWidget) { elements.mapWidget.zoomClick(); } - private void mapZoomOut(ButtonWidget buttonWidget) { + private void mapZoomOut(Button buttonWidget) { elements.mapWidget.dezoomClick(); } @Override - public void resize(MinecraftClient client, int width, int height) { + public void resize(Minecraft client, int width, int height) { super.resize(client, width, height); controller.screenResize(); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/onboarding/onboarding_faction/OnboardingFactionScreenController.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/onboarding/onboarding_faction/OnboardingFactionScreenController.java index 4ccf4a0d37..9bd409c8a7 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/onboarding/onboarding_faction/OnboardingFactionScreenController.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/onboarding/onboarding_faction/OnboardingFactionScreenController.java @@ -1,20 +1,23 @@ package net.sevenstars.middleearth.gui.onboarding.onboarding_faction; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.network.AbstractClientPlayerEntity; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.registry.Registry; -import net.minecraft.text.MutableText; -import net.minecraft.text.Text; -import net.minecraft.util.Formatting; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; -import net.minecraft.world.World; +import net.neoforged.neoforge.network.PacketDistributor; + +import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.player.AbstractClientPlayer; +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntitiesME; import net.sevenstars.middleearth.entity.npcs.NpcEntity; @@ -40,14 +43,15 @@ public class OnboardingFactionScreenController { public static OnboardingFactionScreenController INSTANCE; - private static final Text TITLE = Text.translatable("screen." + MiddleEarth.MOD_ID + ".onboarding_faction_screen"); + private static final Component TITLE = Component.translatable("screen." + MiddleEarth.MOD_ID + ".onboarding_faction_screen"); private static final float DEFAULT_DELAY = 3; - World world; + Level world; OnboardingFactionScreen screen; OnboardingFactionScreenService service; private float currentDelay; private boolean shouldBeDetailed; + private final InteractionHand interactionHand; private HashMap> factions; @@ -60,10 +64,20 @@ public class OnboardingFactionScreenController { private List searchBarResults; private List playerAttributes; - public OnboardingFactionScreenController(World world, float delay, List playerAttributes) { + public OnboardingFactionScreenController(Level world, float delay, List playerAttributes) { + this(world, delay, playerAttributes, InteractionHand.MAIN_HAND); + } + + public OnboardingFactionScreenController( + Level world, + float delay, + List playerAttributes, + InteractionHand interactionHand + ) { screen = new OnboardingFactionScreen(this); this.world = world; this.currentDelay = delay; + this.interactionHand = interactionHand; this.service = new OnboardingFactionScreenService(world); INSTANCE = this; this.playerAttributes = playerAttributes; @@ -74,9 +88,9 @@ public static OnboardingFactionScreenController getInstance(){ } public void open(){ - MinecraftClient mc = MinecraftClient.getInstance(); - if(mc.currentScreen != null) - mc.currentScreen.close(); + Minecraft mc = Minecraft.getInstance(); + if(mc.screen != null) + mc.screen.onClose(); mc.setScreen(screen); if(selectedFaction == null){ screen.elements.mapWidget.zoom(10); @@ -89,7 +103,7 @@ public void open(){ } public void close(){ - this.screen.close(); + this.screen.onClose(); INSTANCE = null; } @@ -122,7 +136,7 @@ public void updateScreenInformation() { screen.elements.npcRandomizerButton.active = true; } - this.screen.elements.factionName = (selectedFaction.tryGetShortName()).formatted(Formatting.BOLD).formatted(Formatting.DARK_GRAY); + this.screen.elements.factionName = (selectedFaction.tryGetShortName()).withStyle(ChatFormatting.BOLD).withStyle(ChatFormatting.DARK_GRAY); if(this.selectedSubfaction != null) this.screen.elements.subfactionName = (selectedSubfaction.tryGetShortName()); else @@ -187,7 +201,7 @@ public void updateScreenInformation() { } //region [Helpers] - private Text getRaceText() { + private Component getRaceText() { Faction factionToUse = getCurrentFaction(); if(factionToUse == null) return null; StringBuilder raceListStringBuilder = new StringBuilder(); @@ -198,7 +212,7 @@ private Text getRaceText() { raceListStringBuilder.append(race.getFullName().getString()); } - return Text.of(raceListStringBuilder.toString()); + return Component.nullToEmpty(raceListStringBuilder.toString()); } private Faction getCurrentFaction() { @@ -346,8 +360,13 @@ private void setRace(Integer index){ } selectedRace = currentFaction.getRaces(world).get(index); + ResourceLocation npcId = currentFaction.getRandomNpcDataIdentifier(); + if (npcId == null) { + currentNpcEntity = null; + return; + } currentNpcEntity = new NpcEntity(EntitiesME.NPC, world); - currentNpcEntity.prepareNpcIdentifier(currentFaction.getRandomNpcDataIdentifier()); + currentNpcEntity.prepareNpcIdentifier(npcId); currentNpcEntity.prepare(); updateNpcPreview(); @@ -361,7 +380,11 @@ public void updateNpcPreview(boolean forced){ Faction currentFaction = getCurrentFaction(); if(!forced){ - if(currentNpcEntity != null && currentFaction != null && currentNpcEntity.getFactionIdentifier() == currentFaction.getId() && currentNpcEntity.getNpcType().getRace() == selectedRace.getId()) + if(currentNpcEntity != null + && currentFaction != null + && selectedRace != null + && Objects.equals(currentNpcEntity.getFactionIdentifier(), currentFaction.getId()) + && Objects.equals(currentNpcEntity.getNpcType().getRace(), selectedRace.getId())) return; } @@ -371,14 +394,14 @@ public void updateNpcPreview(boolean forced){ var idList = currentFaction.getAllNpcDatas().values().stream().flatMap(List::stream).toList(); // filter list by race - var optionalNpcRegistry = world.getRegistryManager().getOptional(DynamicRegistriesME.NPC_TYPE); + var optionalNpcRegistry = world.registryAccess().lookup(DynamicRegistriesME.NPC_TYPE); if(optionalNpcRegistry.isEmpty()) return; var npcRegistry = optionalNpcRegistry.get(); - var filteredList = new ArrayList(); - for(Identifier idToFilter : idList){ + var filteredList = new ArrayList(); + for(ResourceLocation idToFilter : idList){ if(filterNpc(npcRegistry, idToFilter)) filteredList.add(idToFilter); } @@ -386,13 +409,15 @@ public void updateNpcPreview(boolean forced){ if(filteredList.isEmpty()) return; - Identifier id = filteredList.get((new Random()).nextInt(filteredList.size())); - if(world instanceof ClientWorld clientWorld) + ResourceLocation id = filteredList.get((new Random()).nextInt(filteredList.size())); + if(world instanceof ClientLevel clientWorld) this.screen.elements.npcPreviewWidget.updateEntity(id, selectedRace, clientWorld, false); } - private boolean filterNpc(Registry registry, Identifier elementToFilter){ - NpcType foundData = registry.get(elementToFilter); + private boolean filterNpc(HolderLookup.RegistryLookup registry, ResourceLocation elementToFilter){ + NpcType foundData = registry.get(ResourceKey.create(DynamicRegistriesME.NPC_TYPE, elementToFilter)) + .map(reference -> reference.value()) + .orElse(null); if(foundData == null) return false; if(selectedRace == null) @@ -470,16 +495,28 @@ public void randomizeAll(){ } private void randomize(){ + if (factions == null || factions.isEmpty()) { + return; + } Random random = new Random(); - setDisposition(factions.keySet().stream().toList().get(random.nextInt(factions.keySet().size()))); - setFaction(random.nextInt(factions.get(selectedDispositionType).size())); + List dispositions = factions.keySet().stream().toList(); + setDisposition(dispositions.get(random.nextInt(dispositions.size()))); + List availableFactions = factions.get(selectedDispositionType); + if (availableFactions == null || availableFactions.isEmpty()) { + return; + } + setFaction(random.nextInt(availableFactions.size())); if(selectedFaction.getSubFactions() != null && !selectedFaction.getSubFactions().isEmpty()) setSubfaction(random.nextInt(selectedFaction.getSubFactions().size())); else selectedSubfaction = null; Faction factionToUse = getCurrentFaction(); - setSpawnPoint(random.nextInt(factionToUse.getSpawnAmount())); + if (factionToUse == null) { + return; + } + int spawnAmount = factionToUse.getSpawnAmount(); + setSpawnPoint(spawnAmount > 0 ? random.nextInt(spawnAmount) : null); List races = factionToUse.getRaces(world); setRace((races == null || races.isEmpty()) ? 0 : random.nextInt(races.size())); @@ -487,23 +524,19 @@ private void randomize(){ public void confirmSelection(){ Faction faction = getCurrentFaction(); - if(faction == null) return; - - Vec3d coordinate = selectedSpawn.getCoordinates(); - if(selectedSpawn.isDynamic()){ - ClientPlayNetworking.send(new PacketTeleportToDynamicCoordinate(coordinate.getX(), coordinate.getZ(), true)); - } else { - ClientPlayNetworking.send(new PacketTeleportToCustomCoordinate(coordinate.getX(), coordinate.getY(), coordinate.getZ(), true)); - } + if(faction == null || selectedRace == null || selectedSpawn == null) return; - ClientPlayNetworking.send(new PacketSetRace(selectedRace.getId().toString())); - ClientPlayNetworking.send(new PacketSetAffiliation(selectedDispositionType.name(), faction.getId().toString(), selectedSpawn.getIdentifier().toString())); - ClientPlayerEntity player = MinecraftClient.getInstance().player; + LocalPlayer player = Minecraft.getInstance().player; if(player != null){ - BlockPos overworldBlockPos = player.getBlockPos(); - ClientPlayNetworking.send(new PacketSetSpawnData(overworldBlockPos.getX(), overworldBlockPos.getY(), overworldBlockPos.getZ())); + PacketDistributor.sendToServer(new PacketCompleteOnboarding( + faction.getId(), + selectedRace.getId(), + selectedSpawn.getIdentifier(), + player.blockPosition(), + interactionHand == InteractionHand.OFF_HAND + )); } - screen.close(); + screen.onClose(); } public int getMaxSpawnAmount() { @@ -536,7 +569,7 @@ private List fetchAllPossibleSearchBarResults() { if(faction.isJoinable()){ newList.add(getSearchBarResult(faction)); if(faction.getSubFactions() != null){ - for(Identifier subfacId : faction.getSubFactions()){ + for(ResourceLocation subfacId : faction.getSubFactions()){ try{ Faction subfac = FactionLookup.getFactionById(world, subfacId); newList.add(getSearchBarResult(faction, subfac)); @@ -551,16 +584,16 @@ private List fetchAllPossibleSearchBarResults() { } private SearchBarResult getSearchBarResult(Faction faction) { - MutableText text = faction.tryGetShortName(); - Identifier factionId = faction.getId(); + MutableComponent text = faction.tryGetShortName(); + ResourceLocation factionId = faction.getId(); SearchBarResultType type = SearchBarResultType.NORMAL; return new SearchBarResult(text, factionId, type, button -> selectFactionByIdentifier(factionId, null)); } private SearchBarResult getSearchBarResult(Faction faction, Faction subfaction) { - MutableText text = subfaction.tryGetShortName(); - Identifier factionId = faction.getId(); - Identifier subfactionId = subfaction.getId(); + MutableComponent text = subfaction.tryGetShortName(); + ResourceLocation factionId = faction.getId(); + ResourceLocation subfactionId = subfaction.getId(); SearchBarResultType type = SearchBarResultType.SUB; return new SearchBarResult(text, subfactionId, type, button -> selectFactionByIdentifier(factionId, subfactionId)); } @@ -569,7 +602,7 @@ public List getAllSearchBarResults(){ return searchBarResults; } - public void selectFactionByIdentifier(Identifier factionId, Identifier subfactionId){ + public void selectFactionByIdentifier(ResourceLocation factionId, ResourceLocation subfactionId){ try{ Faction faction = FactionLookup.getFactionById(world, factionId); setDisposition(faction.getDisposition()); @@ -593,11 +626,11 @@ public float getCurrentDelay(){ return (Math.round(this.currentDelay * 10f) /10f); } - public Text getCurrentFactionFullName() { + public Component getCurrentFactionFullName() { return selectedFaction.getFullName(); } - public void drawRaceTooltip(AbstractClientPlayerEntity player, DrawContext context, TextRenderer textRenderer, int x, int y) { + public void drawRaceTooltip(AbstractClientPlayer player, GuiGraphics context, Font textRenderer, int x, int y) { if(selectedRace == null) return; RaceStatTooltip.draw(selectedRace, player, context, textRenderer, x, y, playerAttributes, shouldBeDetailed); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/onboarding/onboarding_faction/OnboardingFactionScreenService.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/onboarding/onboarding_faction/OnboardingFactionScreenService.java index f41c2961ea..34ccf69f40 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/onboarding/onboarding_faction/OnboardingFactionScreenService.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/onboarding/onboarding_faction/OnboardingFactionScreenService.java @@ -1,7 +1,7 @@ package net.sevenstars.middleearth.gui.onboarding.onboarding_faction; -import net.minecraft.registry.DynamicRegistryManager; -import net.minecraft.world.World; +import net.minecraft.core.RegistryAccess; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.registries.DynamicRegistriesME; import net.sevenstars.middleearth.resources.datas.common.DispositionType; import net.sevenstars.middleearth.resources.datas.factions.Faction; @@ -12,9 +12,12 @@ public class OnboardingFactionScreenService { private List factions = new ArrayList<>(); - public OnboardingFactionScreenService(World world){ - DynamicRegistryManager registryManager = world.getRegistryManager(); - this.factions = registryManager.getOrThrow(DynamicRegistriesME.FACTION).stream().toList(); + public OnboardingFactionScreenService(Level world){ + RegistryAccess registryManager = world.registryAccess(); + this.factions = registryManager.lookupOrThrow(DynamicRegistriesME.FACTION) + .listElements() + .map(reference -> reference.value()) + .toList(); } public List getFactionsByDisposition(DispositionType dispositionType){ diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/playerbook/PlayerBookPageData.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/playerbook/PlayerBookPageData.java index 04d41cbae3..54d590e136 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/playerbook/PlayerBookPageData.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/playerbook/PlayerBookPageData.java @@ -1,13 +1,12 @@ package net.sevenstars.middleearth.gui.playerbook; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; +import net.minecraft.resources.ResourceLocation; public class PlayerBookPageData { public String leftPageTitle; public String leftPageDescription; public String rightPageDescription; - public Identifier image; + public ResourceLocation image; public PlayerBookPageData withTitle(String title) { this.leftPageTitle = title; @@ -24,7 +23,7 @@ public PlayerBookPageData withRightPageDesc(String desc) { return this; } - public PlayerBookPageData withImage(Identifier image) { + public PlayerBookPageData withImage(ResourceLocation image) { this.image = image; return this; } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/playerbook/PlayerBookScreen.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/playerbook/PlayerBookScreen.java index da20b7f08c..9e1117643b 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/playerbook/PlayerBookScreen.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/playerbook/PlayerBookScreen.java @@ -1,23 +1,21 @@ package net.sevenstars.middleearth.gui.playerbook; import com.google.common.collect.Lists; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.block.Blocks; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.InventoryScreen; -import net.minecraft.client.gui.widget.PageTurnWidget; -import net.minecraft.client.sound.PositionedSoundInstance; -import net.minecraft.item.Item; -import net.minecraft.sound.SoundEvents; -import net.minecraft.text.MutableText; -import net.minecraft.text.Text; -import net.minecraft.util.Colors; -import net.minecraft.util.Formatting; -import net.minecraft.util.Identifier; +import com.mojang.blaze3d.vertex.PoseStack; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.minecraft.ChatFormatting; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.PageButton; +import net.minecraft.client.resources.sounds.SimpleSoundInstance; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.CommonColors; +import net.minecraft.world.item.Item; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.entity.EntitiesME; import net.sevenstars.middleearth.entity.spider.scuttler.ShelobiteScuttlerEntity; @@ -25,26 +23,25 @@ import net.sevenstars.middleearth.item.EggItemsME; import net.sevenstars.middleearth.item.ResourceItemsME; import net.sevenstars.middleearth.item.ToolItemsME; -import org.joml.Matrix3x2fStack; import java.util.Dictionary; import java.util.HashMap; import java.util.List; -@Environment(EnvType.CLIENT) +@OnlyIn(Dist.CLIENT) public class PlayerBookScreen extends Screen { - private static final Identifier TEXTURE = Identifier.of(MiddleEarth.MOD_ID, "textures/gui/player_book.png"); + private static final ResourceLocation TEXTURE = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, "textures/gui/player_book.png"); private static final String PATH = "textures/gui/playerbook/"; private static final int WIDTH = 320; private static final int HEIGHT = 220; private static HashMap> chaptersPages; private List chapters; - private PageTurnWidget nextPageButton; - private PageTurnWidget previousPageButton; + private PageButton nextPageButton; + private PageButton previousPageButton; private PlayerBookChapters currentChapter = PlayerBookChapters.GETTING_STARTED; private int currentPage = 0; - public PlayerBookScreen(Text title) { + public PlayerBookScreen(Component title) { super(title); chapters = List.of(new Chapter("playerbook.chapter_getting_started", PlayerBookChapters.GETTING_STARTED, ResourceItemsME.STARLIGHT_PHIAL), new Chapter("playerbook.chapter_mining", PlayerBookChapters.MINING, ToolItemsME.STEEL_PICKAXE), @@ -59,66 +56,76 @@ protected void init() { super.init(); int x = (this.width - 192) / 2; int y = this.height / 2; - this.previousPageButton = this.addDrawableChild(new PageTurnWidget(x - 27, y + 70, false, button -> this.openPreviousPage(), true)); - this.nextPageButton = this.addDrawableChild(new PageTurnWidget(x + 210, y + 70, true, button -> this.openNextPage(), true)); + this.previousPageButton = this.addRenderableWidget(new PageButton(x - 27, y + 70, false, button -> this.openPreviousPage(), true)); + this.nextPageButton = this.addRenderableWidget(new PageButton(x + 210, y + 70, true, button -> this.openNextPage(), true)); updatePageButtons(); } @Override - public void render(DrawContext context, int mouseX, int mouseY, float deltaTicks) { - int centerX = context.getScaledWindowWidth() / 2; - int startX = 5 + centerX - (WIDTH / 2); - int startY = (context.getScaledWindowHeight() / 2) - (HEIGHT / 2); + public void render(GuiGraphics context, int mouseX, int mouseY, float deltaTicks) { + renderBackground(context, mouseX, mouseY, deltaTicks); - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, - startX, startY, 0, 0, - WIDTH, HEIGHT, 384, 384); + int centerX = context.guiWidth() / 2; + int startX = 5 + centerX - (WIDTH / 2); + int startY = (context.guiHeight() / 2) - (HEIGHT / 2); if(currentPage == 0) { - drawScaledText(textRenderer, context, Text.translatable("screen." + MiddleEarth.MOD_ID + ".playerbook.title").formatted(Formatting.UNDERLINE).formatted(Formatting.BOLD), - startX + (int)(WIDTH * 0.325), startY + (int)(HEIGHT * 0.11f), 1.5f, Colors.BLACK, true); + drawScaledText(font, context, Component.translatable("screen." + MiddleEarth.MOD_ID + ".playerbook.title").withStyle(ChatFormatting.UNDERLINE).withStyle(ChatFormatting.BOLD), + startX + (int)(WIDTH * 0.325), startY + (int)(HEIGHT * 0.11f), 1.5f, CommonColors.BLACK, true); - context.drawWrappedText(textRenderer, Text.translatable("screen." + MiddleEarth.MOD_ID + ".playerbook.description"), startX + 38, startY + (int)(HEIGHT * 0.22f), 116, Colors.BLACK, false); + context.drawWordWrap(font, Component.translatable("screen." + MiddleEarth.MOD_ID + ".playerbook.description"), startX + 38, startY + (int)(HEIGHT * 0.22f), 116, CommonColors.BLACK); - drawScaledText(textRenderer, context, Text.translatable("screen." + MiddleEarth.MOD_ID + ".playerbook.chapters").formatted(Formatting.UNDERLINE).formatted(Formatting.BOLD), - startX + (int)(WIDTH * 0.75), startY + (int)(HEIGHT * 0.11f), 1.5f, Colors.BLACK, true); + drawScaledText(font, context, Component.translatable("screen." + MiddleEarth.MOD_ID + ".playerbook.chapters").withStyle(ChatFormatting.UNDERLINE).withStyle(ChatFormatting.BOLD), + startX + (int)(WIDTH * 0.75), startY + (int)(HEIGHT * 0.11f), 1.5f, CommonColors.BLACK, true); int index = 0; for(Chapter chapter : chapters) { - MutableText text = Text.translatable("screen." + MiddleEarth.MOD_ID + "." + chapter.name); + MutableComponent text = Component.translatable("screen." + MiddleEarth.MOD_ID + "." + chapter.name); int startTooltipX = centerX + 30; - int startTooltipY = (context.getScaledWindowHeight() / 2) - (int)(HEIGHT * 0.295f) + (index * 18); + int startTooltipY = (context.guiHeight() / 2) - (int)(HEIGHT * 0.295f) + (index * 18); if (mouseX >= startTooltipX && mouseX <= startTooltipX + (chapter.name.length() * 4.75) + 5 && mouseY >= startTooltipY && mouseY <= startTooltipY + 9) { - context.drawOrderedTooltip(this.client.textRenderer, Lists.transform( - List.of(Text.translatable("screen." + MiddleEarth.MOD_ID + ".playerbook.navigate_to") - ), Text::asOrderedText), mouseX, mouseY); - text.formatted(Formatting.UNDERLINE); + context.renderTooltip(this.minecraft.font, Lists.transform( + List.of(Component.translatable("screen." + MiddleEarth.MOD_ID + ".playerbook.navigate_to") + ), Component::getVisualOrderText), mouseX, mouseY); + text.withStyle(ChatFormatting.UNDERLINE); } - context.drawItem(chapter.icon.getDefaultStack(), startX + (int)(WIDTH * 0.5f) + 12, startY + (int)(HEIGHT * 0.22f) - 4 + (index * 18)); - context.drawText(textRenderer, text, startX + (int)(WIDTH * 0.5f) + 32, startY + (int)(HEIGHT * 0.22f) + (index * 18), Colors.BLACK, false); + context.renderItem(chapter.icon.getDefaultInstance(), startX + (int)(WIDTH * 0.5f) + 12, startY + (int)(HEIGHT * 0.22f) - 4 + (index * 18)); + context.drawString(font, text, startX + (int)(WIDTH * 0.5f) + 32, startY + (int)(HEIGHT * 0.22f) + (index * 18), CommonColors.BLACK, false); index++; } } else { PlayerBookPageData pageData = chaptersPages.get(currentChapter).get(currentPage - 1); if(pageData != null) { - drawScaledText(textRenderer, context, Text.translatable("screen." + MiddleEarth.MOD_ID + "." + pageData.leftPageTitle).formatted(Formatting.UNDERLINE), - startX + (int)(WIDTH * 0.3), startY + (int)(HEIGHT * 0.11f), 1.25f, Colors.BLACK, true); + drawScaledText(font, context, Component.translatable("screen." + MiddleEarth.MOD_ID + "." + pageData.leftPageTitle).withStyle(ChatFormatting.UNDERLINE), + startX + (int)(WIDTH * 0.3), startY + (int)(HEIGHT * 0.11f), 1.25f, CommonColors.BLACK, true); if(pageData.image != null) { - context.drawTexture(RenderPipelines.GUI_TEXTURED, pageData.image, + context.blit(pageData.image, startX, startY, 0, 0, WIDTH, HEIGHT, 320, 320); } - context.drawWrappedText(textRenderer, Text.translatable("screen." + MiddleEarth.MOD_ID + "." + pageData.leftPageDescription), - startX + 38, startY + (int)(HEIGHT * 0.2f), 116, Colors.BLACK, false); - context.drawWrappedText(textRenderer, Text.translatable("screen." + MiddleEarth.MOD_ID + "." + pageData.rightPageDescription), - startX + (int)(WIDTH * 0.5f) + 16, startY + (int)(HEIGHT * 0.16f), 114, Colors.BLACK, false); + context.drawWordWrap(font, Component.translatable("screen." + MiddleEarth.MOD_ID + "." + pageData.leftPageDescription), + startX + 38, startY + (int)(HEIGHT * 0.2f), 116, CommonColors.BLACK); + context.drawWordWrap(font, Component.translatable("screen." + MiddleEarth.MOD_ID + "." + pageData.rightPageDescription), + startX + (int)(WIDTH * 0.5f) + 16, startY + (int)(HEIGHT * 0.16f), 114, CommonColors.BLACK); } } + this.renderables.forEach(renderable -> renderable.render(context, mouseX, mouseY, deltaTicks)); renderTooltip(context, mouseX, mouseY); - super.render(context, mouseX, mouseY, deltaTicks); + } + + @Override + public void renderBackground(GuiGraphics context, int mouseX, int mouseY, float deltaTicks) { + super.renderBackground(context, mouseX, mouseY, deltaTicks); + + int centerX = context.guiWidth() / 2; + int startX = 5 + centerX - (WIDTH / 2); + int startY = (context.guiHeight() / 2) - (HEIGHT / 2); + context.blit(TEXTURE, + startX, startY, 0, 0, + WIDTH, HEIGHT, 384, 384); } @@ -132,14 +139,14 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { for (Chapter chapter : chapters) { int startTooltipX = centerX + 30; int startTooltipY = (this.height / 2) - (int)(HEIGHT * 0.28f) + (index * 18); - int textWidth = this.client.textRenderer.getWidth(chapter.name); + int textWidth = this.minecraft.font.width(chapter.name); if (mouseX >= startTooltipX && mouseX <= startTooltipX + textWidth + 5 && mouseY >= startTooltipY && mouseY <= startTooltipY + 9) { this.currentChapter = chapter.chapter; this.currentPage = 1; updatePageButtons(); - this.client.getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + this.minecraft.getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); return true; } index++; @@ -149,23 +156,23 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { return super.mouseClicked(mouseX, mouseY, button); } - private void renderTooltip(DrawContext context, int mouseX, int mouseY) { - int centerX = context.getScaledWindowWidth() / 2; + private void renderTooltip(GuiGraphics context, int mouseX, int mouseY) { + int centerX = context.guiWidth() / 2; } - public static void drawScaledText(TextRenderer textRenderer, DrawContext context, Text text, int x, int y, float scale, int color, boolean centered) { - Matrix3x2fStack matrices = context.getMatrices(); - matrices.pushMatrix(); - matrices.scale(scale); + public static void drawScaledText(Font textRenderer, GuiGraphics context, Component text, int x, int y, float scale, int color, boolean centered) { + PoseStack matrices = context.pose(); + matrices.pushPose(); + matrices.scale(scale, scale, 1.0F); if (centered) { - context.drawText(textRenderer, text, (int)(x / scale) - (int)((textRenderer.getWidth(text) * Math.pow(scale, 0.5f)) / 2), + context.drawString(textRenderer, text, (int)(x / scale) - (int)((textRenderer.width(text) * Math.pow(scale, 0.5f)) / 2), (int)(y / scale), color, false); } else { - context.drawText(textRenderer, text, x, y, color, false); + context.drawString(textRenderer, text, x, y, color, false); } - matrices.popMatrix(); + matrices.popPose(); } private void openPreviousPage() { @@ -206,55 +213,55 @@ public Chapter(String name, PlayerBookChapters chapter, Item icon) { static { chaptersPages = new HashMap<>(); chaptersPages.put(PlayerBookChapters.GETTING_STARTED, List.of( - new PlayerBookPageData().withTitle("playerbook.chapter_getting_started").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "getting_started1.png")) + new PlayerBookPageData().withTitle("playerbook.chapter_getting_started").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "getting_started1.png")) .withLeftPageDesc("playerbook.getting_started_desc") .withRightPageDesc("playerbook.getting_started_desc_right") )); chaptersPages.put(PlayerBookChapters.MINING, List.of( - new PlayerBookPageData().withTitle("playerbook.chapter_mining").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "mining1.png")) + new PlayerBookPageData().withTitle("playerbook.chapter_mining").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "mining1.png")) .withLeftPageDesc("playerbook.mining_desc") .withRightPageDesc("playerbook.mining_desc_right"), new PlayerBookPageData().withTitle("playerbook.tools") .withLeftPageDesc("playerbook.mining_tools_desc") .withRightPageDesc("playerbook.mining_tools_desc_right"), - new PlayerBookPageData().withTitle("playerbook.cave_monsters").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "mining3.png")) + new PlayerBookPageData().withTitle("playerbook.cave_monsters").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "mining3.png")) .withLeftPageDesc("playerbook.mining_cave_monster_desc") .withRightPageDesc("playerbook.mining_cave_monster_desc_right") )); chaptersPages.put(PlayerBookChapters.SMITHING, List.of( - new PlayerBookPageData().withTitle("playerbook.chapter_smithing").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "smithing1.png")) + new PlayerBookPageData().withTitle("playerbook.chapter_smithing").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "smithing1.png")) .withLeftPageDesc("playerbook.smithing_desc") .withRightPageDesc("playerbook.smithing_desc_right"), - new PlayerBookPageData().withTitle("playerbook.copper_alloys").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "smithing2.png")) + new PlayerBookPageData().withTitle("playerbook.copper_alloys").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "smithing2.png")) .withLeftPageDesc("playerbook.smithing_copper_alloys_smithing_desc") .withRightPageDesc("playerbook.smithing_copper_alloys_smithing_desc_right"), - new PlayerBookPageData().withTitle("playerbook.casting").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "smithing3.png")) + new PlayerBookPageData().withTitle("playerbook.casting").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "smithing3.png")) .withLeftPageDesc("playerbook.smithing_casting_desc") .withRightPageDesc("playerbook.smithing_casting_desc_right"), - new PlayerBookPageData().withTitle("playerbook.shaping_anvil").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "smithing4.png")) + new PlayerBookPageData().withTitle("playerbook.shaping_anvil").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "smithing4.png")) .withLeftPageDesc("playerbook.smithing_shaping_anvil_desc") .withRightPageDesc("playerbook.smithing_shaping_anvil_desc_right"), new PlayerBookPageData().withTitle("playerbook.shaping_anvil") .withLeftPageDesc("playerbook.smithing_shaping_anvil_1_desc") .withRightPageDesc("playerbook.smithing_shaping_anvil_1_desc_right"), - new PlayerBookPageData().withTitle("playerbook.quenching").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "smithing5.png")) + new PlayerBookPageData().withTitle("playerbook.quenching").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "smithing5.png")) .withLeftPageDesc("playerbook.smithing_quenching_desc") .withRightPageDesc("playerbook.smithing_quenching_desc_right"), - new PlayerBookPageData().withTitle("playerbook.artisan_table").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "smithing6.png")) + new PlayerBookPageData().withTitle("playerbook.artisan_table").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "smithing6.png")) .withLeftPageDesc("playerbook.smithing_artisan_table_desc") .withRightPageDesc("playerbook.smithing_artisan_table_desc_right"), - new PlayerBookPageData().withTitle("playerbook.artisan_table").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "smithing7.png")) + new PlayerBookPageData().withTitle("playerbook.artisan_table").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "smithing7.png")) .withLeftPageDesc("playerbook.smithing_artisan_table_1_desc") .withRightPageDesc("playerbook.smithing_artisan_table_1_desc_right") )); chaptersPages.put(PlayerBookChapters.ENCHANTING, List.of( - new PlayerBookPageData().withTitle("playerbook.chapter_enchanting").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "enchanting1.png")) + new PlayerBookPageData().withTitle("playerbook.chapter_enchanting").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "enchanting1.png")) .withLeftPageDesc("playerbook.enchanting_desc") .withRightPageDesc("playerbook.enchanting_desc_right"), - new PlayerBookPageData().withTitle("playerbook.inscription_table").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "enchanting2.png")) + new PlayerBookPageData().withTitle("playerbook.inscription_table").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "enchanting2.png")) .withLeftPageDesc("playerbook.inscription_table_desc") .withRightPageDesc("playerbook.inscription_table_desc_right") )); @@ -263,16 +270,16 @@ public Chapter(String name, PlayerBookChapters chapter, Item icon) { new PlayerBookPageData().withTitle("playerbook.chapter_mounts") .withLeftPageDesc("playerbook.mounts_desc") .withRightPageDesc("playerbook.mounts_desc_right"), - new PlayerBookPageData().withTitle("playerbook.broadhoof_goat").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "mount_broadhoof_goat.png")) + new PlayerBookPageData().withTitle("playerbook.broadhoof_goat").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "mount_broadhoof_goat.png")) .withLeftPageDesc("playerbook.mount_broadhoof_goat_desc") .withRightPageDesc("playerbook.mount_broadhoof_goat_desc_right"), - new PlayerBookPageData().withTitle("playerbook.great_horn").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "mount_great_horn.png")) + new PlayerBookPageData().withTitle("playerbook.great_horn").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "mount_great_horn.png")) .withLeftPageDesc("playerbook.mount_great_horn_desc") .withRightPageDesc("playerbook.mount_great_horn_desc_right"), - new PlayerBookPageData().withTitle("playerbook.warg").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "mount_warg.png")) + new PlayerBookPageData().withTitle("playerbook.warg").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "mount_warg.png")) .withLeftPageDesc("playerbook.mount_warg_desc") .withRightPageDesc("playerbook.mount_warg_desc_right"), - new PlayerBookPageData().withTitle("playerbook.cave_troll").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "mount_cave_troll.png")) + new PlayerBookPageData().withTitle("playerbook.cave_troll").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "mount_cave_troll.png")) .withLeftPageDesc("playerbook.mount_cave_troll_desc") .withRightPageDesc("playerbook.mount_cave_troll_desc_right") )); @@ -281,10 +288,10 @@ public Chapter(String name, PlayerBookChapters chapter, Item icon) { new PlayerBookPageData().withTitle("playerbook.chapter_dungeons") .withLeftPageDesc("playerbook.dungeons_desc") .withRightPageDesc("playerbook.dungeons_desc_right"), - new PlayerBookPageData().withTitle("playerbook.brigands").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "dungeon_brigands.png")) + new PlayerBookPageData().withTitle("playerbook.brigands").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "dungeon_brigands.png")) .withLeftPageDesc("playerbook.dungeon_brigands_desc") .withRightPageDesc("playerbook.dungeon_brigands_desc_right"), - new PlayerBookPageData().withTitle("playerbook.spider_burrows").withImage(Identifier.of(MiddleEarth.MOD_ID, PATH + "dungeon_spider_burrows.png")) + new PlayerBookPageData().withTitle("playerbook.spider_burrows").withImage(ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID, PATH + "dungeon_spider_burrows.png")) .withLeftPageDesc("playerbook.dungeon_spider_burrows_desc") .withRightPageDesc("playerbook.dungeon_spider_burrows_desc_right") )); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/render/BannerResultWithScaleGuiElementRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/render/BannerResultWithScaleGuiElementRenderer.java index 0ad56c9579..93662e08c5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/render/BannerResultWithScaleGuiElementRenderer.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/render/BannerResultWithScaleGuiElementRenderer.java @@ -1,43 +1,53 @@ package net.sevenstars.middleearth.gui.render; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.render.SpecialGuiElementRenderer; -import net.minecraft.client.render.DiffuseLighting; -import net.minecraft.client.render.OverlayTexture; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BannerBlockEntityRenderer; -import net.minecraft.client.render.model.ModelBaker; -import net.minecraft.client.util.math.MatrixStack; -import net.sevenstars.middleearth.gui.render.states.BannerResultWithScaleGuiElementRenderState; +import com.mojang.blaze3d.platform.Lighting; +import com.mojang.blaze3d.vertex.PoseStack; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.model.geom.ModelPart; +import net.minecraft.client.renderer.blockentity.BannerRenderer; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.client.resources.model.ModelBakery; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.level.block.entity.BannerPatternLayers; -@Environment(EnvType.CLIENT) -public class BannerResultWithScaleGuiElementRenderer extends InstancedGuiElementRenderer { - public BannerResultWithScaleGuiElementRenderer(VertexConsumerProvider.Immediate immediate) { - super(immediate); +@OnlyIn(Dist.CLIENT) +public final class BannerResultWithScaleGuiElementRenderer { + private BannerResultWithScaleGuiElementRenderer() { } - public Class getElementClass() { - return BannerResultWithScaleGuiElementRenderState.class; - } - - protected void render(BannerResultWithScaleGuiElementRenderState bannerResultWithStateGuiElementRenderState, MatrixStack matrixStack) { - MinecraftClient.getInstance().gameRenderer.getDiffuseLighting().setShaderLights(DiffuseLighting.Type.ITEMS_FLAT); - matrixStack.translate(0.0F, 0.25F, 0.0F); - BannerBlockEntityRenderer.renderCanvas( - matrixStack, - this.vertexConsumers, + public static void render( + GuiGraphics graphics, + ModelPart flag, + DyeColor baseColor, + BannerPatternLayers patterns, + int x, + int y, + float scale + ) { + Lighting.setupForFlatItems(); + PoseStack pose = graphics.pose(); + pose.pushPose(); + pose.translate(x, y, 0.0F); + pose.scale(scale, scale, 1.0F); + pose.translate(0.5F, -0.5F, 0.5F); + pose.scale(0.6666667F, 0.6666667F, -0.6666667F); + flag.xRot = 0.0F; + flag.y = -32.0F; + BannerRenderer.renderPatterns( + pose, + graphics.bufferSource(), 15728880, - OverlayTexture.DEFAULT_UV, - bannerResultWithStateGuiElementRenderState.flag(), - ModelBaker.BANNER_BASE, + OverlayTexture.NO_OVERLAY, + flag, + ModelBakery.BANNER_BASE, true, - bannerResultWithStateGuiElementRenderState.baseColor(), - bannerResultWithStateGuiElementRenderState.resultBannerPatterns()); - } - - protected String getName() { - return "banner result"; + baseColor, + patterns + ); + pose.popPose(); + graphics.flush(); + Lighting.setupFor3DItems(); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/render/InstancedGuiElementRenderer.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/render/InstancedGuiElementRenderer.java deleted file mode 100644 index 28cf4823b4..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/render/InstancedGuiElementRenderer.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.sevenstars.middleearth.gui.render; - -import net.minecraft.client.gui.render.SpecialGuiElementRenderer; -import net.minecraft.client.gui.render.state.GuiRenderState; -import net.minecraft.client.render.VertexConsumerProvider; -import net.sevenstars.middleearth.gui.render.states.InstancedGuiElementRenderState; - -public abstract class InstancedGuiElementRenderer extends SpecialGuiElementRenderer { - private boolean usedThisFrame; - - protected InstancedGuiElementRenderer(VertexConsumerProvider.Immediate vertexConsumers) { - super(vertexConsumers); - } - - public final boolean usedThisFrame() { - return this.usedThisFrame; - } - - public final void resetUsedThisFrame() { - this.usedThisFrame = false; - } - - @Override - public void renderElement(T specialGuiElementRenderState, GuiRenderState guiRenderState) { - super.renderElement(specialGuiElementRenderState, guiRenderState); - this.usedThisFrame = true; - } -} \ No newline at end of file diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/render/states/BannerResultWithScaleGuiElementRenderState.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/render/states/BannerResultWithScaleGuiElementRenderState.java deleted file mode 100644 index d40b5ccd01..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/render/states/BannerResultWithScaleGuiElementRenderState.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.sevenstars.middleearth.gui.render.states; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.gui.ScreenRect; -import net.minecraft.client.gui.render.state.special.SpecialGuiElementRenderState; -import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.component.type.BannerPatternsComponent; -import net.minecraft.util.DyeColor; -import net.sevenstars.middleearth.gui.render.BannerResultWithScaleGuiElementRenderer; -import net.sevenstars.middleearth.gui.render.InstancedGuiElementRenderer; -import org.jetbrains.annotations.Nullable; - -@Environment(EnvType.CLIENT) -public record BannerResultWithScaleGuiElementRenderState(ModelPart flag, DyeColor baseColor, BannerPatternsComponent resultBannerPatterns, int x1, int y1, int x2, int y2, float scale, @Nullable ScreenRect scissorArea, @Nullable ScreenRect bounds) implements InstancedGuiElementRenderState { - public BannerResultWithScaleGuiElementRenderState(ModelPart flag, DyeColor color, BannerPatternsComponent bannerPatterns, int x1, int y1, int x2, int y2, float scale, @Nullable ScreenRect scissorArea) { - this(flag, color, bannerPatterns, x1, y1, x2, y2, scale, scissorArea, SpecialGuiElementRenderState.createBounds(x1, y1, x2, y2, scissorArea)); - } - - public float scale() { - return scale; - } - - @Override - public InstancedGuiElementRenderer newRenderer(VertexConsumerProvider.Immediate vertexConsumers) { - return new BannerResultWithScaleGuiElementRenderer(vertexConsumers); - } -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/render/states/InstancedGuiElementRenderState.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/render/states/InstancedGuiElementRenderState.java deleted file mode 100644 index 51e732350e..0000000000 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/render/states/InstancedGuiElementRenderState.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.sevenstars.middleearth.gui.render.states; - -import net.minecraft.client.gui.render.state.special.SpecialGuiElementRenderState; -import net.minecraft.client.render.VertexConsumerProvider; -import net.sevenstars.middleearth.gui.render.InstancedGuiElementRenderer; - -public interface InstancedGuiElementRenderState extends SpecialGuiElementRenderState { - InstancedGuiElementRenderer newRenderer(VertexConsumerProvider.Immediate vertexConsumers); -} diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/return_confirmation/ReturnConfirmationScreen.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/return_confirmation/ReturnConfirmationScreen.java index bdaf22745a..fa8c2357d8 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/return_confirmation/ReturnConfirmationScreen.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/return_confirmation/ReturnConfirmationScreen.java @@ -1,47 +1,86 @@ package net.sevenstars.middleearth.gui.return_confirmation; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.text.Text; -import net.minecraft.util.Colors; -import net.minecraft.util.Identifier; +import net.neoforged.neoforge.network.PacketDistributor; + +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.CommonColors; +import net.minecraft.world.InteractionHand; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.gui.utils.widgets.ModWidget; import net.sevenstars.middleearth.network.packets.C2S.PacketTeleportToCurrentOverworldSpawn; +import net.sevenstars.middleearth.network.handlers.OnboardingReturnResult; import java.awt.event.KeyEvent; public class ReturnConfirmationScreen extends Screen { - private static final Text RETURN_CONFIRMATION_TITLE = Text.translatable("ui.%s.return_confirmation.title".formatted(MiddleEarth.MOD_ID)); - private static final Identifier BUTTON_WIDGET = Identifier.of(MiddleEarth.MOD_ID,"textures/gui/widget/button_widget.png"); - public ButtonWidget returnToOverworldButton; - public ButtonWidget closeButton; + private static final Component RETURN_CONFIRMATION_TITLE = Component.translatable("ui.%s.return_confirmation.title".formatted(MiddleEarth.MOD_ID)); + private static final ResourceLocation BUTTON_WIDGET = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID,"textures/gui/widget/button_widget.png"); + public Button returnToOverworldButton; + public Button closeButton; float currentDelay; - public ReturnConfirmationScreen(float delay) { + private final InteractionHand interactionHand; + private boolean requestPending; + + public ReturnConfirmationScreen(float delay, InteractionHand interactionHand) { super(RETURN_CONFIRMATION_TITLE); currentDelay = delay; + this.interactionHand = interactionHand; } @Override protected void init() { - ButtonWidget.PressAction returnToOverworldAction = button -> { + Button.OnPress returnToOverworldAction = button -> { returnToOverworld(); }; - returnToOverworldButton = ButtonWidget.builder(Text.translatable("ui.%s.return_confirmation.continue_character.title".formatted(MiddleEarth.MOD_ID)), returnToOverworldAction).build(); - addDrawableChild(returnToOverworldButton); + returnToOverworldButton = Button.builder(Component.translatable("ui.%s.return_confirmation.continue_character.title".formatted(MiddleEarth.MOD_ID)), returnToOverworldAction).build(); + addRenderableWidget(returnToOverworldButton); if(currentDelay > 0) returnToOverworldButton.active = false; } private void returnToOverworld() { - ClientPlayNetworking.send(new PacketTeleportToCurrentOverworldSpawn()); + if (requestPending) { + return; + } + requestPending = true; + returnToOverworldButton.active = false; + PacketDistributor.sendToServer(new PacketTeleportToCurrentOverworldSpawn(interactionHand == InteractionHand.OFF_HAND)); + } + + public void handleResult(OnboardingReturnResult.Status status, int retryAfterMillis) { + requestPending = false; + if (status == OnboardingReturnResult.Status.SUCCESS) { + onClose(); + return; + } + + showFailure(status.translationSuffix()); + if (status.retryable()) { + currentDelay = Math.max(0.05F, retryAfterMillis / 1000.0F); + returnToOverworldButton.active = currentDelay <= 0.0F; + } else { + onClose(); + } + } + + private void showFailure(String suffix) { + if (minecraft != null && minecraft.player != null) { + minecraft.player.displayClientMessage( + Component.translatable( + "ui.%s.return_confirmation.error.%s".formatted(MiddleEarth.MOD_ID, suffix) + ), + false + ); + } } @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) { + public void render(GuiGraphics context, int mouseX, int mouseY, float delta) { + renderBackground(context, mouseX, mouseY, delta); ModWidget.updateMouse(mouseX, mouseY); this.drawContent(context); } @@ -50,14 +89,14 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) { public void tick() { if(currentDelay > 0){ currentDelay = Math.max(0, currentDelay - (1f / 20)); - if(currentDelay == 0) { + if(currentDelay == 0 && !requestPending) { returnToOverworldButton.active = true; } } super.tick(); } - private void drawContent(DrawContext context) { + private void drawContent(GuiGraphics context) { int panelSizeX = 102; int panelSizeY = 18; int margin = 5; @@ -66,30 +105,30 @@ private void drawContent(DrawContext context) { int startX = (width / 2) - (panelSizeX / 2); int startY = (height / 2) - (panelSizeY / 2); if(returnToOverworldButton.active){ - context.drawTexture(RenderPipelines.GUI_TEXTURED, BUTTON_WIDGET, + context.blit(BUTTON_WIDGET, startX, startY,0, returnToOverworldButton.isFocused() || isMouseOver(startX, panelSizeX, startY, panelSizeY) ? 19 : 0, panelSizeX, panelSizeY, 256, 256); - Text continueText = Text.translatable("ui.%s.return_confirmation.continue_character.content".formatted(MiddleEarth.MOD_ID)); - context.drawText(textRenderer, continueText, - startX + (int)((panelSizeX - textRenderer.getWidth(continueText)) / 2f), - startY + (int) ((panelSizeY / 2f) - (textRenderer.fontHeight / 2f)) + 1, - Colors.BLACK, false); + Component continueText = Component.translatable("ui.%s.return_confirmation.continue_character.content".formatted(MiddleEarth.MOD_ID)); + context.drawString(font, continueText, + startX + (int)((panelSizeX - font.width(continueText)) / 2f), + startY + (int) ((panelSizeY / 2f) - (font.lineHeight / 2f)) + 1, + CommonColors.BLACK, false); - returnToOverworldButton.setDimensionsAndPosition(panelSizeX, panelSizeY, startX, startY); + returnToOverworldButton.setRectangle(panelSizeX, panelSizeY, startX, startY); if(ModWidget.getFocusEnabled() && returnToOverworldButton.isFocused()){ - context.drawTexture(RenderPipelines.GUI_TEXTURED, BUTTON_WIDGET, + context.blit(BUTTON_WIDGET, startX, startY,103, 0, panelSizeX, panelSizeY, 256, 256); } } else { - context.drawTexture(RenderPipelines.GUI_TEXTURED, BUTTON_WIDGET, + context.blit(BUTTON_WIDGET, startX, startY,0, 38, panelSizeX, panelSizeY, 256, 256); - Text delayText = Text.literal(String.valueOf((Math.round(this.currentDelay * 10f) /10f))); - context.drawText(textRenderer, delayText, - startX + (panelSizeX / 2) - (textRenderer.getWidth(delayText) / 2), + Component delayText = Component.literal(String.valueOf((Math.round(this.currentDelay * 10f) /10f))); + context.drawString(font, delayText, + startX + (panelSizeX / 2) - (font.width(delayText) / 2), startY + 5, 0xc4343e, true); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/sack/SackScreenHandler.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/sack/SackScreenHandler.java index af4ba2e1f0..16020a9c52 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/sack/SackScreenHandler.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/sack/SackScreenHandler.java @@ -1,36 +1,36 @@ package net.sevenstars.middleearth.gui.sack; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.Inventory; -import net.minecraft.inventory.SimpleInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.ScreenHandlerType; -import net.minecraft.screen.slot.Slot; +import net.minecraft.world.Container; +import net.minecraft.world.SimpleContainer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; -public class SackScreenHandler extends ScreenHandler { +public class SackScreenHandler extends AbstractContainerMenu { private static final int CONTAINER_SIZE = 9; private static final int INVENTORY_START = 9; private static final int INVENTORY_END = 36; private static final int HOTBAR_START = 36; private static final int HOTBAR_END = 45; - private final Inventory inventory; + private final Container inventory; - public SackScreenHandler(int syncId, PlayerInventory playerInventory) { - this(syncId, playerInventory, new SimpleInventory(9)); + public SackScreenHandler(int syncId, Inventory playerInventory) { + this(syncId, playerInventory, new SimpleContainer(9)); } - public SackScreenHandler(int syncId, PlayerInventory playerInventory, Inventory inventory) { - super(ScreenHandlerType.GENERIC_3X3, syncId); - checkSize(inventory, CONTAINER_SIZE); + public SackScreenHandler(int syncId, Inventory playerInventory, Container inventory) { + super(MenuType.GENERIC_3x3, syncId); + checkContainerSize(inventory, CONTAINER_SIZE); this.inventory = inventory; - inventory.onOpen(playerInventory.player); + inventory.startOpen(playerInventory.player); this.add3x3Slots(inventory, 62, 17); - this.addPlayerSlots(playerInventory, 8, 84); + this.addPlayerInventorySlots(playerInventory, 8, 84); } - protected void add3x3Slots(Inventory inventory, int x, int y) { + protected void add3x3Slots(Container inventory, int x, int y) { for(int i = 0; i < 3; ++i) { for(int j = 0; j < 3; ++j) { int k = j + i * 3; @@ -39,42 +39,58 @@ protected void add3x3Slots(Inventory inventory, int x, int y) { } } - public boolean canUse(PlayerEntity player) { - return this.inventory.canPlayerUse(player); + protected void addPlayerInventorySlots(Inventory playerInventory, int x, int y) { + for (int row = 0; row < 3; ++row) { + for (int column = 0; column < 9; ++column) { + this.addSlot(new Slot(playerInventory, column + row * 9 + 9, x + column * 18, y + row * 18)); + } + } + + for (int column = 0; column < 9; ++column) { + this.addSlot(new Slot(playerInventory, column, x + column * 18, y + 58)); + } + } + + public boolean stillValid(Player player) { + return this.inventory.stillValid(player); + } + + public boolean isContainer(Container container) { + return this.inventory == container; } - public ItemStack quickMove(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { ItemStack itemStack = ItemStack.EMPTY; Slot slot2 = (Slot)this.slots.get(slot); - if (slot2 != null && slot2.hasStack()) { - ItemStack itemStack2 = slot2.getStack(); + if (slot2 != null && slot2.hasItem()) { + ItemStack itemStack2 = slot2.getItem(); itemStack = itemStack2.copy(); if (slot < 9) { - if (!this.insertItem(itemStack2, INVENTORY_START, HOTBAR_END, true)) { + if (!this.moveItemStackTo(itemStack2, INVENTORY_START, HOTBAR_END, true)) { return ItemStack.EMPTY; } - } else if (!this.insertItem(itemStack2, 0, INVENTORY_START, false)) { + } else if (!this.moveItemStackTo(itemStack2, 0, INVENTORY_START, false)) { return ItemStack.EMPTY; } if (itemStack2.isEmpty()) { - slot2.setStack(ItemStack.EMPTY); + slot2.setByPlayer(ItemStack.EMPTY); } else { - slot2.markDirty(); + slot2.setChanged(); } if (itemStack2.getCount() == itemStack.getCount()) { return ItemStack.EMPTY; } - slot2.onTakeItem(player, itemStack2); + slot2.onTake(player, itemStack2); } return itemStack; } - public void onClosed(PlayerEntity player) { - super.onClosed(player); - this.inventory.onClose(player); + public void removed(Player player) { + super.removed(player); + this.inventory.stopOpen(player); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/sack/SackSlot.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/sack/SackSlot.java index 9b39c5ee59..25f73bbfee 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/sack/SackSlot.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/sack/SackSlot.java @@ -1,19 +1,18 @@ package net.sevenstars.middleearth.gui.sack; -import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemStack; -import net.minecraft.registry.tag.ItemTags; -import net.minecraft.screen.slot.Slot; +import net.minecraft.world.Container; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import net.sevenstars.middleearth.item.DecorativeItemsME; public class SackSlot extends Slot { - public SackSlot(Inventory inventory, int index, int x, int y) { + public SackSlot(Container inventory, int index, int x, int y) { super(inventory, index, x, y); } @Override - public boolean canInsert(ItemStack stack) { - if(stack.isOf(DecorativeItemsME.SACK) || stack.isIn(ItemTags.SHULKER_BOXES)) return false; - return super.canInsert(stack); + public boolean mayPlace(ItemStack stack) { + if(stack.is(DecorativeItemsME.SACK) || !stack.getItem().canFitInsideContainerItems()) return false; + return super.mayPlace(stack); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/shapinganvil/ShapingAnvilScreen.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/shapinganvil/ShapingAnvilScreen.java index eaa7780c31..23aaf8aec7 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/shapinganvil/ShapingAnvilScreen.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/shapinganvil/ShapingAnvilScreen.java @@ -1,26 +1,26 @@ package net.sevenstars.middleearth.gui.shapinganvil; +import net.neoforged.neoforge.network.PacketDistributor; + import com.google.common.collect.Lists; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.client.sound.PositionedSoundInstance; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.sound.SoundEvents; -import net.minecraft.text.Text; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.resources.sounds.SimpleSoundInstance; +import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.item.ItemStack; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.network.packets.C2S.AnvilIndexPacket; import java.util.ArrayList; import java.util.List; -public class ShapingAnvilScreen extends HandledScreen { - private static final Identifier TEXTURE = MiddleEarth.ofPath( "textures", "gui", "shaping_anvil.png"); +public class ShapingAnvilScreen extends AbstractContainerScreen { + private static final ResourceLocation TEXTURE = MiddleEarth.ofPath( "textures", "gui", "shaping_anvil.png"); private float scrollAmount; private boolean mouseClicked; @@ -28,7 +28,7 @@ public class ShapingAnvilScreen extends HandledScreen private List outputs; - public ShapingAnvilScreen(ShapingAnvilScreenHandler handler, PlayerInventory inventory, Text title) { + public ShapingAnvilScreen(ShapingAnvilScreenHandler handler, Inventory inventory, Component title) { super(handler, inventory, title); outputs = new ArrayList<>(); } @@ -36,14 +36,14 @@ public ShapingAnvilScreen(ShapingAnvilScreenHandler handler, PlayerInventory inv @Override protected void init() { super.init(); - titleX = (backgroundWidth - textRenderer.getWidth(title)) / 2; + titleLabelX = (imageWidth - font.width(title)) / 2; - int x = (width - backgroundWidth) / 2; - int y = (height - backgroundHeight) / 2; + int x = (width - imageWidth) / 2; + int y = (height - imageHeight) / 2; - BlockPos pos = this.handler.getPos(); + BlockPos pos = this.menu.getPos(); AnvilIndexPacket newPacket = new AnvilIndexPacket(-1, pos.getX(), pos.getY(), pos.getZ()); - ClientPlayNetworking.send(newPacket); + PacketDistributor.sendToServer(newPacket); } public void addRecipe(int index, ItemStack output) { @@ -66,23 +66,23 @@ private boolean shouldScroll() { @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { - int i = this.x + 20; - int j = this.y + 14; + int i = this.leftPos + 20; + int j = this.topPos + 14; int k = this.scrollOffset + 12; for(int l = this.scrollOffset; l < k; ++l) { int m = l - this.scrollOffset; double d = mouseX - (double)(i + m % 4 * 16); double e = mouseY - (double)(j + m / 4 * 18); - if (d >= 0.0 && e >= 0.0 && d < 16.0 && e < 18.0 && (this.handler).onButtonClick(this.client.player, l)) { - MinecraftClient.getInstance().getSoundManager().play(PositionedSoundInstance.master(SoundEvents.UI_BUTTON_CLICK, 1.0F)); - this.handler.setSelectedRecipe(l); + if (d >= 0.0 && e >= 0.0 && d < 16.0 && e < 18.0 && (this.menu).clickMenuButton(this.minecraft.player, l)) { + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK, 1.0F)); + this.menu.setSelectedRecipe(l); return true; } } - i = this.x + 119; - j = this.y + 9; + i = this.leftPos + 119; + j = this.topPos + 9; if (mouseX >= (double)i && mouseX < (double)(i + 12) && mouseY >= (double)j && mouseY < (double)(j + 54)) { this.mouseClicked = true; } @@ -92,81 +92,81 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { } @Override - protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) { - int x = (width - backgroundWidth) / 2; - int y = (height - backgroundHeight) / 2; - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, this.x, this.y, 0, 0, this.backgroundWidth, this.backgroundHeight, 256, 256); + protected void renderBg(GuiGraphics context, float delta, int mouseX, int mouseY) { + int x = (width - imageWidth) / 2; + int y = (height - imageHeight) / 2; + context.blit(TEXTURE, this.leftPos, this.topPos, 0, 0, this.imageWidth, this.imageHeight, 256, 256); } @Override - protected void drawForeground(DrawContext context, int mouseX, int mouseY) { - context.drawText(this.textRenderer, this.title, this.titleX, this.titleY - 1, -12566464, false); - context.drawText(this.textRenderer, this.playerInventoryTitle, this.playerInventoryTitleX, this.playerInventoryTitleY, -12566464, false); + protected void renderLabels(GuiGraphics context, int mouseX, int mouseY) { + context.drawString(this.font, this.title, this.titleLabelX, this.titleLabelY - 1, -12566464, false); + context.drawString(this.font, this.playerInventoryTitle, this.inventoryLabelX, this.inventoryLabelY, -12566464, false); } @Override - public void render(DrawContext context, int mouseX, int mouseY, float delta) { - renderBackground(context, mouseX,mouseY,delta); + public void render(GuiGraphics context, int mouseX, int mouseY, float delta) { super.render(context, mouseX, mouseY, delta); - drawMouseoverTooltip(context, mouseX, mouseY); - int x = (width - backgroundWidth) / 2; - int y = (height - backgroundHeight) / 2; + renderTooltip(context, mouseX, mouseY); + int x = (width - imageWidth) / 2; + int y = (height - imageHeight) / 2; int k = (int)(41.0F * this.scrollAmount); - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, x + 87, y + 15 + k, 176 + (this.shouldScroll() ? 0 : 12), 20, 12, 15, 256, 256); + context.blit(TEXTURE, x + 87, y + 15 + k, 176 + (this.shouldScroll() ? 0 : 12), 20, 12, 15, 256, 256); - int l = this.x + 19; - int m = this.y + 14; + int l = this.leftPos + 19; + int m = this.topPos + 14; int n = this.scrollOffset + 12; this.renderRecipeBackground(context, mouseX, mouseY, l + 1, m, n); this.renderRecipeIcons(context, l, m, n); } - private void renderOutputTooltip(DrawContext context, int mouseX, int mouseY) { - int x = (width - backgroundWidth) / 2; - int y = (height - backgroundHeight) / 2; + private void renderOutputTooltip(GuiGraphics context, int mouseX, int mouseY) { + int x = (width - imageWidth) / 2; + int y = (height - imageHeight) / 2; if (mouseX >= x + 79 && mouseX <= x + 96 && mouseY >= y + 16 && mouseY <= y + 33){ - context.drawTooltip(this.client.textRenderer, handler.getOutputStack().getItem().getName(), mouseX, mouseY); + ItemStack outputStack = menu.getOutputStack(); + context.renderTooltip(this.minecraft.font, outputStack.getItem().getName(outputStack), mouseX, mouseY); } } - private void renderHammerTooltip(DrawContext context, int mouseX, int mouseY) { - int x = (width - backgroundWidth) / 2; - int y = (height - backgroundHeight) / 2; + private void renderHammerTooltip(GuiGraphics context, int mouseX, int mouseY) { + int x = (width - imageWidth) / 2; + int y = (height - imageHeight) / 2; if (mouseX >= x + 79 && mouseX <= x + 96 && mouseY >= y + 34 && mouseY <= y + 51){ - context.drawOrderedTooltip(this.client.textRenderer, - Lists.transform(List.of(Text.translatable("tooltip." + MiddleEarth.MOD_ID +".anvil_hammer"), - Text.translatable("tooltip." + MiddleEarth.MOD_ID +".anvil_hammer_2")), - Text::asOrderedText), mouseX, mouseY); + context.renderTooltip(this.minecraft.font, + Lists.transform(List.of(Component.translatable("tooltip." + MiddleEarth.MOD_ID +".anvil_hammer"), + Component.translatable("tooltip." + MiddleEarth.MOD_ID +".anvil_hammer_2")), + Component::getVisualOrderText), mouseX, mouseY); } } - private void renderRecipeBackground(DrawContext context, int mouseX, int mouseY, int x, int y, int scrollOffset) { + private void renderRecipeBackground(GuiGraphics context, int mouseX, int mouseY, int x, int y, int scrollOffset) { for(int i = this.scrollOffset; i < scrollOffset && i < this.outputs.size(); ++i) { int j = i - this.scrollOffset; int k = x + j % 4 * 16; int l = j / 4; int m = y + l * 18 + 2; int n = 0; - if (i == (this.handler).getSelectedRecipe()) { + if (i == (this.menu).getSelectedRecipe()) { n += 16; } else if (mouseX >= k && mouseY >= m && mouseX < k + 16 && mouseY < m + 18) { n += 32; } - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, k, m - 1, 176 + n, 1, 16, 18, 256,256); + context.blit(TEXTURE, k, m - 1, 176 + n, 1, 16, 18, 256,256); } } - private void renderRecipeIcons(DrawContext context, int x, int y, int scrollOffset) { + private void renderRecipeIcons(GuiGraphics context, int x, int y, int scrollOffset) { for (int i = this.scrollOffset; i < scrollOffset && i < this.outputs.size(); ++i) { int j = i - this.scrollOffset; int k = x + 1 + j % 4 * 16; int l = j / 4; int m = y + l * 18 + 2; - context.drawItem(outputs.get(i), k, m); + context.renderItem(outputs.get(i), k, m); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/shapinganvil/ShapingAnvilScreenHandler.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/shapinganvil/ShapingAnvilScreenHandler.java index 21da7dce8d..fec4072680 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/shapinganvil/ShapingAnvilScreenHandler.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/shapinganvil/ShapingAnvilScreenHandler.java @@ -1,27 +1,24 @@ package net.sevenstars.middleearth.gui.shapinganvil; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; -import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.inventory.Inventory; -import net.minecraft.inventory.SimpleInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.RecipeEntry; -import net.minecraft.recipe.ServerRecipeManager; -import net.minecraft.recipe.input.SingleStackRecipeInput; -import net.minecraft.screen.ArrayPropertyDelegate; -import net.minecraft.screen.Property; -import net.minecraft.screen.PropertyDelegate; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.screen.slot.Slot; -import net.minecraft.server.network.ServerPlayerEntity; -import net.minecraft.server.world.ServerWorld; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.neoforged.neoforge.network.PacketDistributor; + +import net.minecraft.client.Minecraft; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.Container; +import net.minecraft.world.SimpleContainer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ContainerData; +import net.minecraft.world.inventory.DataSlot; +import net.minecraft.world.inventory.SimpleContainerData; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.world.item.crafting.SingleRecipeInput; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.block.special.forge.MultipleStackRecipeInput; import net.sevenstars.middleearth.block.special.shapingAnvil.ShapingAnvilBlockEntity; import net.sevenstars.middleearth.gui.ModScreenHandlers; @@ -35,45 +32,45 @@ import java.util.List; -public class ShapingAnvilScreenHandler extends ScreenHandler { - private final Inventory inventory; - private final PropertyDelegate propertyDelegate; +public class ShapingAnvilScreenHandler extends AbstractContainerMenu { + private final Container inventory; + private final ContainerData propertyDelegate; protected BlockPos pos; - private final World world; - private List> availableRecipes; + private final Level world; + private List> availableRecipes; private ItemStack outputStack; - private PlayerEntity player; - private Property selectedIndex; - private Property recipesSize; + private Player player; + private DataSlot selectedIndex; + private DataSlot recipesSize; - public ShapingAnvilScreenHandler(int syncId, PlayerInventory playerInventory, BlockPos blockPos) { - this(syncId, playerInventory, new SimpleInventory(1), new ArrayPropertyDelegate(2)); + public ShapingAnvilScreenHandler(int syncId, Inventory playerInventory, BlockPos blockPos) { + this(syncId, playerInventory, new SimpleContainer(1), new SimpleContainerData(2)); this.pos = blockPos; } - public ShapingAnvilScreenHandler(int syncId, PlayerInventory playerInventory, Inventory inventory, PropertyDelegate delegate) { + public ShapingAnvilScreenHandler(int syncId, Inventory playerInventory, Container inventory, ContainerData delegate) { super(ModScreenHandlers.TREATED_ANVIL_SCREEN_HANDLER, syncId); - checkSize(inventory, 1); + checkContainerSize(inventory, 1); this.inventory = inventory; - inventory.onOpen(playerInventory.player); + inventory.startOpen(playerInventory.player); this.propertyDelegate = delegate; - this.pos = BlockPos.ORIGIN; - this.world = playerInventory.player.getWorld(); + this.pos = inventory instanceof ShapingAnvilBlockEntity anvil ? anvil.getBlockPos() : BlockPos.ZERO; + this.world = playerInventory.player.level(); this.outputStack = ItemStack.EMPTY; this.player = playerInventory.player; - this.selectedIndex = Property.create(); - this.recipesSize = Property.create(); + this.selectedIndex = DataSlot.standalone(); + this.recipesSize = DataSlot.standalone(); - this.addProperty(selectedIndex).set(-1); - this.addProperty(recipesSize).set(0); + this.addDataSlot(selectedIndex).set(-1); + this.addDataSlot(recipesSize).set(0); this.addSlot(new ShapingAnvilSlot(inventory, 0, 136, 33){ @Override - public void markDirty() { - super.markDirty(); - if(player.getWorld().isClient) { - ShapingAnvilScreen screen = (ShapingAnvilScreen)MinecraftClient.getInstance().currentScreen; + public void setChanged() { + super.setChanged(); + if(player.level().isClientSide) { + ShapingAnvilScreen screen = (ShapingAnvilScreen)Minecraft.getInstance().screen; if(screen != null) screen.clearOutputs(); } ShapingAnvilScreenHandler.this.updateStack(ShapingAnvilScreenHandler.this.inventory); @@ -83,30 +80,30 @@ public void markDirty() { addPlayerInventory(playerInventory); addPlayerHotbar(playerInventory); - addProperties(delegate); + addDataSlots(delegate); } @Override - public ItemStack quickMove(PlayerEntity player, int invSlot) { + public ItemStack quickMoveStack(Player player, int invSlot) { ItemStack newStack = ItemStack.EMPTY; Slot slot = this.slots.get(invSlot); - if (slot != null && slot.hasStack()) { - ItemStack originalStack = slot.getStack(); + if (slot != null && slot.hasItem()) { + ItemStack originalStack = slot.getItem(); newStack = originalStack.copy(); - if (invSlot < this.inventory.size()) { - if (!this.insertItem(originalStack, this.inventory.size(), this.slots.size(), true)) { + if (invSlot < this.inventory.getContainerSize()) { + if (!this.moveItemStackTo(originalStack, this.inventory.getContainerSize(), this.slots.size(), true)) { return ItemStack.EMPTY; } - } else if (!this.insertItem(originalStack, 0, this.inventory.size(), false)) { + } else if (!this.moveItemStackTo(originalStack, 0, this.inventory.getContainerSize(), false)) { return ItemStack.EMPTY; } if (originalStack.isEmpty()) { - slot.setStack(ItemStack.EMPTY); + slot.setByPlayer(ItemStack.EMPTY); } else { - slot.markDirty(); + slot.setChanged(); } } @@ -121,32 +118,40 @@ public void updateScreen(){ this.updateStack(this.inventory); } - public void updateStack(Inventory inventory) { - ItemStack input = inventory.getStack(0); - if (!this.world.isClient){ - ServerRecipeManager serverRecipeManager = (ServerRecipeManager) this.world.getRecipeManager(); - this.availableRecipes = serverRecipeManager.getAllMatches(RecipesME.ANVIL_SHAPING, new SingleStackRecipeInput(input), this.world).toList(); + public void updateStack(Container inventory) { + ItemStack input = inventory.getItem(0); + if (!this.world.isClientSide){ + RecipeManager serverRecipeManager = this.world.getRecipeManager(); + this.availableRecipes = serverRecipeManager.getRecipesFor( + RecipesME.ANVIL_SHAPING, + new SingleRecipeInput(input), + this.world + ); recipesSize.set(this.availableRecipes.size()); int index = 0; - for(RecipeEntry recipe : availableRecipes) { + for(RecipeHolder recipe : availableRecipes) { ShapingAnvilRecipePacket newPacket = new ShapingAnvilRecipePacket(index++, recipe.value().getOutput()); - ServerPlayNetworking.send((ServerPlayerEntity) player, newPacket); + PacketDistributor.sendToPlayer((ServerPlayer) player, newPacket); } } } public int getAvailableRecipeCount() { int count = 0; - ItemStack input = inventory.getStack(0); - if (!this.world.isClient){ - ServerRecipeManager serverRecipeManager = (ServerRecipeManager) this.world.getRecipeManager(); - this.availableRecipes = serverRecipeManager.getAllMatches(RecipesME.ANVIL_SHAPING, new SingleStackRecipeInput(input), this.world).toList(); + ItemStack input = inventory.getItem(0); + if (!this.world.isClientSide){ + RecipeManager serverRecipeManager = this.world.getRecipeManager(); + this.availableRecipes = serverRecipeManager.getRecipesFor( + RecipesME.ANVIL_SHAPING, + new SingleRecipeInput(input), + this.world + ); count = this.availableRecipes.size(); } return count; } - public List> getAvailableRecipes() { + public List> getAvailableRecipes() { return availableRecipes; } @@ -156,10 +161,10 @@ public int getSelectedRecipe() { public void setSelectedRecipe(int index) { selectedIndex.set(index); AnvilIndexPacket anvilIndexPacket = new AnvilIndexPacket(index, getPos().getX(), getPos().getY(), getPos().getZ()); - ClientPlayNetworking.send(anvilIndexPacket); + PacketDistributor.sendToServer(anvilIndexPacket); } - public boolean onButtonClick(PlayerEntity player, int id) { + public boolean clickMenuButton(Player player, int id) { this.player = player; return this.isInBounds(id); } @@ -172,11 +177,11 @@ public ItemStack getOutputStack() { return outputStack; } - public boolean canUse(PlayerEntity player) { - return this.inventory.canPlayerUse(player); + public boolean stillValid(Player player) { + return this.inventory.stillValid(player); } - private void addPlayerInventory(PlayerInventory playerInventory) { + private void addPlayerInventory(Inventory playerInventory) { for (int i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); @@ -184,7 +189,7 @@ private void addPlayerInventory(PlayerInventory playerInventory) { } } - private void addPlayerHotbar(PlayerInventory playerInventory) { + private void addPlayerHotbar(Inventory playerInventory) { for (int i = 0; i < 9; ++i) { this.addSlot(new Slot(playerInventory, i, 8 + i * 18, 142)); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/shapinganvil/ShapingAnvilSlot.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/shapinganvil/ShapingAnvilSlot.java index ca51c29945..57aed07271 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/shapinganvil/ShapingAnvilSlot.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/shapinganvil/ShapingAnvilSlot.java @@ -1,21 +1,21 @@ package net.sevenstars.middleearth.gui.shapinganvil; -import net.minecraft.inventory.Inventory; -import net.minecraft.screen.slot.Slot; +import net.minecraft.world.Container; +import net.minecraft.world.inventory.Slot; public class ShapingAnvilSlot extends Slot { private final int MAX_ITEM_COUNT; - public ShapingAnvilSlot(Inventory inventory, int index, int x, int y) { + public ShapingAnvilSlot(Container inventory, int index, int x, int y) { this(inventory, index, x, y, 1); } - public ShapingAnvilSlot(Inventory inventory, int index, int x, int y, int itemCount) { + public ShapingAnvilSlot(Container inventory, int index, int x, int y, int itemCount) { super(inventory, index, x, y); MAX_ITEM_COUNT = itemCount; } @Override - public int getMaxItemCount() { + public int getMaxStackSize() { return MAX_ITEM_COUNT; } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/StructureManagerScreen.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/StructureManagerScreen.java index 37b69bc03a..eb9f6d6d38 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/StructureManagerScreen.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/StructureManagerScreen.java @@ -1,17 +1,16 @@ package net.sevenstars.middleearth.gui.structuremanager; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.registry.RegistryKey; -import net.minecraft.text.Text; -import net.minecraft.util.Formatting; -import net.minecraft.util.Identifier; -import net.minecraft.world.World; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.minecraft.ChatFormatting; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.gui.utils.widgets.ModWidget; import net.sevenstars.middleearth.gui.utils.widgets.SearchBarWidget; @@ -24,31 +23,32 @@ import java.util.ArrayList; import java.util.List; -@Environment(value= EnvType.CLIENT) -public class StructureManagerScreen extends HandledScreen { - private static final Identifier TEXTURE = MiddleEarth.ofPath("textures", "gui", "structure_manager.png"); +@OnlyIn(Dist.CLIENT) +public class StructureManagerScreen extends AbstractContainerScreen { + private static final ResourceLocation TEXTURE = MiddleEarth.ofPath("textures", "gui", "structure_manager.png"); public SearchBarWidget searchBarWidget; - public Text runtimeDataText; - public Identifier dataIdentifier; - public ButtonWidget toInitializeToggleButton; - public ButtonWidget isEnabledToggleButton; - public ButtonWidget showAllButton; - public ButtonWidget respawnAllButton; + public Component runtimeDataText; + public ResourceLocation dataIdentifier; + public Button toInitializeToggleButton; + public Button isEnabledToggleButton; + public Button showAllButton; + public Button respawnAllButton; - public ArrayList identifiers; + public ArrayList identifiers; private static final int TEXT_COLOR = Color.WHITE.getRGB(); - public StructureManagerScreen(StructureManagerScreenHandler handler, PlayerInventory playerInventory, Text title) { + public StructureManagerScreen(StructureManagerScreenHandler handler, Inventory playerInventory, Component title) { super(handler, playerInventory, title); - World world = playerInventory.player.getWorld(); + Level world = playerInventory.player.level(); this.identifiers = new ArrayList<>(); - for(RegistryKey data : world.getRegistryManager().getOptional(DynamicRegistriesME.STRUCTURE_MANAGER_DATA).get().getKeys()){ - this.identifiers.add(data.getValue()); - } + world.registryAccess().lookupOrThrow(DynamicRegistriesME.STRUCTURE_MANAGER_DATA) + .listElementIds() + .map(ResourceKey::location) + .forEach(this.identifiers::add); this.dataIdentifier = handler.getDataIdentifier(); } @@ -58,77 +58,76 @@ protected void init() { super.init(); List results = new ArrayList<>(); - for(Identifier identifier : this.identifiers){ - results.add(new SearchBarResult(Text.translatable(identifier.toTranslationKey("structure_manager_data")), identifier, SearchBarResultType.NORMAL, button -> selectIdentifier(identifier))); + for(ResourceLocation identifier : this.identifiers){ + results.add(new SearchBarResult(Component.translatable(identifier.toLanguageKey("structure_manager_data")), identifier, SearchBarResultType.NORMAL, button -> selectIdentifier(identifier))); } this.searchBarWidget = new SearchBarWidget(9, results, x -> updateScreenInformation(), 170); - addDrawableChild(this.searchBarWidget.getSearchBarToggleButton()); - this.searchBarWidget.getAllButtons().forEach(this::addDrawableChild); - addDrawableChild(this.searchBarWidget.getScreenClickButton()); + addRenderableWidget(this.searchBarWidget.getSearchBarToggleButton()); + this.searchBarWidget.getAllButtons().forEach(this::addRenderableWidget); + addRenderableWidget(this.searchBarWidget.getScreenClickButton()); - toInitializeToggleButton = ButtonWidget.builder(Text.of("toInitializeToggleButton"),x -> toggleToInitialize()).build(); - toInitializeToggleButton.setDimensions(15, 15); - addDrawableChild(toInitializeToggleButton); + toInitializeToggleButton = Button.builder(Component.nullToEmpty("toInitializeToggleButton"),x -> toggleToInitialize()).build(); + toInitializeToggleButton.setSize(15, 15); + addRenderableWidget(toInitializeToggleButton); - isEnabledToggleButton = ButtonWidget.builder(Text.of("isEnabledToggleButton"),x -> toggleEnable()).build(); - isEnabledToggleButton.setDimensions(15, 15); - addDrawableChild(isEnabledToggleButton); + isEnabledToggleButton = Button.builder(Component.nullToEmpty("isEnabledToggleButton"),x -> toggleEnable()).build(); + isEnabledToggleButton.setSize(15, 15); + addRenderableWidget(isEnabledToggleButton); - showAllButton = ButtonWidget.builder(Text.of("showAll"),x -> handler.triggerGlowOnAllEntities()).build(); - showAllButton.setDimensions(104, 20); - addDrawableChild(showAllButton); + showAllButton = Button.builder(Component.nullToEmpty("showAll"),x -> menu.triggerGlowOnAllEntities()).build(); + showAllButton.setSize(104, 20); + addRenderableWidget(showAllButton); - respawnAllButton = ButtonWidget.builder(Text.of("showAll"),x -> handler.triggerRespawnAllEntities()).build(); - respawnAllButton.setDimensions(104, 20); - addDrawableChild(respawnAllButton); + respawnAllButton = Button.builder(Component.nullToEmpty("showAll"),x -> menu.triggerRespawnAllEntities()).build(); + respawnAllButton.setSize(104, 20); + addRenderableWidget(respawnAllButton); } @Override - protected void drawBackground(DrawContext context, float deltaTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics context, float deltaTicks, int mouseX, int mouseY) { } @Override - protected void drawForeground(DrawContext context, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics context, int mouseX, int mouseY) { } @Override - public void render(DrawContext context, int mouseX, int mouseY, float deltaTicks) { - renderBackground(context, mouseX, mouseY, deltaTicks); + public void render(GuiGraphics context, int mouseX, int mouseY, float deltaTicks) { super.render(context, mouseX, mouseY, deltaTicks); ModWidget.updateMouse(mouseX, mouseY); - int centerX = (int) (client.currentScreen.width / 2f); + int centerX = (int) (minecraft.screen.width / 2f); int startY = 70; int managerSearchBarWidgetStartY = startY; - managerSearchBarWidgetStartY += this.searchBarWidget.drawSearchBar(context, centerX - 5 - this.searchBarWidget.searchBarToggleButton.getWidth(), managerSearchBarWidgetStartY, textRenderer); + managerSearchBarWidgetStartY += this.searchBarWidget.drawSearchBar(context, centerX - 5 - this.searchBarWidget.searchBarToggleButton.getWidth(), managerSearchBarWidgetStartY, font); this.searchBarWidget.setEndY(startY + 500); if(this.searchBarWidget.searchIsToggled()) { this.searchBarWidget.drawSearchResults(context, centerX - 5 - this.searchBarWidget.searchBarToggleButton.getWidth(), managerSearchBarWidgetStartY - 20); } - Text selectedIdText = (dataIdentifier == null) - ? Text.translatable("N/A") - : Text.translatable(dataIdentifier.toTranslationKey("structure_manager_data")); - this.runtimeDataText = Text.translatable("ui.middle-earth.structure_manager.label_selected_id", selectedIdText).formatted(Formatting.BOLD).formatted(Formatting.WHITE); + Component selectedIdText = (dataIdentifier == null) + ? Component.translatable("N/A") + : Component.translatable(dataIdentifier.toLanguageKey("structure_manager_data")); + this.runtimeDataText = Component.translatable("ui.middle-earth.structure_manager.label_selected_id", selectedIdText).withStyle(ChatFormatting.BOLD).withStyle(ChatFormatting.WHITE); - context.drawText(this.textRenderer, this.runtimeDataText, centerX + 5, startY + 5, TEXT_COLOR, false); + context.drawString(this.font, this.runtimeDataText, centerX + 5, startY + 5, TEXT_COLOR, false); startY += 20; toInitializeToggleButton.setPosition(centerX + 5, startY); boolean toInitializeToggleButtonFocused = toInitializeToggleButton.isMouseOver(mouseX, mouseY) || toInitializeToggleButton.isFocused(); int toInitializeToggleButtonUvY = 1; - if(handler.getToInitialize()) + if(menu.getToInitialize()) toInitializeToggleButtonUvY = toInitializeToggleButtonFocused ? 52 : 35; else if(toInitializeToggleButtonFocused) toInitializeToggleButtonUvY = 18; - if(handler.getDataIdentifier() == null){ + if(menu.getDataIdentifier() == null){ toInitializeToggleButton.active = false; isEnabledToggleButton.active = false; showAllButton.active = false; @@ -141,46 +140,46 @@ else if(toInitializeToggleButtonFocused) respawnAllButton.active = true; } - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, + context.blit(TEXTURE, toInitializeToggleButton.getX(), toInitializeToggleButton.getY(), 1, toInitializeToggleButtonUvY, toInitializeToggleButton.getWidth(), toInitializeToggleButton.getHeight(), 256, 256); if(toInitializeToggleButton.isMouseOver(mouseX, mouseY)) - context.drawTooltip(Text.of("[SET TO TRUE] Before saving a structure."), toInitializeToggleButton.getX(), toInitializeToggleButton.getY()); + context.renderTooltip(this.font, Component.nullToEmpty("[SET TO TRUE] Before saving a structure."), toInitializeToggleButton.getX(), toInitializeToggleButton.getY()); isEnabledToggleButton.setPosition(centerX + 25, startY); boolean isEnabledToggleButtonFocused = isEnabledToggleButton.isMouseOver(mouseX, mouseY) || isEnabledToggleButton.isFocused(); int isEnabledToggleButtonUvY = 1; - if(handler.getIsEnabled()) + if(menu.getIsEnabled()) isEnabledToggleButtonUvY = isEnabledToggleButtonFocused ? 52 : 35; else if(isEnabledToggleButtonFocused) isEnabledToggleButtonUvY = 18; - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, + context.blit(TEXTURE, isEnabledToggleButton.getX(), isEnabledToggleButton.getY(), 18, isEnabledToggleButtonUvY, isEnabledToggleButton.getWidth(), isEnabledToggleButton.getHeight(), 256, 256); if(isEnabledToggleButton.isMouseOver(mouseX, mouseY)) - context.drawTooltip(Text.of("[SET TO FALSE] Before saving a structure."), isEnabledToggleButton.getX(), isEnabledToggleButton.getY()); + context.renderTooltip(this.font, Component.nullToEmpty("[SET TO FALSE] Before saving a structure."), isEnabledToggleButton.getX(), isEnabledToggleButton.getY()); startY += 15; showAllButton.setPosition(centerX + 5, startY); - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, + context.blit(TEXTURE, showAllButton.getX(), showAllButton.getY(), 35, showAllButton.isMouseOver(mouseX, mouseY) ? 23 : 1, showAllButton.getWidth(), showAllButton.getHeight(), 256, 256); - Text showAllText = Text.translatable("Show all"); - int showAllStartX = showAllButton.getX() + (showAllButton.getWidth() / 2) - (textRenderer.getWidth(showAllText) / 2); - context.drawText(textRenderer, showAllText,showAllStartX,showAllButton.getY() + 6, Color.BLACK.getRGB(), false); + Component showAllText = Component.translatable("Show all"); + int showAllStartX = showAllButton.getX() + (showAllButton.getWidth() / 2) - (font.width(showAllText) / 2); + context.drawString(font, showAllText,showAllStartX,showAllButton.getY() + 6, Color.BLACK.getRGB(), false); startY += showAllButton.getHeight() + 4; respawnAllButton.setPosition(centerX + 5, startY); - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, + context.blit(TEXTURE, respawnAllButton.getX(), respawnAllButton.getY(), 35, respawnAllButton.isMouseOver(mouseX, mouseY) ? 23 : 1, respawnAllButton.getWidth(), respawnAllButton.getHeight(), 256, 256); - Text respawnAllText = Text.translatable("Respawn all"); - int respawnAllStartX = respawnAllButton.getX() + (respawnAllButton.getWidth() / 2) - (textRenderer.getWidth(respawnAllText) / 2); - context.drawText(textRenderer, respawnAllText, respawnAllStartX,respawnAllButton.getY() + 6, Color.BLACK.getRGB(), false); + Component respawnAllText = Component.translatable("Respawn all"); + int respawnAllStartX = respawnAllButton.getX() + (respawnAllButton.getWidth() / 2) - (font.width(respawnAllText) / 2); + context.drawString(font, respawnAllText, respawnAllStartX,respawnAllButton.getY() + 6, Color.BLACK.getRGB(), false); } @Override @@ -224,17 +223,17 @@ private boolean isMouseOver(int startX, int sizeX, int startY, int sizeY) { return ModWidget.isMouseOver(sizeX, sizeY, startX, startY); } - private void selectIdentifier(Identifier identifier) { - this.handler.selectIdentifier(client.player, identifier); + private void selectIdentifier(ResourceLocation identifier) { + this.menu.selectIdentifier(minecraft.player, identifier); this.dataIdentifier = identifier; } private void toggleToInitialize() { - this.handler.toggleToInitialize(); + this.menu.toggleToInitialize(); } private void toggleEnable() { - this.handler.toggleToActivate(); + this.menu.toggleToActivate(); } private void updateScreenInformation() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/StructureManagerScreenData.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/StructureManagerScreenData.java index 7738747ef4..4517b01eb9 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/StructureManagerScreenData.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/StructureManagerScreenData.java @@ -1,28 +1,27 @@ package net.sevenstars.middleearth.gui.structuremanager; -import net.minecraft.network.RegistryByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; - import java.util.Optional; +import net.minecraft.core.BlockPos; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; public class StructureManagerScreenData{ private BlockPos pos; - private Identifier structureManagerIdentifier; + private ResourceLocation structureManagerIdentifier; private boolean isActive; private boolean toInitialize; - public static final PacketCodec PACKET_CODEC; + public static final StreamCodec PACKET_CODEC; public BlockPos getPos() { return this.pos; } - public Identifier getStructureManagerIdentifier() { + public ResourceLocation getStructureManagerIdentifier() { return this.structureManagerIdentifier; } - private Optional getStructureManagerIdentifierOptional() { + private Optional getStructureManagerIdentifierOptional() { return Optional.ofNullable(this.structureManagerIdentifier); } @@ -33,7 +32,7 @@ public boolean getToInitialize() { return this.toInitialize; } - public void setStructureManagerIdentifier(Identifier structureManagerIdentifier) { + public void setStructureManagerIdentifier(ResourceLocation structureManagerIdentifier) { this.structureManagerIdentifier = structureManagerIdentifier; } @@ -44,7 +43,7 @@ public void setToInitialize(boolean toInitialize) { this.toInitialize = toInitialize; } - public StructureManagerScreenData(BlockPos pos, boolean isActive, boolean toInitialize, Optional structureManagerId){ + public StructureManagerScreenData(BlockPos pos, boolean isActive, boolean toInitialize, Optional structureManagerId){ this.pos = pos; setActive(isActive); setToInitialize(toInitialize); @@ -52,11 +51,11 @@ public StructureManagerScreenData(BlockPos pos, boolean isActive, boolean toInit } static { - PACKET_CODEC = PacketCodec.tuple( - BlockPos.PACKET_CODEC, StructureManagerScreenData::getPos, - PacketCodecs.BOOLEAN, StructureManagerScreenData::getIsActive, - PacketCodecs.BOOLEAN, StructureManagerScreenData::getToInitialize, - PacketCodecs.optional(Identifier.PACKET_CODEC), StructureManagerScreenData::getStructureManagerIdentifierOptional, + PACKET_CODEC = StreamCodec.composite( + BlockPos.STREAM_CODEC, StructureManagerScreenData::getPos, + ByteBufCodecs.BOOL, StructureManagerScreenData::getIsActive, + ByteBufCodecs.BOOL, StructureManagerScreenData::getToInitialize, + ByteBufCodecs.optional(ResourceLocation.STREAM_CODEC), StructureManagerScreenData::getStructureManagerIdentifierOptional, StructureManagerScreenData::new ); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/StructureManagerScreenHandler.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/StructureManagerScreenHandler.java index d307c619d3..01ba237f4a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/StructureManagerScreenHandler.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/StructureManagerScreenHandler.java @@ -1,46 +1,53 @@ package net.sevenstars.middleearth.gui.structuremanager; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; +import net.neoforged.neoforge.network.PacketDistributor; + +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.block.special.structureManager.StructureManagerBlockEntity; import net.sevenstars.middleearth.gui.ModScreenHandlers; import net.sevenstars.middleearth.network.packets.C2S.PacketStructureManagerRespawnEntities; import net.sevenstars.middleearth.network.packets.C2S.PacketStructureManagerShowAllEntities; import net.sevenstars.middleearth.network.packets.C2S.PacketStructureManagerUpdateBlockEntityRequest; -public class StructureManagerScreenHandler extends ScreenHandler { +public class StructureManagerScreenHandler extends AbstractContainerMenu { - private final World world; + private final Level world; private StructureManagerScreenData data; StructureManagerBlockEntity blockEntity; // Client side Constructor - public StructureManagerScreenHandler(int syncId, PlayerInventory playerInventory, StructureManagerScreenData structureManagerScreenData) { + public StructureManagerScreenHandler(int syncId, Inventory playerInventory, StructureManagerScreenData structureManagerScreenData) { super(ModScreenHandlers.STRUCTURE_MANAGER_SCREEN_HANDLER, syncId); - this.world = playerInventory.player.getWorld(); + this.world = playerInventory.player.level(); this.data = structureManagerScreenData; this.blockEntity = (StructureManagerBlockEntity) this.world.getBlockEntity(data.getPos()); } @Override - public ItemStack quickMove(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { return null; } @Override - public boolean canUse(PlayerEntity player) { - return true; + public boolean stillValid(Player player) { + BlockPos pos = data.getPos(); + return blockEntity != null + && !blockEntity.isRemoved() + && world.hasChunkAt(pos) + && world.getBlockEntity(pos) == blockEntity + && player.distanceToSqr(Vec3.atCenterOf(pos)) <= 64.0D; } - public void selectIdentifier(PlayerEntity player, Identifier identifier) { + public void selectIdentifier(Player player, ResourceLocation identifier) { this.data.setStructureManagerIdentifier(identifier); - ClientPlayNetworking.send(new PacketStructureManagerUpdateBlockEntityRequest( + PacketDistributor.sendToServer(new PacketStructureManagerUpdateBlockEntityRequest( data.getPos(), data.getStructureManagerIdentifier(), data.getToInitialize(), @@ -51,7 +58,7 @@ public BlockPos getPos() { return this.data.getPos(); } - public Identifier getDataIdentifier() { + public ResourceLocation getDataIdentifier() { return this.data.getStructureManagerIdentifier(); } @@ -68,7 +75,7 @@ public void toggleToInitialize() { } private void updateServer() { - ClientPlayNetworking.send(new PacketStructureManagerUpdateBlockEntityRequest(this.data.getPos(), this.data.getStructureManagerIdentifier(), this.data.getToInitialize(), this.data.getIsActive())); + PacketDistributor.sendToServer(new PacketStructureManagerUpdateBlockEntityRequest(this.data.getPos(), this.data.getStructureManagerIdentifier(), this.data.getToInitialize(), this.data.getIsActive())); } public void toggleToActivate() { @@ -76,11 +83,11 @@ public void toggleToActivate() { updateServer(); } public void triggerGlowOnAllEntities() { - ClientPlayNetworking.send(new PacketStructureManagerShowAllEntities(this.data.getPos())); + PacketDistributor.sendToServer(new PacketStructureManagerShowAllEntities(this.data.getPos())); } public void triggerRespawnAllEntities() { - ClientPlayNetworking.send(new PacketStructureManagerRespawnEntities(this.data.getPos())); + PacketDistributor.sendToServer(new PacketStructureManagerRespawnEntities(this.data.getPos())); } } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/structurenest/StructureNestScreen.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/structurenest/StructureNestScreen.java index ca4013856b..1b7dfbb7b5 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/structurenest/StructureNestScreen.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/structurenest/StructureNestScreen.java @@ -1,17 +1,16 @@ package net.sevenstars.middleearth.gui.structuremanager.structurenest; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.registry.RegistryKey; -import net.minecraft.text.Text; -import net.minecraft.util.Formatting; -import net.minecraft.util.Identifier; -import net.minecraft.world.World; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import net.minecraft.ChatFormatting; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.level.Level; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.gui.utils.CycledSelectionButtonType; import net.sevenstars.middleearth.gui.utils.widgets.CycledSelectionWidget; @@ -27,32 +26,38 @@ import java.util.ArrayList; import java.util.List; -@Environment(value= EnvType.CLIENT) -public class StructureNestScreen extends HandledScreen { - private static final Identifier TEXTURE = MiddleEarth.ofPath("textures", "gui", "structure_manager.png"); +@OnlyIn(Dist.CLIENT) +public class StructureNestScreen extends AbstractContainerScreen { + private static final ResourceLocation TEXTURE = MiddleEarth.ofPath("textures", "gui", "structure_manager.png"); private static final int TEXT_COLOR = Color.WHITE.getRGB(); public SearchBarWidget managerSearchBarWidget; public CycledSelectionWidget nestCycledSelection; - public ButtonWidget isEnabledToggleButton; + public Button isEnabledToggleButton; public StructureManagerData manager; public SpawnNestNodeData nest; public ArrayList managers; - public StructureNestScreen(StructureNestScreenHandler handler, PlayerInventory inventory, Text title) { + public StructureNestScreen(StructureNestScreenHandler handler, Inventory inventory, Component title) { super(handler, inventory, title); - World world = inventory.player.getWorld(); + Level world = inventory.player.level(); this.managers = new ArrayList<>(); - var registryManager = world.getRegistryManager().getOptional(DynamicRegistriesME.STRUCTURE_MANAGER_DATA).get(); - for(RegistryKey data : registryManager.getKeys()){ - this.managers.add(registryManager.get(data.getValue())); - } - this.manager = registryManager.get(handler.getManagerKey()); + var registryManager = world.registryAccess().lookupOrThrow(DynamicRegistriesME.STRUCTURE_MANAGER_DATA); + registryManager.listElements() + .map(holder -> holder.value()) + .forEach(this.managers::add); + + ResourceLocation managerKey = handler.getManagerKey(); + this.manager = managerKey == null + ? null + : registryManager.get(ResourceKey.create(DynamicRegistriesME.STRUCTURE_MANAGER_DATA, managerKey)) + .map(holder -> holder.value()) + .orElse(null); if(manager != null) this.nest = manager.getNpcSpawnNest(handler.getNestKey()); } @@ -63,29 +68,29 @@ protected void init() { List results = new ArrayList<>(); for(StructureManagerData data : this.managers){ - results.add(new SearchBarResult(Text.translatable(data.getId().toTranslationKey("structure_manager_data")), data.getId(), SearchBarResultType.NORMAL, button -> selectManager(data))); + results.add(new SearchBarResult(Component.translatable(data.getId().toLanguageKey("structure_manager_data")), data.getId(), SearchBarResultType.NORMAL, button -> selectManager(data))); } this.managerSearchBarWidget = new SearchBarWidget(9, results, x -> updateScreenInformation(), 170); - addDrawableChild(this.managerSearchBarWidget.getSearchBarToggleButton()); - this.managerSearchBarWidget.getAllButtons().forEach(this::addDrawableChild); - addDrawableChild(this.managerSearchBarWidget.getScreenClickButton()); + addRenderableWidget(this.managerSearchBarWidget.getSearchBarToggleButton()); + this.managerSearchBarWidget.getAllButtons().forEach(this::addRenderableWidget); + addRenderableWidget(this.managerSearchBarWidget.getScreenClickButton()); nestCycledSelection = new CycledSelectionWidget( x -> this.updateNestList(-1), x -> this.updateNestList(1), null, CycledSelectionButtonType.GOLD); - nestCycledSelection.getButtons().forEach(this::addDrawableChild); + nestCycledSelection.getButtons().forEach(this::addRenderableWidget); updateNestList(0); - isEnabledToggleButton = ButtonWidget.builder(Text.of("isEnabledToggleButton"),x -> toggleEnable()).build(); - isEnabledToggleButton.setDimensions(15, 15); - addDrawableChild(isEnabledToggleButton); + isEnabledToggleButton = Button.builder(Component.nullToEmpty("isEnabledToggleButton"),x -> toggleEnable()).build(); + isEnabledToggleButton.setSize(15, 15); + addRenderableWidget(isEnabledToggleButton); } private void toggleEnable() { - this.handler.toggleToActivate(); + this.menu.toggleToActivate(); } private void updateNestList(int difference) { @@ -118,67 +123,66 @@ private void updateNestList(int difference) { this.nest = nests.get(index); } - this.handler.selectNestId(client.player, this.nest.getId()); + this.menu.selectNestId(minecraft.player, this.nest.getId()); this.nestCycledSelection.enableArrows(nests.size() > 1); - this.nestCycledSelection.setText(Text.of(this.nest.getId().toTranslationKey()).copy()); + this.nestCycledSelection.setText(Component.nullToEmpty(this.nest.getId().toLanguageKey()).copy()); } @Override - protected void drawBackground(DrawContext context, float deltaTicks, int mouseX, int mouseY) { + protected void renderBg(GuiGraphics context, float deltaTicks, int mouseX, int mouseY) { } @Override - protected void drawForeground(DrawContext context, int mouseX, int mouseY) { + protected void renderLabels(GuiGraphics context, int mouseX, int mouseY) { } @Override - public void render(DrawContext context, int mouseX, int mouseY, float deltaTicks) { - renderBackground(context, mouseX, mouseY, deltaTicks); + public void render(GuiGraphics context, int mouseX, int mouseY, float deltaTicks) { super.render(context, mouseX, mouseY, deltaTicks); ModWidget.updateMouse(mouseX, mouseY); - int centerX = (int) (client.currentScreen.width / 2f); + int centerX = (int) (minecraft.screen.width / 2f); int startY = 70; int managerSearchBarWidgetStartY = startY; - managerSearchBarWidgetStartY += this.managerSearchBarWidget.drawSearchBar(context, centerX - 5 - this.managerSearchBarWidget.searchBarToggleButton.getWidth(), managerSearchBarWidgetStartY, textRenderer); + managerSearchBarWidgetStartY += this.managerSearchBarWidget.drawSearchBar(context, centerX - 5 - this.managerSearchBarWidget.searchBarToggleButton.getWidth(), managerSearchBarWidgetStartY, font); this.managerSearchBarWidget.setEndY(startY + 500); if(this.managerSearchBarWidget.searchIsToggled()) { this.managerSearchBarWidget.drawSearchResults(context, centerX - 5 - this.managerSearchBarWidget.searchBarToggleButton.getWidth(), managerSearchBarWidgetStartY - 20); } - Text managerIdText = (manager == null) - ? Text.translatable("N/A") - : Text.translatable(manager.getId().toTranslationKey("structure_manager_data")); + Component managerIdText = (manager == null) + ? Component.translatable("N/A") + : Component.translatable(manager.getId().toLanguageKey("structure_manager_data")); - context.drawText(this.textRenderer, Text.translatable("ui.middle-earth.structure_manager.label_selected_id", managerIdText).formatted(Formatting.BOLD).formatted(Formatting.WHITE), centerX + 5, startY + 5, TEXT_COLOR, false); + context.drawString(this.font, Component.translatable("ui.middle-earth.structure_manager.label_selected_id", managerIdText).withStyle(ChatFormatting.BOLD).withStyle(ChatFormatting.WHITE), centerX + 5, startY + 5, TEXT_COLOR, false); if(manager != null && this.managerSearchBarWidget != null){ startY += 25; - Text nestIdText = (nest == null) - ? Text.translatable("N/A") - : Text.translatable(nest.getId().toTranslationKey("structure_nest")); + Component nestIdText = (nest == null) + ? Component.translatable("N/A") + : Component.translatable(nest.getId().toLanguageKey("structure_nest")); - this.nestCycledSelection.drawAnchored(context, centerX, startY, true, nestIdText.copy(), textRenderer); + this.nestCycledSelection.drawAnchored(context, centerX, startY, true, nestIdText.copy(), font); isEnabledToggleButton.active = true; isEnabledToggleButton.setPosition(centerX + CycledSelectionWidget.TOTAL_WIDTH + 5, startY); //isEnabledToggleButton.render(context, mouseX, mouseY, deltaTicks); boolean isEnabledToggleButtonFocused = isEnabledToggleButton.isMouseOver(mouseX, mouseY) || isEnabledToggleButton.isFocused(); int isEnabledToggleButtonUvY = 1; - if(handler.getIsEnabled()) + if(menu.getIsEnabled()) isEnabledToggleButtonUvY = isEnabledToggleButtonFocused ? 52 : 35; else if(isEnabledToggleButtonFocused) isEnabledToggleButtonUvY = 18; - context.drawTexture(RenderPipelines.GUI_TEXTURED, TEXTURE, + context.blit(TEXTURE, isEnabledToggleButton.getX(), isEnabledToggleButton.getY(), 18, isEnabledToggleButtonUvY, isEnabledToggleButton.getWidth(), isEnabledToggleButton.getHeight(), 256, 256); if(isEnabledToggleButton.isMouseOver(mouseX, mouseY)) - context.drawTooltip(Text.of("[SET TO TRUE] To ready up the structure manager subscription."), isEnabledToggleButton.getX(), isEnabledToggleButton.getY()); + context.renderTooltip(this.font, Component.nullToEmpty("[SET TO TRUE] To ready up the structure manager subscription."), isEnabledToggleButton.getX(), isEnabledToggleButton.getY()); } else this.isEnabledToggleButton.active = false; @@ -222,7 +226,7 @@ public boolean charTyped(char chr, int modifiers) { } private void selectManager(StructureManagerData data) { - this.handler.selectManagerId(client.player, data.getId()); + this.menu.selectManagerId(minecraft.player, data.getId()); this.manager = data; this.nest = null; updateNestList(0); diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/structurenest/StructureNestScreenData.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/structurenest/StructureNestScreenData.java index bdaee5aa32..a77ce841a6 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/structurenest/StructureNestScreenData.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/structurenest/StructureNestScreenData.java @@ -1,21 +1,20 @@ package net.sevenstars.middleearth.gui.structuremanager.structurenest; -import net.minecraft.network.RegistryByteBuf; -import net.minecraft.network.codec.PacketCodec; -import net.minecraft.network.codec.PacketCodecs; -import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; - import java.util.Optional; +import net.minecraft.core.BlockPos; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.resources.ResourceLocation; public class StructureNestScreenData { private BlockPos pos; - private Identifier structureManagerId; - private Identifier structureNestId; + private ResourceLocation structureManagerId; + private ResourceLocation structureNestId; private int spawnRadius; private boolean isEnabled; - public static final PacketCodec PACKET_CODEC; + public static final StreamCodec PACKET_CODEC; public BlockPos getPos() { return this.pos; @@ -26,28 +25,28 @@ public int getSpawnRadius() { public boolean getIsEnabled() { return this.isEnabled; } - public Identifier getStructureManagerId() { + public ResourceLocation getStructureManagerId() { return this.structureManagerId; } - public Identifier getStructureNestId() { + public ResourceLocation getStructureNestId() { return this.structureNestId; } - private Optional getStructureManagerIdOptional() { + private Optional getStructureManagerIdOptional() { return Optional.ofNullable(this.structureManagerId); } - private Optional getStructureNestIdOptional() { + private Optional getStructureNestIdOptional() { return Optional.ofNullable(this.structureNestId); } - public void setStructureManagerId(Identifier structureManagerId) { + public void setStructureManagerId(ResourceLocation structureManagerId) { this.structureManagerId = structureManagerId; } - public void setStructureNestId(Identifier structureNestId) { + public void setStructureNestId(ResourceLocation structureNestId) { this.structureNestId = structureNestId; } - public StructureNestScreenData(BlockPos pos, Optional structureManagerId, Optional structureNestId, int spawnRadius, boolean isEnabled){ + public StructureNestScreenData(BlockPos pos, Optional structureManagerId, Optional structureNestId, int spawnRadius, boolean isEnabled){ this.pos = pos; structureManagerId.ifPresentOrElse(x -> setStructureManagerId(x), () -> setStructureManagerId(null)); structureNestId.ifPresentOrElse(x -> setStructureNestId(x), () -> setStructureNestId(null)); @@ -56,12 +55,12 @@ public StructureNestScreenData(BlockPos pos, Optional structureManag } static { - PACKET_CODEC = PacketCodec.tuple( - BlockPos.PACKET_CODEC, StructureNestScreenData::getPos, - PacketCodecs.optional(Identifier.PACKET_CODEC), StructureNestScreenData::getStructureManagerIdOptional, - PacketCodecs.optional(Identifier.PACKET_CODEC), StructureNestScreenData::getStructureNestIdOptional, - PacketCodecs.INTEGER, StructureNestScreenData::getSpawnRadius, - PacketCodecs.BOOLEAN, StructureNestScreenData::getIsEnabled, + PACKET_CODEC = StreamCodec.composite( + BlockPos.STREAM_CODEC, StructureNestScreenData::getPos, + ByteBufCodecs.optional(ResourceLocation.STREAM_CODEC), StructureNestScreenData::getStructureManagerIdOptional, + ByteBufCodecs.optional(ResourceLocation.STREAM_CODEC), StructureNestScreenData::getStructureNestIdOptional, + ByteBufCodecs.INT, StructureNestScreenData::getSpawnRadius, + ByteBufCodecs.BOOL, StructureNestScreenData::getIsEnabled, StructureNestScreenData::new ); } diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/structurenest/StructureNestScreenHandler.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/structurenest/StructureNestScreenHandler.java index 397c989245..877b5cf39e 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/structurenest/StructureNestScreenHandler.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/structuremanager/structurenest/StructureNestScreenHandler.java @@ -1,56 +1,68 @@ package net.sevenstars.middleearth.gui.structuremanager.structurenest; -import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.entity.player.PlayerInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.screen.ScreenHandler; -import net.minecraft.util.Identifier; -import net.minecraft.world.World; +import net.neoforged.neoforge.network.PacketDistributor; + +import net.minecraft.client.player.LocalPlayer; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; import net.sevenstars.middleearth.block.special.structureManager.nest.StructureNestBlockEntity; import net.sevenstars.middleearth.gui.ModScreenHandlers; import net.sevenstars.middleearth.network.packets.C2S.PacketStructureNestUpdateBlockEntityRequest; import java.util.Optional; -public class StructureNestScreenHandler extends ScreenHandler { - private final World world; +public class StructureNestScreenHandler extends AbstractContainerMenu { + private final Level world; private StructureNestScreenData data; StructureNestBlockEntity blockEntity; - public StructureNestScreenHandler(int syncId, PlayerInventory playerInventory, StructureNestScreenData structureNestScreenData) { + public StructureNestScreenHandler(int syncId, Inventory playerInventory, StructureNestScreenData structureNestScreenData) { super(ModScreenHandlers.STRUCTURE_NEST_SCREEN_HANDLER, syncId); - this.world = playerInventory.player.getWorld(); + this.world = playerInventory.player.level(); this.data = structureNestScreenData; this.blockEntity = (StructureNestBlockEntity) this.world.getBlockEntity(data.getPos()); } @Override - public ItemStack quickMove(PlayerEntity player, int slot) { + public ItemStack quickMoveStack(Player player, int slot) { return null; } @Override - public boolean canUse(PlayerEntity player) { - return true; + public boolean stillValid(Player player) { + BlockPos pos = data.getPos(); + return blockEntity != null + && !blockEntity.isRemoved() + && world.hasChunkAt(pos) + && world.getBlockEntity(pos) == blockEntity + && player.distanceToSqr(Vec3.atCenterOf(pos)) <= 64.0D; + } + + public BlockPos getPos() { + return data.getPos(); } - public Identifier getManagerKey() { + public ResourceLocation getManagerKey() { return data.getStructureManagerId(); } - public Identifier getNestKey() { + public ResourceLocation getNestKey() { return data.getStructureNestId(); } - public void selectManagerId(ClientPlayerEntity player, Identifier identifier) { + public void selectManagerId(LocalPlayer player, ResourceLocation identifier) { this.data.setStructureManagerId(identifier); this.data.setStructureNestId(null); updateBlockEntity(); } - public void selectNestId(ClientPlayerEntity player, Identifier identifier) { + public void selectNestId(LocalPlayer player, ResourceLocation identifier) { this.data.setStructureNestId(identifier); updateBlockEntity(); } @@ -61,7 +73,7 @@ public void toggleToActivate() { } private void updateBlockEntity() { - ClientPlayNetworking.send(new PacketStructureNestUpdateBlockEntityRequest(data.getPos(), Optional.ofNullable(getManagerKey()), Optional.ofNullable(getNestKey()), data.getSpawnRadius(), data.getIsEnabled())); + PacketDistributor.sendToServer(new PacketStructureNestUpdateBlockEntityRequest(data.getPos(), Optional.ofNullable(getManagerKey()), Optional.ofNullable(getNestKey()), data.getSpawnRadius(), data.getIsEnabled())); } public boolean getIsEnabled() { diff --git a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/utils/widgets/CycledSelectionWidget.java b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/utils/widgets/CycledSelectionWidget.java index 8f2f7afb84..92305f569a 100644 --- a/middle-earth/src/main/java/net/sevenstars/middleearth/gui/utils/widgets/CycledSelectionWidget.java +++ b/middle-earth/src/main/java/net/sevenstars/middleearth/gui/utils/widgets/CycledSelectionWidget.java @@ -1,13 +1,12 @@ package net.sevenstars.middleearth.gui.utils.widgets; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gl.RenderPipelines; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.widget.ButtonWidget; -import net.minecraft.text.MutableText; -import net.minecraft.text.Text; -import net.minecraft.util.Colors; -import net.minecraft.util.Identifier; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.CommonColors; import net.sevenstars.middleearth.MiddleEarth; import net.sevenstars.middleearth.gui.utils.CycledSelectionButtonType; @@ -15,13 +14,13 @@ import java.util.List; public class CycledSelectionWidget extends ModWidget{ - private static final Identifier TEXTURE = Identifier.of(MiddleEarth.MOD_ID,"textures/gui/widget/cycled_selection_widget.png"); + private static final ResourceLocation TEXTURE = ResourceLocation.fromNamespaceAndPath(MiddleEarth.MOD_ID,"textures/gui/widget/cycled_selection_widget.png"); boolean leftCanBeActive = true; boolean rightCanBeActive = true; boolean centerCanBeActive = true; - private final ButtonWidget buttonLeft; - private final ButtonWidget buttonRight; - private final ButtonWidget selectionButton; + private final Button buttonLeft; + private final Button buttonRight; + private final Button selectionButton; private final CycledSelectionButtonType buttonType; private boolean shouldDisplay = true; static final int ARROW_SIZE_X = 7; @@ -30,18 +29,18 @@ public class CycledSelectionWidget extends ModWidget{ static final int PANEL_SIZE_Y = CycledSelectionButtonType.HEIGHT; public static final int TOTAL_WIDTH = ((MARGIN + ARROW_SIZE_X) * 2) + PANEL_SIZE_X; public static final int TOTAL_HEIGHT = Math.max(PANEL_SIZE_Y, ARROW_SIZE_Y); - public MutableText text; + public MutableComponent text; - public CycledSelectionWidget(ButtonWidget.PressAction leftAction, ButtonWidget.PressAction rightAction, ButtonWidget.PressAction selectionAction, CycledSelectionButtonType buttonType){ + public CycledSelectionWidget(Button.OnPress leftAction, Button.OnPress rightAction, Button.OnPress selectionAction, CycledSelectionButtonType buttonType){ this.buttonType = buttonType; - buttonLeft = ButtonWidget.builder(Text.of("Cycled Selection Left"), leftAction).build(); - buttonLeft.setDimensions(ARROW_SIZE_X, ARROW_SIZE_Y); + buttonLeft = Button.builder(Component.nullToEmpty("Cycled Selection Left"), leftAction).build(); + buttonLeft.setSize(ARROW_SIZE_X, ARROW_SIZE_Y); - buttonRight = ButtonWidget.builder(Text.of("Cycled Selection Right"), rightAction).build(); - buttonRight.setDimensions(ARROW_SIZE_X, ARROW_SIZE_Y); + buttonRight = Button.builder(Component.nullToEmpty("Cycled Selection Right"), rightAction).build(); + buttonRight.setSize(ARROW_SIZE_X, ARROW_SIZE_Y); - selectionButton = ButtonWidget.builder(Text.of("Cycled Selection"), selectionAction).build(); - selectionButton.setDimensions(PANEL_SIZE_X, PANEL_SIZE_Y); + selectionButton = Button.builder(Component.nullToEmpty("Cycled Selection"), selectionAction).build(); + selectionButton.setSize(PANEL_SIZE_X, PANEL_SIZE_Y); if(selectionAction == null){ centerCanBeActive = false; @@ -57,8 +56,8 @@ public CycledSelectionWidget(ButtonWidget.PressAction leftAction, ButtonWidget.P } } - public List getButtons(){ - ArrayList listOfButtons = new ArrayList<>(); + public List